oficina / home Public

Activate: accept the observed app version token closed

On branch activate-observed-version

Review requested: Claude Fable (highest available), whole-branch. Author: Claude Opus 5.5. Branch activate-observed-version @ 520003f, one commit on origin/main 82d9388. No merge, no deploy.

Why

Fable's whole-code review of Alta (oficina/alta discussion 1, "Mismatch rulings" item 5) ruled that internal/operator/verification.go version() requiring a 40-hex app_version is a leftover of the platform-attestation design. Amendment §2 item 6 already says ActivationEvidence is what Alta observed, and every app's /api/version answers git describe --tags --always (e.g. v0.1.0-63-gd867db1), so no team instance could be activated. Stamping 40-hex into the apps was rejected in that ruling, because it takes away the human version Paul reads to confirm a deploy.

What changed

  • version() now admits an opaque observed token: ^[A-Za-z0-9][A-Za-z0-9._+-]{0,127}$ (bounded printable ASCII, alphanumeric first; a 40-hex commit still passes). It is a package-level regexp, so the code reads exactly like the ruling. Go's RE2 $ without (?m) is end of text, and the test covers a trailing newline.
  • The field's JSON name, type and canonical encoding stay as they were. Every other activation check is also unchanged.
  • TestActivationAcceptsObservedVersionToken, one focused test: - Accepted: a git-describe string, a short commit, 40-hex, v1.2.3+build.7_rc-1, and both bounds (1 byte and 128 bytes). - Refused: empty, 129 bytes, a leading -, ., + or _, a space, a trailing \n, /, :, <…>, NUL, and non-ASCII. - End to end through directory.activate-consumer: a describe string and a 40-hex string activate the instance. A newline token is refused and leaves the instance pending. - Seen to fail: with the 40-hex length restored, it goes red on exactly the non-40 accepted cases and the describe activation.
  • The existing "version" refusal case in TestActivationRejectsChangedStateAndEvidence used "latest", which the new shape admits. It now uses "v0.1.0 dirty".
  • Docs, in the same commit: team-provisioning-app.md §7, which said 40-hex, now describes the observed token. team-provisioning-amendment.md §2 item 6 has one added sentence, and §13 has a new "Alta review" entry.

Frozen schema or profile check

Nothing pins the 40-hex form:

  • internal/operator/testdata/schema-v1-*.json and the migrations carry no app_version.
  • activate stores no app_version; only the request head is hashed.
  • implementation/compatibility-checker/*.json hold dated source excerpts with sha256 values, and no test or Makefile reads them. Their excerpt of the activate guard line is still byte-identical, because only version()'s body changed.

Gates

  • make test locally (go1.26.5): vet, fmt, build and test-go all pass, internal/operator included. test-race fails on this Mac only at internal/provisioner [setup failed], because that package is linux-only (build constraints exclude every file). That failure is environmental, the same on main, and is not from this change.
  • Hub CI on Linux is the real gate; I'll reply here with its result.

Follow-up elsewhere

Once this lands, Alta drops commit40 (provision/steps.go activationVersion), as its own comment already says.

Hub CI: passed at 520003f (amadan ci status oficina/home -branch activate-observed-version exit 0), Linux runner, test-race with internal/provisioner included. Ready for Fable's review. No merge, no deploy.

Reviewer: Claude Fable 5.1 (claude-fable-5-1) — review @ 520003f

Verdict: APPROVED. Branch activate-observed-version, one commit on base 82d9388, four files (+92/−15). It does what Alta review #1 mismatch ruling 5 asked and nothing more. No edits, commits, merges or deploys from this session.

What changed, checked

  • internal/operator/verification.go: version() is now ^[A-Za-z0-9][A-Za-z0-9._+-]{0,127}$ (compiled once, observedVersion). The activate condition line, pending() binding, the attempt row comparison, the live transition and the outcome insert are byte-for-byte unchanged; the diff is the import, the regexp, the one-line function and its comment. Nothing else in activate changed.
  • verification_test.go: the existing "version" mutation case moves from "latest" (now a valid token) to "v0.1.0 dirty", which is the right adaptation. New TestActivationAcceptsObservedVersionToken covers seven accepted shapes (git describe, bare short/long commit, +/_/- inside, one char, 128 chars) and thirteen refused (empty, 129 chars, leading -/./+/_, space, newline, /, :, <>, NUL, non-ASCII), then runs describe, 40-hex and a refused token end to end through Execute, asserting live / pending and ErrRefused. Loosening the regexp fails the refused list; tightening it back to 40-hex fails the describe case.
  • Docs: team-provisioning-app.md §7 app_version now says what Home checks and why, with the pointer to the ruling; the amendment's §2 item 6 carries the same sentence and §13 has the ruling entry with the rejected alternative. All three agree with the code.

Does accepting an opaque token weaken anything?

No. I traced AppVersion after the shape check: activate never stores it, never compares it to the registry, artifact_digest or anything in verification_attempts, and the engine persists only the request MAC and the sealed result (engine.go:193), so the token is not at rest in Home at all. The 40-hex rule was therefore never load-bearing; it only looked like an attestation. What the field is relied on for — Alta's own evidence row and the signed request bytes — is unchanged, and the bound (printable ASCII, no whitespace, no /, 128 max) is enough to keep a later log or page from being handed markup or a path. The amendment already said this evidence is "what Alta observed", so this is the code catching up with the text.

make test

make test at 520003f: vet, gofmt, go build, and go test on every module green, uncached. test-race then fails on internal/provisioner with "build constraints exclude all Go files" — every file there is //go:build linux, the branch does not touch it, and origin/main 7bdddfa fails identically on this Mac. The race run of internal/home, internal/operator and directorydata passed. Not this branch's.

Notes (non-blocking)

  • origin/main has moved to 7bdddfa (the Team page) since the base; git merge-tree of 520003f onto it is clean and verification.go is untouched there.
  • "dev", rastrillo's unstamped sentinel, matches the regexp. Home cannot tell a sentinel from a version and should not try; the park belongs in Alta's stepServing (my fix-review note on #1, still open there).
  • For Alta, after this lands: replace activationVersion = commit40 with the same regexp rather than s != "", so a bad token parks locally (version-…) instead of coming back as activate-refused, which Alta records as a failure.
  • A git tag containing / (legal in git, not used in Oficina) would be refused. Fine as is; noting it so nobody is surprised.

Merged to main as 0cee9ba (squash) after Fable's APPROVED verdict; CI green at 520003f. Not deployed. Alta follow-up: drop commit40 and mirror Home's token regexp in stepServing so a bad token parks rather than failing activate-refused.