| new file mode 100644 |
| index 000000000..ab64dc7ca |
| --- /dev/null |
| +++ b/internal/provision/regional_domains_447_census_test.go |
| @@ -0,0 +1,117 @@ |
| +package provision |
| + |
| +// Record-write census entries for #447 (branch regional-domains-447, |
| +// regional custom-domain placements), layered on |
| +// freshBox446WriteCensusInventory (main's newest as merged into this |
| +// branch). Reviewed by the branch author against the source; the |
| +// census approval is recorded on #280 with the root-read card |
| +// (docs/superpowers/notes/census-proposal-regional-domains-447.md). No |
| +// record write is added: the claim writers are domain claims (nonrecord), |
| +// the record creates keep their typed writers, and the one new record-key |
| +// unit only lists and parses keys. |
| +// - claimRawSetClaimPlacements (domains) is new: the placements door's |
| +// claim writer. It stamps schema 2, clears pending, sorts the placements |
| +// by region, refuses with ErrBadPlacements a claim ValidPlacements |
| +// rejects (or with no account or app, or a host NormalizeAliasHost does |
| +// not keep as is), writes nothing when the bytes equal cur's, and Puts |
| +// ClaimKey(host): create-only with cur nil and etag "", a CAS on etag |
| +// otherwise, a lost CAS returned as it is. A domain claim, not a record: |
| +// nonrecord, sel:Put. |
| +// - setClaimCapabilitiesAt (domains) is new: the capability write moved out |
| +// of claimRawSetClaimCapabilities so the console's capability door can |
| +// write against the claim it read under regionalMu |
| +// (claimRawSetClaimCapabilitiesAt, which calls it). Owner gate and |
| +// instance catch-all refusal as before, same values a no-op, a regional |
| +// claim's capabilities refused (ErrRegionalClaim), an empty etag refused |
| +// as a CAS conflict, then one Put of ClaimKey(host) with a CAS on etag. |
| +// nonrecord, sel:Put. |
| +// - claimRawSetClaimCapabilities (domains) leaves the inventory: it keeps |
| +// its reread-and-retry loop but its Put is now setClaimCapabilitiesAt's, |
| +// so it holds no write site. |
| +// - claimRawSetClaimPaths (domains), re-pinned: a regional claim carries no |
| +// prefix map (ErrRegionalClaim) after the owner gate; the same Put. |
| +// nonrecord. |
| +// - claimRawAttachInstanceCatchall (domains), re-pinned: a regional parent |
| +// lends no instance catch-all (ErrRegionalClaim, answered only after the |
| +// parent's owner check); the same create-only Put. nonrecord. |
| +// - AttachClaimProven (domains), re-pinned: the caller's own regional claim |
| +// is a no-op when Route is one of its bound hosts and ErrRegionalClaim |
| +// otherwise, before the converge, so this writer never writes one; the |
| +// pending-expiry helper is renamed PendingLive. The same Puts, schema 1. |
| +// nonrecord. |
| +// - RecordHostDeclared (provision) is new: the placements PUT's |
| +// never-served check (regionalEvidenceRefusal) that no instance record, |
| +// under any account and app, declares the host. It lists the instances/ |
| +// subtree of every known account (knownAccounts, listAppSubtree, both |
| +// refusing an incomplete walk) and parses each key with ParseRecordKey, |
| +// comparing the host. It reads keys only and writes nothing: key-site, |
| +// like Reconcile's ParseRecordKey. |
| +// - Server.createRecordMarked (console), re-pinned: takes the hostname |
| +// exclusion after the app lock and runs the regional recheck |
| +// (regionalRecheck, a claim read) before the first-kind recheck and the |
| +// mark, then calls instanceCreateStage, a test hook (nil in production), |
| +// after the same provision.CreateRecord. record-writer. |
| +// - Server.createRecordWithLifetimeLocked (console), re-pinned: the |
| +// regional recheck after the app read and before admit and |
| +// BeginAllocation, so a refusal leaves no pending allocation; the same |
| +// RecordKey use. key-site. |
| +// - Server.handleAPIDomainAttach (console), re-pinned: maps |
| +// domains.ErrRegionalClaim to a 409 with its own text; the same |
| +// instances literal. key-site. |
| +// - Server.registerCLIRoutes (console), re-pinned: two more routes, GET |
| +// .../domains/{host}/placements (the per-host read's roles and team |
| +// scope) and PUT .../domains/{host}/placements (no service role); its |
| +// instances and sidecars literals are unchanged. key-site. |
| +func regionalDomains447WriteCensusInventory() []censusEntry { |
| + entries := append([]censusEntry(nil), freshBox446WriteCensusInventory()...) |
| + removed := map[string]bool{ |
| + "internal/domains/claims.go:claimRawSetClaimCapabilities": true, |
| + } |
| + var kept []censusEntry |
| + for _, e := range entries { |
| + if !removed[e.File+":"+e.Unit] { |
| + kept = append(kept, e) |
| + } |
| + } |
| + if len(kept) != len(entries)-len(removed) { |
| + panic("regional-domains-447 removes an unlisted unit") |
| + } |
| + entries = kept |
| + repins := []censusEntry{ |
| + {"internal/domains/claims.go", "claimRawSetClaimPaths", "nonrecord", "sel:Put", "bd309c9b204bca24ecf97269dc2941af7a8fdd23a1adac9be84d813cecb5a50a"}, |
| + {"internal/domains/claims.go", "claimRawAttachInstanceCatchall", "nonrecord", "sel:Put", "fabe206d81b2d04ca1c4879a3cd0ff2992f0c8d522435eca76585457a209b82e"}, |
| + {"internal/domains/claims.go", "AttachClaimProven", "nonrecord", "sel:Put", "86a046e43fad009310b44612a7976c20c87c413c3a969f74b031928342ab52f6"}, |
| + {"internal/console/hostsused.go", "Server.createRecordMarked", "record-writer", "key:CreateRecord,key:RecordKey", "c90cd27b8c886cf8c09eda53d25ecc4cb376e1f3400ac8afce4670ecbd45ab3c"}, |
| + {"internal/console/lifetimes_create.go", "Server.createRecordWithLifetimeLocked", "key-site", "key:RecordKey", "e04dc27d9ce2e829e3c1b97201fc032b20029051118c0119fca5fe8ac1d294c7"}, |
| + {"internal/console/apidomains.go", "Server.handleAPIDomainAttach", "key-site", "lit:instances", "d98f3c0c07d951d7154057e61b04d328caece9f502fdb5b5db39fa6649430894"}, |
| + {"internal/console/authcli.go", "Server.registerCLIRoutes", "key-site", "lit:instances,lit:sidecars", "5dc9bbb64cd67252b6016ae003dae855dbea033eddded7e505330686acd6a3ae"}, |
| + } |
| + for _, r := range repins { |
| + found := false |
| + for i, e := range entries { |
| + if e.File == r.File && e.Unit == r.Unit { |
| + if e.Class != r.Class || e.Kinds != r.Kinds { |
| + panic("regional-domains-447 re-pin changes the class or kinds of " + r.File + ":" + r.Unit) |
| + } |
| + entries[i], found = r, true |
| + } |
| + } |
| + if !found { |
| + panic("regional-domains-447 re-pin of an unlisted unit " + r.File + ":" + r.Unit) |
| + } |
| + } |
| + additions := []censusEntry{ |
| + {"internal/domains/claims.go", "claimRawSetClaimPlacements", "nonrecord", "sel:Put", "59e757705e2b0f1409e9f4b851daf2372811349ca7d0f9bde911a63dccba6fdc"}, |
| + {"internal/domains/claims.go", "setClaimCapabilitiesAt", "nonrecord", "sel:Put", "784fe5f994dcb2c00025933dbfee0857d0983b63c2b45d1accd99b8f7286a082"}, |
| + {"internal/provision/recordhost.go", "RecordHostDeclared", "key-site", "key:ParseRecordKey,lit:instances", "89b00b6ba8ec1485edccb852bffb043f4b2dcf13bcb01ae257570feebfd27e27"}, |
| + } |
| + for _, a := range additions { |
| + for _, e := range entries { |
| + if e.File == a.File && e.Unit == a.Unit { |
| + panic("regional-domains-447 adds a listed unit " + a.File + ":" + a.Unit) |
| + } |
| + } |
| + entries = append(entries, a) |
| + } |
| + return entries |
| +} |