Merge origin/main into demo-disk-slice1-retention
Brings in d668a77cd (catch-all names stamp at once, #1516).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
18 files changed,
+809
−108
docs/superpowers/notes/census-proposal-catchall-stamp-now.md+29 −0docs/superpowers/notes/census-proposal-demo-disk-slice1-retention.md+0 −44internal/console/domainstate.go+9 −2internal/console/domainstate_test.go+11 −9internal/domains/aliases.go+22 −2internal/domains/instancecatchall_test.go+35 −0internal/domains/reconcile.go+96 −0internal/domains/stamphosts_test.go+113 −0internal/host/agent.go+3 −3internal/host/edgesfile.go+5 −0internal/host/edgesschedule.go+13 −1internal/host/group_names_test.go+12 −2internal/host/rollout.go+4 −2internal/host/stampwatch.go+263 −0internal/host/stampwatch_test.go+176 −0internal/provision/testdata/plan14-root-reads-catchall-stamp-now.tsv+17 −0internal/provision/testdata/plan14-root-reads-chain.tsv+1 −1internal/provision/testdata/plan14-root-reads-demo-disk-slice1-retention.tsv+0 −42
diff --git a/docs/superpowers/notes/census-proposal-catchall-stamp-now.md b/docs/superpowers/notes/census-proposal-catchall-stamp-now.md| new file mode 100644 |
| index 000000000..904d17bef |
| --- /dev/null |
| +++ b/docs/superpowers/notes/census-proposal-catchall-stamp-now.md |
| @@ -0,0 +1,29 @@ |
| +# Census approval: catchall-stamp-now |
| + |
| +Ruling `census-ruling-catchall-stamp-now`. The independent reviewer approves or rejects every change below, 3 with a new disposition; nothing goes to the census owner (Paul, #280, 2026-10-26). |
| + |
| +| unit | change | read sites | what changed | |
| +|---|---|---|---| |
| +| `internal/domains/aliases.go` `ReconcileAliasesReport` | body | unchanged (89) | #1516: the agent's alias pass (user carlos, no root pass calls it) resets AliasReport.Unstamped and hands deriveInstanceAliases the report's nil-safe noteUnstamped method, which appends each name to it; Unstamped is an output only; same reads and writes, body change only | |
| +| `internal/host/agent.go` `aliasPassReportingComplete` | body | unchanged (5) | #1516: hands rep.Unstamped and whether the pass was complete to watchUnstamped, an in-memory watch list that may wake the domains loop through a buffered channel; same reads and calls, body change only | |
| +| `internal/domains/reconcile.go` `StampHealth` | sites | -registry:Alias ×7, -registry:DNSCheckedAt ×2, -registry:DNSStatus ×4, -registry:Host ×6, -whole:Route ×5, -whole:RouteAlias ×11 | #1516: now a one-line wrapper over stampHealth(ctx, reg, cfg, routes, nil); its body moved there unchanged, hence its dropped sites | |
| + |
| +Envelopes re-pinned: `internal/domains`, `internal/host`. |
| + |
| +Review: a model from the other family than the author reads the branch's diff against main on the amadan.net remote (`origin` or `amadan`, whichever points at amadan.net) and gives a verdict for every unit and every re-pinned envelope above. For a unit, compare the change with its recorded disposition and basis below; for an envelope, read every changed function in the package and what it reaches. Reject if the change lets root open, run, query or follow anything it did not before from a path or input a tenant, an app or a box agent can create, write or name; if it weakens a check, refusal, validation, argument or environment the basis relies on; or if the diff cannot settle either. Otherwise approve. Record each verdict on #280 with the tip. A rejected unit goes back to the author to correct; nothing escalates to the census owner. |
| + |
| +Recorded dispositions, which each change must still satisfy: |
| + |
| +- `internal/domains/aliases.go` `ReconcileAliasesReport`: legacy, task accepted-legacy. Basis: accepted-legacy;rev3=J1;basis=root-route;rev3=census-ruling-edge-asset-cache-1;basis=the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos), in its alias pass (aliasPassReporting in runAgent; ReconcileAliases, now a wrapper, is its other caller): main's ReconcileAliases body, moved here with the same reads and writes, plus a completeness report (AliasReport) set false at every point that already logged a failure and carried on, and when relevantDropped names a listed claim the pass could not rule out; the box's asset authority clock advances only after a complete pass; one more whole:Route and whole:RouteAlias site each, the routes and alias rows the pass already read handed to relevantDropped; no registry, file or bucket read added; no root pass calls it; no root decision;rev3=census-ruling-regional-domains-447;basis=#447 Task 4: in the alias pass inside the agent: reads the existing regional_domains rows (reg.ListRegional) beside the alias rows, derives a regional claim's rows through deriveRegional for AliasReport.Region (the caller's ReconcileConfig.Region, set by aliasPassReporting) and its wildcard parent when bound, skipping the alias, paths and catch-all halves for it, writes them through writeRegional, and keeps an unread regional claim's wildcard parent while the kept apex row still binds a target RegionalTarget accepts on the routes this pass read (same account and app, per-box cap); claims are read as before (the listing and per-claim GETs it already does); the added reads are the registry's regional rows and fields of rows the pass already holds;rev3=census-ruling-fleet-public-routes;basis=fleet public routes (spec 2026-10-29 rev 4, §4.2 writer rule): Task 6 fix rounds 2-3: AliasReport.FleetRefused (edge.FleetArmVerdict's refused set) is called once on the pass's own listing; a Wildcard claim whose primary is fleet-refused derives no wildcard_domains row (an earlier one goes with the ordinary removal); the catch-all alias is derived as before (+registry:Host, +whole:Route). Rows already read; writes less, never more; no root pass calls it.;rev3=census-ruling-region-ha-g2-fixes;basis=Project accepted regional exact/catchall names and plain/delegated aliases into routing-only reports using existing claims and pre-pool metadata; new whole Route/RegionalDomain uses, no new external reader.;rev3=census-ruling-fix-incomplete-domains-pass;basis=adds AliasReport.StartupNoRemoval, an input set only by the agent startup HA ingress pass (host startupAliasPass via runHAIngressStartup): when set, the pass skips the route_aliases, wildcard_domains and route_paths removals (each skipped removal marks the pass incomplete) and the removal rules themselves are unchanged; derivations, refusals and writes are unchanged; same read sites (body change only); no new registry, file or bucket read; deletes less, never more, and only on the startup pass; no root pass calls it; no root decision;rev3=census-ruling-account-subdomains;basis=with AliasReport.AppsDomain set, reads the box's own account_namespaces table (reg.ListAccountNamespaces), sorts a listed-but-unread namespace claim (ParseNamespaceHost on the dropped host): a not-found body keeps nothing and is not counted by relevantDropped, any other failure keeps that name's recorded rows; runs deriveNamespaceAliases after deriveInstanceAliases on the routes, alias rows and claims it already read (AccountNamespaces over the read claims), keepNamespaceAliases for unread names, and writes the table through writeAccountNamespaces (once, only when it differs; no shrink under StartupNoRemoval); the added sites are the routes and alias rows already read handed to those helpers; no file or bucket read added; fix round 1: keepNamespaceAliases runs before deriveNamespaceAliases, and repairNamespaceStatus stamps "pointing" on derived-shape rows of exact claims and kept names, over claims and rows already read;rev3=census-ruling-path-routes-across-boxes;basis=#186: path derivation moved to derivePaths and the route_paths write to writePaths (pathwrite.go); its own route_paths reads moved with them; unread claims now keep their path rows like regional rows; no read added here |
| +- `internal/host/agent.go` `aliasPassReportingComplete`: legacy, task accepted-legacy. Basis: accepted-legacy;rev3=census-ruling-region-ha-g2-fixes;basis=Extract the existing serialized alias pass, add cancellable locking and routing-only alias/regional publication from its completeness report; existing deployment/claim/registry reads retained, new in-memory Route/RegionalDomain passes.;rev3=census-ruling-fix-incomplete-domains-pass;basis=gains a startup bool parameter that it copies into domains.AliasReport.StartupNoRemoval; runHAIngressStartup passes true, aliasPassReporting (the ordinary agent pass) passes false; same reads and calls, body change only; no root pass calls it; no root decision;rev3=census-ruling-account-subdomains;basis=sets AliasReport.AppsDomain from PLATFORM_APPS_DOMAIN (trimmed), the variable domainsTickConfig reads; same reads and calls otherwise; body change only;rev3=census-ruling-sr-followups;basis=#966, the agent pass (user carlos, no root pass calls it): on a door box (doorFleet: no CARLOS_DEPLOYMENT_BUCKET or CARLOS_DEPLOYMENT_DIR and a fleet identity from the process environment, CARLOS_FLEET and its box label, as openDeployStoreEnv decides) it skips edgesfile.DeploymentRoutesComplete, the status/boxes/ list the store door refuses, and reports the route set incomplete (DeploymentRoutesPartial false, routesWhole false) as the refused list did. One store list fewer on door boxes, none added, every other box unchanged, no file, bucket or root call added |
| +- `internal/domains/reconcile.go` `StampHealth`: legacy, task accepted-legacy. Basis: accepted-legacy;rev3=J1;basis=root-route;rev3=census-ruling-dns-fresh-lookup-724;basis=section 4 now computes every cached verdict first, then freshUpgrade gives up to 64 randomly ordered names that could have a public zone (not under the apps domain, not special-use like .internal) and whose verdict is "" or "elsewhere" an uncached lookup (30 s pass budget) that may only upgrade to "pointing", then stamps; the extra sites are the indexed loops over the same rows (#724);rev3=census-ruling-no-negative-prime-724;basis=section 4 now hands each route and alias, with its previous stamp (the two new registry:DNSStatus reads, rt.DNSStatus and a.DNSStatus, same rows already listed), to dnsVerdicts, which first hands the pass's hostnames to Config.FreshRetain (the resolver forgets its in-memory backoff and strike for names no longer carried) and then decides each hostname once per pass and applies the verdict to every row carrying it: a name not "pointing" before this pass and eligible for a fresh lookup (public name, not under the apps domain, ResolveFresh set) is looked at uncached first within the same 64-lookup/30 s budget (shared, with previously "pointing" names' upgrade looks serviced before any fresh-first name so new names cannot starve a published one) and stamped from it (edge address, A or AAAA, "pointing", other "elsewhere", authoritative not-found "", authoritative NODATA for A and AAAA with the zone's SOA "" with no cached query), falling back to the cached lookup past the budget or on the second fresh failure in a row; the first fresh failure in a row is held (stamp and check time untouched, the resolver forgives it so the next pass asks fresh again); a previously "pointing" name keeps cached-first plus the upgrade-only fresh look (ResolveUpgrade, nearest zones first), so the fresh path still never unpublishes; a fresh-first name that ends the pass "pointing" (fresh or cached) has its fresh failure backoff cleared through Config.FreshForget, so an onboarding failure never suppresses the upgrade look that keeps it published; new names are ordered never-checked first then oldest check, and lookups answered from the backoff do not count against the budget; StampHealth's own body is unchanged by the last round; no new file, path or command input; the dropped Alias/Host/Route/RouteAlias sites are the old indexed loops folded into the candidate build (#724);rev3=census-ruling-account-subdomains;basis=reads the box's own account_namespaces table (only when DNS stamping runs) and leaves out of the DNS loop the alias rows isNamespaceDerived names (an alias under a held name, of that name's account, pointing at its sqid twin); if that read fails it logs and leaves out every alias two or more labels under the apps domain, still stamping every other alias, every route and all TLS expiry (fix round 1); the added RouteAlias sites are that filter over rows already listed; stamps less, never more; TLS stamping unchanged |
| + |
| +New dispositions, which census-propose wrote and the reviewer checks against the unit's reads and the diff: |
| + |
| +- new `internal/domains/reconcile.go:StampHealthHosts`: reads +registry:Alias ×2, +registry:CertExpiresAt ×3, +registry:DNSCheckedAt ×2, +registry:DNSStatus ×3, +whole:RouteAlias ×6; written legacy, accepted-legacy, frozen |
| +- new `internal/domains/reconcile.go:stampHealth`: reads +registry:Alias ×8, +registry:DNSCheckedAt ×2, +registry:DNSStatus ×4, +registry:Host ×6, +whole:Route ×6, +whole:RouteAlias ×18; written legacy, accepted-legacy, frozen |
| +- reads `internal/domains/aliases.go:deriveInstanceAliases`: +registry:DNSCheckedAt; keeps legacy, task accepted-legacy |
| + |
| +Seal: `0fdff597ef83fb9966e07c70b4283001eb97f7dfa71a83a19bde92382192eb6b` → `c9940b1b6fb0146a30a2fb2b557f898ac6d28ba80df7dfe642cc623b581f347b`. |
| + |
| +Overlay: `internal/provision/testdata/plan14-root-reads-catchall-stamp-now.tsv`, appended to `internal/provision/testdata/plan14-root-reads-chain.tsv`. |
diff --git a/docs/superpowers/notes/census-proposal-demo-disk-slice1-retention.md b/docs/superpowers/notes/census-proposal-demo-disk-slice1-retention.md| deleted file mode 100644 |
| index ec2a72ac8..000000000 |
| --- a/docs/superpowers/notes/census-proposal-demo-disk-slice1-retention.md |
| +++ /dev/null |
| @@ -1,44 +0,0 @@ |
| -# Census approval: demo-disk-slice1-retention |
| - |
| -Ruling `census-ruling-demo-disk-slice1-retention`. The independent reviewer approves or rejects every change below, 14 with a new disposition; nothing goes to the census owner (Paul, #280, 2026-10-26). |
| - |
| -| unit | change | read sites | what changed | |
| -|---|---|---|---| |
| -| `internal/host/agent.go` `runAdoptUnderRootRelease` | body | unchanged (4) | demo disk bound slice 1: release.Pass now runs inside demoRetention.around (productionDemoRetention(reg, generationPins, passLockErr == nil)), still inside pr.around and under the adopt pass lock taken at the top; around adds release.WithBeforeStage(beforeStage) to the pass options and, after the pass, runs demo build retention when a demo route's Version moved or on the hourly (not -stage-only) pass. Never on -config-only or -restart-only, which return before this. No read added in this unit; read sites unchanged | |
| -| `internal/host/agent.go` `statusLoop` | body | unchanged (7) | the agent (carlos-edge.service, user carlos): the status tick also fills Probes.DemoDisk from readDemoDisk(), nil unless CARLOS_DEMO_BOX is set; statfs of /data and /run, and root's public retention record (readDemoBuilds); report only; no store request added; read sites unchanged | |
| -| `internal/release/adopt.go` `PassFilter` | body | unchanged (75) | the stage check's beforeWrite is cfg.stageWriteCheck (generationWriteCheck first, unchanged, then WithBeforeStage's callback for a path that holds nothing yet); no read added in this unit | |
| -| `internal/release/adopt.go` `type passConfig` | body | unchanged (0) | adds the beforeStage callback field, set only by WithBeforeStage (root's adopt pass); reads nothing | |
| -| `internal/status/snapshot.go` `CollectBox` | body | unchanged (28) | copies Probes.DemoDisk into BoxMetrics.DemoDisk (json demo_disk, omitempty; private, like Layout) and counts it in the condition that builds Metrics; the same 28 sites, no read added | |
| - |
| -Envelopes re-pinned: `.`, `internal/host`, `internal/release`, `internal/status`. |
| - |
| -Review: a model from the other family than the author reads the branch's diff against main on the amadan.net remote (`origin` or `amadan`, whichever points at amadan.net) and gives a verdict for every unit and every re-pinned envelope above. For a unit, compare the change with its recorded disposition and basis below; for an envelope, read every changed function in the package and what it reaches. Reject if the change lets root open, run, query or follow anything it did not before from a path or input a tenant, an app or a box agent can create, write or name; if it weakens a check, refusal, validation, argument or environment the basis relies on; or if the diff cannot settle either. Otherwise approve. Record each verdict on #280 with the tip. A rejected unit goes back to the author to correct; nothing escalates to the census owner. |
| - |
| -Recorded dispositions, which each change must still satisfy: |
| - |
| -- `internal/host/agent.go` `runAdoptUnderRootRelease`: authority, task B3,E1,E2,E3. Basis: rev3=census-ruling-self-serve-moves-1;basis=root claim/adopt/update controller uid 0: builds root's lifetime judge once from the host-claim switch and hands it to both productionRestartRequestPass calls; read sites unchanged, offsets moved; the preceding B3,E1,E2,E3 classification retained;rev3=census-ruling-claims-cleanup-r1;basis=claims cleanup R1: the claims shutdown timeout is the host constant claimsShutdownLimit (120s) instead of hostbox.RequestLimit (120s); no read added or changed;rev3=census-ruling-named-unit-delivery-114;basis=config sync is appconfig.SyncUnits with productionUnitOps (drop-in root /etc/systemd/system, base dir /etc/carlos/units, the declaration file /etc/carlos/named-units.json, systemctl probe/reload/restart, the config flock); no proof binding and no bucket read for delivery (Paul's ruling on #114: a root-owned declaration decides); the comment at the restart callback rewritten; read sites unchanged;rev3=census-ruling-sr-followups;basis=#966 census fix: the SyncUnits ack callback is configAckRootFunc(ctx, store) instead of configAckFunc(ctx, store, "adopt"). configAckRootFunc (new, agent.go): on a box with a bucket or dir (doorFleet empty: no fleet identity, or CARLOS_DEPLOYMENT_BUCKET or CARLOS_DEPLOYMENT_DIR set in the process environment) it returns configAckFunc(ctx, store, "adopt"), the same callback as before #966 (platform-root key, read-then-CAS). On a door box it writes each ack through appconfig.ReplaceConfigAckBlind (new, configack.go) under NewPrefixStore(store, "fleets/<fleet>/"): s.Delete(key) then a create-only s.Put(key, body, ""), returning only errors, which are logged. THE ROOT PASS NO LONGER READS THE FLEET CORNER: it sends exactly DELETE and PUT for fleets/<F>/control/config-ack/<label>/<host>.json and no GET, Open or HEAD of any fleet key; it inspects no body, ETag or listing. Reads only the process environment (doorFleet, BoxLabel), as configAckFunc did. Read sites unchanged;rev3=census-ruling-named-units-param-114;basis=named-units-param-114 Task 4/5: after the restart-only return, calls runNamedUnitsStep, which runs adoptNamedUnitsStep (root reads its own IMDSv2 identity; ssm:GetParameter of /carlos/host/named-units/<instance-id> in that region, operator-written, box role read-only; trusted rootstate reads of /etc/carlos/named-units.json, the console guard marker, root's rollback journal and root history; installs under the config-sync flock), logs, and writes writeNamedUnitsStatus (public root store /var/lib/carlos-named-units), all before ParsePublicKey; config sync moved into adoptConfigSync with a second status write; no input a tenant, app or box agent can write selects the parameter or authorises the install; read sites unchanged;rev3=census-ruling-console-addr-from-install;basis=calls adoptConsoleFleetStep after the named-units step, never fatal (spec §4); no read added here;rev3=census-ruling-managed-fleets-2b2;basis=builds managedRootGate("/") (root's RootAdmission: identity + root 0700 admission files, re-verified) and wraps the round-1 start/selected-restart/rollback callbacks, SyncUnits' UnitOps.Restart and named-unit recovery with it; BYO answers admitted, so nothing changes there; merge of origin/main 65951fbb: main's configAckRootFunc ack, the named-units step (runNamedUnitsStep) with adoptConfigSync, and adoptConsoleFleetStep, not this branch; resolution: adoptConfigSync is handed managedGatedUnitOps(managedGate, productionUnitOps(...)), so SyncUnits' UnitOps.Restart keeps root's gate |
| -- `internal/host/agent.go` `statusLoop`: legacy, task accepted-legacy. Basis: accepted-legacy;rev3=census-ruling-self-serve-moves-1;basis=the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos): the status tick's context carries the box's lifetime judge; read sites unchanged, offsets moved;rev3=census-ruling-rootfs-apps-2;basis=main's body as of the merge of origin/main 953b9fda (its later changes, regional box names and self-serve moves plan 1 among them, under main's own census rulings), where the tick fills rootfs_ready and rootfs_blocked from armedRootfs.Load().probe, which each tick runs NestedOK's checks and asks the control socket's GET /ready/rootfs (never the store); the same four direct sites;rev3=census-ruling-instance-egress-sizes-328-329;basis=#328 plan 2 Task 11 and #329 plan 3 Task 7: takes root's GET /egress reader and fills p.Egress = egressStatusProbe(egressStatus, routes, provision.PolicyReadStates()) and p.SizeCommittedMiB = sizeCommittedMiB(armedSizeSource.Load(), routes); the two added whole:Route sites are the tick's own registry list handed to those two units (decision rows), which read root's control socket and the activator's memory; no store request added; the four existing sites unchanged, offsets moved.;rev3=census-ruling-fleet-alerts-1;basis=the agent (carlos-edge.service, user carlos): the status tick passes os.Geteuid() to alertDeliveryProbe, which fills AlertDelivery.EngineBeat/EngineBeatWhy from engineBeatArmed (the env value and the euid only, no file access, root refused before the path is looked at), and fills Probes.DiskFullETAHours from diskETAProbe(&processDiskTrend, now), a Theil-Sen fit over the metrics loop's in-memory ring of disk readings; the same six sites, no read added, no store request added;rev3=census-ruling-edge-held-streams;basis=the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos): the status tick's Probes gain HeldStreams: heldStreamsState(), which calls the edge's in-memory counters function (nil until the edge is ready). No file, bucket or registry access added.;rev3=census-ruling-stateless-replicas-3;basis=Fix round 1 Q20: read the detached in-memory replica snapshot source into Probes.ReplicaCopies on the existing five-minute tick. Existing six direct read sites unchanged. No additional bucket request, changed cadence or app lifecycle action.;rev3=census-ruling-agent-start-demo-3;basis=Report moved capability only when the serving edge reports readiness; report claim-seed support only with CARLOS_DEMO_CLAIM=1. Reads the explicit capability flag from the process environment; no new filesystem or registry read.;rev3=census-ruling-stateless-replicas-4-task5;basis=Task 5 fix round 1 (#511 R16 amendment): the status tick also fills Probes.ApplyFinished from systemApplyFinished(release.OptDir()), an Lstat of root's apply journal <opt>/system/router/journal.json in the root-owned, world-readable state directory: finished only when the journal is absent, any other answer unknown and so unfinished. Round 0: Probes.PrevRelease from prevReleaseOf (carlos.prev and carlos.prev.version, the files withMovesFields already reads). Reported in the private BoxMetrics block; no bucket request or cadence change.;rev3=census-ruling-offline-move-stage-refusals-339;basis=#339: the agent (carlos-edge.service, user carlos): the status tick fills p.OfflineMove = offlineMoveFactsProbe(routes); the added whole:Route site is the tick's own registry list handed to that unit, which under a non-root euid lists the names of root's <opt>/live and nothing else; no store request added.;rev3=census-ruling-platform-mail-submission;basis=Task 3 (plan gap G6 (b)): the status tick also fills Probes.MailerArmed from mailerArmed(mailwire.MailerSocket, 2s): a stat of /run/carlos-mailer/mailer.sock and, only when it is a socket, GET /v1/health on it. The agent (carlos-edge.service, user carlos), not root; reported in the private BoxMetrics block only. The same seven sites; no store request, no read of /etc/carlos-mailer (which uid carlos cannot traverse).;rev3=census-ruling-named-units-param-114;basis=named-units-param-114 Task 6: the agent (carlos-edge.service, user carlos) fills Probes.NamedUnits from readNamedUnitsStatus: rootstate.Open(/var/lib/carlos-named-units, false, true) status.json, 64 KiB cap, any error nil; report only, nothing reads it as authority; no store request added; the same sites;rev3=census-ruling-console-addr-from-install;basis=sets Probes.ConsoleFleet from consoleFleetProbe (root public store read, edge in-memory state); no read added in this unit |
| -- `internal/release/adopt.go` `PassFilter`: authority, task B3,E3,J1,E1,E2. Basis: Signed named-unit recovery is independent of release and health history. Root rechecks canonical source, unit, process, signed target and trusted live pointer; captures attempt authority before publication; verifies readiness and resumes without repeated effects. Fixtures: TestPlan14SignedActiveFixIgnoresHistory, TestPlan14SignedActiveFixAuthority, TestPlan14SignedFixSupersedesOlderAttempt, TestPlan14ActiveRecoveryProcessCrash, TestPlan14SignedRestartWithoutHealthHistory, TestPlan14CapturedRollbackWithoutHealthHistory, TestPlan14SignedRestartRequiresTrustedLiveLink. E7 applies merge ruling 4: unbound no-census routes use the legacy pass and restart; ordinary candidates make no binding store call. Fixtures: TestR2UnguardedERecoveryUpdate, TestR2UnguardedERecoveryIncidentRecipe, TestPlan14ERecoveryBindingRefusalKeepsPromotedFix. E19: both destructive readers use the root reservation snapshot under existing release exclusion. Exact artifact and containing-tree identities are retained; missing completeness refuses destruction. Production installation/launch/kernel completeness and verified retirement remain unfinished. Fixtures: TestPlan14GenerationDeletionCannotUnpin, TestPlan14GenerationSnapshotCompleteness, TestPlan14GenerationSnapshotPermitsUnreservedRestage, TestPlan14GenerationSnapshotPinsContainingTree, TestPlan14GenerationSnapshotEmptyIsUnknown, TestPlan14GenerationConsumerMode.;rev3=PROPOSED-p3;run=8;identity=carlos adopt uid 0; legacy agent pass uid carlos;basis=resolves protected route inputs before filters, recovery and dispatch on census boxes and bypasses service-owned failure opener only there;rev3=PROPOSED-s3-change-index;identity=carlos adopt uid 0; legacy agent pass uid carlos;basis=asks the optional pointer gate (gatePointers) once per channel group before selection and reports each group's pointer outcome to it; only the agent's fast sweep arms a gate (WithPointerGate), so under carlos adopt the gate is nil and the pass is unchanged; a gate can only leave a group out of the pass, never add one; one whole-Route site added;rev3=census-ruling-rootfs-apps-3;basis=rootfs Plan 3: comment only, the Hibernate check is left as is for a resident;rev3=census-ruling-hunt-release-chain-integrity;basis=a digestless head is bound to its signed promotion record through stagePointerHead, and a pointer without an account binding is refused on read (verifyPointer); the ratchet it consults (Admit) now also holds a per-channel promoted_at floor that admits only a strictly later stamp or the very pointer it recorded (PointerIdentity, fix round 1), which root reads only from its own root-owned <opt>/pointer-digests and never from the agent's data dir, through instancefs.ReadBeneathLimitOrAbsent (openat2 RESOLVE_BENEATH|NO_SYMLINKS|NO_MAGICLINKS, O_NONBLOCK, regular file only, 4 KiB cap); fix round 2: the floor's identity is the sha256 of the exact signed wrapper the pointer was verified from (set at the parse site), and a floor with no identity admits nothing at its own stamp, so the floor only refuses more; no read kind is added to the unit; CI fix: an app channel pointer is now stamped to the millisecond (pointerStampGrain) so a signer's wait past the head it replaces is at most a millisecond; the floor still admits only a strictly later stamp or the pointer it recorded, compared as time.Time, so the rule and the reads are unchanged |
| -- `internal/release/adopt.go` `type passConfig`: authority, task E2,E3. Basis: E19: both destructive readers use the root reservation snapshot under existing release exclusion. Exact artifact and containing-tree identities are retained; missing completeness refuses destruction. Production installation/launch/kernel completeness and verified retirement remain unfinished. Fixtures: TestPlan14GenerationDeletionCannotUnpin, TestPlan14GenerationSnapshotCompleteness, TestPlan14GenerationSnapshotPermitsUnreservedRestage, TestPlan14GenerationSnapshotPinsContainingTree, TestPlan14GenerationSnapshotEmptyIsUnknown, TestPlan14GenerationConsumerMode, TestPlan14GenerationProductionModeGate, TestPlan14GenerationSnapshotPermitsFreshTree.;rev3=PROPOSED-p3;run=8;identity=carlos adopt uid 0; legacy agent pass uid carlos;basis=stores the typed census-only root update provider and per-pass resolved input authority;rev3=census-ruling-315;identity=legacy agent pass uid carlos (RootRestartsUnits; never set on carlos adopt);basis=adds the unitsToRoot bool set by RootRestartsUnits; reads nothing;rev3=PROPOSED-s3-change-index;identity=carlos adopt uid 0; legacy agent pass uid carlos;basis=adds the pointerGate field, set only by WithPointerGate (the agent's fast sweep); reads nothing |
| -- `internal/status/snapshot.go` `CollectBox`: legacy, task accepted-legacy. Basis: accepted-legacy;rev3=J1;basis=root-route;rev3=census-ruling-rootfs-apps-2;basis=copies Probes.RootfsReady and RootfsBlocked into BoxMetrics (private, like Layout); the same 28 sites, no read added;rev3=census-ruling-instance-egress-sizes-328-329;basis=#328 plan 2 Task 11 and #329 plan 3 Task 7: copies Probes.Egress and Probes.SizeCommittedMiB into BoxMetrics (private, like Layout) and counts them in the condition that builds Metrics; the same 28 sites, no read added.;rev3=census-ruling-rootfs-apps-3;basis=rootfs Plan 3: comment only, the Hibernate count is left as is (display);rev3=census-ruling-regional-domains-447;basis=#447 Task 7: copies Probes.AliasesRead into BoxMetrics.AliasesRead (json aliases_read, omitempty) and counts it in the condition that builds Metrics; the same 28 sites, no read added;rev3=census-ruling-fleet-alerts-1;basis=copies Probes.DiskFullETAHours into BoxMetrics.DiskFullETAHours (json disk_full_eta_hours, omitempty; private, like Layout) and counts it in the condition that builds Metrics; the same 28 sites, no read added;rev3=census-ruling-edge-held-streams;basis=copies Probes.HeldStreams into BoxMetrics.HeldStreams (json held_streams, omitempty, additive) and counts it in the condition that builds Metrics; the same 28 sites, no read added.;rev3=census-ruling-stateless-replicas-3;basis=Fix round 1 Q20: carry already-supplied ReplicaCopies into a separate optional private BoxMetrics replica_copies field; allow copy evidence alone to create the metrics block. Upstreams retains address probes only. Existing 28 Route read sites unchanged; no filesystem, bucket, console or CLI read.;rev3=census-ruling-agent-start-demo-3;basis=Report claim-seed protocol capability only when explicitly configured and runtime moved readiness only when armed; dormant status keeps its original JSON shape. Census read-site delta: unchanged (28).;rev3=census-ruling-stateless-replicas-4-task5;basis=Task 5 (#511 R16 and its amendment): copies Probes.PrevRelease and Probes.ApplyFinished into BoxMetrics (json prev_release and apply_finished, omitempty; private, like Release) and counts them in the condition that builds Metrics; the same 28 sites, no read added.;rev3=census-ruling-offline-move-stage-refusals-339;basis=#339: copies Probes.OfflineMove into BoxMetrics.OfflineMove (json offline_move, omitempty; private, like Layout) and counts it in the condition that builds Metrics; the same 28 sites, no read added.;rev3=census-ruling-platform-mail-submission;basis=Task 3: copies Probes.MailerArmed into BoxMetrics.MailerArmed (json mailer_armed, omitempty; private, like Layout) and counts it in the condition that builds Metrics; the same 28 sites, no read added.;rev3=census-ruling-named-units-param-114;basis=named-units-param-114 Task 6: copies Probes.NamedUnits into BoxMetrics.NamedUnits (json named_units, omitempty; private) and counts it in the condition that builds Metrics; the same 28 sites, no read added;rev3=census-ruling-fleet-seeded-create-2;basis=Copies Probes.SeedsFloor into BoxMetrics.SeedsFloor and counts it in the metrics gate; a pure copy of a value the agent filled, the same 28 read sites, no read added.;rev3=census-ruling-console-addr-from-install;basis=copies Probes.ConsoleFleet into BoxMetrics (private); no read added |
| - |
| -New dispositions, which census-propose wrote and the reviewer checks against the unit's reads and the diff: |
| - |
| -- new `cli.go:printDemoDisk`: reads +data-literal; written legacy, accepted-legacy, frozen |
| -- new `internal/host/demodisk_status.go:productionDemoDiskProbe`: reads +file:Open; written legacy, accepted-legacy, frozen |
| -- new `internal/host/demodisk_status.go:readDemoBuilds`: reads +file:Read; written legacy, accepted-legacy, frozen |
| -- new `internal/host/demoretention.go:demoRetention.demoAdoptions`: reads +registry:Host, +registry:Version, +whole:Route ×2; written legacy, accepted-legacy, frozen |
| -- new `internal/host/demoretention.go:demoRetention.demoApp`: reads +registry:App ×3, +whole:Route; written legacy, accepted-legacy, frozen |
| -- new `internal/host/demoretention.go:demoRetention.demoAppListed`: reads +whole:Route ×2; written legacy, accepted-legacy, frozen |
| -- new `internal/host/demoretention.go:demoRetention.pinSet`: reads +registry:App ×2, +registry:GoodVersion, +registry:PrevVersion, +registry:Version, +whole:Route ×5; written legacy, accepted-legacy, frozen |
| -- new `internal/host/demoretention.go:demoRetention.saveStatus`: reads +file:Read; written legacy, accepted-legacy, frozen |
| -- new `internal/host/demoretention.go:demoRetention.selection`: reads +file:Lstat, +file:ReadDir, +registry:Version, +whole:Route ×3; written legacy, accepted-legacy, frozen |
| -- new `internal/host/demoretention.go:pinned`: reads +file:EvalSymlinks; written legacy, accepted-legacy, frozen |
| -- new `internal/host/demoretention.go:previousLinkPins`: reads +file:EvalSymlinks, +file:ReadDir, +file:Readlink; written legacy, accepted-legacy, frozen |
| -- new `internal/host/demoretention.go:productionDemoRetention`: reads +file:Open; written legacy, accepted-legacy, frozen |
| -- new `internal/host/statfs_unix.go:filesystemRoom`: reads +file:Statfs; written legacy, accepted-legacy, frozen |
| -- new `internal/release/adopt.go:passConfig.stageWriteCheck`: reads +file:Lstat; written legacy, accepted-legacy, frozen |
| - |
| -Seal: `0fdff597ef83fb9966e07c70b4283001eb97f7dfa71a83a19bde92382192eb6b` → `2372a1fa9c40b4743fdccbffb946d3a90f4d2ca4bb9d9c5cbe536ae601aae313`. |
| - |
| -Overlay: `internal/provision/testdata/plan14-root-reads-demo-disk-slice1-retention.tsv`, appended to `internal/provision/testdata/plan14-root-reads-chain.tsv`. |
diff --git a/internal/console/domainstate.go b/internal/console/domainstate.go| index 9c5c304e0..12591bd13 100644 |
| --- a/internal/console/domainstate.go |
| +++ b/internal/console/domainstate.go |
| @@ -115,9 +115,16 @@ const domainFailedAttempts = 3 |
| // none — and nil is the ordinary case, because a record exists only while a |
| // host is failing. |
| func domainState(reading status.AliasReading, seen bool, warm *certwarm.Record, now time.Time) (state, reason, detail string) { |
| + const notYet = "No edge has reported on this hostname yet. Checks run every few minutes, so this should settle shortly after attaching." |
| if !seen { |
| - return StateChecking, "no-reading", |
| - "No edge has reported on this hostname yet. Checks run every few minutes, so this should settle shortly after attaching." |
| + return StateChecking, "no-reading", notYet |
| + } |
| + // A row a box carries but has never looked up (an instance catch-all |
| + // name the alias pass just derived, #1516) has no verdict, which is |
| + // "checking", not the customer's missing record. The fold keeps the |
| + // freshest stamp, so this reading wins only when no box has checked. |
| + if reading.DNSStatus == "" && reading.DNSCheckedAt == 0 { |
| + return StateChecking, "not-checked-yet", notYet |
| } |
| switch reading.DNSStatus { |
| case "unresolved": |
diff --git a/internal/console/domainstate_test.go b/internal/console/domainstate_test.go| index 41bfbc2f6..21effadad 100644 |
| --- a/internal/console/domainstate_test.go |
| +++ b/internal/console/domainstate_test.go |
| @@ -21,14 +21,15 @@ func TestDomainStateVocabulary(t *testing.T) { |
| wantState string |
| wantReason string |
| }{ |
| - "no box has reported": {seen: false, wantState: StateChecking, wantReason: "no-reading"}, |
| - "our lookup failed": {reading: status.AliasReading{DNSStatus: "unresolved"}, seen: true, wantState: StateUnknown, wantReason: "lookup-failed"}, |
| - "no record yet": {reading: status.AliasReading{DNSStatus: ""}, seen: true, wantState: StatePendingDNS, wantReason: "no-record"}, |
| - "points elsewhere": {reading: status.AliasReading{DNSStatus: "elsewhere"}, seen: true, wantState: StateMisdirected, wantReason: "points-elsewhere"}, |
| - "pointing, no cert": {reading: status.AliasReading{DNSStatus: "pointing"}, seen: true, wantState: StateIssuingCert, wantReason: "awaiting-certificate"}, |
| - "pointing, dead cert": {reading: status.AliasReading{DNSStatus: "pointing", CertExpiresAt: past}, seen: true, wantState: StateIssuingCert, wantReason: "awaiting-certificate"}, |
| - "pointing, live cert": {reading: status.AliasReading{DNSStatus: "pointing", CertExpiresAt: future}, seen: true, wantState: StateLive, wantReason: "serving"}, |
| - "a status we don't know": {reading: status.AliasReading{DNSStatus: "quantum"}, seen: true, wantState: StateUnknown, wantReason: "unrecognised-status"}, |
| + "no box has reported": {seen: false, wantState: StateChecking, wantReason: "no-reading"}, |
| + "our lookup failed": {reading: status.AliasReading{DNSStatus: "unresolved"}, seen: true, wantState: StateUnknown, wantReason: "lookup-failed"}, |
| + "no record yet": {reading: status.AliasReading{DNSStatus: "", DNSCheckedAt: now.Unix()}, seen: true, wantState: StatePendingDNS, wantReason: "no-record"}, |
| + "never looked up (#1516)": {reading: status.AliasReading{DNSStatus: ""}, seen: true, wantState: StateChecking, wantReason: "not-checked-yet"}, |
| + "points elsewhere": {reading: status.AliasReading{DNSStatus: "elsewhere"}, seen: true, wantState: StateMisdirected, wantReason: "points-elsewhere"}, |
| + "pointing, no cert": {reading: status.AliasReading{DNSStatus: "pointing"}, seen: true, wantState: StateIssuingCert, wantReason: "awaiting-certificate"}, |
| + "pointing, dead cert": {reading: status.AliasReading{DNSStatus: "pointing", CertExpiresAt: past}, seen: true, wantState: StateIssuingCert, wantReason: "awaiting-certificate"}, |
| + "pointing, live cert": {reading: status.AliasReading{DNSStatus: "pointing", CertExpiresAt: future}, seen: true, wantState: StateLive, wantReason: "serving"}, |
| + "a status we don't know": {reading: status.AliasReading{DNSStatus: "quantum"}, seen: true, wantState: StateUnknown, wantReason: "unrecognised-status"}, |
| } { |
| state, reason, detail := domainState(tc.reading, tc.seen, nil, now) |
| if state != tc.wantState || reason != tc.wantReason { |
| @@ -47,7 +48,7 @@ func TestDomainStateVocabulary(t *testing.T) { |
| func TestDomainStateNeverBlamesTheCustomerForOurOutage(t *testing.T) { |
| now := time.Unix(1_000_000, 0) |
| ourFault, _, ourDetail := domainState(status.AliasReading{DNSStatus: "unresolved"}, true, nil, now) |
| - theirs, _, _ := domainState(status.AliasReading{DNSStatus: ""}, true, nil, now) |
| + theirs, _, _ := domainState(status.AliasReading{DNSStatus: "", DNSCheckedAt: now.Unix()}, true, nil, now) |
| if ourFault == theirs { |
| t.Fatalf("a failed lookup and a missing record both read %q", ourFault) |
| } |
| @@ -84,6 +85,7 @@ func TestAdvertisedStatesAreExactlyTheReachableOnes(t *testing.T) { |
| {seen: false}, |
| {r: status.AliasReading{DNSStatus: "unresolved"}, seen: true}, |
| {r: status.AliasReading{DNSStatus: ""}, seen: true}, |
| + {r: status.AliasReading{DNSStatus: "", DNSCheckedAt: now.Unix()}, seen: true}, |
| {r: status.AliasReading{DNSStatus: "elsewhere"}, seen: true}, |
| {r: status.AliasReading{DNSStatus: "pointing"}, seen: true}, |
| {r: status.AliasReading{DNSStatus: "pointing", CertExpiresAt: now.Unix() + 86400}, seen: true}, |
diff --git a/internal/domains/aliases.go b/internal/domains/aliases.go| index f829c3d6f..3560c8285 100644 |
| --- a/internal/domains/aliases.go |
| +++ b/internal/domains/aliases.go |
| @@ -132,7 +132,7 @@ func sayInstanceCatchallOnce(host, reason string) { |
| // The result is true when the pass was INCOMPLETE here: the label count |
| // failed (the names were kept, not decided), a label's count was unknown, |
| // or an alias write failed. The caller folds it into the pass's report. |
| -func deriveInstanceAliases(claims []Claim, listed map[string]bool, routes []registry.Route, byHost map[string]registry.Route, existing []registry.RouteAlias, deploymentRoutes map[string]bool, desired map[string]bool, labelHosts func(account, app string) (map[string]int, map[string]bool, error), budget *int, reg *registry.Registry, now func() time.Time) (incomplete bool) { |
| +func deriveInstanceAliases(claims []Claim, listed map[string]bool, routes []registry.Route, byHost map[string]registry.Route, existing []registry.RouteAlias, deploymentRoutes map[string]bool, desired map[string]bool, labelHosts func(account, app string) (map[string]int, map[string]bool, error), budget *int, reg *registry.Registry, now func() time.Time, unstamped func(name string)) (incomplete bool) { |
| claimed := make(map[string]Claim, len(claims)) |
| for _, c := range claims { |
| claimed[c.Host] = c |
| @@ -244,6 +244,9 @@ func deriveInstanceAliases(claims []Claim, listed map[string]bool, routes []regi |
| *budget-- |
| desired[name] = true |
| if a, ok := have[name]; ok && a.Host == rt.Host && a.Account == c.Account && a.App == c.App { |
| + if a.DNSCheckedAt == 0 && unstamped != nil { |
| + unstamped(name) // written earlier, never looked at yet (#1516) |
| + } |
| continue // already the row we want: no write, so no reload |
| } |
| if err := reg.UpsertAlias(registry.RouteAlias{ |
| @@ -252,6 +255,8 @@ func deriveInstanceAliases(claims []Claim, listed map[string]bool, routes []regi |
| }); err != nil { |
| log.Printf("domains: upsert instance alias %s: %v", name, err) |
| incomplete = true |
| + } else if unstamped != nil { |
| + unstamped(name) |
| } |
| } |
| } |
| @@ -312,6 +317,13 @@ type AliasReport struct { |
| // Complete is the pass's answer; written by ReconcileAliasesReport. |
| Complete bool |
| + // Unstamped is an OUTPUT: the instance catch-all names (deriveInstanceAliases) |
| + // this pass wrote, or found written, whose DNS has never been checked. |
| + // Nothing else looks at such a row until the domains loop's next |
| + // five-minute tick, so the agent hands these to it for an early, |
| + // host-scoped stamp (StampHealthHosts, #1516): the name's record is the |
| + // parent's wildcard, there before the instance was. |
| + Unstamped []string |
| // DeploymentRoutesPartial is an INPUT, set by the caller before the pass: |
| // the deploymentRoutes it passes came from a read that skipped an |
| // unusable edges file (edgesfile.DeploymentRoutesComplete said so). The |
| @@ -411,6 +423,13 @@ func relevantDropped(dropped []droppedClaim, routes []registry.Route, aliases [] |
| return out |
| } |
| +// noteUnstamped adds name to Unstamped; a nil report keeps nothing. |
| +func (r *AliasReport) noteUnstamped(name string) { |
| + if r != nil { |
| + r.Unstamped = append(r.Unstamped, name) |
| + } |
| +} |
| + |
| // ReconcileAliasesReport is ReconcileAliases plus a completeness report. A |
| // nil rep is legal (ReconcileAliases passes one). rep.Complete is false on |
| // every error return, and is otherwise written once, at the end, true only if |
| @@ -439,6 +458,7 @@ func ReconcileAliasesReport(ctx context.Context, s release.Store, reg *registry. |
| rep.Complete = false // any early error return leaves it so |
| rep.RegionalIngress = map[string]registry.RegionalDomain{} |
| rep.AliasIngress = map[string]registry.Route{} |
| + rep.Unstamped = nil |
| } |
| // incomplete is set at every point that logs a failure and carries on; |
| // the report is written once, at the end. |
| @@ -709,7 +729,7 @@ func ReconcileAliasesReport(ctx context.Context, s release.Store, reg *registry. |
| // The judge rides in the pass's context (provision.WithLifetimes |
| // records it here too); none is today's key count. |
| return InstanceLabelCountsJudged(ctx, s, InstanceObserverFrom(ctx), account, app, 2) |
| - }, &budget, reg, now) { |
| + }, &budget, reg, now, rep.noteUnstamped) { |
| incomplete = true |
| } |
| noRemoval := rep != nil && rep.StartupNoRemoval |
diff --git a/internal/domains/instancecatchall_test.go b/internal/domains/instancecatchall_test.go| index eff0f61e2..2e2e38d7f 100644 |
| --- a/internal/domains/instancecatchall_test.go |
| +++ b/internal/domains/instancecatchall_test.go |
| @@ -4,6 +4,8 @@ import ( |
| "context" |
| "encoding/json" |
| "errors" |
| + "slices" |
| + "sort" |
| "strconv" |
| "strings" |
| "testing" |
| @@ -543,3 +545,36 @@ func TestInstanceLabelCounts(t *testing.T) { |
| t.Fatalf("counts = %v, %v", got, err) |
| } |
| } |
| + |
| +// #1516: the pass reports the names it derived that no stamp has looked at |
| +// yet, so the agent can stamp them at once instead of at its next tick. A |
| +// name already stamped is not reported again. |
| +func TestInstanceCatchallReportsUnstampedNames(t *testing.T) { |
| + s := jellyStore(t) |
| + reg := aliasRegWith(t) |
| + addInstance(t, reg, "acme.bad.carlos.exciting.io", "acme", "bad", "dev-managed-jelly") |
| + addInstance(t, reg, "smoketest.bad.carlos.exciting.io", "smoketest", "bad", "dev-managed-jelly") |
| + pass := func() []string { |
| + t.Helper() |
| + var rep AliasReport |
| + if err := ReconcileAliasesReport(context.Background(), s, reg, aliasNow(), nil, nil, &rep); err != nil { |
| + t.Fatal(err) |
| + } |
| + sort.Strings(rep.Unstamped) |
| + return rep.Unstamped |
| + } |
| + if got := pass(); !slices.Equal(got, []string{"acme.letsjelly.dev", "smoketest.letsjelly.dev"}) { |
| + t.Fatalf("first pass reported %v, want both new names", got) |
| + } |
| + // Written but still never looked at (an agent restarted mid-wait): still |
| + // reported. |
| + if got := pass(); len(got) != 2 { |
| + t.Fatalf("second pass reported %v, want both names again", got) |
| + } |
| + if err := reg.SetAliasDNSStatus("acme.letsjelly.dev", "pointing", 100); err != nil { |
| + t.Fatal(err) |
| + } |
| + if got := pass(); !slices.Equal(got, []string{"smoketest.letsjelly.dev"}) { |
| + t.Fatalf("after a stamp the pass reported %v, want only the unstamped name", got) |
| + } |
| +} |
diff --git a/internal/domains/reconcile.go b/internal/domains/reconcile.go| index 6a6cd1f3a..b224589d6 100644 |
| --- a/internal/domains/reconcile.go |
| +++ b/internal/domains/reconcile.go |
| @@ -452,6 +452,93 @@ func Reconcile(ctx context.Context, s release.Store, reg *registry.Registry, cfg |
| // routes may be nil, in which case the registry is listed here. Inert with |
| // no AppsDomain, per Config's contract. |
| func StampHealth(ctx context.Context, reg *registry.Registry, cfg Config, routes []registry.Route) error { |
| + return stampHealth(ctx, reg, cfg, routes, nil) |
| +} |
| + |
| +// StampHealthHosts is StampHealth for the named aliases alone, run between |
| +// the loop's ticks so a name the alias pass just derived is judged in |
| +// seconds rather than at the next five-minute tick (#1516). Routes are not |
| +// stamped, and neither is any other alias. The verdict rules are |
| +// StampHealth's own (fresh-first for a name not yet pointing, the |
| +// two-strike rule, the hold on our own failures), but the pass does not |
| +// hand its names to cfg.FreshRetain: they are not every name the box |
| +// carries, and retaining only them would drop the resolver's memory of |
| +// every other name. |
| +// |
| +// An error after the stamp ran (re-reading the rows) comes with changed |
| +// true, since the stamps may have moved; an error before it, with false. |
| +// |
| +// It answers which of hosts are settled: pointing with a certificate that |
| +// has not expired, or no longer an alias row here at all. A watcher stops |
| +// asking about those. changed is whether any named row's DNS verdict, |
| +// certificate expiry or checked-at-all moved in this pass, which is what the |
| +// status snapshot and the edges file need to hear about. |
| +func StampHealthHosts(ctx context.Context, reg *registry.Registry, cfg Config, hosts []string) (settled []string, changed bool, err error) { |
| + if cfg.AppsDomain == "" || len(hosts) == 0 { |
| + return nil, false, nil |
| + } |
| + if cfg.Now == nil { |
| + cfg.Now = time.Now |
| + } |
| + only := make(map[string]bool, len(hosts)) |
| + for _, h := range hosts { |
| + only[stampKey(h)] = true |
| + } |
| + read := func() (map[string]registry.RouteAlias, error) { |
| + all, err := reg.ListAliases() |
| + if err != nil { |
| + return nil, fmt.Errorf("domains: list aliases: %w", err) |
| + } |
| + rows := map[string]registry.RouteAlias{} |
| + for _, a := range all { |
| + if only[stampKey(a.Alias)] { |
| + rows[stampKey(a.Alias)] = a |
| + } |
| + } |
| + return rows, nil |
| + } |
| + before, err := read() |
| + if err != nil { |
| + return nil, false, err |
| + } |
| + cfg.FreshRetain = nil |
| + if err := stampHealth(ctx, reg, cfg, []registry.Route{}, only); err != nil { |
| + return nil, false, err |
| + } |
| + after, err := read() |
| + if err != nil { |
| + // The stamps may have been written: say changed, so the caller |
| + // still wakes the publishers. On its retry the written rows are |
| + // the "before", and the change would not be seen again. |
| + return nil, true, err |
| + } |
| + now := cfg.Now().Unix() |
| + for _, h := range hosts { |
| + a, ok := after[stampKey(h)] |
| + if !ok { |
| + settled = append(settled, h) |
| + continue |
| + } |
| + b := before[stampKey(h)] |
| + // A first verdict that leaves the status "" (no record) is news |
| + // too: the console reads a row never checked as checking. |
| + if a.DNSStatus != b.DNSStatus || a.CertExpiresAt != b.CertExpiresAt || |
| + (b.DNSCheckedAt == 0) != (a.DNSCheckedAt == 0) { |
| + changed = true |
| + } |
| + if a.DNSStatus == "pointing" && a.CertExpiresAt > now { |
| + settled = append(settled, h) |
| + } |
| + } |
| + return settled, changed, nil |
| +} |
| + |
| +// stampKey is how StampHealthHosts matches a name to its row. |
| +func stampKey(host string) string { return strings.ToLower(strings.TrimSuffix(host, ".")) } |
| + |
| +// stampHealth is StampHealth, limited to the aliases in only when only is |
| +// not nil (StampHealthHosts). |
| +func stampHealth(ctx context.Context, reg *registry.Registry, cfg Config, routes []registry.Route, only map[string]bool) error { |
| if cfg.AppsDomain == "" { |
| return nil |
| } |
| @@ -476,6 +563,15 @@ func StampHealth(ctx context.Context, reg *registry.Registry, cfg Config, routes |
| if err != nil { |
| return fmt.Errorf("domains: list aliases: %w", err) |
| } |
| + if only != nil { |
| + kept := aliases[:0] |
| + for _, a := range aliases { |
| + if only[stampKey(a.Alias)] { |
| + kept = append(kept, a) |
| + } |
| + } |
| + aliases = kept |
| + } |
| } |
| // The account namespaces' derived rows (spec §4.4, §4.7) are not |
| // DNS-stamped here: the alias pass keeps each "pointing" |
diff --git a/internal/domains/stamphosts_test.go b/internal/domains/stamphosts_test.go| new file mode 100644 |
| index 000000000..9faff0dd5 |
| --- /dev/null |
| +++ b/internal/domains/stamphosts_test.go |
| @@ -0,0 +1,113 @@ |
| +package domains_test |
| + |
| +import ( |
| + "context" |
| + "testing" |
| + "time" |
| + |
| + "github.com/carlosframework/platform/internal/domains" |
| + "github.com/carlosframework/platform/internal/registry" |
| +) |
| + |
| +// #1516: an instance catch-all name is born unstamped, and before this |
| +// nothing looked at it until the domains loop's next five-minute tick. |
| +// StampHealthHosts is the early stamp: the named aliases only, by |
| +// StampHealth's own rules. |
| + |
| +func TestStampHealthHostsStampsOnlyTheNamedAliases(t *testing.T) { |
| + reg := regWithAlias(t, "new.patrix.site") |
| + if err := reg.UpsertAlias(registry.RouteAlias{Alias: "other.example.com", Host: "app.acct.oncarlos.test", Account: "acct", App: "app"}); err != nil { |
| + t.Fatal(err) |
| + } |
| + var calls []string |
| + cfg := freshCfg(pointingAt, pointingAt, &calls) |
| + retained := false |
| + cfg.FreshRetain = func([]string) { retained = true } |
| + |
| + settled, changed, err := domains.StampHealthHosts(context.Background(), reg, cfg, []string{"New.Patrix.Site."}) |
| + if err != nil { |
| + t.Fatal(err) |
| + } |
| + if got := aliasStatus(t, reg, "new.patrix.site"); got != "pointing" { |
| + t.Fatalf("named alias dns_status = %q, want pointing", got) |
| + } |
| + if got := aliasRow(t, reg, "other.example.com"); got.DNSStatus != "" || got.DNSCheckedAt != 0 { |
| + t.Fatalf("an alias not named was stamped: %+v", got) |
| + } |
| + if got := mustGet(t, reg, "app.acct.oncarlos.test"); got.DNSCheckedAt != 0 { |
| + t.Fatalf("a route was stamped: %+v", got) |
| + } |
| + if len(calls) != 1 || calls[0] != "new.patrix.site" { |
| + t.Fatalf("fresh lookups = %v, want [new.patrix.site]", calls) |
| + } |
| + // Retaining only the named names would drop the resolver's memory of |
| + // every other name the box carries. |
| + if retained { |
| + t.Fatal("a host-scoped stamp handed its names to FreshRetain") |
| + } |
| + if !changed { |
| + t.Fatal("the verdict moved from none to pointing, but changed is false") |
| + } |
| + if len(settled) != 0 { |
| + t.Fatalf("settled = %v with no certificate yet, want none", settled) |
| + } |
| + |
| + // Nothing moves on a second look: not changed, still not settled. |
| + settled, changed, err = domains.StampHealthHosts(context.Background(), reg, cfg, []string{"new.patrix.site"}) |
| + if err != nil { |
| + t.Fatal(err) |
| + } |
| + if changed || len(settled) != 0 { |
| + t.Fatalf("second look: settled %v changed %v, want none and false", settled, changed) |
| + } |
| +} |
| + |
| +func TestStampHealthHostsSettlesOnACertificate(t *testing.T) { |
| + reg := regWithAlias(t, "new.patrix.site") |
| + var calls []string |
| + cfg := freshCfg(pointingAt, pointingAt, &calls) |
| + cfg.AcmeDir = t.TempDir() |
| + writeCertBundle(t, cfg.AcmeDir, "new.patrix.site", time.Unix(5000, 0).Add(90*24*time.Hour)) |
| + |
| + settled, changed, err := domains.StampHealthHosts(context.Background(), reg, cfg, []string{"new.patrix.site", "gone.patrix.site"}) |
| + if err != nil { |
| + t.Fatal(err) |
| + } |
| + if !changed { |
| + t.Fatal("changed is false") |
| + } |
| + want := map[string]bool{"new.patrix.site": true, "gone.patrix.site": true} |
| + if len(settled) != 2 || !want[settled[0]] || !want[settled[1]] { |
| + t.Fatalf("settled = %v, want the pointing name with a certificate and the name with no row", settled) |
| + } |
| +} |
| + |
| +// A name whose record is missing is stamped "" with its check time, so the |
| +// console tells the customer, and it stays watched. |
| +func TestStampHealthHostsRecordMissing(t *testing.T) { |
| + reg := regWithAlias(t, "new.patrix.site") |
| + var calls []string |
| + cfg := freshCfg(nxdomain, nxdomain, &calls) |
| + settled, changed, err := domains.StampHealthHosts(context.Background(), reg, cfg, []string{"new.patrix.site"}) |
| + if err != nil { |
| + t.Fatal(err) |
| + } |
| + if !changed { |
| + t.Fatal("never checked to checked is a change the console must hear") |
| + } |
| + if got := aliasRow(t, reg, "new.patrix.site"); got.DNSStatus != "" || got.DNSCheckedAt == 0 { |
| + t.Fatalf("row = %+v, want an authoritative \"\" with its check time", got) |
| + } |
| + if len(settled) != 0 { |
| + t.Fatalf("settled = %v, want none", settled) |
| + } |
| +} |
| + |
| +func TestStampHealthHostsInertWithoutNames(t *testing.T) { |
| + reg := regWithAlias(t, "new.patrix.site") |
| + var calls []string |
| + settled, changed, err := domains.StampHealthHosts(context.Background(), reg, freshCfg(pointingAt, pointingAt, &calls), nil) |
| + if err != nil || changed || settled != nil || len(calls) != 0 { |
| + t.Fatalf("no names: settled %v changed %v err %v lookups %v", settled, changed, err, calls) |
| + } |
| +} |
diff --git a/internal/host/agent.go b/internal/host/agent.go| index ad7269f54..c97d2e5be 100644 |
| --- a/internal/host/agent.go |
| +++ b/internal/host/agent.go |
| @@ -1623,6 +1623,7 @@ func aliasPassReportingComplete(ctx context.Context, store release.Store, reg *r |
| rep.Complete = false |
| } |
| auth.aliasPass(start, rep) |
| + watchUnstamped(rep.Unstamped, err == nil && rep.Complete, time.Now()) |
| boxHAIngress.publishRegional(rep.RegionalIngress, err == nil && rep.Complete) |
| boxHAIngress.publishAliases(rep.AliasIngress, err == nil && rep.Complete) |
| return rep.Complete && err == nil, err |
| @@ -4616,10 +4617,9 @@ func domainsLoop(reg *registry.Registry, acmeCacheFlag string, hostClaim bool) { |
| return domains.Reconcile(ctx, store, reg, cfg) |
| }) |
| fleetBox := shouldSkipPublisherElection(os.Getenv) |
| - delay := time.Minute |
| + early := newEarlyStamper(reg, cfg, fleetBox, time.Minute) |
| for { |
| - time.Sleep(delay) |
| - delay = 5*time.Minute + rand.N(time.Minute) |
| + early.wait(ctx) // the next tick; early stamps for new names meanwhile (stampwatch.go) |
| // The deployment-global half, gated; then the per-box half on EVERY |
| // platform box (#303): DNS and TLS health stamp this box's own |
| // registry from this box's own view, no lease involved, ONCE per |
diff --git a/internal/host/edgesfile.go b/internal/host/edgesfile.go| index f7849e24f..82220f941 100644 |
| --- a/internal/host/edgesfile.go |
| +++ b/internal/host/edgesfile.go |
| @@ -1413,6 +1413,11 @@ func edgesFileLoop(reg *registry.Registry, lifetimes bool, assets *assetPolicy, |
| // EC2 each read can block for the probe's whole timeout. |
| eip := readPublicIP() |
| for now := range tick.C { |
| + select { |
| + case <-edgesStampNudge: |
| + state.stampsChanged() |
| + default: |
| + } |
| armedFixedAdmission.Load().tick(context.Background()) |
| fp, err := reg.Fingerprint() |
| if err != nil { |
diff --git a/internal/host/edgesschedule.go b/internal/host/edgesschedule.go| index 8d3dbc961..5f9831dea 100644 |
| --- a/internal/host/edgesschedule.go |
| +++ b/internal/host/edgesschedule.go |
| @@ -12,8 +12,17 @@ type edgesLoopState struct { |
| sched *edgesFileSchedule |
| schedDue bool |
| assetDue bool |
| + // stampsDue: a DNS or certificate stamp on one of this box's names moved |
| + // between ticks (stampsChanged). The fingerprint leaves those stamps out |
| + // on purpose, so without this the name would wait for the timer to be |
| + // published (#1516). Cleared by the next pass that succeeds. |
| + stampsDue bool |
| } |
| +// stampsChanged makes a pass due on the next tick, as a fingerprint change |
| +// would, with the schedule's retry backoff. |
| +func (s *edgesLoopState) stampsChanged() { s.stampsDue = true } |
| + |
| // due reports whether to run a pass on this tick. |
| func (s *edgesLoopState) due(now time.Time, fp string, fpOK bool) bool { |
| return s.dueWith(now, fp, fpOK, false) |
| @@ -26,7 +35,7 @@ func (s *edgesLoopState) due(now time.Time, fp string, fpOK bool) bool { |
| // asked on every tick. It is never the timer's. |
| func (s *edgesLoopState) dueWith(now time.Time, fp string, fpOK, assetsDue bool) bool { |
| s.schedDue = s.sched.due(now, fp, fpOK) |
| - s.assetDue = assetsDue && !now.Before(s.sched.retryAt) |
| + s.assetDue = (assetsDue || s.stampsDue) && !now.Before(s.sched.retryAt) |
| return s.schedDue || s.assetDue |
| } |
| @@ -40,6 +49,9 @@ func (s *edgesLoopState) timed() bool { return s.schedDue && s.sched.timed } |
| func (s *edgesLoopState) done(now time.Time, ok bool) { |
| if s.schedDue || s.assetDue { |
| s.sched.done(now, ok) |
| + if ok { |
| + s.stampsDue = false // every pass publishes the stamps as they are |
| + } |
| } |
| } |
diff --git a/internal/host/group_names_test.go b/internal/host/group_names_test.go| index 109922428..3a495ba48 100644 |
| --- a/internal/host/group_names_test.go |
| +++ b/internal/host/group_names_test.go |
| @@ -490,6 +490,16 @@ func (p *haIngressProjection) publishAliases(names map[string]Route) { p.aliases |
| // entry to the hosts map: no name is published, derived or made locally |
| // served; a selection through it is checked at request time (§5.3). |
| // |
| +// Early stamps for instance catch-all names (#1516) keep the existing name |
| +// classes: |
| +// - deriveInstanceAliases also reports, through a callback, each name it |
| +// wrote or found written whose DNS has never been checked. It derives, |
| +// writes and caps exactly as before; the report changes no row. |
| +// - ReconcileAliasesReport collects those names in AliasReport.Unstamped |
| +// (noteUnstamped), |
| +// an output the agent uses only to stamp them early |
| +// (domains.StampHealthHosts). No name is minted, published or renamed. |
| +// |
| // TestHAIngressNamesWithoutLocalRow, TestHAIngressAliasBinding and |
| // TestHAIngressStartupNames exercise these existing name classes end to end. |
| var groupNameProducerInventory = map[string]string{ |
| @@ -503,11 +513,11 @@ var groupNameProducerInventory = map[string]string{ |
| "../provision/demo_claim_seed.go:abortDemoClaimSeed": "e010b4e6b026a0744b7eacf6ffdb09647de6e1541e33ce73e71e7c99964a9f7a", |
| // Path routes across boxes (#186): paths derived by derivePaths on every |
| // box, written by writePaths; an unread claim's rows are kept (above). |
| - "../domains/aliases.go:ReconcileAliasesReport": "1d4e6fce767e9b72eabad602db74d895c344b61ba23ded81022fab8e51ffd01f", |
| + "../domains/aliases.go:ReconcileAliasesReport": "62be26c027c4d37704783c965dedb8f2e6dff7256d0bce9ae79471b2a6f6f373", |
| // Path routes across boxes (#186): route_paths rows for every path-routed |
| // claim host, local or not, keyed by its exact host; no new name class. |
| "../domains/aliases.go:derivePaths": "b8ee17573968b7e38090747092e26cfb365aa7c91dcc6a6de122e6c1706bd37f", |
| - "../domains/aliases.go:deriveInstanceAliases": "8393d746112286a43f77877067c1d4eaf8035e588c02acad71364b58e93f9a9c", |
| + "../domains/aliases.go:deriveInstanceAliases": "f81d4ea35478d67b610355b71a357c22346f401a68d06c95a9c371351b85147a", |
| "../domains/namespacealiases.go:deriveNamespaceAliases": "b4066d58cc5618c1323dadfc885d940143ba3abbcee0287df9639578e45fb67d", |
| "../domains/namespacealiases.go:repairNamespaceStatus": "1b9bae5baa6aeb724e484f17edaaafecc1df9d249f7c8723e9581be83b0536c0", |
| "../domains/aliases.go:deriveRegional": "79fd7c432e6b0a9ffd945312851e52af2c450769416ef44ff9a4bea681b44cde", |
diff --git a/internal/host/rollout.go b/internal/host/rollout.go| index ca7aeeb66..7d20b1530 100644 |
| --- a/internal/host/rollout.go |
| +++ b/internal/host/rollout.go |
| @@ -71,8 +71,10 @@ func armedRollout() *rollout.Manager { return rolloutMgr.Load() } |
| // statusNudge asks the status loop for an early tick: a rollout transition |
| // should reach status/boxes/<label>.json in seconds, not at the next |
| -// five-minute tick. Never sent to with the flag off. Capacity one, and every |
| -// send is non-blocking, so a burst of transitions is one nudge. |
| +// five-minute tick. The domains loop sends it too, when an early stamp of a |
| +// newly derived name moves (#1516), so the console sees the name go live. |
| +// Capacity one, and every send is non-blocking, so a burst of transitions is |
| +// one nudge. |
| var statusNudge = make(chan struct{}, 1) |
| // nudgeStatus is the scheduler's OnChange: a non-blocking send that |
diff --git a/internal/host/stampwatch.go b/internal/host/stampwatch.go| new file mode 100644 |
| index 000000000..9c2c2ffab |
| --- /dev/null |
| +++ b/internal/host/stampwatch.go |
| @@ -0,0 +1,263 @@ |
| +package host |
| + |
| +import ( |
| + "context" |
| + "log" |
| + "math/rand/v2" |
| + "strings" |
| + "sync" |
| + "time" |
| + |
| + "github.com/carlosframework/platform/internal/domains" |
| + "github.com/carlosframework/platform/internal/registry" |
| +) |
| + |
| +// The early stamp for newly derived names (#1516). |
| +// |
| +// An instance catch-all (`*.patrix.site` on an app) derives one alias row per |
| +// instance on the alias pass, which runs within seconds of the instance's |
| +// route. The row is born with no DNS stamp, and before this nothing looked at |
| +// it until the domains loop's next tick, five minutes and up to a minute of |
| +// jitter away. Until it reads "pointing" the edges file does not publish it, |
| +// and the console reports it as pending-dns. Its record is the parent's |
| +// wildcard, there before the instance was, so the first look nearly always |
| +// says pointing: the whole wait was the timer. |
| +// |
| +// The alias pass now hands those names to domainStampWatch and nudges the |
| +// domains loop, which stamps just them at once (domains.StampHealthHosts), |
| +// then again every stampWatchEvery while any of them is not yet pointing |
| +// with a certificate, for at most stampWatchFor. When a stamp moves, the |
| +// loop nudges the status snapshot and the edges file, so the console and |
| +// the other edges hear in seconds too. A name still unsettled after |
| +// stampWatchFor (its record is missing, or points elsewhere) is left to the |
| +// ordinary tick, as every name was before. |
| + |
| +// How often a watched name is stamped again, and for how long. |
| +const ( |
| + stampWatchEvery = 20 * time.Second |
| + stampWatchFor = 10 * time.Minute |
| +) |
| + |
| +// stampWatch is the set of names waiting for their early stamps. Safe for |
| +// the alias pass to add to while the domains loop reads it. |
| +type stampWatch struct { |
| + mu sync.Mutex |
| + since map[string]time.Time // name -> when it was first watched |
| + // spent holds the names watched for stampWatchFor without settling. The |
| + // alias pass reports a never-checked name on every pass, and a name |
| + // whose checks keep standing down (no edge set) stays never checked, so |
| + // without this each report would start another watch. A name leaves it |
| + // when a report no longer holds it: checked by the tick, or gone. |
| + spent map[string]bool |
| + last time.Time // when the loop last stamped them |
| +} |
| + |
| +// add watches names from now, and reports whether any was not watched |
| +// already. A name already watched keeps its start, so a name the alias pass |
| +// keeps reporting is not watched for ever, and does not wake the loop again: |
| +// the alias pass runs on every serial bump, and each early stamp reads the |
| +// deployment's edge set. |
| +// |
| +// When whole is true names is a complete alias pass's report, so add also |
| +// forgets the spent names it no longer holds. A pass that failed part way |
| +// reports only some names, and forgetting on it would start the watches |
| +// again. |
| +func (w *stampWatch) add(names []string, whole bool, now time.Time) (added bool) { |
| + w.mu.Lock() |
| + defer w.mu.Unlock() |
| + if w.since == nil { |
| + w.since, w.spent = map[string]time.Time{}, map[string]bool{} |
| + } |
| + reported := make(map[string]bool, len(names)) |
| + for _, n := range names { |
| + k := strings.ToLower(strings.TrimSuffix(n, ".")) |
| + reported[k] = true |
| + if _, ok := w.since[k]; !ok && !w.spent[k] { |
| + w.since[k] = now |
| + added = true |
| + } |
| + } |
| + for k := range w.spent { |
| + if whole && !reported[k] { |
| + delete(w.spent, k) |
| + } |
| + } |
| + return added |
| +} |
| + |
| +// due answers the names to stamp now, or nil: none watched, or the last |
| +// stamp was less than stampWatchEvery ago and nudged is false. A nudge (a |
| +// name just added) skips the wait, but never stamps twice in one second. |
| +// Names watched longer than stampWatchFor are dropped, and so are not |
| +// answered. |
| +func (w *stampWatch) due(now time.Time, nudged bool) []string { |
| + w.mu.Lock() |
| + defer w.mu.Unlock() |
| + for n, at := range w.since { |
| + if now.Sub(at) >= stampWatchFor { |
| + delete(w.since, n) |
| + w.spent[n] = true |
| + } |
| + } |
| + if len(w.since) == 0 { |
| + return nil |
| + } |
| + wait := stampWatchEvery |
| + if nudged { |
| + wait = time.Second |
| + } |
| + if !w.last.IsZero() && now.Sub(w.last) < wait { |
| + return nil |
| + } |
| + w.last = now |
| + names := make([]string, 0, len(w.since)) |
| + for n := range w.since { |
| + names = append(names, n) |
| + } |
| + return names |
| +} |
| + |
| +// settled stops watching names. |
| +func (w *stampWatch) settled(names []string) { |
| + w.mu.Lock() |
| + defer w.mu.Unlock() |
| + for _, n := range names { |
| + delete(w.since, strings.ToLower(strings.TrimSuffix(n, "."))) |
| + } |
| +} |
| + |
| +// watching reports whether any name is watched, so the loop knows to wake. |
| +func (w *stampWatch) watching() bool { |
| + w.mu.Lock() |
| + defer w.mu.Unlock() |
| + return len(w.since) > 0 |
| +} |
| + |
| +// domainStampWatch is the box's watch: one agent per process, as with |
| +// aliasClaimCache. |
| +var domainStampWatch stampWatch |
| + |
| +// domainsNudge wakes the domains loop for an early stamp. Capacity one and |
| +// every send non-blocking, as statusNudge. |
| +var domainsNudge = make(chan struct{}, 1) |
| + |
| +// edgesStampNudge tells the edges file loop a stamp moved (stampsChanged). |
| +var edgesStampNudge = make(chan struct{}, 1) |
| + |
| +// watchUnstamped is the alias pass's hand-off: watch the names it reported |
| +// and wake the domains loop. whole is whether the pass was complete. |
| +func watchUnstamped(names []string, whole bool, now time.Time) { |
| + if domainStampWatch.add(names, whole, now) { |
| + nudge(domainsNudge) |
| + } |
| +} |
| + |
| +// edgeIPsFor is the edge set for early stamps: the loop's own fold, read at |
| +// most once a minute. The fold lists and reads every box's edges file, and |
| +// an early stamp may run every stampWatchEvery; the set changes when a box |
| +// joins or leaves, which the full tick reads afresh. |
| +func edgeIPsFor(fold func() []string, now func() time.Time) func() []string { |
| + var ( |
| + mu sync.Mutex |
| + at time.Time |
| + last []string |
| + ) |
| + return func() []string { |
| + mu.Lock() |
| + defer mu.Unlock() |
| + if t := now(); last == nil || t.Sub(at) >= time.Minute { |
| + if ips := fold(); len(ips) > 0 { |
| + last, at = ips, t |
| + } else { |
| + return ips // unknown: StampHealth stands down; ask again next time |
| + } |
| + } |
| + return last |
| + } |
| +} |
| + |
| +// nudge is a non-blocking send that coalesces. |
| +func nudge(ch chan struct{}) { |
| + select { |
| + case ch <- struct{}{}: |
| + default: |
| + } |
| +} |
| + |
| +// earlyStamper is the domains loop's wait between its ticks: the tick's |
| +// timer, and the early stamps for watched names while it runs. |
| +type earlyStamper struct { |
| + reg *registry.Registry |
| + cfg domains.Config // the loop's, with the edge set read at most once a minute |
| + fleet bool // a fleet box: no stamps, as the tick's own (domainsLoop) |
| + tick *time.Timer |
| +} |
| + |
| +func newEarlyStamper(reg *registry.Registry, cfg domains.Config, fleet bool, first time.Duration) *earlyStamper { |
| + cfg.EdgeIPs = edgeIPsFor(cfg.EdgeIPs, time.Now) |
| + return &earlyStamper{reg: reg, cfg: cfg, fleet: fleet, tick: time.NewTimer(first)} |
| +} |
| + |
| +// wait returns when the loop's tick is due, then arms the next one five |
| +// minutes and up to a minute of jitter on, as the loop's sleep did. |
| +// Meanwhile it stamps the watched names: at once when the alias pass wakes |
| +// it, then every stampWatchEvery while any is unsettled. A tick that is due |
| +// always goes first: an early stamp can take most of a minute (fresh |
| +// lookups, an edge-set read), so the timer is checked again whenever a wake |
| +// wins the select, and a nudge that loses to it is kept for after the tick. |
| +func (s *earlyStamper) wait(ctx context.Context) { |
| + defer func() { s.tick.Reset(5*time.Minute + rand.N(time.Minute)) }() |
| + for !timerFired(s.tick) { |
| + var every <-chan time.Time |
| + if !s.fleet && domainStampWatch.watching() { |
| + every = time.After(stampWatchEvery) |
| + } |
| + nudged := false |
| + select { |
| + case <-s.tick.C: |
| + return |
| + case <-domainsNudge: |
| + nudged = true |
| + case <-every: |
| + } |
| + if timerFired(s.tick) { |
| + if nudged { |
| + nudge(domainsNudge) |
| + } |
| + return |
| + } |
| + stampWatched(ctx, s.reg, s.cfg, s.fleet, nudged) |
| + } |
| +} |
| + |
| +// timerFired takes a fired timer's tick without waiting. |
| +func timerFired(t *time.Timer) bool { |
| + select { |
| + case <-t.C: |
| + return true |
| + default: |
| + return false |
| + } |
| +} |
| + |
| +// stampWatched stamps the watched names now (domains.StampHealthHosts), stops |
| +// watching those that are settled, and tells the status snapshot and the |
| +// edges file when a stamp moved. Inert on a fleet box. |
| +func stampWatched(ctx context.Context, reg *registry.Registry, cfg domains.Config, fleetBox, nudged bool) { |
| + if fleetBox { |
| + return |
| + } |
| + names := domainStampWatch.due(time.Now(), nudged) |
| + if len(names) == 0 { |
| + return |
| + } |
| + settled, changed, err := domains.StampHealthHosts(ctx, reg, cfg, names) |
| + if err != nil { |
| + log.Printf("agent: domains early stamp: %v", err) |
| + } |
| + domainStampWatch.settled(settled) |
| + if changed { // with an error too: the stamps may have been written |
| + nudge(edgesStampNudge) |
| + nudgeStatus() |
| + } |
| +} |
diff --git a/internal/host/stampwatch_test.go b/internal/host/stampwatch_test.go| new file mode 100644 |
| index 000000000..f8fe15ee2 |
| --- /dev/null |
| +++ b/internal/host/stampwatch_test.go |
| @@ -0,0 +1,176 @@ |
| +package host |
| + |
| +import ( |
| + "runtime" |
| + "testing" |
| + "time" |
| +) |
| + |
| +func TestStampWatchDue(t *testing.T) { |
| + var w stampWatch |
| + t0 := time.Unix(1_000_000, 0) |
| + if w.watching() || w.due(t0, true) != nil { |
| + t.Fatal("an empty watch is watching or due") |
| + } |
| + w.add([]string{"New.Patrix.Site."}, true, t0) |
| + if !w.watching() { |
| + t.Fatal("not watching after add") |
| + } |
| + if got := w.due(t0, true); len(got) != 1 || got[0] != "new.patrix.site" { |
| + t.Fatalf("due on the nudge = %v, want [new.patrix.site]", got) |
| + } |
| + // A second nudge inside a second is coalesced; past it, a nudge stamps. |
| + if got := w.due(t0.Add(500*time.Millisecond), true); got != nil { |
| + t.Fatalf("due twice in one second: %v", got) |
| + } |
| + if got := w.due(t0.Add(2*time.Second), true); len(got) != 1 { |
| + t.Fatalf("a nudge after a second = %v, want the name", got) |
| + } |
| + // Without a nudge, the follow-up waits stampWatchEvery from the last stamp. |
| + if got := w.due(t0.Add(2*time.Second+stampWatchEvery-time.Second), false); got != nil { |
| + t.Fatalf("follow-up before stampWatchEvery: %v", got) |
| + } |
| + if got := w.due(t0.Add(2*time.Second+stampWatchEvery), false); len(got) != 1 { |
| + t.Fatalf("follow-up at stampWatchEvery = %v, want the name", got) |
| + } |
| + w.settled([]string{"NEW.patrix.site"}) |
| + if w.watching() { |
| + t.Fatal("still watching a settled name") |
| + } |
| +} |
| + |
| +// A name that never settles (its record is missing) is given up after |
| +// stampWatchFor and left to the ordinary tick; adding it again does not |
| +// restart its clock while it is still watched. |
| +func TestStampWatchGivesUp(t *testing.T) { |
| + var w stampWatch |
| + t0 := time.Unix(1_000_000, 0) |
| + if !w.add([]string{"a.patrix.site"}, true, t0) { |
| + t.Fatal("a new name was not reported added") |
| + } |
| + if w.add([]string{"A.patrix.site."}, true, t0.Add(5*time.Minute)) { |
| + t.Fatal("a watched name was reported added again") |
| + } |
| + if got := w.due(t0.Add(stampWatchFor-time.Second), true); len(got) != 1 { |
| + t.Fatalf("due just before the limit = %v", got) |
| + } |
| + if got := w.due(t0.Add(stampWatchFor), true); got != nil { |
| + t.Fatalf("due at the limit = %v, want none", got) |
| + } |
| + if w.watching() { |
| + t.Fatal("still watching after the limit") |
| + } |
| + // Reported again by a later pass (still never checked): not watched |
| + // again, and no wake. |
| + if w.add([]string{"a.patrix.site"}, true, t0.Add(stampWatchFor+time.Minute)) || w.watching() { |
| + t.Fatal("a spent name started a new watch") |
| + } |
| + // Once a report no longer holds it (the tick checked it, or it went), |
| + // it may be watched again if it ever comes back unchecked. |
| + // A pass that failed part way reports nothing, and forgets nothing. |
| + w.add(nil, false, t0.Add(stampWatchFor+2*time.Minute)) |
| + if w.add([]string{"a.patrix.site"}, true, t0.Add(stampWatchFor+3*time.Minute)) { |
| + t.Fatal("an incomplete pass forgot a spent name") |
| + } |
| + w.add(nil, true, t0.Add(stampWatchFor+4*time.Minute)) |
| + if !w.add([]string{"a.patrix.site"}, true, t0.Add(stampWatchFor+5*time.Minute)) { |
| + t.Fatal("a spent name the reports had dropped could not be watched again") |
| + } |
| +} |
| + |
| +func TestTimerFired(t *testing.T) { |
| + tm := time.NewTimer(time.Hour) |
| + defer tm.Stop() |
| + if timerFired(tm) { |
| + t.Fatal("an unfired timer read as fired") |
| + } |
| + tm.Reset(time.Nanosecond) |
| + for !timerFired(tm) { // a fired timer is read without blocking |
| + runtime.Gosched() |
| + } |
| + if timerFired(tm) { |
| + t.Fatal("a fired timer's tick was taken twice") |
| + } |
| +} |
| + |
| +func TestWatchUnstampedNudgesOnce(t *testing.T) { |
| + // Package-level state: drain whatever an earlier test left. |
| + select { |
| + case <-domainsNudge: |
| + default: |
| + } |
| + defer domainStampWatch.settled([]string{"x.patrix.site", "y.patrix.site"}) |
| + watchUnstamped(nil, false, time.Now()) |
| + select { |
| + case <-domainsNudge: |
| + t.Fatal("nudged with no names") |
| + default: |
| + } |
| + watchUnstamped([]string{"x.patrix.site"}, false, time.Now()) |
| + watchUnstamped([]string{"y.patrix.site"}, false, time.Now()) // coalesces, never blocks |
| + select { |
| + case <-domainsNudge: |
| + default: |
| + t.Fatal("no nudge after names were watched") |
| + } |
| + // Reported again by a later alias pass: already watched, no wake. |
| + watchUnstamped([]string{"x.patrix.site"}, false, time.Now()) |
| + select { |
| + case <-domainsNudge: |
| + t.Fatal("a name already watched woke the loop again") |
| + default: |
| + } |
| + select { |
| + case <-domainsNudge: |
| + t.Fatal("two nudges queued") |
| + default: |
| + } |
| +} |
| + |
| +// A stamp that moved makes an edges-file pass due though the fingerprint, |
| +// which leaves stamps out, has not moved; a successful pass clears it, and a |
| +// failed one keeps it for the retry. |
| +func TestEdgesLoopStampsChanged(t *testing.T) { |
| + t0 := time.Unix(1_000_000, 0) |
| + s := &edgesLoopState{sched: newEdgesFileSchedule(t0, func() time.Duration { return 5 * time.Minute })} |
| + if s.dueWith(t0, "fp", true, false) { |
| + t.Fatal("due on the baseline tick") |
| + } |
| + s.stampsChanged() |
| + if !s.dueWith(t0.Add(2*time.Second), "fp", true, false) { |
| + t.Fatal("not due after a stamp moved") |
| + } |
| + s.done(t0.Add(2*time.Second), false) |
| + if s.dueWith(t0.Add(3*time.Second), "fp", true, false) { |
| + t.Fatal("due inside the retry backoff") |
| + } |
| + if !s.dueWith(t0.Add(5*time.Second), "fp", true, false) { |
| + t.Fatal("a failed pass dropped the stamp change") |
| + } |
| + s.done(t0.Add(5*time.Second), true) |
| + if s.dueWith(t0.Add(7*time.Second), "fp", true, false) { |
| + t.Fatal("still due after a successful pass") |
| + } |
| +} |
| + |
| +func TestEdgeIPsForReadsOnceAMinute(t *testing.T) { |
| + now := time.Unix(1_000_000, 0) |
| + reads := 0 |
| + answer := []string{} |
| + ips := edgeIPsFor(func() []string { reads++; return answer }, func() time.Time { return now }) |
| + if got := ips(); len(got) != 0 || reads != 1 { |
| + t.Fatalf("unknown set: %v after %d reads", got, reads) |
| + } |
| + answer = []string{"203.0.113.7"} |
| + if got := ips(); len(got) != 1 || reads != 2 { |
| + t.Fatalf("an unknown set is asked again: %v after %d reads", got, reads) |
| + } |
| + now = now.Add(59 * time.Second) |
| + if ips(); reads != 2 { |
| + t.Fatalf("read again inside the minute (%d reads)", reads) |
| + } |
| + now = now.Add(time.Second) |
| + if ips(); reads != 3 { |
| + t.Fatalf("not read again after the minute (%d reads)", reads) |
| + } |
| +} |
diff --git a/internal/provision/testdata/plan14-root-reads-catchall-stamp-now.tsv b/internal/provision/testdata/plan14-root-reads-catchall-stamp-now.tsv| new file mode 100644 |
| index 000000000..836c13eab |
| --- /dev/null |
| +++ b/internal/provision/testdata/plan14-root-reads-catchall-stamp-now.tsv |
| @@ -0,0 +1,17 @@ |
| +# Census overlay catchall-stamp-now, written by census-propose (#369). census-ruling-catchall-stamp-now, approved on #280 before the merge; the approval card is docs/superpowers/notes/census-proposal-catchall-stamp-now.md. |
| +# 2 body, 1 sites, 2 envelope: each changed unit re-frozen at its existing disposition with its claim appended. |
| +# 3 new dispositions: 1 reads re-frozen at their disposition with the claim, 2 new units frozen accepted-legacy, 0 quiet units retired while they read nothing, 0 other. |
| +@legacy 76d1043d3ba8ec7045dfec5084f5b7865b70cae7ddfed232e49a6e61266b25dd internal/domains/aliases.go ReconcileAliasesReport legacy accepted-legacy accepted-legacy;rev3=J1;basis=root-route;rev3=census-ruling-edge-asset-cache-1;basis=the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos), in its alias pass (aliasPassReporting in runAgent; ReconcileAliases, now a wrapper, is its other caller): main's ReconcileAliases body, moved here with the same reads and writes, plus a completeness report (AliasReport) set false at every point that already logged a failure and carried on, and when relevantDropped names a listed claim the pass could not rule out; the box's asset authority clock advances only after a complete pass; one more whole:Route and whole:RouteAlias site each, the routes and alias rows the pass already read handed to relevantDropped; no registry, file or bucket read added; no root pass calls it; no root decision;rev3=census-ruling-regional-domains-447;basis=#447 Task 4: in the alias pass inside the agent: reads the existing regional_domains rows (reg.ListRegional) beside the alias rows, derives a regional claim's rows through deriveRegional for AliasReport.Region (the caller's ReconcileConfig.Region, set by aliasPassReporting) and its wildcard parent when bound, skipping the alias, paths and catch-all halves for it, writes them through writeRegional, and keeps an unread regional claim's wildcard parent while the kept apex row still binds a target RegionalTarget accepts on the routes this pass read (same account and app, per-box cap); claims are read as before (the listing and per-claim GETs it already does); the added reads are the registry's regional rows and fields of rows the pass already holds;rev3=census-ruling-fleet-public-routes;basis=fleet public routes (spec 2026-10-29 rev 4, §4.2 writer rule): Task 6 fix rounds 2-3: AliasReport.FleetRefused (edge.FleetArmVerdict's refused set) is called once on the pass's own listing; a Wildcard claim whose primary is fleet-refused derives no wildcard_domains row (an earlier one goes with the ordinary removal); the catch-all alias is derived as before (+registry:Host, +whole:Route). Rows already read; writes less, never more; no root pass calls it.;rev3=census-ruling-region-ha-g2-fixes;basis=Project accepted regional exact/catchall names and plain/delegated aliases into routing-only reports using existing claims and pre-pool metadata; new whole Route/RegionalDomain uses, no new external reader.;rev3=census-ruling-fix-incomplete-domains-pass;basis=adds AliasReport.StartupNoRemoval, an input set only by the agent startup HA ingress pass (host startupAliasPass via runHAIngressStartup): when set, the pass skips the route_aliases, wildcard_domains and route_paths removals (each skipped removal marks the pass incomplete) and the removal rules themselves are unchanged; derivations, refusals and writes are unchanged; same read sites (body change only); no new registry, file or bucket read; deletes less, never more, and only on the startup pass; no root pass calls it; no root decision;rev3=census-ruling-account-subdomains;basis=with AliasReport.AppsDomain set, reads the box's own account_namespaces table (reg.ListAccountNamespaces), sorts a listed-but-unread namespace claim (ParseNamespaceHost on the dropped host): a not-found body keeps nothing and is not counted by relevantDropped, any other failure keeps that name's recorded rows; runs deriveNamespaceAliases after deriveInstanceAliases on the routes, alias rows and claims it already read (AccountNamespaces over the read claims), keepNamespaceAliases for unread names, and writes the table through writeAccountNamespaces (once, only when it differs; no shrink under StartupNoRemoval); the added sites are the routes and alias rows already read handed to those helpers; no file or bucket read added; fix round 1: keepNamespaceAliases runs before deriveNamespaceAliases, and repairNamespaceStatus stamps "pointing" on derived-shape rows of exact claims and kept names, over claims and rows already read;rev3=census-ruling-path-routes-across-boxes;basis=#186: path derivation moved to derivePaths and the route_paths write to writePaths (pathwrite.go); its own route_paths reads moved with them; unread claims now keep their path rows like regional rows; no read added here;rev3=census-ruling-catchall-stamp-now;basis=#1516: the agent's alias pass (user carlos, no root pass calls it) resets AliasReport.Unstamped and hands deriveInstanceAliases the report's nil-safe noteUnstamped method, which appends each name to it; Unstamped is an output only; same reads and writes, body change only registry:Account@15007,registry:Account@15022,registry:Account@15140,registry:Account@15492,registry:Account@15505,registry:Alias@13001,registry:Alias@13134,registry:Alias@13204,registry:App@15035,registry:App@15046,registry:App@15153,registry:App@15518,registry:App@15527,registry:App@5204,registry:App@5400,registry:App@8746,registry:App@8946,registry:App@9102,registry:App@9303,registry:Host@14817,registry:Host@14892,registry:Host@14915,registry:Host@14967,registry:Host@15301,registry:Host@15373,registry:Host@15477,registry:Host@15788,registry:Host@15934,registry:Host@16006,registry:Host@856,registry:Host@9669,registry:Region@15162,registry:Target@14987,registry:Target@15092,whole:RegionalDomain@13781,whole:RegionalDomain@13799,whole:RegionalDomain@14745,whole:RegionalDomain@14783,whole:RegionalDomain@14804,whole:RegionalDomain@14827,whole:RegionalDomain@14954,whole:RegionalDomain@276,whole:RegionalDomain@3655,whole:RegionalDomain@3856,whole:Route@10551,whole:Route@1067,whole:Route@11676,whole:Route@11684,whole:Route@12534,whole:Route@12624,whole:Route@12632,whole:Route@15085,whole:Route@15136,whole:Route@2273,whole:Route@337,whole:Route@3837,whole:Route@4256,whole:Route@4547,whole:Route@5244,whole:Route@5395,whole:Route@5451,whole:Route@7493,whole:Route@809,whole:Route@838,whole:Route@849,whole:Route@867,whole:Route@8715,whole:Route@8790,whole:Route@8937,whole:Route@8999,whole:Route@9142,whole:Route@9298,whole:RouteAlias@11692,whole:RouteAlias@12516,whole:RouteAlias@12640,whole:RouteAlias@12795,whole:RouteAlias@12976,whole:RouteAlias@2281,whole:WildcardDomain@14851,whole:WildcardDomain@14880,whole:WildcardDomain@15361,whole:WildcardDomain@15383,whole:WildcardDomain@15407,whole:WildcardDomain@15456,whole:WildcardDomain@15619,whole:WildcardDomain@15747,whole:WildcardDomain@15776,whole:WildcardDomain@4070,whole:WildcardDomain@9865 857931e794c6043d988e98264f12a75ac22261e71defb17147f9a0af86905d32 |
| +@legacy e3edd8099a611304e9140e1f869ccdbc48400a298f2150912ed6fc0553d5712a internal/host/agent.go aliasPassReportingComplete legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-g2-fixes;basis=Extract the existing serialized alias pass, add cancellable locking and routing-only alias/regional publication from its completeness report; existing deployment/claim/registry reads retained, new in-memory Route/RegionalDomain passes.;rev3=census-ruling-fix-incomplete-domains-pass;basis=gains a startup bool parameter that it copies into domains.AliasReport.StartupNoRemoval; runHAIngressStartup passes true, aliasPassReporting (the ordinary agent pass) passes false; same reads and calls, body change only; no root pass calls it; no root decision;rev3=census-ruling-account-subdomains;basis=sets AliasReport.AppsDomain from PLATFORM_APPS_DOMAIN (trimmed), the variable domainsTickConfig reads; same reads and calls otherwise; body change only;rev3=census-ruling-sr-followups;basis=#966, the agent pass (user carlos, no root pass calls it): on a door box (doorFleet: no CARLOS_DEPLOYMENT_BUCKET or CARLOS_DEPLOYMENT_DIR and a fleet identity from the process environment, CARLOS_FLEET and its box label, as openDeployStoreEnv decides) it skips edgesfile.DeploymentRoutesComplete, the status/boxes/ list the store door refuses, and reports the route set incomplete (DeploymentRoutesPartial false, routesWhole false) as the refused list did. One store list fewer on door boxes, none added, every other box unchanged, no file, bucket or root call added;rev3=census-ruling-catchall-stamp-now;basis=#1516: hands rep.Unstamped and whether the pass was complete to watchUnstamped, an in-memory watch list that may wake the domains loop through a buffered channel; same reads and calls, body change only whole:RegionalDomain@2271,whole:Route@1379,whole:Route@1401,whole:Route@1420,whole:Route@2349 92645a7c4fb12251a01cd37ba0879c6979bdc93db67de9831eb2b3fe98e60ddf |
| +@legacy 004909c028c40503f21b5d3b2b7dd84f26fc9fa9bb3eb21cb6b9351f90f9a70e internal/domains/reconcile.go StampHealthHosts legacy accepted-legacy accepted-legacy;rev3=census-ruling-catchall-stamp-now;basis=#1516: new. Called only by the agent's domains loop (user carlos), never by root: lists the box's own alias rows before and after, runs stampHealth over the named aliases only with no routes and FreshRetain unset, and compares DNSStatus, DNSCheckedAt and CertExpiresAt to report settled names and whether any changed; a failed re-read reports changed (census round 1 P2); no file, bucket or command input added beyond stampHealth's own registry:Alias@621,registry:Alias@651,registry:CertExpiresAt@1482,registry:CertExpiresAt@1501,registry:CertExpiresAt@1628,registry:DNSCheckedAt@1524,registry:DNSCheckedAt@1549,registry:DNSStatus@1452,registry:DNSStatus@1467,registry:DNSStatus@1599,whole:RouteAlias@1214,whole:RouteAlias@1299,whole:RouteAlias@595,whole:RouteAlias@637,whole:RouteAlias@663,whole:RouteAlias@683 0fec173690c96a0c696ce3161ccadb0eef99c8f849880f8e027114f4465f01cb |
| +@legacy d0e8d0c793b6b7d05f30c5335847fdbf1be73ba8be55a018355c5afefa0094a1 internal/domains/reconcile.go stampHealth legacy accepted-legacy accepted-legacy;rev3=census-ruling-catchall-stamp-now;basis=#1516: StampHealth's body moved here unchanged, plus an optional only-set that keeps the listed alias rows whose name it holds; same registry reads, stamps, resolver calls and acme-dir certificate reads as StampHealth; the agent's domains loop (user carlos) is its only caller; no root pass calls it registry:Alias@1006,registry:Alias@2161,registry:Alias@4639,registry:Alias@5228,registry:Alias@5318,registry:Alias@5752,registry:Alias@5816,registry:Alias@5904,registry:DNSCheckedAt@4514,registry:DNSCheckedAt@4661,registry:DNSStatus@4500,registry:DNSStatus@4648,registry:DNSStatus@4853,registry:DNSStatus@5152,registry:Host@4491,registry:Host@4925,registry:Host@5009,registry:Host@5521,registry:Host@5580,registry:Host@5662,whole:Route@221,whole:Route@258,whole:Route@4315,whole:Route@4431,whole:Route@4760,whole:Route@5475,whole:RouteAlias@1023,whole:RouteAlias@1037,whole:RouteAlias@1043,whole:RouteAlias@1060,whole:RouteAlias@1070,whole:RouteAlias@1869,whole:RouteAlias@2095,whole:RouteAlias@2247,whole:RouteAlias@2295,whole:RouteAlias@2315,whole:RouteAlias@2327,whole:RouteAlias@4361,whole:RouteAlias@4575,whole:RouteAlias@5055,whole:RouteAlias@5705,whole:RouteAlias@802,whole:RouteAlias@942,whole:RouteAlias@975 1be38ed3a6254e4227a33843acf162fbd43b626feb1b636052ee6e2a8d78684e |
| +@legacy 9f0ad1d9e14118531860eb3f222d3c3be8bf067f640b9ef01ddc2ad5435f6728 internal/domains/aliases.go deriveInstanceAliases legacy accepted-legacy accepted-legacy;rev3=census-ruling-self-serve-moves-1;basis=root-route; the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos): rev3=J1's body; a stale body under a retired lifetime no longer makes a label shared, and a label with a record that cannot be judged keeps its existing alias row of the catch-all's own account and app (reading that row's Account and App) only once the derived name has passed every precedence check a derived name answers to (validity, an exact claim, a local real route, a deployment route, the per-box cap), and derives no new one; a report-only conservative keep, never a new route;rev3=census-ruling-regional-domains-447;basis=#447 Task 2: an instance catch-all whose parent claim is regional is inert (logged once, continue), as one whose parent is not held is; it only narrows what derives; no read added;rev3=census-ruling-account-subdomains;basis=takes a *int budget shared with the namespace pass instead of a local counter; the same checks and cap (maxInstanceAliases, now a var so a test can lower it); names kept on a failed instance listing now take the budget too, each once (fix round 1, Astra I-2), so the cap holds on that branch; same reads; body change only; derives and keeps less, never more;rev3=census-ruling-catchall-stamp-now;basis=#1516: reports through the new callback each derived name it wrote, or found already written with dns_checked_at 0 (the added registry:DNSCheckedAt site is a.DNSCheckedAt on the alias row it already read); derives, writes and caps exactly as before; no file, bucket or root read added registry:Account@2694,registry:Account@4286,registry:Account@5085,registry:Alias@2756,registry:Alias@2824,registry:Alias@2863,registry:Alias@3142,registry:Alias@603,registry:App@2016,registry:App@2720,registry:App@4312,registry:App@5111,registry:DNSCheckedAt@5135,registry:Host@2173,registry:Host@5064,registry:Host@5074,registry:Host@5394,registry:Provisioned@1966,registry:Replica@2002,registry:Slug@2105,whole:Route@1950,whole:Route@2056,whole:Route@3828,whole:RouteAlias@2674,whole:RouteAlias@4268,whole:RouteAlias@5046,whole:RouteAlias@555,whole:RouteAlias@585,whole:RouteAlias@598,whole:RouteAlias@614 16186a15572f852d45b3302b98593dee1cef90b2ea8db6026966d1b653d5f592 |
| +@legacy 933320c65725f4b6dd9c621583e7329fb065112e2784813983dbdf594a6d7ef9 internal/domains/reconcile.go StampHealth legacy accepted-legacy accepted-legacy;rev3=J1;basis=root-route;rev3=census-ruling-dns-fresh-lookup-724;basis=section 4 now computes every cached verdict first, then freshUpgrade gives up to 64 randomly ordered names that could have a public zone (not under the apps domain, not special-use like .internal) and whose verdict is "" or "elsewhere" an uncached lookup (30 s pass budget) that may only upgrade to "pointing", then stamps; the extra sites are the indexed loops over the same rows (#724);rev3=census-ruling-no-negative-prime-724;basis=section 4 now hands each route and alias, with its previous stamp (the two new registry:DNSStatus reads, rt.DNSStatus and a.DNSStatus, same rows already listed), to dnsVerdicts, which first hands the pass's hostnames to Config.FreshRetain (the resolver forgets its in-memory backoff and strike for names no longer carried) and then decides each hostname once per pass and applies the verdict to every row carrying it: a name not "pointing" before this pass and eligible for a fresh lookup (public name, not under the apps domain, ResolveFresh set) is looked at uncached first within the same 64-lookup/30 s budget (shared, with previously "pointing" names' upgrade looks serviced before any fresh-first name so new names cannot starve a published one) and stamped from it (edge address, A or AAAA, "pointing", other "elsewhere", authoritative not-found "", authoritative NODATA for A and AAAA with the zone's SOA "" with no cached query), falling back to the cached lookup past the budget or on the second fresh failure in a row; the first fresh failure in a row is held (stamp and check time untouched, the resolver forgives it so the next pass asks fresh again); a previously "pointing" name keeps cached-first plus the upgrade-only fresh look (ResolveUpgrade, nearest zones first), so the fresh path still never unpublishes; a fresh-first name that ends the pass "pointing" (fresh or cached) has its fresh failure backoff cleared through Config.FreshForget, so an onboarding failure never suppresses the upgrade look that keeps it published; new names are ordered never-checked first then oldest check, and lookups answered from the backoff do not count against the budget; StampHealth's own body is unchanged by the last round; no new file, path or command input; the dropped Alias/Host/Route/RouteAlias sites are the old indexed loops folded into the candidate build (#724);rev3=census-ruling-account-subdomains;basis=reads the box's own account_namespaces table (only when DNS stamping runs) and leaves out of the DNS loop the alias rows isNamespaceDerived names (an alias under a held name, of that name's account, pointing at its sqid twin); if that read fails it logs and leaves out every alias two or more labels under the apps domain, still stamping every other alias, every route and all TLS expiry (fix round 1); the added RouteAlias sites are that filter over rows already listed; stamps less, never more; TLS stamping unchanged;rev3=census-ruling-catchall-stamp-now;basis=#1516: now a one-line wrapper over stampHealth(ctx, reg, cfg, routes, nil); its body moved there unchanged, hence its dropped sites whole:Route@142 c589f2e7e31ac631a4dedbfe66e070b835a7ed010bd9d07d4df96d1f4f6912df |
| +internal/domains/aliases.go ReconcileAliasesReport legacy accepted-legacy accepted-legacy;rev3=J1;basis=root-route;rev3=census-ruling-edge-asset-cache-1;basis=the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos), in its alias pass (aliasPassReporting in runAgent; ReconcileAliases, now a wrapper, is its other caller): main's ReconcileAliases body, moved here with the same reads and writes, plus a completeness report (AliasReport) set false at every point that already logged a failure and carried on, and when relevantDropped names a listed claim the pass could not rule out; the box's asset authority clock advances only after a complete pass; one more whole:Route and whole:RouteAlias site each, the routes and alias rows the pass already read handed to relevantDropped; no registry, file or bucket read added; no root pass calls it; no root decision;rev3=census-ruling-regional-domains-447;basis=#447 Task 4: in the alias pass inside the agent: reads the existing regional_domains rows (reg.ListRegional) beside the alias rows, derives a regional claim's rows through deriveRegional for AliasReport.Region (the caller's ReconcileConfig.Region, set by aliasPassReporting) and its wildcard parent when bound, skipping the alias, paths and catch-all halves for it, writes them through writeRegional, and keeps an unread regional claim's wildcard parent while the kept apex row still binds a target RegionalTarget accepts on the routes this pass read (same account and app, per-box cap); claims are read as before (the listing and per-claim GETs it already does); the added reads are the registry's regional rows and fields of rows the pass already holds;rev3=census-ruling-fleet-public-routes;basis=fleet public routes (spec 2026-10-29 rev 4, §4.2 writer rule): Task 6 fix rounds 2-3: AliasReport.FleetRefused (edge.FleetArmVerdict's refused set) is called once on the pass's own listing; a Wildcard claim whose primary is fleet-refused derives no wildcard_domains row (an earlier one goes with the ordinary removal); the catch-all alias is derived as before (+registry:Host, +whole:Route). Rows already read; writes less, never more; no root pass calls it.;rev3=census-ruling-region-ha-g2-fixes;basis=Project accepted regional exact/catchall names and plain/delegated aliases into routing-only reports using existing claims and pre-pool metadata; new whole Route/RegionalDomain uses, no new external reader.;rev3=census-ruling-fix-incomplete-domains-pass;basis=adds AliasReport.StartupNoRemoval, an input set only by the agent startup HA ingress pass (host startupAliasPass via runHAIngressStartup): when set, the pass skips the route_aliases, wildcard_domains and route_paths removals (each skipped removal marks the pass incomplete) and the removal rules themselves are unchanged; derivations, refusals and writes are unchanged; same read sites (body change only); no new registry, file or bucket read; deletes less, never more, and only on the startup pass; no root pass calls it; no root decision;rev3=census-ruling-account-subdomains;basis=with AliasReport.AppsDomain set, reads the box's own account_namespaces table (reg.ListAccountNamespaces), sorts a listed-but-unread namespace claim (ParseNamespaceHost on the dropped host): a not-found body keeps nothing and is not counted by relevantDropped, any other failure keeps that name's recorded rows; runs deriveNamespaceAliases after deriveInstanceAliases on the routes, alias rows and claims it already read (AccountNamespaces over the read claims), keepNamespaceAliases for unread names, and writes the table through writeAccountNamespaces (once, only when it differs; no shrink under StartupNoRemoval); the added sites are the routes and alias rows already read handed to those helpers; no file or bucket read added; fix round 1: keepNamespaceAliases runs before deriveNamespaceAliases, and repairNamespaceStatus stamps "pointing" on derived-shape rows of exact claims and kept names, over claims and rows already read;rev3=census-ruling-path-routes-across-boxes;basis=#186: path derivation moved to derivePaths and the route_paths write to writePaths (pathwrite.go); its own route_paths reads moved with them; unread claims now keep their path rows like regional rows; no read added here;rev3=census-ruling-catchall-stamp-now;basis=#1516: the agent's alias pass (user carlos, no root pass calls it) resets AliasReport.Unstamped and hands deriveInstanceAliases the report's nil-safe noteUnstamped method, which appends each name to it; Unstamped is an output only; same reads and writes, body change only registry:Account@15007,registry:Account@15022,registry:Account@15140,registry:Account@15492,registry:Account@15505,registry:Alias@13001,registry:Alias@13134,registry:Alias@13204,registry:App@15035,registry:App@15046,registry:App@15153,registry:App@15518,registry:App@15527,registry:App@5204,registry:App@5400,registry:App@8746,registry:App@8946,registry:App@9102,registry:App@9303,registry:Host@14817,registry:Host@14892,registry:Host@14915,registry:Host@14967,registry:Host@15301,registry:Host@15373,registry:Host@15477,registry:Host@15788,registry:Host@15934,registry:Host@16006,registry:Host@856,registry:Host@9669,registry:Region@15162,registry:Target@14987,registry:Target@15092,whole:RegionalDomain@13781,whole:RegionalDomain@13799,whole:RegionalDomain@14745,whole:RegionalDomain@14783,whole:RegionalDomain@14804,whole:RegionalDomain@14827,whole:RegionalDomain@14954,whole:RegionalDomain@276,whole:RegionalDomain@3655,whole:RegionalDomain@3856,whole:Route@10551,whole:Route@1067,whole:Route@11676,whole:Route@11684,whole:Route@12534,whole:Route@12624,whole:Route@12632,whole:Route@15085,whole:Route@15136,whole:Route@2273,whole:Route@337,whole:Route@3837,whole:Route@4256,whole:Route@4547,whole:Route@5244,whole:Route@5395,whole:Route@5451,whole:Route@7493,whole:Route@809,whole:Route@838,whole:Route@849,whole:Route@867,whole:Route@8715,whole:Route@8790,whole:Route@8937,whole:Route@8999,whole:Route@9142,whole:Route@9298,whole:RouteAlias@11692,whole:RouteAlias@12516,whole:RouteAlias@12640,whole:RouteAlias@12795,whole:RouteAlias@12976,whole:RouteAlias@2281,whole:WildcardDomain@14851,whole:WildcardDomain@14880,whole:WildcardDomain@15361,whole:WildcardDomain@15383,whole:WildcardDomain@15407,whole:WildcardDomain@15456,whole:WildcardDomain@15619,whole:WildcardDomain@15747,whole:WildcardDomain@15776,whole:WildcardDomain@4070,whole:WildcardDomain@9865 857931e794c6043d988e98264f12a75ac22261e71defb17147f9a0af86905d32 |
| +internal/host/agent.go aliasPassReportingComplete legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-g2-fixes;basis=Extract the existing serialized alias pass, add cancellable locking and routing-only alias/regional publication from its completeness report; existing deployment/claim/registry reads retained, new in-memory Route/RegionalDomain passes.;rev3=census-ruling-fix-incomplete-domains-pass;basis=gains a startup bool parameter that it copies into domains.AliasReport.StartupNoRemoval; runHAIngressStartup passes true, aliasPassReporting (the ordinary agent pass) passes false; same reads and calls, body change only; no root pass calls it; no root decision;rev3=census-ruling-account-subdomains;basis=sets AliasReport.AppsDomain from PLATFORM_APPS_DOMAIN (trimmed), the variable domainsTickConfig reads; same reads and calls otherwise; body change only;rev3=census-ruling-sr-followups;basis=#966, the agent pass (user carlos, no root pass calls it): on a door box (doorFleet: no CARLOS_DEPLOYMENT_BUCKET or CARLOS_DEPLOYMENT_DIR and a fleet identity from the process environment, CARLOS_FLEET and its box label, as openDeployStoreEnv decides) it skips edgesfile.DeploymentRoutesComplete, the status/boxes/ list the store door refuses, and reports the route set incomplete (DeploymentRoutesPartial false, routesWhole false) as the refused list did. One store list fewer on door boxes, none added, every other box unchanged, no file, bucket or root call added;rev3=census-ruling-catchall-stamp-now;basis=#1516: hands rep.Unstamped and whether the pass was complete to watchUnstamped, an in-memory watch list that may wake the domains loop through a buffered channel; same reads and calls, body change only whole:RegionalDomain@2271,whole:Route@1379,whole:Route@1401,whole:Route@1420,whole:Route@2349 92645a7c4fb12251a01cd37ba0879c6979bdc93db67de9831eb2b3fe98e60ddf |
| +internal/domains/reconcile.go StampHealthHosts legacy accepted-legacy accepted-legacy;rev3=census-ruling-catchall-stamp-now;basis=#1516: new. Called only by the agent's domains loop (user carlos), never by root: lists the box's own alias rows before and after, runs stampHealth over the named aliases only with no routes and FreshRetain unset, and compares DNSStatus, DNSCheckedAt and CertExpiresAt to report settled names and whether any changed; a failed re-read reports changed (census round 1 P2); no file, bucket or command input added beyond stampHealth's own registry:Alias@621,registry:Alias@651,registry:CertExpiresAt@1482,registry:CertExpiresAt@1501,registry:CertExpiresAt@1628,registry:DNSCheckedAt@1524,registry:DNSCheckedAt@1549,registry:DNSStatus@1452,registry:DNSStatus@1467,registry:DNSStatus@1599,whole:RouteAlias@1214,whole:RouteAlias@1299,whole:RouteAlias@595,whole:RouteAlias@637,whole:RouteAlias@663,whole:RouteAlias@683 0fec173690c96a0c696ce3161ccadb0eef99c8f849880f8e027114f4465f01cb |
| +internal/domains/reconcile.go stampHealth legacy accepted-legacy accepted-legacy;rev3=census-ruling-catchall-stamp-now;basis=#1516: StampHealth's body moved here unchanged, plus an optional only-set that keeps the listed alias rows whose name it holds; same registry reads, stamps, resolver calls and acme-dir certificate reads as StampHealth; the agent's domains loop (user carlos) is its only caller; no root pass calls it registry:Alias@1006,registry:Alias@2161,registry:Alias@4639,registry:Alias@5228,registry:Alias@5318,registry:Alias@5752,registry:Alias@5816,registry:Alias@5904,registry:DNSCheckedAt@4514,registry:DNSCheckedAt@4661,registry:DNSStatus@4500,registry:DNSStatus@4648,registry:DNSStatus@4853,registry:DNSStatus@5152,registry:Host@4491,registry:Host@4925,registry:Host@5009,registry:Host@5521,registry:Host@5580,registry:Host@5662,whole:Route@221,whole:Route@258,whole:Route@4315,whole:Route@4431,whole:Route@4760,whole:Route@5475,whole:RouteAlias@1023,whole:RouteAlias@1037,whole:RouteAlias@1043,whole:RouteAlias@1060,whole:RouteAlias@1070,whole:RouteAlias@1869,whole:RouteAlias@2095,whole:RouteAlias@2247,whole:RouteAlias@2295,whole:RouteAlias@2315,whole:RouteAlias@2327,whole:RouteAlias@4361,whole:RouteAlias@4575,whole:RouteAlias@5055,whole:RouteAlias@5705,whole:RouteAlias@802,whole:RouteAlias@942,whole:RouteAlias@975 1be38ed3a6254e4227a33843acf162fbd43b626feb1b636052ee6e2a8d78684e |
| +internal/domains/aliases.go deriveInstanceAliases legacy accepted-legacy accepted-legacy;rev3=census-ruling-self-serve-moves-1;basis=root-route; the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos): rev3=J1's body; a stale body under a retired lifetime no longer makes a label shared, and a label with a record that cannot be judged keeps its existing alias row of the catch-all's own account and app (reading that row's Account and App) only once the derived name has passed every precedence check a derived name answers to (validity, an exact claim, a local real route, a deployment route, the per-box cap), and derives no new one; a report-only conservative keep, never a new route;rev3=census-ruling-regional-domains-447;basis=#447 Task 2: an instance catch-all whose parent claim is regional is inert (logged once, continue), as one whose parent is not held is; it only narrows what derives; no read added;rev3=census-ruling-account-subdomains;basis=takes a *int budget shared with the namespace pass instead of a local counter; the same checks and cap (maxInstanceAliases, now a var so a test can lower it); names kept on a failed instance listing now take the budget too, each once (fix round 1, Astra I-2), so the cap holds on that branch; same reads; body change only; derives and keeps less, never more;rev3=census-ruling-catchall-stamp-now;basis=#1516: reports through the new callback each derived name it wrote, or found already written with dns_checked_at 0 (the added registry:DNSCheckedAt site is a.DNSCheckedAt on the alias row it already read); derives, writes and caps exactly as before; no file, bucket or root read added registry:Account@2694,registry:Account@4286,registry:Account@5085,registry:Alias@2756,registry:Alias@2824,registry:Alias@2863,registry:Alias@3142,registry:Alias@603,registry:App@2016,registry:App@2720,registry:App@4312,registry:App@5111,registry:DNSCheckedAt@5135,registry:Host@2173,registry:Host@5064,registry:Host@5074,registry:Host@5394,registry:Provisioned@1966,registry:Replica@2002,registry:Slug@2105,whole:Route@1950,whole:Route@2056,whole:Route@3828,whole:RouteAlias@2674,whole:RouteAlias@4268,whole:RouteAlias@5046,whole:RouteAlias@555,whole:RouteAlias@585,whole:RouteAlias@598,whole:RouteAlias@614 16186a15572f852d45b3302b98593dee1cef90b2ea8db6026966d1b653d5f592 |
| +internal/domains/reconcile.go StampHealth legacy accepted-legacy accepted-legacy;rev3=J1;basis=root-route;rev3=census-ruling-dns-fresh-lookup-724;basis=section 4 now computes every cached verdict first, then freshUpgrade gives up to 64 randomly ordered names that could have a public zone (not under the apps domain, not special-use like .internal) and whose verdict is "" or "elsewhere" an uncached lookup (30 s pass budget) that may only upgrade to "pointing", then stamps; the extra sites are the indexed loops over the same rows (#724);rev3=census-ruling-no-negative-prime-724;basis=section 4 now hands each route and alias, with its previous stamp (the two new registry:DNSStatus reads, rt.DNSStatus and a.DNSStatus, same rows already listed), to dnsVerdicts, which first hands the pass's hostnames to Config.FreshRetain (the resolver forgets its in-memory backoff and strike for names no longer carried) and then decides each hostname once per pass and applies the verdict to every row carrying it: a name not "pointing" before this pass and eligible for a fresh lookup (public name, not under the apps domain, ResolveFresh set) is looked at uncached first within the same 64-lookup/30 s budget (shared, with previously "pointing" names' upgrade looks serviced before any fresh-first name so new names cannot starve a published one) and stamped from it (edge address, A or AAAA, "pointing", other "elsewhere", authoritative not-found "", authoritative NODATA for A and AAAA with the zone's SOA "" with no cached query), falling back to the cached lookup past the budget or on the second fresh failure in a row; the first fresh failure in a row is held (stamp and check time untouched, the resolver forgives it so the next pass asks fresh again); a previously "pointing" name keeps cached-first plus the upgrade-only fresh look (ResolveUpgrade, nearest zones first), so the fresh path still never unpublishes; a fresh-first name that ends the pass "pointing" (fresh or cached) has its fresh failure backoff cleared through Config.FreshForget, so an onboarding failure never suppresses the upgrade look that keeps it published; new names are ordered never-checked first then oldest check, and lookups answered from the backoff do not count against the budget; StampHealth's own body is unchanged by the last round; no new file, path or command input; the dropped Alias/Host/Route/RouteAlias sites are the old indexed loops folded into the candidate build (#724);rev3=census-ruling-account-subdomains;basis=reads the box's own account_namespaces table (only when DNS stamping runs) and leaves out of the DNS loop the alias rows isNamespaceDerived names (an alias under a held name, of that name's account, pointing at its sqid twin); if that read fails it logs and leaves out every alias two or more labels under the apps domain, still stamping every other alias, every route and all TLS expiry (fix round 1); the added RouteAlias sites are that filter over rows already listed; stamps less, never more; TLS stamping unchanged;rev3=census-ruling-catchall-stamp-now;basis=#1516: now a one-line wrapper over stampHealth(ctx, reg, cfg, routes, nil); its body moved there unchanged, hence its dropped sites whole:Route@142 c589f2e7e31ac631a4dedbfe66e070b835a7ed010bd9d07d4df96d1f4f6912df |
| +@coverage internal/domains 15c2c51705378862e5a8005c128ebe9554a19ca9b29788a0de6c016d3bca04dd |
| +@coverage internal/host 8ae295467b61170d602585245065624bb28e483c65d0304678ead1aa9c4889c7 |
diff --git a/internal/provision/testdata/plan14-root-reads-chain.tsv b/internal/provision/testdata/plan14-root-reads-chain.tsv| index 33604cf78..4b56ce3b3 100644 |
| --- a/internal/provision/testdata/plan14-root-reads-chain.tsv |
| +++ b/internal/provision/testdata/plan14-root-reads-chain.tsv |
| @@ -312,4 +312,4 @@ plan14-root-reads-moved-at-floor-v0-44-1.tsv ed1957bc7d18714e39984e757b73b8c590f |
| plan14-root-reads-gvisor-slice2-explicit-mode.tsv ed1957bc7d18714e39984e757b73b8c590f1a2a924ca35e20e9041fc09f2ca78 |
| plan14-root-reads-public-share.tsv ed1957bc7d18714e39984e757b73b8c590f1a2a924ca35e20e9041fc09f2ca78 |
| plan14-root-reads-gvisor-slice3-containment.tsv 0fdff597ef83fb9966e07c70b4283001eb97f7dfa71a83a19bde92382192eb6b |
| -plan14-root-reads-demo-disk-slice1-retention.tsv 2372a1fa9c40b4743fdccbffb946d3a90f4d2ca4bb9d9c5cbe536ae601aae313 |
| +plan14-root-reads-catchall-stamp-now.tsv c9940b1b6fb0146a30a2fb2b557f898ac6d28ba80df7dfe642cc623b581f347b |
diff --git a/internal/provision/testdata/plan14-root-reads-demo-disk-slice1-retention.tsv b/internal/provision/testdata/plan14-root-reads-demo-disk-slice1-retention.tsv| deleted file mode 100644 |
| index 569623864..000000000 |
| --- a/internal/provision/testdata/plan14-root-reads-demo-disk-slice1-retention.tsv |
| +++ /dev/null |
| @@ -1,42 +0,0 @@ |
| -# Census overlay demo-disk-slice1-retention, written by census-propose (#369). census-ruling-demo-disk-slice1-retention, approved on #280 before the merge; the approval card is docs/superpowers/notes/census-proposal-demo-disk-slice1-retention.md. |
| -# 5 body, 0 sites, 4 envelope: each changed unit re-frozen at its existing disposition with its claim appended. |
| -# 14 new dispositions: 0 reads re-frozen at their disposition with the claim, 14 new units frozen accepted-legacy, 0 quiet units retired while they read nothing, 0 other. |
| -@legacy c7b088568fd27e4c9c9f090b19d9362dca7b0e447695d329364cecf71b1e7971 internal/host/agent.go statusLoop legacy accepted-legacy accepted-legacy;rev3=census-ruling-self-serve-moves-1;basis=the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos): the status tick's context carries the box's lifetime judge; read sites unchanged, offsets moved;rev3=census-ruling-rootfs-apps-2;basis=main's body as of the merge of origin/main 953b9fda (its later changes, regional box names and self-serve moves plan 1 among them, under main's own census rulings), where the tick fills rootfs_ready and rootfs_blocked from armedRootfs.Load().probe, which each tick runs NestedOK's checks and asks the control socket's GET /ready/rootfs (never the store); the same four direct sites;rev3=census-ruling-instance-egress-sizes-328-329;basis=#328 plan 2 Task 11 and #329 plan 3 Task 7: takes root's GET /egress reader and fills p.Egress = egressStatusProbe(egressStatus, routes, provision.PolicyReadStates()) and p.SizeCommittedMiB = sizeCommittedMiB(armedSizeSource.Load(), routes); the two added whole:Route sites are the tick's own registry list handed to those two units (decision rows), which read root's control socket and the activator's memory; no store request added; the four existing sites unchanged, offsets moved.;rev3=census-ruling-fleet-alerts-1;basis=the agent (carlos-edge.service, user carlos): the status tick passes os.Geteuid() to alertDeliveryProbe, which fills AlertDelivery.EngineBeat/EngineBeatWhy from engineBeatArmed (the env value and the euid only, no file access, root refused before the path is looked at), and fills Probes.DiskFullETAHours from diskETAProbe(&processDiskTrend, now), a Theil-Sen fit over the metrics loop's in-memory ring of disk readings; the same six sites, no read added, no store request added;rev3=census-ruling-edge-held-streams;basis=the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos): the status tick's Probes gain HeldStreams: heldStreamsState(), which calls the edge's in-memory counters function (nil until the edge is ready). No file, bucket or registry access added.;rev3=census-ruling-stateless-replicas-3;basis=Fix round 1 Q20: read the detached in-memory replica snapshot source into Probes.ReplicaCopies on the existing five-minute tick. Existing six direct read sites unchanged. No additional bucket request, changed cadence or app lifecycle action.;rev3=census-ruling-agent-start-demo-3;basis=Report moved capability only when the serving edge reports readiness; report claim-seed support only with CARLOS_DEMO_CLAIM=1. Reads the explicit capability flag from the process environment; no new filesystem or registry read.;rev3=census-ruling-stateless-replicas-4-task5;basis=Task 5 fix round 1 (#511 R16 amendment): the status tick also fills Probes.ApplyFinished from systemApplyFinished(release.OptDir()), an Lstat of root's apply journal <opt>/system/router/journal.json in the root-owned, world-readable state directory: finished only when the journal is absent, any other answer unknown and so unfinished. Round 0: Probes.PrevRelease from prevReleaseOf (carlos.prev and carlos.prev.version, the files withMovesFields already reads). Reported in the private BoxMetrics block; no bucket request or cadence change.;rev3=census-ruling-offline-move-stage-refusals-339;basis=#339: the agent (carlos-edge.service, user carlos): the status tick fills p.OfflineMove = offlineMoveFactsProbe(routes); the added whole:Route site is the tick's own registry list handed to that unit, which under a non-root euid lists the names of root's <opt>/live and nothing else; no store request added.;rev3=census-ruling-platform-mail-submission;basis=Task 3 (plan gap G6 (b)): the status tick also fills Probes.MailerArmed from mailerArmed(mailwire.MailerSocket, 2s): a stat of /run/carlos-mailer/mailer.sock and, only when it is a socket, GET /v1/health on it. The agent (carlos-edge.service, user carlos), not root; reported in the private BoxMetrics block only. The same seven sites; no store request, no read of /etc/carlos-mailer (which uid carlos cannot traverse).;rev3=census-ruling-named-units-param-114;basis=named-units-param-114 Task 6: the agent (carlos-edge.service, user carlos) fills Probes.NamedUnits from readNamedUnitsStatus: rootstate.Open(/var/lib/carlos-named-units, false, true) status.json, 64 KiB cap, any error nil; report only, nothing reads it as authority; no store request added; the same sites;rev3=census-ruling-console-addr-from-install;basis=sets Probes.ConsoleFleet from consoleFleetProbe (root public store read, edge in-memory state); no read added in this unit;rev3=census-ruling-demo-disk-slice1-retention;basis=the agent (carlos-edge.service, user carlos): the status tick also fills Probes.DemoDisk from readDemoDisk(), nil unless CARLOS_DEMO_BOX is set; statfs of /data and /run, and root's public retention record (readDemoBuilds); report only; no store request added; read sites unchanged whole:Route@10707,whole:Route@12781,whole:Route@13062,whole:Route@13420,whole:Route@6583,whole:Route@6610,whole:Route@7918 1b271f453a4718ca5fb64f513ec22acdd2550bc8cb4cfb021ea9c8ec7300df64 |
| -@legacy 0fd651fe1d76c34ae70bec021d3f5e3d6e7ebadac8f1a96350f9e11eb77d8b64 internal/status/snapshot.go CollectBox legacy accepted-legacy accepted-legacy;rev3=J1;basis=root-route;rev3=census-ruling-rootfs-apps-2;basis=copies Probes.RootfsReady and RootfsBlocked into BoxMetrics (private, like Layout); the same 28 sites, no read added;rev3=census-ruling-instance-egress-sizes-328-329;basis=#328 plan 2 Task 11 and #329 plan 3 Task 7: copies Probes.Egress and Probes.SizeCommittedMiB into BoxMetrics (private, like Layout) and counts them in the condition that builds Metrics; the same 28 sites, no read added.;rev3=census-ruling-rootfs-apps-3;basis=rootfs Plan 3: comment only, the Hibernate count is left as is (display);rev3=census-ruling-regional-domains-447;basis=#447 Task 7: copies Probes.AliasesRead into BoxMetrics.AliasesRead (json aliases_read, omitempty) and counts it in the condition that builds Metrics; the same 28 sites, no read added;rev3=census-ruling-fleet-alerts-1;basis=copies Probes.DiskFullETAHours into BoxMetrics.DiskFullETAHours (json disk_full_eta_hours, omitempty; private, like Layout) and counts it in the condition that builds Metrics; the same 28 sites, no read added;rev3=census-ruling-edge-held-streams;basis=copies Probes.HeldStreams into BoxMetrics.HeldStreams (json held_streams, omitempty, additive) and counts it in the condition that builds Metrics; the same 28 sites, no read added.;rev3=census-ruling-stateless-replicas-3;basis=Fix round 1 Q20: carry already-supplied ReplicaCopies into a separate optional private BoxMetrics replica_copies field; allow copy evidence alone to create the metrics block. Upstreams retains address probes only. Existing 28 Route read sites unchanged; no filesystem, bucket, console or CLI read.;rev3=census-ruling-agent-start-demo-3;basis=Report claim-seed protocol capability only when explicitly configured and runtime moved readiness only when armed; dormant status keeps its original JSON shape. Census read-site delta: unchanged (28).;rev3=census-ruling-stateless-replicas-4-task5;basis=Task 5 (#511 R16 and its amendment): copies Probes.PrevRelease and Probes.ApplyFinished into BoxMetrics (json prev_release and apply_finished, omitempty; private, like Release) and counts them in the condition that builds Metrics; the same 28 sites, no read added.;rev3=census-ruling-offline-move-stage-refusals-339;basis=#339: copies Probes.OfflineMove into BoxMetrics.OfflineMove (json offline_move, omitempty; private, like Layout) and counts it in the condition that builds Metrics; the same 28 sites, no read added.;rev3=census-ruling-platform-mail-submission;basis=Task 3: copies Probes.MailerArmed into BoxMetrics.MailerArmed (json mailer_armed, omitempty; private, like Layout) and counts it in the condition that builds Metrics; the same 28 sites, no read added.;rev3=census-ruling-named-units-param-114;basis=named-units-param-114 Task 6: copies Probes.NamedUnits into BoxMetrics.NamedUnits (json named_units, omitempty; private) and counts it in the condition that builds Metrics; the same 28 sites, no read added;rev3=census-ruling-fleet-seeded-create-2;basis=Copies Probes.SeedsFloor into BoxMetrics.SeedsFloor and counts it in the metrics gate; a pure copy of a value the agent filled, the same 28 read sites, no read added.;rev3=census-ruling-console-addr-from-install;basis=copies Probes.ConsoleFleet into BoxMetrics (private); no read added;rev3=census-ruling-demo-disk-slice1-retention;basis=copies Probes.DemoDisk into BoxMetrics.DemoDisk (json demo_disk, omitempty; private, like Layout) and counts it in the condition that builds Metrics; the same 28 sites, no read added registry:Alias@4543,registry:CertExpiresAt@3160,registry:CertExpiresAt@3396,registry:CertExpiresAt@4658,registry:DBPath@2495,registry:DBPath@2553,registry:DNSCheckedAt@3365,registry:DNSCheckedAt@4627,registry:DNSStatus@3139,registry:DNSStatus@3334,registry:DNSStatus@4597,registry:Hibernate@3853,registry:Host@2295,registry:Host@2437,registry:Host@2666,registry:Host@3280,registry:Host@3315,registry:Host@4578,registry:Kind@2473,registry:Kind@3807,registry:Platform@2152,registry:ServingVersion@2324,registry:ServingVersion@2447,registry:Socket@4066,registry:Version@2186,registry:Version@2305,whole:Route@1581,whole:RouteAlias@4440 f001b427c01c4ee280a8d848eaaf60de952ecdfb3f2c6108f7c105f89a51efbf |
| -@legacy bb12acb7b402f19403f40d0b9ec14cd97989bb5d93e9a07d111eb6bc3648c582 cli.go printDemoDisk legacy accepted-legacy accepted-legacy;rev3=census-ruling-demo-disk-slice1-retention;basis=operator CLI (carlos status --live), not root: prints a published box snapshot's demo_disk numbers; reads only the decoded snapshot in hand data-literal@195 ed2577c68d95ca5a6ebba28e905a65115ff335bc36aecca1e2c415ed98fb6fff |
| -@legacy 247e50229523fd4ee12c49fd765420996ceb6a5bc27924b5f0e0c496faf16b5b internal/host/demodisk_status.go productionDemoDiskProbe legacy accepted-legacy accepted-legacy;rev3=census-ruling-demo-disk-slice1-retention;basis=the agent (user carlos), not root: opens root's public record directory /var/lib/carlos-release/demo-retention read-only through rootstate.Open(dir, false, true) (every ancestor root-owned, not group or world writable); report only file:Open@208 f8df171d9a2ff2d96b73c63f4618d035230acc4b8f244dd7f377184686e4933f |
| -@legacy f6953a7fa7a4f22ae5896f799b9a9bebcbcbecef7b0a39752a60dc8bfff5dd1a internal/host/demodisk_status.go readDemoBuilds legacy accepted-legacy accepted-legacy;rev3=census-ruling-demo-disk-slice1-retention;basis=the agent (user carlos): reads the record 'status' from that rootstate store (descriptor read, trusted owner, 1 MiB cap) and decodes it; schema 1 or an error; report only, nothing reads it as authority file:Read@174 213c08b6d79b17ca25b94b815815bd0c7dfbeaa8664aafbfc8419fab2b2679ca |
| -@legacy 96e466a8a94616a2985e33b8e4355d30cee8510b3254964cd7a1b876c8490258 internal/host/demoretention.go demoRetention.demoAdoptions legacy accepted-legacy accepted-legacy;rev3=census-ruling-demo-disk-slice1-retention;basis=root adopt pass (uid 0): lists the registry and keeps each demo route's Host and Version, to tell after the pass whether it adopted a demo version; decides only whether retention runs registry:Host@287,registry:Version@298,whole:Route@237,whole:Route@270 d1ca3b3d0e084d93b09023e7a0bcb6dfa496b80976362f4f5f0a0ce03c215ff8 |
| -@legacy fbc3df3be40ed617dd6917842743d12c37687c3105583582c05823bda53862b8 internal/host/demoretention.go demoRetention.demoApp legacy accepted-legacy accepted-legacy;rev3=census-ruling-demo-disk-slice1-retention;basis=root adopt pass: a route is a demo app on this demo box only when it is marked demo (IsDemo), its app is tmp-demo-*, and its account is the box's CARLOS_DEMO_ACCOUNT from host.env (demo.BoxConfig); retention never selects any other app registry:App@112,registry:App@147,registry:App@324,whole:Route@235 4af8f894c32e176fc4886d743ea6271236c3ba4e687f2b085cb9f20222550555 |
| -@legacy 6bb576d9a4caa82eb6ce3fad9fd81551536c5a0c2eac1eed0832ae183c3d04b2 internal/host/demoretention.go demoRetention.demoAppListed legacy accepted-legacy accepted-legacy;rev3=census-ruling-demo-disk-slice1-retention;basis=root adopt pass: the pending-output cleanup acts on a path only when a demo route of this box runs that account/app; a registry that does not list counts as listed so the cleanup's own read refuses the stage whole:Route@271,whole:Route@306 92b1b3bde40e55e2dd696e52516b5e375e76f663bae01cb5953eb6f3eb64efce |
| -@legacy 39fee80616ed078b3aac3b19ec28d59ccf2580ae1c6701ccf46505ad7b8f6810 internal/host/demoretention.go demoRetention.pinSet legacy accepted-legacy accepted-legacy;rev3=census-ruling-demo-disk-slice1-retention;basis=root adopt pass: the pin set from every source: release.BoxPins over every registry row (live link chains; Version, PrevVersion, GoodVersion, settings references), previous links, release.GenerationPins over the generations file, and root's generation ledger (productionRootGenerationPins). Strict: any source that does not read in full is an error and nothing is deleted. Agent-writable inputs (the registry, the generations file under /data) can only ADD pins, never remove one; the estimate mode (no deletion) only counts registry:App@819,registry:App@943,registry:GoodVersion@784,registry:PrevVersion@768,registry:Version@756,whole:Route@1179,whole:Route@423,whole:Route@671,whole:Route@715,whole:Route@935 6d38329b474d0f4dddbcca7d61dc8cf25becc75f7b3d1b93a222479cf239eecb |
| -@legacy 5b539f056a2aee18af105158c54ab5559b1709831ced2a1598c0352ed9366bca internal/host/demoretention.go demoRetention.saveStatus legacy accepted-legacy accepted-legacy;rev3=census-ruling-demo-disk-slice1-retention;basis=root adopt pass: reads its own previous record from the public root store /var/lib/carlos-release/demo-retention (rootstate, created root-owned 0755, file 0644) to carry the backlog's start, and writes the new record there; status only, never read back as a pin or a decision file:Read@289 5bb8a4f44a6b268632d4351409ea113646844e7224b08d3862b656172a8e28d3 |
| -@legacy 46d3d1fb2037654ffe6f0a289eeba614b876b13a94d7601a8b7dee6ac6e04b97 internal/host/demoretention.go demoRetention.selection legacy accepted-legacy accepted-legacy;rev3=census-ruling-demo-disk-slice1-retention;basis=root adopt pass: lists <opt>/versions (root-owned version store) and Lstats <ver>/<account>/<app> and its .manifest.json for each demo app; ENOTDIR (an ops app's file named like the account) is not present; decides which demo outputs nothing pins. Deletion is only by removeOutput through instancefs.RemoveAllBeneath (openat2 beneath, no symlinks), per app, never a version directory, and only with the adopt pass lock held file:Lstat@1302,file:ReadDir@659,registry:Version@495,whole:Route@386,whole:Route@419,whole:Route@587 ed401bfe4a1ddfeed3a492df8dedfa5b1391f229bfd93efda3e011aa5d8f29db |
| -@legacy 689041137a1496d034d2b218340c44c16ce7f422dbd7fa481184b56f4e26ff3c internal/host/demoretention.go pinned legacy accepted-legacy accepted-legacy;rev3=census-ruling-demo-disk-slice1-retention;basis=root adopt pass: an output is pinned when a pin names it, its manifest or a path inside it, under the store's spelling or the real path of its directory (EvalSymlinks of the root-owned version directory) file:EvalSymlinks@151 86cb92546860e0251e2e9f0c46feab68ab83d7069f2285d3f260789c6f07ca6b |
| -@legacy 06875fb1e5da69d6e5231a27c7612738d8d80d2a06d0163ca719a7fd97bb1466 internal/host/demoretention.go previousLinkPins legacy accepted-legacy accepted-legacy;rev3=census-ruling-demo-disk-slice1-retention;basis=root adopt pass: every <opt>/previous link (root-owned) is a pin at its target and its real path, as release.LivePins reads them for the sweep; an unreadable link is an error and nothing is deleted file:EvalSymlinks@559,file:ReadDir@127,file:Readlink@373 6f66df0648b22a40d3d351fd46cd8d67c2629b02ab8399aa9660355483bc2afe |
| -@legacy 6c35a72bc0403008043937a272bef66a03891902119ce9d1ef1ce3606933dd4c internal/host/demoretention.go productionDemoRetention legacy accepted-legacy accepted-legacy;rev3=census-ruling-demo-disk-slice1-retention;basis=root adopt pass: demo.BoxConfig from host.env (root-owned), the version store and generations file paths, root's generation ledger, and the record store opener rootstate.Open(/var/lib/carlos-release/demo-retention, true, true) file:Open@515 3717758213e219b3daee5301239dae3e5b1a433af47546e950a074ad334a91db |
| -@legacy 3b974d675442a49c90a22cacd91c82f61317b0a74a137f931aacca7abb9a38cb internal/host/statfs_unix.go filesystemRoom legacy accepted-legacy accepted-legacy;rev3=census-ruling-demo-disk-slice1-retention;basis=the agent (user carlos): statfs of /data and /run for status and the disk alert; numbers only file:Statfs@102 bc0b7000ddb11715edd58a955d7950a1c19bfacb315b47d9575f7ac0a0a4a732 |
| -@legacy 36814a480e2c91b2833082a70a5a01292608196aa1c5850793697ae572e3ae00 internal/release/adopt.go passConfig.stageWriteCheck legacy accepted-legacy accepted-legacy;rev3=census-ruling-demo-disk-slice1-retention;basis=root adopt pass and agent passes: generationWriteCheck unchanged first; then, only when WithBeforeStage is set (root's adopt pass only), Lstat of the VersionPath about to be written and the callback when nothing is there; an error fails the stage (nothing written, route unchanged) file:Lstat@233 92aa097f88dc4c665a3564a8cd981537d2394857967be73230a0ef39648c48fd |
| -internal/host/agent.go runAdoptUnderRootRelease authority B3,E1,E2,E3 rev3=census-ruling-self-serve-moves-1;basis=root claim/adopt/update controller uid 0: builds root's lifetime judge once from the host-claim switch and hands it to both productionRestartRequestPass calls; read sites unchanged, offsets moved; the preceding B3,E1,E2,E3 classification retained;rev3=census-ruling-claims-cleanup-r1;basis=claims cleanup R1: the claims shutdown timeout is the host constant claimsShutdownLimit (120s) instead of hostbox.RequestLimit (120s); no read added or changed;rev3=census-ruling-named-unit-delivery-114;basis=config sync is appconfig.SyncUnits with productionUnitOps (drop-in root /etc/systemd/system, base dir /etc/carlos/units, the declaration file /etc/carlos/named-units.json, systemctl probe/reload/restart, the config flock); no proof binding and no bucket read for delivery (Paul's ruling on #114: a root-owned declaration decides); the comment at the restart callback rewritten; read sites unchanged;rev3=census-ruling-sr-followups;basis=#966 census fix: the SyncUnits ack callback is configAckRootFunc(ctx, store) instead of configAckFunc(ctx, store, "adopt"). configAckRootFunc (new, agent.go): on a box with a bucket or dir (doorFleet empty: no fleet identity, or CARLOS_DEPLOYMENT_BUCKET or CARLOS_DEPLOYMENT_DIR set in the process environment) it returns configAckFunc(ctx, store, "adopt"), the same callback as before #966 (platform-root key, read-then-CAS). On a door box it writes each ack through appconfig.ReplaceConfigAckBlind (new, configack.go) under NewPrefixStore(store, "fleets/<fleet>/"): s.Delete(key) then a create-only s.Put(key, body, ""), returning only errors, which are logged. THE ROOT PASS NO LONGER READS THE FLEET CORNER: it sends exactly DELETE and PUT for fleets/<F>/control/config-ack/<label>/<host>.json and no GET, Open or HEAD of any fleet key; it inspects no body, ETag or listing. Reads only the process environment (doorFleet, BoxLabel), as configAckFunc did. Read sites unchanged;rev3=census-ruling-named-units-param-114;basis=named-units-param-114 Task 4/5: after the restart-only return, calls runNamedUnitsStep, which runs adoptNamedUnitsStep (root reads its own IMDSv2 identity; ssm:GetParameter of /carlos/host/named-units/<instance-id> in that region, operator-written, box role read-only; trusted rootstate reads of /etc/carlos/named-units.json, the console guard marker, root's rollback journal and root history; installs under the config-sync flock), logs, and writes writeNamedUnitsStatus (public root store /var/lib/carlos-named-units), all before ParsePublicKey; config sync moved into adoptConfigSync with a second status write; no input a tenant, app or box agent can write selects the parameter or authorises the install; read sites unchanged;rev3=census-ruling-console-addr-from-install;basis=calls adoptConsoleFleetStep after the named-units step, never fatal (spec §4); no read added here;rev3=census-ruling-managed-fleets-2b2;basis=builds managedRootGate("/") (root's RootAdmission: identity + root 0700 admission files, re-verified) and wraps the round-1 start/selected-restart/rollback callbacks, SyncUnits' UnitOps.Restart and named-unit recovery with it; BYO answers admitted, so nothing changes there; merge of origin/main 65951fbb: main's configAckRootFunc ack, the named-units step (runNamedUnitsStep) with adoptConfigSync, and adoptConsoleFleetStep, not this branch; resolution: adoptConfigSync is handed managedGatedUnitOps(managedGate, productionUnitOps(...)), so SyncUnits' UnitOps.Restart keeps root's gate;rev3=census-ruling-demo-disk-slice1-retention;basis=demo disk bound slice 1: release.Pass now runs inside demoRetention.around (productionDemoRetention(reg, generationPins, passLockErr == nil)), still inside pr.around and under the adopt pass lock taken at the top; around adds release.WithBeforeStage(beforeStage) to the pass options and, after the pass, runs demo build retention when a demo route's Version moved or on the hourly (not -stage-only) pass. Never on -config-only or -restart-only, which return before this. No read added in this unit; read sites unchanged whole:Route@12586,whole:Route@20459,whole:Route@20495,whole:Route@8743 a1f5f583ca88bb172e7c957cfeada75c04c045a52e9d33a671316a4e42b52b7a |
| -internal/host/agent.go statusLoop legacy accepted-legacy accepted-legacy;rev3=census-ruling-self-serve-moves-1;basis=the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos): the status tick's context carries the box's lifetime judge; read sites unchanged, offsets moved;rev3=census-ruling-rootfs-apps-2;basis=main's body as of the merge of origin/main 953b9fda (its later changes, regional box names and self-serve moves plan 1 among them, under main's own census rulings), where the tick fills rootfs_ready and rootfs_blocked from armedRootfs.Load().probe, which each tick runs NestedOK's checks and asks the control socket's GET /ready/rootfs (never the store); the same four direct sites;rev3=census-ruling-instance-egress-sizes-328-329;basis=#328 plan 2 Task 11 and #329 plan 3 Task 7: takes root's GET /egress reader and fills p.Egress = egressStatusProbe(egressStatus, routes, provision.PolicyReadStates()) and p.SizeCommittedMiB = sizeCommittedMiB(armedSizeSource.Load(), routes); the two added whole:Route sites are the tick's own registry list handed to those two units (decision rows), which read root's control socket and the activator's memory; no store request added; the four existing sites unchanged, offsets moved.;rev3=census-ruling-fleet-alerts-1;basis=the agent (carlos-edge.service, user carlos): the status tick passes os.Geteuid() to alertDeliveryProbe, which fills AlertDelivery.EngineBeat/EngineBeatWhy from engineBeatArmed (the env value and the euid only, no file access, root refused before the path is looked at), and fills Probes.DiskFullETAHours from diskETAProbe(&processDiskTrend, now), a Theil-Sen fit over the metrics loop's in-memory ring of disk readings; the same six sites, no read added, no store request added;rev3=census-ruling-edge-held-streams;basis=the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos): the status tick's Probes gain HeldStreams: heldStreamsState(), which calls the edge's in-memory counters function (nil until the edge is ready). No file, bucket or registry access added.;rev3=census-ruling-stateless-replicas-3;basis=Fix round 1 Q20: read the detached in-memory replica snapshot source into Probes.ReplicaCopies on the existing five-minute tick. Existing six direct read sites unchanged. No additional bucket request, changed cadence or app lifecycle action.;rev3=census-ruling-agent-start-demo-3;basis=Report moved capability only when the serving edge reports readiness; report claim-seed support only with CARLOS_DEMO_CLAIM=1. Reads the explicit capability flag from the process environment; no new filesystem or registry read.;rev3=census-ruling-stateless-replicas-4-task5;basis=Task 5 fix round 1 (#511 R16 amendment): the status tick also fills Probes.ApplyFinished from systemApplyFinished(release.OptDir()), an Lstat of root's apply journal <opt>/system/router/journal.json in the root-owned, world-readable state directory: finished only when the journal is absent, any other answer unknown and so unfinished. Round 0: Probes.PrevRelease from prevReleaseOf (carlos.prev and carlos.prev.version, the files withMovesFields already reads). Reported in the private BoxMetrics block; no bucket request or cadence change.;rev3=census-ruling-offline-move-stage-refusals-339;basis=#339: the agent (carlos-edge.service, user carlos): the status tick fills p.OfflineMove = offlineMoveFactsProbe(routes); the added whole:Route site is the tick's own registry list handed to that unit, which under a non-root euid lists the names of root's <opt>/live and nothing else; no store request added.;rev3=census-ruling-platform-mail-submission;basis=Task 3 (plan gap G6 (b)): the status tick also fills Probes.MailerArmed from mailerArmed(mailwire.MailerSocket, 2s): a stat of /run/carlos-mailer/mailer.sock and, only when it is a socket, GET /v1/health on it. The agent (carlos-edge.service, user carlos), not root; reported in the private BoxMetrics block only. The same seven sites; no store request, no read of /etc/carlos-mailer (which uid carlos cannot traverse).;rev3=census-ruling-named-units-param-114;basis=named-units-param-114 Task 6: the agent (carlos-edge.service, user carlos) fills Probes.NamedUnits from readNamedUnitsStatus: rootstate.Open(/var/lib/carlos-named-units, false, true) status.json, 64 KiB cap, any error nil; report only, nothing reads it as authority; no store request added; the same sites;rev3=census-ruling-console-addr-from-install;basis=sets Probes.ConsoleFleet from consoleFleetProbe (root public store read, edge in-memory state); no read added in this unit;rev3=census-ruling-demo-disk-slice1-retention;basis=the agent (carlos-edge.service, user carlos): the status tick also fills Probes.DemoDisk from readDemoDisk(), nil unless CARLOS_DEMO_BOX is set; statfs of /data and /run, and root's public retention record (readDemoBuilds); report only; no store request added; read sites unchanged whole:Route@10707,whole:Route@12781,whole:Route@13062,whole:Route@13420,whole:Route@6583,whole:Route@6610,whole:Route@7918 1b271f453a4718ca5fb64f513ec22acdd2550bc8cb4cfb021ea9c8ec7300df64 |
| -internal/release/adopt.go PassFilter authority B3,E3,J1,E1,E2 Signed named-unit recovery is independent of release and health history. Root rechecks canonical source, unit, process, signed target and trusted live pointer; captures attempt authority before publication; verifies readiness and resumes without repeated effects. Fixtures: TestPlan14SignedActiveFixIgnoresHistory, TestPlan14SignedActiveFixAuthority, TestPlan14SignedFixSupersedesOlderAttempt, TestPlan14ActiveRecoveryProcessCrash, TestPlan14SignedRestartWithoutHealthHistory, TestPlan14CapturedRollbackWithoutHealthHistory, TestPlan14SignedRestartRequiresTrustedLiveLink. E7 applies merge ruling 4: unbound no-census routes use the legacy pass and restart; ordinary candidates make no binding store call. Fixtures: TestR2UnguardedERecoveryUpdate, TestR2UnguardedERecoveryIncidentRecipe, TestPlan14ERecoveryBindingRefusalKeepsPromotedFix. E19: both destructive readers use the root reservation snapshot under existing release exclusion. Exact artifact and containing-tree identities are retained; missing completeness refuses destruction. Production installation/launch/kernel completeness and verified retirement remain unfinished. Fixtures: TestPlan14GenerationDeletionCannotUnpin, TestPlan14GenerationSnapshotCompleteness, TestPlan14GenerationSnapshotPermitsUnreservedRestage, TestPlan14GenerationSnapshotPinsContainingTree, TestPlan14GenerationSnapshotEmptyIsUnknown, TestPlan14GenerationConsumerMode.;rev3=PROPOSED-p3;run=8;identity=carlos adopt uid 0; legacy agent pass uid carlos;basis=resolves protected route inputs before filters, recovery and dispatch on census boxes and bypasses service-owned failure opener only there;rev3=PROPOSED-s3-change-index;identity=carlos adopt uid 0; legacy agent pass uid carlos;basis=asks the optional pointer gate (gatePointers) once per channel group before selection and reports each group's pointer outcome to it; only the agent's fast sweep arms a gate (WithPointerGate), so under carlos adopt the gate is nil and the pass is unchanged; a gate can only leave a group out of the pass, never add one; one whole-Route site added;rev3=census-ruling-rootfs-apps-3;basis=rootfs Plan 3: comment only, the Hibernate check is left as is for a resident;rev3=census-ruling-hunt-release-chain-integrity;basis=a digestless head is bound to its signed promotion record through stagePointerHead, and a pointer without an account binding is refused on read (verifyPointer); the ratchet it consults (Admit) now also holds a per-channel promoted_at floor that admits only a strictly later stamp or the very pointer it recorded (PointerIdentity, fix round 1), which root reads only from its own root-owned <opt>/pointer-digests and never from the agent's data dir, through instancefs.ReadBeneathLimitOrAbsent (openat2 RESOLVE_BENEATH|NO_SYMLINKS|NO_MAGICLINKS, O_NONBLOCK, regular file only, 4 KiB cap); fix round 2: the floor's identity is the sha256 of the exact signed wrapper the pointer was verified from (set at the parse site), and a floor with no identity admits nothing at its own stamp, so the floor only refuses more; no read kind is added to the unit; CI fix: an app channel pointer is now stamped to the millisecond (pointerStampGrain) so a signer's wait past the head it replaces is at most a millisecond; the floor still admits only a strictly later stamp or the pointer it recorded, compared as time.Time, so the rule and the reads are unchanged;rev3=census-ruling-demo-disk-slice1-retention;basis=the stage check's beforeWrite is cfg.stageWriteCheck (generationWriteCheck first, unchanged, then WithBeforeStage's callback for a path that holds nothing yet); no read added in this unit registry:App@10134,registry:App@27173,registry:App@29630,registry:App@30317,registry:App@30554,registry:App@31961,registry:App@6735,registry:App@9993,registry:Hibernate@30200,registry:Host@1061,registry:Host@1426,registry:Host@30370,registry:Host@31286,registry:Host@32014,registry:Host@3413,registry:Host@3480,registry:Host@3576,registry:Host@3611,registry:UpdateSettings@9871,whole:Route@10129,whole:Route@1046,whole:Route@1164,whole:Route@1188,whole:Route@1461,whole:Route@1622,whole:Route@27168,whole:Route@2726,whole:Route@2768,whole:Route@2877,whole:Route@2901,whole:Route@2932,whole:Route@29625,whole:Route@29883,whole:Route@29905,whole:Route@29952,whole:Route@29970,whole:Route@29980,whole:Route@30218,whole:Route@30239,whole:Route@30252,whole:Route@30312,whole:Route@30338,whole:Route@30412,whole:Route@30451,whole:Route@30467,whole:Route@30495,whole:Route@30549,whole:Route@30575,whole:Route@3074,whole:Route@31328,whole:Route@31382,whole:Route@3139,whole:Route@31398,whole:Route@31905,whole:Route@31956,whole:Route@31982,whole:Route@32056,whole:Route@32091,whole:Route@32107,whole:Route@3225,whole:Route@3247,whole:Route@3347,whole:Route@4425,whole:Route@5072,whole:Route@6657,whole:Route@6679,whole:Route@6730,whole:Route@6756,whole:Route@761,whole:Route@803,whole:Route@950,whole:Route@9822,whole:Route@988,whole:Route@9936,whole:Route@9981 2dd0717b7e3467741b6f9ebab282bad96ebbde81a83e54e8b64585e5cdd50067 |
| -internal/release/adopt.go type passConfig authority E2,E3 E19: both destructive readers use the root reservation snapshot under existing release exclusion. Exact artifact and containing-tree identities are retained; missing completeness refuses destruction. Production installation/launch/kernel completeness and verified retirement remain unfinished. Fixtures: TestPlan14GenerationDeletionCannotUnpin, TestPlan14GenerationSnapshotCompleteness, TestPlan14GenerationSnapshotPermitsUnreservedRestage, TestPlan14GenerationSnapshotPinsContainingTree, TestPlan14GenerationSnapshotEmptyIsUnknown, TestPlan14GenerationConsumerMode, TestPlan14GenerationProductionModeGate, TestPlan14GenerationSnapshotPermitsFreshTree.;rev3=PROPOSED-p3;run=8;identity=carlos adopt uid 0; legacy agent pass uid carlos;basis=stores the typed census-only root update provider and per-pass resolved input authority;rev3=census-ruling-315;identity=legacy agent pass uid carlos (RootRestartsUnits; never set on carlos adopt);basis=adds the unitsToRoot bool set by RootRestartsUnits; reads nothing;rev3=PROPOSED-s3-change-index;identity=carlos adopt uid 0; legacy agent pass uid carlos;basis=adds the pointerGate field, set only by WithPointerGate (the agent's fast sweep); reads nothing;rev3=census-ruling-demo-disk-slice1-retention;basis=adds the beforeStage callback field, set only by WithBeforeStage (root's adopt pass); reads nothing b74606b6d50ab24289e91dbc36edf9e7058f7bceba544609bf72c67ec07c331e |
| -internal/status/snapshot.go CollectBox legacy accepted-legacy accepted-legacy;rev3=J1;basis=root-route;rev3=census-ruling-rootfs-apps-2;basis=copies Probes.RootfsReady and RootfsBlocked into BoxMetrics (private, like Layout); the same 28 sites, no read added;rev3=census-ruling-instance-egress-sizes-328-329;basis=#328 plan 2 Task 11 and #329 plan 3 Task 7: copies Probes.Egress and Probes.SizeCommittedMiB into BoxMetrics (private, like Layout) and counts them in the condition that builds Metrics; the same 28 sites, no read added.;rev3=census-ruling-rootfs-apps-3;basis=rootfs Plan 3: comment only, the Hibernate count is left as is (display);rev3=census-ruling-regional-domains-447;basis=#447 Task 7: copies Probes.AliasesRead into BoxMetrics.AliasesRead (json aliases_read, omitempty) and counts it in the condition that builds Metrics; the same 28 sites, no read added;rev3=census-ruling-fleet-alerts-1;basis=copies Probes.DiskFullETAHours into BoxMetrics.DiskFullETAHours (json disk_full_eta_hours, omitempty; private, like Layout) and counts it in the condition that builds Metrics; the same 28 sites, no read added;rev3=census-ruling-edge-held-streams;basis=copies Probes.HeldStreams into BoxMetrics.HeldStreams (json held_streams, omitempty, additive) and counts it in the condition that builds Metrics; the same 28 sites, no read added.;rev3=census-ruling-stateless-replicas-3;basis=Fix round 1 Q20: carry already-supplied ReplicaCopies into a separate optional private BoxMetrics replica_copies field; allow copy evidence alone to create the metrics block. Upstreams retains address probes only. Existing 28 Route read sites unchanged; no filesystem, bucket, console or CLI read.;rev3=census-ruling-agent-start-demo-3;basis=Report claim-seed protocol capability only when explicitly configured and runtime moved readiness only when armed; dormant status keeps its original JSON shape. Census read-site delta: unchanged (28).;rev3=census-ruling-stateless-replicas-4-task5;basis=Task 5 (#511 R16 and its amendment): copies Probes.PrevRelease and Probes.ApplyFinished into BoxMetrics (json prev_release and apply_finished, omitempty; private, like Release) and counts them in the condition that builds Metrics; the same 28 sites, no read added.;rev3=census-ruling-offline-move-stage-refusals-339;basis=#339: copies Probes.OfflineMove into BoxMetrics.OfflineMove (json offline_move, omitempty; private, like Layout) and counts it in the condition that builds Metrics; the same 28 sites, no read added.;rev3=census-ruling-platform-mail-submission;basis=Task 3: copies Probes.MailerArmed into BoxMetrics.MailerArmed (json mailer_armed, omitempty; private, like Layout) and counts it in the condition that builds Metrics; the same 28 sites, no read added.;rev3=census-ruling-named-units-param-114;basis=named-units-param-114 Task 6: copies Probes.NamedUnits into BoxMetrics.NamedUnits (json named_units, omitempty; private) and counts it in the condition that builds Metrics; the same 28 sites, no read added;rev3=census-ruling-fleet-seeded-create-2;basis=Copies Probes.SeedsFloor into BoxMetrics.SeedsFloor and counts it in the metrics gate; a pure copy of a value the agent filled, the same 28 read sites, no read added.;rev3=census-ruling-console-addr-from-install;basis=copies Probes.ConsoleFleet into BoxMetrics (private); no read added;rev3=census-ruling-demo-disk-slice1-retention;basis=copies Probes.DemoDisk into BoxMetrics.DemoDisk (json demo_disk, omitempty; private, like Layout) and counts it in the condition that builds Metrics; the same 28 sites, no read added registry:Alias@4543,registry:CertExpiresAt@3160,registry:CertExpiresAt@3396,registry:CertExpiresAt@4658,registry:DBPath@2495,registry:DBPath@2553,registry:DNSCheckedAt@3365,registry:DNSCheckedAt@4627,registry:DNSStatus@3139,registry:DNSStatus@3334,registry:DNSStatus@4597,registry:Hibernate@3853,registry:Host@2295,registry:Host@2437,registry:Host@2666,registry:Host@3280,registry:Host@3315,registry:Host@4578,registry:Kind@2473,registry:Kind@3807,registry:Platform@2152,registry:ServingVersion@2324,registry:ServingVersion@2447,registry:Socket@4066,registry:Version@2186,registry:Version@2305,whole:Route@1581,whole:RouteAlias@4440 f001b427c01c4ee280a8d848eaaf60de952ecdfb3f2c6108f7c105f89a51efbf |
| -cli.go printDemoDisk legacy accepted-legacy accepted-legacy;rev3=census-ruling-demo-disk-slice1-retention;basis=operator CLI (carlos status --live), not root: prints a published box snapshot's demo_disk numbers; reads only the decoded snapshot in hand data-literal@195 ed2577c68d95ca5a6ebba28e905a65115ff335bc36aecca1e2c415ed98fb6fff |
| -internal/host/demodisk_status.go productionDemoDiskProbe legacy accepted-legacy accepted-legacy;rev3=census-ruling-demo-disk-slice1-retention;basis=the agent (user carlos), not root: opens root's public record directory /var/lib/carlos-release/demo-retention read-only through rootstate.Open(dir, false, true) (every ancestor root-owned, not group or world writable); report only file:Open@208 f8df171d9a2ff2d96b73c63f4618d035230acc4b8f244dd7f377184686e4933f |
| -internal/host/demodisk_status.go readDemoBuilds legacy accepted-legacy accepted-legacy;rev3=census-ruling-demo-disk-slice1-retention;basis=the agent (user carlos): reads the record 'status' from that rootstate store (descriptor read, trusted owner, 1 MiB cap) and decodes it; schema 1 or an error; report only, nothing reads it as authority file:Read@174 213c08b6d79b17ca25b94b815815bd0c7dfbeaa8664aafbfc8419fab2b2679ca |
| -internal/host/demoretention.go demoRetention.demoAdoptions legacy accepted-legacy accepted-legacy;rev3=census-ruling-demo-disk-slice1-retention;basis=root adopt pass (uid 0): lists the registry and keeps each demo route's Host and Version, to tell after the pass whether it adopted a demo version; decides only whether retention runs registry:Host@287,registry:Version@298,whole:Route@237,whole:Route@270 d1ca3b3d0e084d93b09023e7a0bcb6dfa496b80976362f4f5f0a0ce03c215ff8 |
| -internal/host/demoretention.go demoRetention.demoApp legacy accepted-legacy accepted-legacy;rev3=census-ruling-demo-disk-slice1-retention;basis=root adopt pass: a route is a demo app on this demo box only when it is marked demo (IsDemo), its app is tmp-demo-*, and its account is the box's CARLOS_DEMO_ACCOUNT from host.env (demo.BoxConfig); retention never selects any other app registry:App@112,registry:App@147,registry:App@324,whole:Route@235 4af8f894c32e176fc4886d743ea6271236c3ba4e687f2b085cb9f20222550555 |
| -internal/host/demoretention.go demoRetention.demoAppListed legacy accepted-legacy accepted-legacy;rev3=census-ruling-demo-disk-slice1-retention;basis=root adopt pass: the pending-output cleanup acts on a path only when a demo route of this box runs that account/app; a registry that does not list counts as listed so the cleanup's own read refuses the stage whole:Route@271,whole:Route@306 92b1b3bde40e55e2dd696e52516b5e375e76f663bae01cb5953eb6f3eb64efce |
| -internal/host/demoretention.go demoRetention.pinSet legacy accepted-legacy accepted-legacy;rev3=census-ruling-demo-disk-slice1-retention;basis=root adopt pass: the pin set from every source: release.BoxPins over every registry row (live link chains; Version, PrevVersion, GoodVersion, settings references), previous links, release.GenerationPins over the generations file, and root's generation ledger (productionRootGenerationPins). Strict: any source that does not read in full is an error and nothing is deleted. Agent-writable inputs (the registry, the generations file under /data) can only ADD pins, never remove one; the estimate mode (no deletion) only counts registry:App@819,registry:App@943,registry:GoodVersion@784,registry:PrevVersion@768,registry:Version@756,whole:Route@1179,whole:Route@423,whole:Route@671,whole:Route@715,whole:Route@935 6d38329b474d0f4dddbcca7d61dc8cf25becc75f7b3d1b93a222479cf239eecb |
| -internal/host/demoretention.go demoRetention.saveStatus legacy accepted-legacy accepted-legacy;rev3=census-ruling-demo-disk-slice1-retention;basis=root adopt pass: reads its own previous record from the public root store /var/lib/carlos-release/demo-retention (rootstate, created root-owned 0755, file 0644) to carry the backlog's start, and writes the new record there; status only, never read back as a pin or a decision file:Read@289 5bb8a4f44a6b268632d4351409ea113646844e7224b08d3862b656172a8e28d3 |
| -internal/host/demoretention.go demoRetention.selection legacy accepted-legacy accepted-legacy;rev3=census-ruling-demo-disk-slice1-retention;basis=root adopt pass: lists <opt>/versions (root-owned version store) and Lstats <ver>/<account>/<app> and its .manifest.json for each demo app; ENOTDIR (an ops app's file named like the account) is not present; decides which demo outputs nothing pins. Deletion is only by removeOutput through instancefs.RemoveAllBeneath (openat2 beneath, no symlinks), per app, never a version directory, and only with the adopt pass lock held file:Lstat@1302,file:ReadDir@659,registry:Version@495,whole:Route@386,whole:Route@419,whole:Route@587 ed401bfe4a1ddfeed3a492df8dedfa5b1391f229bfd93efda3e011aa5d8f29db |
| -internal/host/demoretention.go pinned legacy accepted-legacy accepted-legacy;rev3=census-ruling-demo-disk-slice1-retention;basis=root adopt pass: an output is pinned when a pin names it, its manifest or a path inside it, under the store's spelling or the real path of its directory (EvalSymlinks of the root-owned version directory) file:EvalSymlinks@151 86cb92546860e0251e2e9f0c46feab68ab83d7069f2285d3f260789c6f07ca6b |
| -internal/host/demoretention.go previousLinkPins legacy accepted-legacy accepted-legacy;rev3=census-ruling-demo-disk-slice1-retention;basis=root adopt pass: every <opt>/previous link (root-owned) is a pin at its target and its real path, as release.LivePins reads them for the sweep; an unreadable link is an error and nothing is deleted file:EvalSymlinks@559,file:ReadDir@127,file:Readlink@373 6f66df0648b22a40d3d351fd46cd8d67c2629b02ab8399aa9660355483bc2afe |
| -internal/host/demoretention.go productionDemoRetention legacy accepted-legacy accepted-legacy;rev3=census-ruling-demo-disk-slice1-retention;basis=root adopt pass: demo.BoxConfig from host.env (root-owned), the version store and generations file paths, root's generation ledger, and the record store opener rootstate.Open(/var/lib/carlos-release/demo-retention, true, true) file:Open@515 3717758213e219b3daee5301239dae3e5b1a433af47546e950a074ad334a91db |
| -internal/host/statfs_unix.go filesystemRoom legacy accepted-legacy accepted-legacy;rev3=census-ruling-demo-disk-slice1-retention;basis=the agent (user carlos): statfs of /data and /run for status and the disk alert; numbers only file:Statfs@102 bc0b7000ddb11715edd58a955d7950a1c19bfacb315b47d9575f7ac0a0a4a732 |
| -internal/release/adopt.go passConfig.stageWriteCheck legacy accepted-legacy accepted-legacy;rev3=census-ruling-demo-disk-slice1-retention;basis=root adopt pass and agent passes: generationWriteCheck unchanged first; then, only when WithBeforeStage is set (root's adopt pass only), Lstat of the VersionPath about to be written and the callback when nothing is there; an error fails the stage (nothing written, route unchanged) file:Lstat@233 92aa097f88dc4c665a3564a8cd981537d2394857967be73230a0ef39648c48fd |
| -@coverage . a1a96539bb89f0a450ee4e9789aa3de12fe26862edf5669cd5448257e237efa7 |
| -@coverage internal/host f9e0ff550888bad3d68010bd4ce0ce340828d7954564a49600bf74629c6f585a |
| -@coverage internal/release ea6cff951c883e50055f1348e69a4fac49d7bce8579d1d9ad179e049addeeb51 |
| -@coverage internal/status 36efea008597955202072ed20f65880ac10da54c55ac060a925539bbca0e414e |