carlos / platform Public

console remote instances: record reads go through the lifetime judge (main's audit)

Main's TestNoUnjudgedRecordReads (lifetimes) flagged pageRecords
(GetRecord) and channelHosts (ListRecordsStrict). Both now read under the
context's judge (ReadRecordJudged; s.listRecordsStrict). A judged list
drops records the judge no longer vouches for, so the retire guard no
longer refuses on every listed key missing from the follower read: a key
created during the check is recent and refuses under the window rule,
and an old one is a retired record that follows nothing. Census
re-proposed (seal c4b872b7); record-write digests for pageRecords,
retireUnsettled and channelHosts (classes unchanged).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude agent, operated by paul@keymail.dev 9788f4d1071fbc0d368f3da544204c39a1127967 parent aada817
6 files changed, +17 −14
  • docs/superpowers/notes/census-proposal-console-remote-instances.md +2 −2
  • internal/console/remoteinstances.go +7 −4
  • internal/console/server.go +1 −1
  • internal/provision/console_remote_instances_census_test.go +3 −3
  • internal/provision/testdata/plan14-root-reads-chain.tsv +1 −1
  • internal/provision/testdata/plan14-root-reads-console-remote-instances.tsv +3 −3

CI passed — run details

diff --git a/docs/superpowers/notes/census-proposal-console-remote-instances.md b/docs/superpowers/notes/census-proposal-console-remote-instances.md
index e3fbfd9c1..a736ebb66 100644
--- a/docs/superpowers/notes/census-proposal-console-remote-instances.md
+++ b/docs/superpowers/notes/census-proposal-console-remote-instances.md
@@ -11,7 +11,7 @@ Ruling `census-ruling-console-remote-instances`. Every change below keeps the di
| `internal/console/instancepage.go` `Server.handleAppInstance` | body | unchanged (6) | A remote row (no local registry row) runs none of the hostname-keyed box joins (layout, rollout, updates): it shows only what its row brought through remoteFacts, aliases included. Local rows read layout, rollout join and ListAliases as before. |
| `internal/console/metricsview.go` `buildUnitRows` | body | unchanged (2) | Each unit row also keeps its raw per-sample readings (float32 CPU, int64 memory) so an owner's graph can be redrawn from only their samples; reads nothing new. |
| `internal/console/metricsview.go` `type UnitRow` | body | unchanged (1) | Two unexported fields carrying those raw per-sample readings; schema only. |
-| `internal/console/server.go` `Server.channelHosts` | body | unchanged (4) | Canary-retire guard also counts the account's instance records (ListRecordsStrict) and sidecar records (listed, then each read with GetSidecarRecord; any read error refuses) naming the channel; with none, it refuses unless the app has settled (retireUnsettled). The registry read is as on main. Fails closed. |
+| `internal/console/server.go` `Server.channelHosts` | body | unchanged (4) | Canary-retire guard also counts the account's instance records (ListRecordsStrict under the lifetime judge, listRecordsStrict) and sidecar records (listed, then each read with GetSidecarRecord; any read error refuses) naming the channel; with none, it refuses unless the app has settled (retireUnsettled). The registry read is as on main. Fails closed. |
| `internal/console/templates/app_overview.html` `external` | body | unchanged (1) | Running tile does not claim Served when a route's state is unknown and reads the existing 'no data right now' when every instance's state is unknown; Web addresses tile reads 'no data right now' instead of 'DNS & certs OK' for a domain with no reading; display only. |
| `internal/console/apiinstances.go` `Server.instanceHealth` | sites | +whole:Route ×4 | Records with no local registry row get health only from remoteFacts: a box report whose rollout entry names the record's own account and app, generated after the record was created (held down: Failed; transient, unidentified or unread: Can't tell right now), readings pinned to that box and bounded by the record's created_at and the report's generation. Builds registry.Route literals from the record; reads no registry for them. |
| `internal/console/view.go` `Assemble` | sites | +registry:Host, +whole:Route | Collects the set of local registry hosts (rt.Host) so a record host the registry has gets no remote row (its record's created_at bounds the local row's metrics history); adds rows from the account's records and remoteFacts when given a remote source. |
@@ -34,6 +34,6 @@ Recorded dispositions, which each change must still satisfy:
- `internal/console/apiinstances.go` `Server.instanceHealth`: legacy, task accepted-legacy. Basis: accepted-legacy;rev3=J1;basis=root-route
- `internal/console/view.go` `Assemble`: legacy, task accepted-legacy. Basis: accepted-legacy;rev3=J1;basis=root-route
-Seal: `9cef5e93a1e3520e02efe66455bf70c1170d380b6d6a72ede02036ce3dd41924` → `84c9c46ffcac670b1a6a1d04d0f13567c1502ffa3c7251f4d5b4b73ac38eceaa`.
+Seal: `9cef5e93a1e3520e02efe66455bf70c1170d380b6d6a72ede02036ce3dd41924` → `c4b872b770e88ffa7ffc349490e05d7ae84257bb1bee5b8c8c92444e319fb222`.
Overlay: `internal/provision/testdata/plan14-root-reads-console-remote-instances.tsv`, appended to `internal/provision/testdata/plan14-root-reads-chain.tsv`.
diff --git a/internal/console/remoteinstances.go b/internal/console/remoteinstances.go
index 0abbcac9c..cf2491682 100644
--- a/internal/console/remoteinstances.go
+++ b/internal/console/remoteinstances.go
@@ -441,7 +441,7 @@ func (s *Server) pageRecords(ctx context.Context, acct, app string, skip map[str
sort.Strings(hosts)
recs := make([]provision.Record, 0, len(hosts))
for _, host := range hosts {
- rec, err := provision.GetRecord(ctx, store, acct, app, host)
+ rec, _, err := provision.ReadRecordJudged(ctx, store, provision.JudgeFrom(ctx), acct, app, host)
switch {
case errors.Is(err, os.ErrNotExist):
continue
@@ -524,9 +524,12 @@ func (s *Server) retireUnsettled(ctx context.Context, acct, app string, keys, ho
}
for _, o := range objs {
if !keys[o.Key] {
- if recordKeyUnder(o.Key, prefix) {
- // Created after the follower read: it was not checked.
- return unsettled("%s appeared during the check", o.Key)
+ // Not in the follower read: created since (and so recent,
+ // which refuses below), or a record the lifetime judge does
+ // not vouch for any more (retired, stale), which follows
+ // nothing once it is old.
+ if recordKeyUnder(o.Key, prefix) && (o.Mod.IsZero() || now.Sub(o.Mod) < channelSettle) {
+ return unsettled("%s appeared or changed during the window", o.Key)
}
continue
}
diff --git a/internal/console/server.go b/internal/console/server.go
index e2ae4abcd..cc57b4499 100644
--- a/internal/console/server.go
+++ b/internal/console/server.go
@@ -5284,7 +5284,7 @@ func (s *Server) channelHosts(ctx context.Context, acct, app, channel string) ([
}
ctx, cancel := context.WithTimeout(ctx, instanceStoreTimeout)
defer cancel()
- recs, unreadable, err := provision.ListRecordsStrict(ctx, s.cfg.Releases, acct, app, instanceListMax)
+ recs, unreadable, err := s.listRecordsStrict(ctx, acct, app, instanceListMax)
if err != nil {
return nil, fmt.Errorf("instance records of %s/%s: %w", acct, app, err)
}
diff --git a/internal/provision/console_remote_instances_census_test.go b/internal/provision/console_remote_instances_census_test.go
index 89e16d507..d668ac1c3 100644
--- a/internal/provision/console_remote_instances_census_test.go
+++ b/internal/provision/console_remote_instances_census_test.go
@@ -49,13 +49,13 @@ func consoleRemoteInstancesWriteCensusInventory() []censusEntry {
entries := append([]censusEntry(nil), claimsCleanupR2WriteCensusInventory()...)
replacements := []censusEntry{
{"internal/console/instancepage.go", "Server.handleAppInstance", "key-site", "lit:instances", "5208ae08d92c1022d7849e4ad50578460bb01b521983e09ee2f39af528a1dc55"},
- {"internal/console/server.go", "Server.channelHosts", "key-site", "key:RecordKey,key:SidecarsPrefix", "966e1fb668d3910ccb102845f1c5c91a1aa2cfa857bbf0ca11d850945259c682"},
+ {"internal/console/server.go", "Server.channelHosts", "key-site", "key:RecordKey,key:SidecarsPrefix", "05c81080b1bd975c844e031830246881397e2b1864e1dc4a27bd425c77535d99"},
{"internal/console/apiinstanceimport.go", "Server.deleteRead", "key-site", "key:RecordKey", "b0c92beff1fa7a4f7bbd86ac5c85d675ad4253801bd0bc39cea09c29e34733d3"},
{"internal/console/seedfinish.go", "Server.finishSeedOnce", "key-site", "key:RecordKey", "940dcce4011bc7eaee0884338166ef04f347a82f576dbaf858c9e8879a32911f"},
{"internal/console/lifetimes_create.go", "Server.allocCleanLocked", "key-site", "key:RecordKey", "a6f1a6c5f15fec828ab9ff64ca153d6a6b032716d628924caa925640a44f7856"},
{"internal/console/claim_retire.go", "Server.retireClaimHostRecord", "key-site", "key:claimRetireRecordKey", "3c30cfcad8f2edb3c38b7dd9e56697cd3e17ce3a7fa0e76eb815adf3dad7bd4d"},
- {"internal/console/remoteinstances.go", "Server.retireUnsettled", "key-site", "key:RecordsPrefix,key:SidecarsPrefix", "a880d8edff2cba0ede6ed32fd5e48984b52b486c1db75ff612878ddb7ac2007b"},
- {"internal/console/remoteinstances.go", "Server.pageRecords", "key-site", "key:RecordsPrefix", "5298e5713404c168fdc4cfdc9995f57a5d3d61893d4b6c17f985877de59f8896"},
+ {"internal/console/remoteinstances.go", "Server.retireUnsettled", "key-site", "key:RecordsPrefix,key:SidecarsPrefix", "c1c706feafbb7769a6b3d04e2010cd330d6196a08a4f0068dfd8c530cce8541b"},
+ {"internal/console/remoteinstances.go", "Server.pageRecords", "key-site", "key:RecordsPrefix", "d2b3108fee1429c9638a41628da10abfd9a603824e9ca08bcfc73831d2940ef8"},
{"internal/console/remoteinstances.go", "Server.recordStamps", "key-site", "key:RecordsPrefix,key:SidecarsPrefix", "c38f120e5be0e8c883b6da7d86df23a5b6b495a31732732e6cbe6efe5821ff43"},
}
for _, r := range replacements {
diff --git a/internal/provision/testdata/plan14-root-reads-chain.tsv b/internal/provision/testdata/plan14-root-reads-chain.tsv
index a946230a7..b1b1ec24d 100644
--- a/internal/provision/testdata/plan14-root-reads-chain.tsv
+++ b/internal/provision/testdata/plan14-root-reads-chain.tsv
@@ -45,4 +45,4 @@ plan14-root-reads-edge-protection-2.tsv a864cf31b6bf2c30b5aa8c2647835efdc456f34f
plan14-root-reads-offline-move-trim-t1.tsv a864cf31b6bf2c30b5aa8c2647835efdc456f34f4945eea12751daab2457728e
plan14-root-reads-claims-cleanup-r1.tsv 9cef5e93a1e3520e02efe66455bf70c1170d380b6d6a72ede02036ce3dd41924
plan14-root-reads-claims-cleanup-r2.tsv 9cef5e93a1e3520e02efe66455bf70c1170d380b6d6a72ede02036ce3dd41924
-plan14-root-reads-console-remote-instances.tsv 84c9c46ffcac670b1a6a1d04d0f13567c1502ffa3c7251f4d5b4b73ac38eceaa
+plan14-root-reads-console-remote-instances.tsv c4b872b770e88ffa7ffc349490e05d7ae84257bb1bee5b8c8c92444e319fb222
diff --git a/internal/provision/testdata/plan14-root-reads-console-remote-instances.tsv b/internal/provision/testdata/plan14-root-reads-console-remote-instances.tsv
index 634b094d7..b62e675ff 100644
--- a/internal/provision/testdata/plan14-root-reads-console-remote-instances.tsv
+++ b/internal/provision/testdata/plan14-root-reads-console-remote-instances.tsv
@@ -6,7 +6,7 @@
@legacy e096052196bcd47b52cd721741d73c701d59e2f0d6a0a0a0cf9c4b33a1636bf1 internal/console/claim_retire.go Server.retireClaimHostRecord legacy accepted-legacy accepted-legacy;rev3=J4;basis=root-input;rev3=census-ruling-console-remote-instances;basis=Notes the app in the console's in-memory deletion log (noteRecordDeletion, which also invalidates the pages' held box reports) before retiring a record, for the canary-retire guard; the retire itself is unchanged. file:Read@941 3c30cfcad8f2edb3c38b7dd9e56697cd3e17ce3a7fa0e76eb815adf3dad7bd4d
@legacy 2c4f2defe9c0c19d0f25974cf6ddf19e1fbdf2bf5f5658e4b50447c84d4e90ef internal/console/instancepage.go Server.handleAppInstance legacy accepted-legacy accepted-legacy;rev3=merge-ruling-2;basis=Instance page adds updates view from rollout join; browser rendering remains legacy.;rev3=census-ruling-console-remote-instances;basis=A remote row (no local registry row) runs none of the hostname-keyed box joins (layout, rollout, updates): it shows only what its row brought through remoteFacts, aliases included. Local rows read layout, rollout join and ListAliases as before. file:Query@2895,registry:Account@2667,registry:Alias@2767,registry:App@2697,registry:Host@2645,whole:RouteAlias@2628 5208ae08d92c1022d7849e4ad50578460bb01b521983e09ee2f39af528a1dc55
@legacy aa852aec334f46af0b4bb16f7f81afa3d4690f0f12c6c80b2ab5cff4837367aa internal/console/metricsview.go buildUnitRows legacy accepted-legacy accepted-legacy;rev3=J4;basis=root-input;rev3=census-ruling-console-remote-instances;basis=Each unit row also keeps its raw per-sample readings (float32 CPU, int64 memory) so an owner's graph can be redrawn from only their samples; reads nothing new. file:ReadBytes@315,file:ReadBytes@327 e7f942ea8d32626b6ead3313deec26c458a7d7c296e7120c7384dfc5f416c378
-@legacy 5ba3b725e417106dfbca90c2d28ca0ff116430d0ec8dcbdf9533464cbeda380b internal/console/server.go Server.channelHosts legacy accepted-legacy accepted-legacy;rev3=J1;basis=root-route;rev3=census-ruling-console-remote-instances;basis=Canary-retire guard also counts the account's instance records (ListRecordsStrict) and sidecar records (listed, then each read with GetSidecarRecord; any read error refuses) naming the channel; with none, it refuses unless the app has settled (retireUnsettled). The registry read is as on main. Fails closed. registry:App@424,registry:Channel@441,registry:Host@472,whole:Route@410 966e1fb668d3910ccb102845f1c5c91a1aa2cfa857bbf0ca11d850945259c682
+@legacy b58f31b085d67e08a0f81ba95dd47114f9849e6986cb92a0a89a4234064ff4dc internal/console/server.go Server.channelHosts legacy accepted-legacy accepted-legacy;rev3=J1;basis=root-route;rev3=census-ruling-console-remote-instances;basis=Canary-retire guard also counts the account's instance records (ListRecordsStrict under the lifetime judge, listRecordsStrict) and sidecar records (listed, then each read with GetSidecarRecord; any read error refuses) naming the channel; with none, it refuses unless the app has settled (retireUnsettled). The registry read is as on main. Fails closed. registry:App@424,registry:Channel@441,registry:Host@472,whole:Route@410 05c81080b1bd975c844e031830246881397e2b1864e1dc4a27bd425c77535d99
@legacy 9c63018a0c60a52c55b2ef0159bc58cbf0f191e0166a53adf58feff954c6935e internal/console/templates/app_overview.html external legacy accepted-legacy accepted-legacy;rev3=J4;basis=root-input;rev3=census-ruling-console-remote-instances;basis=Running tile does not claim Served when a route's state is unknown and reads the existing 'no data right now' when every instance's state is unknown; Web addresses tile reads 'no data right now' instead of 'DNS & certs OK' for a domain with no reading; display only. file:external@0 2a112ff768c300894881b858e61465841c87810ca7cb1d98a0fe2a54155a0ca1
@legacy 80631d7995159901c7272e19e73a447d95cce7fc671ec0056f28572057b55071 internal/console/apiinstances.go Server.instanceHealth legacy accepted-legacy accepted-legacy;rev3=J1;basis=root-route;rev3=census-ruling-console-remote-instances;basis=Records with no local registry row get health only from remoteFacts: a box report whose rollout entry names the record's own account and app, generated after the record was created (held down: Failed; transient, unidentified or unread: Can't tell right now), readings pinned to that box and bounded by the record's created_at and the report's generation. Builds registry.Route literals from the record; reads no registry for them. registry:Account@1987,registry:Account@2007,registry:App@1948,registry:App@1964,registry:Host@839,registry:Unit@2117,registry:Unit@2159,whole:Route@1151,whole:Route@2054,whole:Route@2075,whole:Route@2887,whole:Route@3596,whole:Route@4110,whole:Route@4163,whole:Route@4278,whole:Route@792,whole:Route@821,whole:Route@832,whole:Route@850 c6e49aec6194fbb4ce76a51610708b4d9a4de82f2a8ae6a52f4ae25a1a06135b
@legacy 985c17c7d12aab5b0e7faa1861e93fc51e946406f767e9f2fc33a89f4a74f16e internal/console/view.go Assemble legacy accepted-legacy accepted-legacy;rev3=J1;basis=root-route;rev3=census-ruling-console-remote-instances;basis=Collects the set of local registry hosts (rt.Host) so a record host the registry has gets no remote row (its record's created_at bounds the local row's metrics history); adds rows from the account's records and remoteFacts when given a remote source. registry:App@1716,registry:App@1739,registry:App@2117,registry:App@2147,registry:Backing@2017,registry:Caps@1385,registry:Channel@960,registry:Environment@1942,registry:Hibernate@1859,registry:Host@1768,registry:Host@861,registry:Kind@1783,registry:Platform@1889,registry:Provisioned@2042,registry:Status@1800,registry:Unit@1999,registry:Version@1823,whole:Route@2092,whole:Route@2167,whole:Route@810,whole:Route@839,whole:Route@910 120ae8c042523f872fd1c19357b8bb830e4afe9da1e38ad202df2ada3ad52ada
@@ -17,9 +17,9 @@ internal/console/claim_retire.go Server.retireClaimHostRecord legacy accepted-le
internal/console/instancepage.go Server.handleAppInstance legacy accepted-legacy accepted-legacy;rev3=merge-ruling-2;basis=Instance page adds updates view from rollout join; browser rendering remains legacy.;rev3=census-ruling-console-remote-instances;basis=A remote row (no local registry row) runs none of the hostname-keyed box joins (layout, rollout, updates): it shows only what its row brought through remoteFacts, aliases included. Local rows read layout, rollout join and ListAliases as before. file:Query@2895,registry:Account@2667,registry:Alias@2767,registry:App@2697,registry:Host@2645,whole:RouteAlias@2628 5208ae08d92c1022d7849e4ad50578460bb01b521983e09ee2f39af528a1dc55
internal/console/metricsview.go buildUnitRows legacy accepted-legacy accepted-legacy;rev3=J4;basis=root-input;rev3=census-ruling-console-remote-instances;basis=Each unit row also keeps its raw per-sample readings (float32 CPU, int64 memory) so an owner's graph can be redrawn from only their samples; reads nothing new. file:ReadBytes@315,file:ReadBytes@327 e7f942ea8d32626b6ead3313deec26c458a7d7c296e7120c7384dfc5f416c378
internal/console/metricsview.go type UnitRow diagnostic H3 schema-only;rev3=census-ruling-console-remote-instances;basis=Two unexported fields carrying those raw per-sample readings; schema only. file:ReadBytes@133 db66030c5353fee88e0826786a424e0fee88d3191004deff380d00086bef5d62
-internal/console/server.go Server.channelHosts legacy accepted-legacy accepted-legacy;rev3=J1;basis=root-route;rev3=census-ruling-console-remote-instances;basis=Canary-retire guard also counts the account's instance records (ListRecordsStrict) and sidecar records (listed, then each read with GetSidecarRecord; any read error refuses) naming the channel; with none, it refuses unless the app has settled (retireUnsettled). The registry read is as on main. Fails closed. registry:App@424,registry:Channel@441,registry:Host@472,whole:Route@410 966e1fb668d3910ccb102845f1c5c91a1aa2cfa857bbf0ca11d850945259c682
+internal/console/server.go Server.channelHosts legacy accepted-legacy accepted-legacy;rev3=J1;basis=root-route;rev3=census-ruling-console-remote-instances;basis=Canary-retire guard also counts the account's instance records (ListRecordsStrict under the lifetime judge, listRecordsStrict) and sidecar records (listed, then each read with GetSidecarRecord; any read error refuses) naming the channel; with none, it refuses unless the app has settled (retireUnsettled). The registry read is as on main. Fails closed. registry:App@424,registry:Channel@441,registry:Host@472,whole:Route@410 05c81080b1bd975c844e031830246881397e2b1864e1dc4a27bd425c77535d99
internal/console/templates/app_overview.html external legacy accepted-legacy accepted-legacy;rev3=J4;basis=root-input;rev3=census-ruling-console-remote-instances;basis=Running tile does not claim Served when a route's state is unknown and reads the existing 'no data right now' when every instance's state is unknown; Web addresses tile reads 'no data right now' instead of 'DNS & certs OK' for a domain with no reading; display only. file:external@0 2a112ff768c300894881b858e61465841c87810ca7cb1d98a0fe2a54155a0ca1
internal/console/apiinstances.go Server.instanceHealth legacy accepted-legacy accepted-legacy;rev3=J1;basis=root-route;rev3=census-ruling-console-remote-instances;basis=Records with no local registry row get health only from remoteFacts: a box report whose rollout entry names the record's own account and app, generated after the record was created (held down: Failed; transient, unidentified or unread: Can't tell right now), readings pinned to that box and bounded by the record's created_at and the report's generation. Builds registry.Route literals from the record; reads no registry for them. registry:Account@1987,registry:Account@2007,registry:App@1948,registry:App@1964,registry:Host@839,registry:Unit@2117,registry:Unit@2159,whole:Route@1151,whole:Route@2054,whole:Route@2075,whole:Route@2887,whole:Route@3596,whole:Route@4110,whole:Route@4163,whole:Route@4278,whole:Route@792,whole:Route@821,whole:Route@832,whole:Route@850 c6e49aec6194fbb4ce76a51610708b4d9a4de82f2a8ae6a52f4ae25a1a06135b
internal/console/view.go Assemble legacy accepted-legacy accepted-legacy;rev3=J1;basis=root-route;rev3=census-ruling-console-remote-instances;basis=Collects the set of local registry hosts (rt.Host) so a record host the registry has gets no remote row (its record's created_at bounds the local row's metrics history); adds rows from the account's records and remoteFacts when given a remote source. registry:App@1716,registry:App@1739,registry:App@2117,registry:App@2147,registry:Backing@2017,registry:Caps@1385,registry:Channel@960,registry:Environment@1942,registry:Hibernate@1859,registry:Host@1768,registry:Host@861,registry:Kind@1783,registry:Platform@1889,registry:Provisioned@2042,registry:Status@1800,registry:Unit@1999,registry:Version@1823,whole:Route@2092,whole:Route@2167,whole:Route@810,whole:Route@839,whole:Route@910 120ae8c042523f872fd1c19357b8bb830e4afe9da1e38ad202df2ada3ad52ada
-@coverage internal/console 1573003bed1ed9afdbb1d94a158b14d447f3ed17005169e0480b0a8bfb03734c
+@coverage internal/console b685e1f3583949edb1f14426d4e7e6ab9eb25a8afc848dc180ba8484912d8e39
@coverage internal/console/templates 76bacccad8d4be132d3f34ac6c652bdb16bc455f75f92efc12428351f9c19491