oficina / home Public

Gate 9 reaches the native endpoints

Human

Prompt

Implement the Home (id.oficina.works) half of slice A of the approved Oficina ID native spec. Paul approved the spec and building on 2026-11-14.

Read first: native-levelup/BRIEF.md (own worktree from fresh origin/main, repo AGENTS.md, amadan workflow, agent account, never -as-human, pinned-toolchain make gates, no deploys, do not merge). Then in the Home repo: docs/superpowers/specs/2026-11-14-oficina-id-native.md (binding; slice table §14), 2026-11-13-oficina-id-slice-1.md (binding base), Home AGENTS.md.

Scope — slice A, Home side only (another agent does connect/NativeExchange/choose page/IsHomeDerived in parallel on its own branch; a third does the Swift client; coordinate only through the spec's wire formats, and if the spec is ambiguous about a wire detail, pick the reading most consistent with it, write it into a short "wire notes" section of your branch description, and flag it):
- the native grant + device-key proof (§3), persistent replay table, per-grant rate limit, server Date for clock offset;
- email code start/resend/verify with every limit in §4 (per-(address, device key) caps, daily cap, returning-key exemption by end_reason, per-IP-bucket live starts, 503 when full, shared email budget with the web, sealed addresses, no codes/addresses in logs; Keymail addresses get the code in slice A);
- native passkey sign-in (§5): passkey/begin, passkey/finish against RP id.oficina.works, plus the static /.well-known/apple-app-site-association with webcredentials for the five App IDs 9U4A84C4WK.works.oficina.{calls,docs,sheets,calendar,memoria} (no applinks);
- assert with the shared mintPolicy (empty in slice A), native nonce derivation;
- signout, "Sign out all devices" on the web, replacement revoking every grant, first passkey enrolment (native or web) revoking passkey-less grants;
- directory teams listing + zero-teams help;
- every slice-A gate in §13 that belongs to Home, as tests.
Not in scope: A2 (multiple identities UI, Devices page, Keymail sheet), B (native recovery/enrolment), C–E.

Process: small reviewable commits; make ci green; push; describe the branch on the hub with tasks; stop for review. Report: branch, tip, what's done vs deferred, gate output, wire notes, open questions.

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

TestNoContentInLogsNative: the walked gate 9 runs the legacy role, where no native route mounts, and logs to a discarded logger. This one captures the apps' own loggers and the default, drives a full code sign-in, assert and directory exchange with a canary address plus an undeliverable mail, then sends canary-laden garbage to every native route on both origins, and asserts no canary reached a record.
Agent notes
Pre-existing, not fixed here: TestNoContentInLogs builds its app with quietLogger(), which discards, so a handler logging through a.logger is not scanned by the walked gate. Worth a follow-up that hands it the recorder.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude agent, operated by paul@keymail.dev pushed by paul@keymail.dev 7acd230a2f8c2116899da04fcfb0969148f40a79 parent ca1f32a
1 file changed, +66 −0
  • internal/home/native_logs_test.go +66 −0

CI failed — run details

diff --git a/internal/home/native_logs_test.go b/internal/home/native_logs_test.go
new file mode 100644
index 0000000..0509ebc
--- /dev/null
+++ b/internal/home/native_logs_test.go
@@ -0,0 +1,66 @@
+package home
+
+import (
+ "log"
+ "log/slog"
+ "net/http"
+ "net/http/httptest"
+ "strings"
+ "testing"
+
+ "amadan.net/oficina/home/internal/home/logtest"
+)
+
+// TestNoContentInLogsNative is gate 9 extended to the native endpoints (§4:
+// "Gates 1, 2 and 9 extend to this table"). TestNoContentInLogs walks the
+// legacy role's router, where none of these mount, and its app logs to a
+// discarded logger; this one captures both the app's logger and the
+// default, drives a full code sign-in and assert with a canary address,
+// then sends canary-laden garbage to every native route on both origins.
+func TestNoContentInLogsNative(t *testing.T) {
+ rec := logtest.NewRecorder()
+ prevLogger, prevWriter, prevFlags := slog.Default(), log.Writer(), log.Flags()
+ slog.SetDefault(slog.New(rec.Handler()))
+ t.Cleanup(func() {
+ slog.SetDefault(prevLogger)
+ log.SetOutput(prevWriter)
+ log.SetFlags(prevFlags)
+ })
+
+ f := newMountedChooser(t)
+ app := f.p.credential
+ app.logger = slog.New(rec.Handler())
+ f.p.directory.logger = slog.New(rec.Handler())
+ address := strings.ToLower(logtest.Canaries[0])
+
+ d := newDevice(t)
+ grant, _ := d.signInByCode(t, app, address)
+ verifier, challenge := verifierFor(30)
+ w := d.assert(t, app, grant, directoryOrigin, challenge)
+ directoryCall(t, f, "POST", nativeExchangePath, exchangeBody(decodeReply(t, w)["assertion"].(string), verifier), nil, nil)
+ start := d.start(t, app, address)
+ d.verify(t, app, start, "000000")
+ app.secrets.Mailer = failingMailer{}
+ e := newDevice(t)
+ if w := e.call(t, app, nativePrefix+"/code/start", map[string]string{"email": address, "device_key": e.public(), "platform": "ios"}, ""); w.Code != 503 {
+ t.Fatal("undeliverable start", w.Code)
+ }
+
+ body := `{"email":"` + address + `","device_key":"` + logtest.Canaries[1] + `","platform":"` + logtest.Canaries[2] + `","start":"` + logtest.Canaries[1] + `","code":"` + logtest.Canaries[2] + `","pending":"` + logtest.Canaries[1] + `","aud":"https://` + logtest.Canaries[1] + `.example","challenge":"` + logtest.Canaries[2] + `"}`
+ for _, path := range []string{"/code/start", "/code/resend", "/code/verify", "/passkey/begin", "/passkey/finish", "/assert", "/signout"} {
+ r := httptest.NewRequest("POST", Origin+nativePrefix+path, strings.NewReader(body))
+ r.Header.Set("Content-Type", "application/json")
+ r.Header.Set("Oficina-Proof", logtest.Canaries[0]+"."+logtest.Canaries[1])
+ r.Header.Set("Authorization", "OficinaID "+logtest.Canaries[2])
+ r.Header.Set("X-Forwarded-For", logtest.Canaries[0])
+ app.Router().ServeHTTP(httptest.NewRecorder(), r)
+ }
+ for _, path := range []string{nativeExchangePath, nativeDirectorySignout, nativeTeamsPath} {
+ method := "POST"
+ if path == nativeTeamsPath {
+ method = "GET"
+ }
+ directoryCall(t, f, method, path, body, &http.Cookie{Name: f.p.directory.sessions.CookieName(), Value: logtest.Canaries[1]}, map[string]string{"X-Forwarded-For": logtest.Canaries[0]})
+ }
+ rec.AssertNoContent(t)
+}