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