Hold Base's door on a resume too; widen the canonical pin test
Human
Prompt
Fable 5.2 APPROVED base-adoption. Fix the open items before merge, test-first: S1 preflight's resume exemption admits Base with a 200 door; N1 compare the full canonical set; N2 add 503 and 302 door answers; N3 say Base's rollback also passes on the first probe.
From this commit's own message. The prompt ledger has no entries for it — which is what a squashed, rebased or amended commit looks like, and what every commit looks like in a repo without a ledger.
Summary
S1: Preflight's resume exemption (both agent keys the journal's own, door agent-shaped) now applies only to a door that moves; Base's held agent-401 baseline must still answer the challenge, so a 200 without a token is refused (operations-agent-200). N1: TestCanonicalOriginIsHomes also ranges over provision.ReservedLabels; adding "forget" to Alta's CanonicalOrigin now fails it. N2: Base's CheckDelivery table refuses a 503 and a 302 door. N3: docs/base-adoption.md says rollback-config also completes on its first probe for Base, and describes the resume rule. README's "Adopting the six existing apps" heading is now "the existing apps".
Agent notes
The S1 resume case failed first (codes [] where operations-agent-200 was wanted); N1 verified by applying the review's "forget" mutation (fails) and reverting it. N2 pins existing behaviour, so it passed before and after. S3, the homecompat re-pin to Home #157's merge commit, waits on that merge.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
5 files changed,
+51
−9
README.md+1 −1adopt/base_test.go+30 −3adopt/snapshot.go+6 −2docs/base-adoption.md+7 −2homecompat/canonical_test.go+7 −1
CI passed — run details
CI log
=== vet === go vet ./... === fmt === === test === CGO_ENABLED=0 go test ./... ok amadan.net/oficina/alta/adopt 23.965s ok amadan.net/oficina/alta/carlosop (cached) ? amadan.net/oficina/alta/carlosop/fakecarlos [no test files] ok amadan.net/oficina/alta/cmd/alta (cached) ok amadan.net/oficina/alta/cmd/alta-adopt 37.216s ok amadan.net/oficina/alta/console (cached) ? amadan.net/oficina/alta/console/fakeconsole [no test files] ok amadan.net/oficina/alta/homeop (cached) ok amadan.net/oficina/alta/homeop/fakehome (cached) ok amadan.net/oficina/alta/internal/web (cached) ok amadan.net/oficina/alta/provision (cached) === compat === cd homecompat && go vet ./... && CGO_ENABLED=0 go test ./... ok amadan.net/oficina/home/altacompat 0.684s
diff --git a/README.md b/README.md| index 3042903..ac0c16e 100644 |
| --- a/README.md |
| +++ b/README.md |
| @@ -216,7 +216,7 @@ recorded here instead (Fable's rulings on oficina/alta #1): |
| pair Paul sets by hand (see Profiles). |
| - **§11, Help**: the account menu has no Help items yet (no Colophon page). |
| -## Adopting the six existing apps (`alta-adopt`) |
| +## Adopting the existing apps (`alta-adopt`) |
| `alta-adopt` is a second binary, run on Paul's machine and never deployed. |
| It joins the eight canonical apps (docs, sheets, slides, calendar, calls, |
diff --git a/adopt/base_test.go b/adopt/base_test.go| index fa05076..0bbe91c 100644 |
| --- a/adopt/base_test.go |
| +++ b/adopt/base_test.go |
| @@ -101,6 +101,31 @@ func TestPreflightHoldsBaseToItsDoor(t *testing.T) { |
| } |
| wantCodes(t, codes, c.want) |
| } |
| + // On a resume, with both agent keys the journal's own, the exemption |
| + // for a door that has moved does not apply: Base's door never moves, |
| + // so it must still give the challenge, never a 200 without a token. |
| + keys := AgentKeys(appNamed(t, "base")) |
| + mine := map[string]string{keys[0]: Issuer, keys[1]: fixtureSQID} |
| + for _, c := range []struct { |
| + ops func(w http.ResponseWriter) |
| + want string |
| + }{ |
| + {baseOps401, ""}, |
| + {agent200(`{"operations":[]}`), "operations-agent-200"}, |
| + {nil, "operations-absent"}, |
| + } { |
| + x := newCarlosFixture(t, "base") |
| + for k, v := range mine { |
| + x.f.SetVar("base", "", k, v) |
| + } |
| + x.site.ops = c.ops |
| + _, codes := x.preflight(t, mine) |
| + if c.want == "" { |
| + wantCodes(t, codes) |
| + continue |
| + } |
| + wantCodes(t, codes, c.want) |
| + } |
| } |
| // The runner's whole delivery check records for Base with its door |
| @@ -115,9 +140,11 @@ func TestCheckDeliveryRecordsBaseWithItsDoorHeld(t *testing.T) { |
| t.Fatalf("no check recorded (ok %v, err %v)", ok, err) |
| } |
| for name, ops := range map[string]func(http.ResponseWriter){ |
| - "absent": nil, |
| - "app-401": app401, |
| - "open": agent200(`{"operations":[]}`), |
| + "absent": nil, |
| + "app-401": app401, |
| + "open": agent200(`{"operations":[]}`), |
| + "503": respond(http.StatusServiceUnavailable, map[string]string{"Cache-Control": "no-store", "Content-Type": "application/json"}, `{"error":{"code":"unavailable","message":"Base could not answer. Try again."}}`), |
| + "redirect": respond(http.StatusFound, map[string]string{"Location": "/signin"}, ""), |
| } { |
| w := newCheckFixture(t, "base") |
| w.site.ops = ops |
diff --git a/adopt/snapshot.go b/adopt/snapshot.go| index 802cab4..cf037fe 100644 |
| --- a/adopt/snapshot.go |
| +++ b/adopt/snapshot.go |
| @@ -314,7 +314,8 @@ func inherits(eff carlosop.Effective, writeLayer string, keys [2]string) bool { |
| // BaselineOps(app) says, or, on a resume, both agent keys are the |
| // journal's own (as above) and the door gives agent-access's answer: |
| // a baseline Delivered could never move on is refused before it is |
| -// journalled. |
| +// journalled. The resume exemption never applies to a held door |
| +// (Base's): it must still give the challenge, never a 200. |
| // |
| // An error is a read that failed; it is not a refusal to guess past. |
| func Preflight(ctx context.Context, c *carlosop.Client, h *http.Client, app provision.App, mine map[string]string) (Snapshot, []string, error) { |
| @@ -370,7 +371,10 @@ func Preflight(ctx context.Context, c *carlosop.Client, h *http.Client, app prov |
| if d.Health != http.StatusOK { |
| add("healthz") |
| } |
| - if d.Ops != BaselineOps(app) && !(bothOurs && d.Ops.agentShaped()) { |
| + // The resume exemption is for a door that moves. A held door (Base's |
| + // agent-401 baseline) never moves, so it must still answer as before. |
| + moved := bothOurs && d.Ops.agentShaped() && !BaselineOps(app).agentShaped() |
| + if d.Ops != BaselineOps(app) && !moved { |
| add("operations-" + string(d.Ops)) |
| } |
| return snap, sortedSet(codes), nil |
diff --git a/docs/base-adoption.md b/docs/base-adoption.md| index 0296676..6069a94 100644 |
| --- a/docs/base-adoption.md |
| +++ b/docs/base-adoption.md |
| @@ -40,7 +40,9 @@ requires the same challenge after the restart. Everything else in the |
| check is unchanged. In code: `BaselineOps(base) = agent-401` |
| (`adopt/delivery.go`); `Delivered` then admits only agent-401 to agent-401 |
| for Base, and refuses a 404, an app 401, any other answer, and a 200 |
| -without a token. |
| +without a token. On a resume, preflight's exemption for a door that has |
| +already moved (both agent keys the journal's own) does not apply to Base: |
| +its door must still give the challenge. |
| **What it keeps for Base.** The reviewed release, unchanged across the |
| restart, with no redirect and `/healthz` 200; the instance, environment, |
| @@ -58,7 +60,10 @@ The check stays void on any later change, as for every app. |
| Base never reads them. They are written, but they do nothing. |
| 2. **No evidence that the restart happened.** The old process answers the |
| same as the new one, so the first probe after the restart can pass. |
| - This matters only for item 1, which is moot. |
| + The same holds for `rollback-config`: `Reverted` waits for the door's |
| + baseline shape, which Base's door never left, so a rollback also |
| + completes on its first probe. Both matter only for item 1, which is |
| + moot. |
| 3. **No delegated access through connect.** Once Base's row is live, |
| oficina-connect may route team `oficina`'s delegated calls to |
| `https://base.oficina.works/api/v1`. Base refuses them with its 401, |
diff --git a/homecompat/canonical_test.go b/homecompat/canonical_test.go| index 5ffc68e..22bbf7e 100644 |
| --- a/homecompat/canonical_test.go |
| +++ b/homecompat/canonical_test.go |
| @@ -14,7 +14,13 @@ import ( |
| // that Home does not bind is a plan Home refuses, and the reverse is an |
| // app Alta would never offer. |
| func TestCanonicalOriginIsHomes(t *testing.T) { |
| - names := append(provision.Slugs(), "fichas", "mapa", "alta", "home", "", "Base", "base.oficina.works") |
| + // ReservedLabels holds every app-like name (each app's, the suite's |
| + // and the platform's own), so a name added to either registry that |
| + // the other lacks fails here. |
| + names := append(provision.Slugs(), "", "Base", "base.oficina.works", "https://base.oficina.works") |
| + for label := range provision.ReservedLabels { |
| + names = append(names, label) |
| + } |
| for _, app := range names { |
| if got, want := homeop.CanonicalOrigin(app), directorydata.CanonicalOrigin(app); got != want { |
| t.Errorf("CanonicalOrigin(%q): Alta %q, Home %q", app, got, want) |