oficina / equipo Public

Clone
git clone https://amadan.net/oficina/equipo

Plain git — no account needed to clone.

Download

Download this file

1# Preview pass controller report
2
3Branch: `preview/pass`. Base: `7c113ac8`. Design approved by the controller on
42026-11-26 in `2026-11-26-preview-pass.md`.
5
6## Delivered behavior
7
8A device tap mints a 32-byte pass through the device bearer API. A dedicated
9non-persistent WKWebView posts it in a bounded form body to the instance. The
10single-use exchange issues a separate, hashed, task-bound browser grant and
11redirects to the existing preview wrapper. It creates no general sign-in.
12The per-task __Host-equipo-preview-{taskID} cookie is host-only, Secure,
13HttpOnly and SameSite=Strict with Path=/. Server authority permits only the
14bound wrapper's exact GET. Only a well-formed secret under that task's name
15selects the restricted lane; junk and other tasks' cookies are ignored. Once
16selected, invalid grants never fall through to ordinary browser sign-in.
17
18Pass lifetime is at most 60 seconds; grant lifetime is at most 15 minutes,
19capped by the originating credential and preview. Reads never extend it.
20The transaction rechecks the roster, device, backing native session, task,
21candidate, step attempt and deployment fingerprint. Secret lookup uses an exact
22indexed SHA-256 hash. The tested query plan and executed SQL both pin that down.
23Issuance and exchange are limited by device and IP; unknown tokens consume the
24IP allowance. Cookie values and pass bodies do not enter audit records.
25
26The shared renderer preserves its CSP, sandbox and referrer policy. The native
27sheet allows only the fixed POST exchange and exact GET wrapper as main-frame
28navigation; no popups, downloads, custom schemes or device bearer enter it.
29Each presentation owns a new non-persistent WebKit store. Dismissal, expiry,
30changed deployment, sign-out and account replacement dispose it. Foreground
31revalidation checks the task and reloads only the same bound wrapper.
32
33No runner protocol change. The additive app-owned tables are in Models and the
34migration snapshot. The device endpoint and response are in OpenAPI. Existing
35browser sign-in continues when no well-formed grant selects the restricted lane.
36
37## Copy
38
39Luna approved api.preview_changed and api.preview_expired on 2026-11-26.
40Both are marked in copy.go and imported byte-identically under native parity.
41The wrapper retains evidence.candidate_changed and question.expired; the unused
42native copies of those keys are removed. The original import also restored two
43already-reviewed stop reasons missing on the base: merge_credential and
44amadan_unreachable. No copy questions remain.
45
46## Test-first evidence
47
48Initial store stubs refused all mint requests: `go test ./internal/equipo -run
49'^TestPreview' -count=1` failed the new single-use/lifetime and binding tests.
50Initial HTTP stubs left the mint route absent and allowed normal-session
51fall-through: the HTTP tests failed on 401 mint and 200 invalid-cookie fallback.
52Native stubs failed nine assertions across the first four tests. Implementation
53then passed those tests. Evidence is retained in `site/build/slice6/validation`.
54
55The real Chromium browser lane posts a pass, follows the 303, loads the wrapper
56and its iframe, then proves replay returns 404. The actual iframe request has
57no Cookie, Authorization or Referer. Test-only TLS trust is confined to Chromium
58for the two local HTTPS test servers; production WebKit has no TLS override.
59
60## Mutations
61
6233 server guards and 19 native guards were broken deliberately, tested, and
63restored. All 52 logical mutations were killed by assertions, not compile errors.
64The scripts, individual test logs and result JSON are retained in the validation
65folder. Each server invocation uses `GOTOOLCHAIN=go1.26.11 CGO_ENABLED=0` and
66`go test ./internal/equipo -run <named test/subtest> -count=1`. Native mutations
67use `swift test --package-path native/apple --filter 'Preview(Pass|Lifecycle)Tests'`.
68
69Server: pass and grant duration; both indexed hash lookups; task and candidate
70binding; pass and grant expiry; hashed storage; revoked device and native
71session; instance, attempt, current candidate and deployment fingerprint;
72iframe cookie host and canonical trailing-dot host; Preview step candidate;
73final task; preview and device expiry caps; device and IP rate limits; Secure,
74HttpOnly and Strict cookie flags; no ambient-session fallback; GET-only grant;
75bounded exchange body; transactional audit; known refusal audit and device
76limit; single-use consumption.
77
78Native: private store; releasing web view, store and browser; session invalidation
79and permanent invalidation; exact expiry boundary; observed deployment change;
80foreground binding check; late-response generation; busy guard; pass alphabet;
81pass expiry and grant maximum; newest Preview selection; HTTPS; exact wrapper
82origin; GET-only wrapper; iframe cookie-host refusal.
83
84Initial survivors led to stronger tests: query SQL is checked as well as the
85query plan; the device check is tested independently of task authority; the
86body-bound test uses valid form padding; permanent model invalidation is tested
87with an otherwise usable client (session invalidation also disables its client).
88Initial mutation filters/targets were corrected to hit the intended
89subtest or occurrence. No surviving mutation is counted as killed.
90
91## Validation
92
93- Pre-merge native gate passed: 359 tests in 48 suites, one existing known issue;
94 334 web-parity strings, security scripts, fixtures and both platform builds.
95 Recorded in `preview-native-final-gate.log`.
96- `GOOS=linux GOARCH=amd64 make build` passed, including the Darwin runner build.
97- `GOOS=linux GOARCH=amd64 make vet` passed, including the Make target's Darwin
98 runner check. The ordinary Mac all-package build hits the existing Linux-only
99 toolproxy `unix.O_PATH` use. Linux hub CI is the authoritative full gate.
100- `make fmt-check budget spacing copy-release-check migration-check` passed;
101 `PATH="$(GOTOOLCHAIN=go1.26.11 go env GOROOT)/bin:$PATH"` used for gofmt.
102 Size records name the new code and measured totals.
103- Host-built staticcheck v0.7.0 with `GOOS=linux GOARCH=amd64`, tags
104 `browser,perf,testbuild`, passed. Host-built govulncheck v1.8.0 targeting Linux
105 found no reachable vulnerabilities. `make gitleaks` found no leaks.
106- `make lanes-check` passed: 18 regular and 5 browser lanes cover every test.
107- Preview store/HTTP/security tests passed, as did the device/OpenAPI contract
108 and migration tests. Final targeted and browser logs are retained.
109- The Make perf harness, targeted to `./internal/equipotest` on Mac, passed:
110 wrapper median 1.041 ms, worst 1.125 ms against 150 ms; cold boot median
111 154 ms against 500 ms. The new GET exchange refusal has an explicit skip record.
112- An initial validation attempt lost files from the shared Go cache. On the
113 controller's instruction, retried without clearing it. The retry passed.
114
115## Native captures and limitations
116
117`iphone-preview.png` and `mac-preview.png` are captured from the branch's built
118apps against the tagged manual Go fixture, using the actual bearer mint,
119POST-body exchange, wrapper cookie, shared wrapper and iframe. The external
120example page is disposable fixture content. The server is loopback-only behind
121a temporary HTTPS tailnet port. The fixture config contains a disposable test
122credential, stays private, and is deleted at teardown. It is not committed or
123archived. No production account or credential is used. The Mac image is the live
124sheet, captured with AppKit. Its header uses the app palette background so
125bitmap exports preserve the same readable surface as the window.
126
127The iframe's external service remains responsible for its own availability.
128Grant expiry prevents new wrapper reads; it cannot retract HTML already
129received by an arbitrary browser. Native disposes the delivered view at expiry.
130The pass does not approve an unsafe preview or confer any merge authority.
131
132Final commit and Linux CI verdict are sent to the controller after pushing;
133no merge, deployment or release is performed.
134
135
136## Main integration before publication
137
138Normally merged main `088e5863` after `2469eaa8`, as requested. Kept the
139Changed files tab and its explicit detail-only projection. The transactional
140`TaskAt` read shares authority and opts out of file facts; `TaskDetail` still
141opts in. Retained the new native load result and preview invalidation together.
142Moved the preview tables to migration 0109 after main's 0108 change-files field.
143Combined budget reasons and remeasured 23204 app source, 34984/9873 chat
144source/tests, and 11967 plan contract test lines. Re-ran validation on the merge.
145
146The merged native gate passed: 377 tests in 50 suites, one existing known issue,
147334 web-parity strings, and both builds (`preview-native-merged-gate.log`).
148Merged preview/visibility contracts, migration, copy, lane coverage and browser
149exchange checks passed. Changed-files projection tests passed on the merge.
150
151## CI copy-guard correction
152
153Linux CI at f149ba60 rejected the computed API error code in the mint handler
154with TestAPIErrorCopyKeys. Reproduced locally using
155`GOMAXPROCS=2 GOTOOLCHAIN=go1.26.11 CGO_ENABLED=0 go test ./internal/equipo -run '^TestAPIErrorCopyKeys$' -count=1`.
156The HTTP error branches now name their codes literally. The scanner is unchanged
157from main. The person API uses its ordinary api.<code> lookup. Luna approved
158api.preview_changed and api.preview_expired on 2026-11-26; they are marked in
159copy.go and imported byte-identically into both native catalogs under parity.
160Native errors and lifecycle expiry use these words; the wrapper retains its
161reviewed web words.
162
163TestPreviewErrorCopyKeys failed for both old runtime mappings, and the native
164staleAndExpiredWordsComeFromReviewedCatalog test failed with the old native keys.
165Both pass after switching to the approved API keys. TestAPIErrorCopyKeys failed
166without the two catalog entries, then passed. The scanner remains unchanged.
167
168The source budget was remeasured at 23214 lines. The initial Linux run's
169TestContractRetryAccountActions, TestTimeouts and TestBrowserCopyContinue
170failures each passed its automatic retry. The preview browser lane passed.
171
172Approved-copy validation: TestAPIErrorCopyKeys and all TestPreview tests passed
173in the app and person API packages; make copy-release-check, fmt-check and
174budget passed. The native gate passed 377 tests in 50 suites (one existing
175known issue), 336 parity strings, and both app builds.
176
177CI at 7bd80b29 passed the API copy scanner but identified the missing two review
178inventory rows. Added the exact approved text and Luna/date provenance to the
179Plan 3 inventory, following its existing explicit key/date acceptance checks.
180`go test ./internal/plan3test -run '^TestPlan3ReleaseBoundaries$' -count=1` passed
181after reproducing the missing-row failure. Test size is 11969 lines. No runtime
182or native code changed in this inventory correction.
183
184## Security review delta
185
186The server returns expires_in and grant_expires_in, rounded down from its mint
187clock and bounded to 1–60 and 1–900 seconds. Native ignores absolute timestamps
188for enforcement. It subtracts the full monotonic request elapsed time before
189starting its local timer; tests use device clocks five minutes ahead and behind,
1907.25 seconds of travel, and a pass that expires before receipt. No deadline
191slides or gains transit time.
192
193Host-prefixed per-task cookies prevent sibling-domain planting. Junk and another
194task's cookie do not select the restricted lane. Well-formed unknown, expired,
195duplicate or refused capabilities cannot fall through to ambient browser auth.
196Terminal passes are consumed and grants deleted atomically with one refusal
197audit. Replays add no refusal audit. Exchange and read prune expired rows too.
198Migration 0110 adds the two composite credential/task indexes without changing
1990109. Audit-failure tests prove token retirement rolls back with its audit.
200
201The child-frame policy permits only about:blank, about:srcdoc, blob: and data:
202in addition to the existing HTTPS child policy; main-frame rules are unchanged.
203Link previews are disabled. The real browser test now checks nested srcdoc and
204blob contents. The iPhone screenshot iphone-preview-frames.png uses the actual
205mint/exchange/wrapper and a local HTTPS child fixture. Only the disposable
206simulator trusts the local test certificate; production TLS handling is intact.
207The fixture initially checked before WebKit's dynamic blob finished; its bounded
208five-second content wait now reports ok=true, with all four frame types visible.
209
210Test-first: preview-delta-go-red.log and preview-delta-native-red.log show the
211original implementations failing the new behavior. All 25 delta mutations were
212killed by named assertions: relative pass/grant mapping and floor; Host cookie
213prefix/root path; junk/other-task lane selection; replay audit; terminal pass
214consumption and grant deletion; exchange/read pruning and cutoff; both composite
215indexes; device-clock comparison; transit extension and expiry; lifetime bounds
216and ordering; child-only schemes, blocked child schemes and unknown about pages;
217link previews. Individual logs and results are in the review mutation folders.
218One Swift run omitted per-assertion details, but the named child-scheme test
219failed with four issues; the result classifier was corrected, not the test.
220
221Fable's supplied attacks are retained in preview_pass_attack_test.go. Adaptation
222is limited to the per-task Host cookie, relative-lifetime checks and making the
223log-only duplicate-cookie check assert refusal for two well-formed values.
224All five groups passed: 29 path/method tricks; 13 changes between wrapper reads;
225secret-at-rest scanning across every database table; 13 exchange-header cases;
226grant replacement and bearer/cookie separation. No intended-behavior failure
227was found. Command: GOMAXPROCS=2 GOTOOLCHAIN=go1.26.11 CGO_ENABLED=0 go test -p 1
228./internal/equipo -run '^TestReview' -count=1 -v (25.692s).
229
230The preceding published head ffa46f5a passed Linux CI including TestPerfScreens
231and TestPerfBoot. The review delta requires a new exact-head green verdict,
232including that same perf lane, before handoff.
233
234Final local review checks: native/scripts/check-native.sh passed 379 tests in
23550 suites (one existing known issue), 334 parity strings and both app builds.
236The first attempt hit the existing markdown stream test's three-second wait
237under heavy shared-machine load; the unchanged test passed on the full retry.
238The final combined preview, Fable attack, browser exchange, API copy and Plan 3
239contract run passed in all three packages. Build, Linux-target vet, staticcheck
240v0.7.0 with GOOS=linux GOARCH=amd64, fmt-check, size budgets, migration-model
241check, copy-release-check and lane coverage passed. Staticcheck and perf used a
242private cloned GOCACHE, without modifying or clearing the shared cache.
243
244The full macOS make perf invocation reached both performance tests, which passed,
245but exited for the existing Linux-only toolproxy unix.O_PATH build error in
246three unrelated packages. The focused equipotest performance budget invocation
247uses the same required screen/boot tests; the full Linux CI perf lane remains
248the final gate.
249
250## Migration snapshot correction
251
252Fable identified that migration 0110's indexes were missing from schema.sql.
253The narrow TestConversationMigrationSnapshot reproduced both missing-index
254errors. Appended 0110 to the snapshot's existing additive SQL, then the same
255unchanged test passed (1.530s). Command: GOMAXPROCS=2 GOTOOLCHAIN=go1.26.11
256CGO_ENABLED=0 go test -p 1 ./internal/equipo
257-run '^TestConversationMigrationSnapshot$' -count=1. No full local suite or
258simulator was started while the machine was critically loaded.
259
260The focused performance budget check on b3adc1bf passed TestPerfScreens and
261TestPerfBoot with zero failures. Evidence is archived with the review logs.
262