A server can be marked as the household's own: no quiet first week there
release-gate / verify (push) Successful in 15m23s
pauljd/davidson-ci: Davidson CI / quality (push) Failing after 3m56s
pauljd/davidson-ci: Davidson CI / ai-review (push) Failing after 3m52s

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-12 15:01:39 +00:00
co-authored by Claude Opus 5.5
parent b6f133f452
commit 7382d9ee63
3 changed files with 21 additions and 0 deletions
@@ -30,6 +30,8 @@ internal object Edition {
if (intent?.getBooleanExtra("orbit_shadow_catalogue_stop", false) == true) CatalogueShadow.cancel = true
// Timings (0.129 stage 0): on, off or clear; local only.
intent?.getStringExtra("orbit_timing")?.let { OrbitTiming.set(activity, it) }
// This server is the household's own (12 November 2026): no quiet first week. "on" or "off", for the server signed in to.
when (intent?.getStringExtra("orbit_own_server")) { "on" -> Workspaces.current(activity).ownServer = true; "off" -> Workspaces.current(activity).ownServer = false }
// Layouts and looks by name, for checking all 70 pairs on the emulator (12 November 2026).
intent?.getStringExtra("orbit_layout")?.let { n -> OrbitLayout.entries.firstOrNull { it.name == n }?.let { OrbitLayouts.choose(activity, it) } }
intent?.getStringExtra("orbit_look")?.let { n -> OrbitLook.entries.firstOrNull { it.name == n }?.let { OrbitTheme.choose(activity, it) } }
@@ -41,6 +41,7 @@ internal class ServerWorkspace(val origin: String, val root: File, val artworkDi
* aren't read at all. The clock starts the first time this box uses the server.
*/
fun quietStart(nowMs: Long = System.currentTimeMillis()): Boolean {
if (ownServer) return false
val stamp = File(root, "first-used")
val first = runCatching { stamp.readText().trim().toLong() }.getOrNull() ?: nowMs.also { runCatching { root.mkdirs(); stamp.writeText(it.toString()) } }
return nowMs - first < QUIET_START_MS
@@ -48,6 +49,14 @@ internal class ServerWorkspace(val origin: String, val root: File, val artworkDi
}
internal const val QUIET_START_MS = 7 * 24 * 60 * 60_000L
/**
* A server that's the household's own (12 November 2026, Paul's VPS): no quiet first week, since the only thing to protect is
* the server itself, and the back-off and the hourly ceiling already watch that. Set per server, so a shared server keeps it.
*/
internal var ServerWorkspace.ownServer: Boolean
get() = File(root, "own-server").exists()
set(value) { val f = File(root, "own-server"); if (value) runCatching { root.mkdirs(); f.writeText("1") } else f.delete() }
internal const val QUIET_START_BUDGET = 100
internal object Workspaces {
@@ -77,4 +77,14 @@ class SafetyLimitsTest {
assertEquals(1..5, OVERNIGHT_HOURS)
assertEquals(5_000, OVERNIGHT_HOURS.count() * OVERNIGHT_PAGES_PER_HOUR * CATALOGUE_PAGE_SIZE)
}
@Test fun ownServerSkipsTheQuietWeek() {
val root = kotlin.io.path.createTempDirectory("own").toFile()
val w = ServerWorkspace("http://example.test", root, root, "alias", original = false)
assertTrue(w.quietStart(now))
w.ownServer = true
assertFalse(w.quietStart(now))
w.ownServer = false
assertTrue(w.quietStart(now))
}
}