| 1 | # Changed files: bounded per-file diffs |
| 2 | |
| 3 | Implemented on `changes/diff`, based on main 70e4880 with a normal merge. |
| 4 | The controller approved the design on 2026-11-26; the final diff protocol is 35 (renumbered from 34 on 2026-11-27). |
| 5 | |
| 6 | ## Decisions |
| 7 | |
| 8 | One complete file patch fits one bounded base64 durable frame. This avoids |
| 9 | persisting partial, unscanned bytes. The collection remains separately bound |
| 10 | and requires a matching accepted Engineering report before device reads. |
| 11 | Both ends use the module-pinned Gitleaks 8.30.1 embedded default rules; no |
| 12 | repository configuration, baseline, path allowlist or inline ignore is read. |
| 13 | The scanner library logger is permanently disabled to prevent findings from |
| 14 | reaching diagnostic logs. Known-token checks also run on decoded layers. |
| 15 | |
| 16 | ## Test-first record |
| 17 | |
| 18 | All Go commands use `GOMAXPROCS=2 GOTOOLCHAIN=go1.26.11 CGO_ENABLED=0`, `-p 1`. |
| 19 | Only focused tests run locally because the shared Mac is loaded. |
| 20 | |
| 21 | - `go test -p 1 ./internal/wire -run 'TestProtocol32ChangeDiffs|TestDisplayPatchBounds' -count=1`: |
| 22 | failed first (missing types), then passed after implementation. Strict |
| 23 | downgrade rejects upload frames and removes the report reference below 32. |
| 24 | - `go test -p 1 ./internal/diffscan -run TestScanClosed -count=1`: |
| 25 | failed first (missing Check), then caught encoded-token and private-key-header |
| 26 | gaps. Added decoded-layer token detection and conservative private-key-header |
| 27 | withholding. No fixture weakened to accept those cases. |
| 28 | - `go test -p 1 ./internal/runner/thin -run 'TestCollectChangeDiffs|TestDisplayPatchClip' -count=1`: |
| 29 | failed first (missing collector), then passed. Covers Unicode rename, clean |
| 30 | text, secret withholding, binary, large blobs, cancellation and patch caps. |
| 31 | - `go test -p 1 ./internal/equipo/chat -run 'TestChangeDiffUploadBinding|TestChangeDiffPublicationAndRead' -count=1`: |
| 32 | failed first (missing upload/read functions). |
| 33 | |
| 34 | ## Result |
| 35 | |
| 36 | Protocol 35 transports complete bounded file patches separately from task views. |
| 37 | The instance checks runner, person, task, step, attempt, base, candidate, digest, |
| 38 | path, byte count and collection binding, and scans before storing. Only a |
| 39 | matching accepted Engineering report publishes the collection. Device reads |
| 40 | use task-read visibility, exact listed paths, a second roster/candidate check |
| 41 | and no-store. Patches never enter lists, snapshots or Coordinator prompts. |
| 42 | |
| 43 | Limits: 200 files, 1 MiB/blob, 8 MiB input, 64 KiB/2,000 complete lines/file, |
| 44 | 2 MiB/candidate, 128 KiB encoded response, 10 seconds collection time. Unaccepted |
| 45 | bytes expire after 15 minutes; accepted bytes after seven days. The sweep and |
| 46 | uploads prune expired bytes. Superseded candidates are deleted even if the next |
| 47 | runner uploads no replacement. A private attempt-bound deadline preserves the |
| 48 | expired state after pruning. Collection failure leaves Engineering unchanged; |
| 49 | the existing Review measurement test proves identical gate results before and |
| 50 | after display collection. |
| 51 | |
| 52 | Native renders selectable plain monospaced text with added/removed styling, |
| 53 | character wrapping on iPhone and horizontal scrolling on Mac. Open on Amadan |
| 54 | stays outside the scroll area. Late or mismatched file/candidate responses are |
| 55 | discarded. All unavailable reasons retain the Amadan action. |
| 56 | |
| 57 | ## Validation |
| 58 | |
| 59 | Restored-code focused Go tests passed with Go 1.26.11, CGO disabled, |
| 60 | GOMAXPROCS=2 and `-p 1`: |
| 61 | |
| 62 | - Wire protocol/downgrade, patch shape and all display bounds. |
| 63 | - Shared scanner: encoded/known tokens, private key headers, cancellation, |
| 64 | oversized input, and hostile repository scanner settings. |
| 65 | - Runner: clean patches, Unicode rename, initial commit, binary/oversized blobs, |
| 66 | input caps, complete before/after scanning, clipping and hostile Git config. |
| 67 | - Store: upload bindings, replay, publication, expiry, candidate retention, |
| 68 | tampering, encoded response cap, revoked membership and stale-candidate race. |
| 69 | - `TestContractChangeDiffs`: real stream upload/report/device read, no-store, |
| 70 | no patches in ordinary task views and unchanged merge authority. |
| 71 | - `TestConversationMigrationSnapshot`, `TestAPIErrorCopyKeys`, |
| 72 | `TestOpsAreWhatTheHandlersWrite|TestSchemaFollowsEncodingJSON`. |
| 73 | - `swift test --package-path native/apple --jobs 2 --filter ChangeDiffTests`: |
| 74 | two table-driven tests passed for transport/bounds/plain line styling and |
| 75 | late-response cancellation. |
| 76 | - Native fixtures/schema, 334 exact web strings, identity and sign-in lifetime |
| 77 | checks passed. Mac and unsigned iPhone Simulator builds passed. |
| 78 | - `make fmt-check`, `make budget` (93 directories) and `make copy-release-check` |
| 79 | passed. Size allowances use measured counts, retaining earlier reasons. |
| 80 | The new GET has a device-only JSON perf record: indexed lookup, no Git/network. |
| 81 | |
| 82 | The loaded-machine instruction overrides the usual full local gate. No full |
| 83 | native/Go suite or local perf run; Linux CI is the full Go/performance gate. |
| 84 | Its exact-head verdict is delivered with the SHA. The added UI test was not |
| 85 | run; direct fixture-app screenshots were inspected instead. The owned simulator |
| 86 | was stopped/deleted and the fixture Mac app stopped. |
| 87 | |
| 88 | ## Mutation results |
| 89 | |
| 90 | 52 mutations killed, then restored. Commands below returned nonzero with a |
| 91 | relevant failing assertion. Two initially invalid scan mutants were repaired |
| 92 | and rerun. Initially surviving fixtures were strengthened: isolate newline and |
| 93 | UTF-8 guards, use a valid index/total pair, test blob caps directly, and use |
| 94 | distinct before/after files so Git rename detection cannot mask a removed scan. |
| 95 | |
| 96 | - `runner` in `internal/equipo/chat/change_diffs.go`: **KILLED**. `go test -p 1 ./internal/equipo/chat -run ^TestChangeDiff -count=1`. |
| 97 | - `person` in `internal/equipo/chat/change_diffs.go`: **KILLED**. `go test -p 1 ./internal/equipo/chat -run ^TestChangeDiff -count=1`. |
| 98 | - `attempt` in `internal/equipo/chat/change_diffs.go`: **KILLED**. `go test -p 1 ./internal/equipo/chat -run ^TestChangeDiff -count=1`. |
| 99 | - `base` in `internal/equipo/chat/change_diffs.go`: **KILLED**. `go test -p 1 ./internal/equipo/chat -run ^TestChangeDiff -count=1`. |
| 100 | - `candidate` in `internal/equipo/chat/change_diffs.go`: **KILLED**. `go test -p 1 ./internal/equipo/chat -run ^TestChangeDiff -count=1`. |
| 101 | - `engineering` in `internal/equipo/chat/change_diffs.go`: **KILLED**. `go test -p 1 ./internal/equipo/chat -run ^TestChangeDiff -count=1`. |
| 102 | - `running` in `internal/equipo/chat/change_diffs.go`: **KILLED**. `go test -p 1 ./internal/equipo/chat -run ^TestChangeDiff -count=1`. |
| 103 | - `retired` in `internal/equipo/chat/change_diffs.go`: **KILLED**. `go test -p 1 ./internal/equipo/chat -run ^TestChangeDiff -count=1`. |
| 104 | - `cancel` in `internal/equipo/chat/change_diffs.go`: **KILLED**. `go test -p 1 ./internal/equipo/chat -run ^TestChangeDiff -count=1`. |
| 105 | - `moving` in `internal/equipo/chat/change_diffs.go`: **KILLED**. `go test -p 1 ./internal/equipo/chat -run ^TestChangeDiff -count=1`. |
| 106 | - `size` in `internal/equipo/chat/change_diffs.go`: **KILLED**. `go test -p 1 ./internal/equipo/chat -run ^TestChangeDiff -count=1`. |
| 107 | - `digest` in `internal/equipo/chat/change_diffs.go`: **KILLED**. `go test -p 1 ./internal/equipo/chat -run ^TestChangeDiff -count=1`. |
| 108 | - `order` in `internal/equipo/chat/change_diffs.go`: **KILLED**. `go test -p 1 ./internal/equipo/chat -run ^TestChangeDiff -count=1`. |
| 109 | - `candidate-byte-cap` in `internal/equipo/chat/change_diffs.go`: **KILLED**. `go test -p 1 ./internal/equipo/chat -run ^TestChangeDiff -count=1`. |
| 110 | - `file-count` in `internal/equipo/chat/change_diffs.go`: **KILLED**. `go test -p 1 ./internal/equipo/chat -run ^TestChangeDiff -count=1`. |
| 111 | - `instance-rescan` in `internal/equipo/chat/change_diffs.go`: **KILLED**. `go test -p 1 ./internal/equipo/chat -run ^TestChangeDiff -count=1`. |
| 112 | - `accepted-only` in `internal/equipo/chat/change_diffs.go`: **KILLED**. `go test -p 1 ./internal/equipo/chat -run ^TestChangeDiff -count=1`. |
| 113 | - `expiry` in `internal/equipo/chat/change_diffs.go`: **KILLED**. `go test -p 1 ./internal/equipo/chat -run ^TestChangeDiff -count=1`. |
| 114 | - `response-cap` in `internal/equipo/chat/change_diffs.go`: **KILLED**. `go test -p 1 ./internal/equipo/chat -run ^TestChangeDiff -count=1`. |
| 115 | - `wire-path` in `internal/wire/change_diffs.go`: **KILLED**. `go test -p 1 ./internal/wire -run TestDisplayPatchBounds -count=1`. |
| 116 | - `wire-bytes` in `internal/wire/change_diffs.go`: **KILLED**. `go test -p 1 ./internal/wire -run TestDisplayPatchBounds -count=1`. |
| 117 | - `wire-lines` in `internal/wire/change_diffs.go`: **KILLED**. `go test -p 1 ./internal/wire -run TestDisplayPatchBounds -count=1`. |
| 118 | - `wire-utf8` in `internal/wire/change_diffs.go`: **KILLED**. `go test -p 1 ./internal/wire -run TestDisplayPatchBounds -count=1`. |
| 119 | - `wire-nul` in `internal/wire/change_diffs.go`: **KILLED**. `go test -p 1 ./internal/wire -run TestDisplayPatchBounds -count=1`. |
| 120 | - `wire-withheld` in `internal/wire/change_diffs.go`: **KILLED**. `go test -p 1 ./internal/wire -run TestDisplayPatchBounds -count=1`. |
| 121 | - `scan-known` in `internal/diffscan/scan.go`: **KILLED**. `go test -p 1 ./internal/diffscan -run TestScanClosed -count=1`. |
| 122 | - `scan-decoded` in `internal/diffscan/scan.go`: **KILLED**. `go test -p 1 ./internal/diffscan -run TestScanClosed -count=1`. |
| 123 | - `scan-private-header` in `internal/diffscan/scan.go`: **KILLED**. `go test -p 1 ./internal/diffscan -run TestScanClosed -count=1`. |
| 124 | - `scan-rules` in `internal/diffscan/scan.go`: **KILLED**. `go test -p 1 ./internal/diffscan -run TestScanClosed -count=1`. |
| 125 | - `scan-inline-ignore` in `internal/diffscan/scan.go`: **KILLED**. `go test -p 1 ./internal/diffscan -run TestScanClosed -count=1`. |
| 126 | - `runner-blob-cap` in `internal/runner/thin/change_diffs.go`: **KILLED**. `go test -p 1 ./internal/runner/thin -run TestCollectChangeDiffs|TestDisplayPatchClip|TestDisplayBlobSafetyAndInputBudget|TestCollectionScansBeforeAfterAndBeyondCut -count=1`. |
| 127 | - `runner-aggregate` in `internal/runner/thin/change_diffs.go`: **KILLED**. `go test -p 1 ./internal/runner/thin -run TestCollectChangeDiffs|TestDisplayPatchClip|TestDisplayBlobSafetyAndInputBudget|TestCollectionScansBeforeAfterAndBeyondCut -count=1`. |
| 128 | - `runner-mode` in `internal/runner/thin/change_diffs.go`: **KILLED**. `go test -p 1 ./internal/runner/thin -run TestCollectChangeDiffs|TestDisplayPatchClip|TestDisplayBlobSafetyAndInputBudget|TestCollectionScansBeforeAfterAndBeyondCut -count=1`. |
| 129 | - `runner-before-scan` in `internal/runner/thin/change_diffs.go`: **KILLED**. `go test -p 1 ./internal/runner/thin -run TestCollectChangeDiffs|TestDisplayPatchClip|TestDisplayBlobSafetyAndInputBudget|TestCollectionScansBeforeAfterAndBeyondCut -count=1`. |
| 130 | - `runner-after-scan` in `internal/runner/thin/change_diffs.go`: **KILLED**. `go test -p 1 ./internal/runner/thin -run TestCollectChangeDiffs|TestDisplayPatchClip|TestDisplayBlobSafetyAndInputBudget|TestCollectionScansBeforeAfterAndBeyondCut -count=1`. |
| 131 | - `runner-line-cap` in `internal/runner/thin/change_diffs.go`: **KILLED**. `go test -p 1 ./internal/runner/thin -run TestCollectChangeDiffs|TestDisplayPatchClip|TestDisplayBlobSafetyAndInputBudget|TestCollectionScansBeforeAfterAndBeyondCut -count=1`. |
| 132 | - `native-bearer` in `native/apple/Sources/EquipoKit/API/ChangeDiff.swift`: **KILLED**. `swift test --package-path native/apple --jobs 2 --filter ChangeDiffTests`. |
| 133 | - `native-response-cap` in `native/apple/Sources/EquipoKit/API/ChangeDiff.swift`: **KILLED**. `swift test --package-path native/apple --jobs 2 --filter ChangeDiffTests`. |
| 134 | - `native-task` in `native/apple/Sources/EquipoKit/API/ChangeDiff.swift`: **KILLED**. `swift test --package-path native/apple --jobs 2 --filter ChangeDiffTests`. |
| 135 | - `native-candidate` in `native/apple/Sources/EquipoKit/API/ChangeDiff.swift`: **KILLED**. `swift test --package-path native/apple --jobs 2 --filter ChangeDiffTests`. |
| 136 | - `native-path` in `native/apple/Sources/EquipoKit/API/ChangeDiff.swift`: **KILLED**. `swift test --package-path native/apple --jobs 2 --filter ChangeDiffTests`. |
| 137 | - `native-byte-cap` in `native/apple/Sources/EquipoKit/API/ChangeDiff.swift`: **KILLED**. `swift test --package-path native/apple --jobs 2 --filter ChangeDiffTests`. |
| 138 | - `native-lines` in `native/apple/Sources/EquipoKit/API/ChangeDiff.swift`: **KILLED**. `swift test --package-path native/apple --jobs 2 --filter ChangeDiffTests`. |
| 139 | - `native-late-response` in `native/apple/Sources/EquipoKit/Presentation/ChangeDiffModel.swift`: **KILLED**. `swift test --package-path native/apple --jobs 2 --filter ChangeDiffTests`. |
| 140 | - `publication-hash` in `internal/equipo/chat/change_diffs.go`: **KILLED**. `go test -p 1 ./internal/equipo/chat -run ^TestChangeDiff -count=1`. |
| 141 | - `second-candidate` in `internal/equipo/chat/change_diffs.go`: **KILLED**. `go test -p 1 ./internal/equipo/chat -run ^TestChangeDiff -count=1`. |
| 142 | - `second-roster` in `internal/equipo/chat/change_diffs.go`: **KILLED**. `go test -p 1 ./internal/equipo/chat -run ^TestChangeDiff -count=1`. |
| 143 | - `prune-pending` in `internal/equipo/chat/change_diffs.go`: **KILLED**. `go test -p 1 ./internal/equipo/chat -run ^TestChangeDiff -count=1`. |
| 144 | - `discard-superseded` in `internal/equipo/chat/change_diffs.go`: **KILLED**. `go test -p 1 ./internal/equipo/chat -run ^TestChangeDiff -count=1`. |
| 145 | - `frame-downgrade` in `internal/wire/runners.go`: **KILLED**. `go test -p 1 ./internal/wire -run TestProtocol32ChangeDiffs -count=1`. |
| 146 | - `report-downgrade` in `internal/wire/runners.go`: **KILLED**. `go test -p 1 ./internal/wire -run TestProtocol32ChangeDiffs -count=1`. |
| 147 | - `complete-lines` in `internal/wire/change_diffs.go`: **KILLED**. `go test -p 1 ./internal/wire -run TestDisplayPatchBounds -count=1`. |
| 148 | |
| 149 | Raw mutation scripts/results and validation logs are archived beside the |
| 150 | screenshots in `site/build/slice5b/validation/`, outside this repository. |
| 151 | |
| 152 | ## Screenshots |
| 153 | |
| 154 | `~/amadan.net/oficina/polish-audit/equipo-daily-driver/site/build/slice5b/`: |
| 155 | `iphone-diff.png`, `iphone-diff-large.png`, `mac-diff.png`. Production sheet, |
| 156 | fake device transport, long lines; the large iPhone capture uses Accessibility |
| 157 | XL. Wrapping, scrolling and the visible Amadan action were inspected. |
| 158 | |
| 159 | ## Copy review |
| 160 | |
| 161 | Luna approved all five on 2026-11-26, replacing the unavailable sentence below. |
| 162 | The source and both native catalogs now record that approval. |
| 163 | |
| 164 | - `native.diff.withheld`: This file’s changes are hidden because they may contain a secret. |
| 165 | - `native.diff.too_large`: This file is too large to show here. |
| 166 | - `native.diff.unavailable`: These changes aren’t available. Open on Amadan to review them. |
| 167 | - `native.diff.expired`: These changes have expired. Open on Amadan to review them. |
| 168 | - `native.diff.truncated`: Only part of this file’s changes is shown. Open on Amadan for the rest. |
| 169 | |
| 170 | Binary reuses `native.changes.binary`. Stale-candidate errors use the literal |
| 171 | reviewed `preview_changed` code and `api.preview_changed` words. No server copy |
| 172 | was added. Native copy review is resolved; Fable review remains with the controller. |
| 173 | |
| 174 | ## First Linux CI result and corrections |
| 175 | |
| 176 | 58c9c213 compiled and passed the copy step. CI caught a stale protocol-99 |
| 177 | negotiation expectation (31 instead of 32), four budget reasons over 200 bytes, |
| 178 | and the new scanner package's missing budget TestMain hook. Fixed those test |
| 179 | integration issues and reran their narrow checks. The same run had timeouts in |
| 180 | TestContractChecksPlacedOnTheWorker, TestBrowserCopyContinue and webread's |
| 181 | TestTimeouts; all three passed their automatic retries. No timeout assertion or |
| 182 | production behavior was weakened. The subsequent head is the final CI gate. |
| 183 | |
| 184 | Staticcheck also rejected the deprecated detect.Fragment API. The scanner now |
| 185 | uses the supported DetectSource API with one complete bounded in-memory |
| 186 | fragment, no path and no filesystem/archive reader. Govulncheck found reachable |
| 187 | GO-2026-6888, GO-2026-6865 and GO-2025-3922 through the newly imported scanner. |
| 188 | Raised only the named dependencies to patched versions: brotli 1.2.7, |
| 189 | klauspost/compress 1.20.2, and ulikunitz/xz 0.5.15. Gitleaks and its embedded |
| 190 | rules remain pinned at 8.30.1. No finding was suppressed. |
| 191 | |
| 192 | After correction, the focused scanner/runner/store/stream tests passed. |
| 193 | Staticcheck v0.7.0 and govulncheck v1.8.0 on internal/diffscan, targeting |
| 194 | linux/amd64, passed; govulncheck reported zero reachable vulnerabilities. |
| 195 | |
| 196 | Luna follow-up: regenerated catalogs, string checks and parity passed. |
| 197 | The implementation head 05c89179 passed Linux CI including perf before this |
| 198 | copy-only follow-up; delivery reports the new head and its CI verdict. |
| 199 | |
| 200 | ## Fable delta review, 2026-11-26 |
| 201 | |
| 202 | The normal merge of main includes `602b91fe` (the landed check-db diagnostic). |
| 203 | Main had meanwhile shipped unfinished-work capability 32, and the controller |
| 204 | reserved 33 for the open Assistant attachments branch. The controller allocated |
| 205 | `ProtocolChangeDiffs = 34`. Diff references and frames are stripped/refused for |
| 206 | 32 and 33, with frozen StepReport key sets and unfinished-work semantics tested. |
| 207 | The controller will not land or release this branch before |
| 208 | `design/assistant-attachments` (protocol 33) lands. If that branch stalls, the |
| 209 | controller will coordinate renumbering. Keep 34 meanwhile. No code from that |
| 210 | open branch was merged. |
| 211 | |
| 212 | The instance computes `hidden_characters` from every Unicode Cf code point on |
| 213 | the returned patch. This covers bidi controls, marks, isolates, zero-width |
| 214 | characters and other format characters. Patch bytes and collection hashes stay |
| 215 | unchanged; this is a device response field, not runner-supplied authority. |
| 216 | Native also detects the characters locally for older responses. It shows the |
| 217 | approved notice and renders each character as a highlighted code-point marker. |
| 218 | The initial Mac cap and original-byte Copy described by this review have been |
| 219 | replaced by the second-review fixes below. Both platforms now wrap all text, |
| 220 | and Copy contains the displayed markers. |
| 221 | |
| 222 | The new notice is `native.diff.hidden_characters`: “This file contains hidden |
| 223 | characters that can change how code reads. They are shown as codes.” Approved |
| 224 | by Luna, 2026-11-26, in both generated catalogs. Copy reuses `chat.paste.copy`. |
| 225 | |
| 226 | The shared runner/instance scanner now refuses URLs with nonempty embedded |
| 227 | passwords, before and after supported decoding. Detector panic and error tests |
| 228 | exercise the actual detector boundary as well as rule-loading failures. |
| 229 | |
| 230 | Tests were extended before implementation: the password fixture failed at |
| 231 | runtime; missing hidden-character fields/rendering helpers failed to compile. |
| 232 | Focused wire/scanner/store and native tests then passed. Mutation outcomes and |
| 233 | final validation are recorded below before delivery. Local commands remain |
| 234 | limited to two workers and focused tests under the loaded-Mac ruling. |
| 235 | |
| 236 | All seven reported survivor mutations now fail at runtime: own forge credential |
| 237 | omission, scanner panic as clean, scanner error as clean, nonliteral pathspecs, |
| 238 | runner candidate-byte cap removal, retired-step read allowance, and publication |
| 239 | with fewer files than the facts. The literal-path regression exercises both |
| 240 | blob lookup and the diff command; the latter catches Git wildcard expansion. |
| 241 | |
| 242 | Additional killed mutations: embedded-password scan removal, hidden-character |
| 243 | flag removal, Unicode Cf detection removal, native marker removal, notice |
| 244 | removal, Mac line cap removal, and loss of the full copy text. All mutations |
| 245 | were restored. Logs and scripts are archived in `site/build/slice5b/validation-review/`. |
| 246 | |
| 247 | Focused wire/scanner/store tests passed; runner diff tests passed (7.770s), |
| 248 | including real Git candidate caps and credential withholding. The device |
| 249 | contract sends a hostile bidi patch through the real upload/report/read route |
| 250 | and verifies the flag and unchanged bytes (1.364s). Native ChangeDiffTests |
| 251 | passed, as did string parity, catalog checks, Mac build, iPhone Simulator build, |
| 252 | formatting, measured size budgets and release-copy checks. |
| 253 | |
| 254 | An overly broad local `Test.*Diff` selector also picked unrelated |
| 255 | `TestPreviewRejectsDifferentAncestor` (local preview scanner unavailable) and |
| 256 | `TestTokenCheckUnfinished` (token-card timeout). Neither assertion was changed; |
| 257 | the corrected focused selection passed. Linux CI remains the full gate under |
| 258 | the controller's instruction to avoid full local suites. |
| 259 | |
| 260 | New visual evidence: `mac-hidden-characters.png` and |
| 261 | `iphone-hidden-characters.png` in `site/build/slice5b/`. Both use the production |
| 262 | diff sheet and fake device transport, with RLO/PDF and zero-width-space code |
| 263 | markers and the reviewed notice. No real project or credential is involved. |
| 264 | |
| 265 | CI at `daeedf1e` found the device schema's new flag did not match the generated |
| 266 | contract: the always-emitted bool must be required, and its description belongs |
| 267 | in `wireschema` as well as the generated document. Both are corrected. The |
| 268 | focused `TestPersonAPIDeviceContract` is now included in local validation. |
| 269 | |
| 270 | ## Second Fable review: visible characters and complete Mac text |
| 271 | |
| 272 | The Go flag and native presentation now cover every Cf and |
| 273 | Default_Ignorable_Code_Point, U+2028/U+2029, and every Cc except TAB and LF. |
| 274 | The controller explicitly keeps LF structural. CR is marked, including in |
| 275 | CRLF files; that case also displays the approved hidden-character notice. |
| 276 | NUL remains refused by patch validation, and is still covered by the display |
| 277 | predicate. Original patch bytes, path acceptance and merge authority do not change. |
| 278 | |
| 279 | `internal/wire/testdata/hidden-codepoints.json` is consumed by Go and Swift: |
| 280 | 65 ranges, 4,422 code-point cases including visible/structural negative cases. |
| 281 | Its Cf and Default_Ignorable ranges come from Unicode 17's |
| 282 | [UnicodeData](https://www.unicode.org/Public/17.0.0/ucd/UnicodeData.txt) and |
| 283 | [DerivedCoreProperties](https://www.unicode.org/Public/17.0.0/ucd/DerivedCoreProperties.txt). |
| 284 | The fixture includes all default-ignorable ranges, including unassigned points, |
| 285 | Hangul fillers, CGJ, variation selectors and tags. The Go union of Cf, |
| 286 | Other_Default_Ignorable_Code_Point and Variation_Selector covers the same set; |
| 287 | Swift uses its scalar properties. Tests also pin Cf characters excluded from |
| 288 | Default_Ignorable_Code_Point, so dropping either class fails. |
| 289 | |
| 290 | Mac now uses selectable NSTextView with character wrapping in the vertical |
| 291 | scroll view. There is no line truncation and no horizontal scroll requirement. |
| 292 | The layout regression measures the real text container at widths 240, 560 and |
| 293 | 800, with 2,000 spaces before `evil()`, and verifies those glyphs are inside the |
| 294 | view's measured bounds. A separate 60,000-character line keeps its trailing code. |
| 295 | Rendering and whole-file Copy use the same visible text, including marker codes |
| 296 | and actual LF separators. The Copy button remains outside the patch and copies |
| 297 | the whole displayed file; native selection also copies only visible text. |
| 298 | File rows, folder headers, rename sources, accessibility labels and the sheet |
| 299 | header use the same escaping. Request URLs still use the original validated path. |
| 300 | |
| 301 | The CRLF regression exposed another issue: Swift Character treats CRLF as one |
| 302 | grapheme, so the old suffix check rejected it and the line counter missed it. |
| 303 | Both now inspect Unicode scalars, matching Go. CRLF is accepted within the bounds, |
| 304 | renders `⟨U+000D⟩` before each real line break, and counts toward the 2,000-line cap. |
| 305 | The scanner now also withholds empty-username password URLs such as |
| 306 | `redis://:secret@host`; runner collection and instance acceptance tests cover it. |
| 307 | No new copy was introduced. |
| 308 | |
| 309 | Test-first evidence (logs in `site/build/slice5b/validation-review2/`): |
| 310 | |
| 311 | - `GOMAXPROCS=2 GOTOOLCHAIN=go1.26.11 CGO_ENABLED=0 go test -p 1 ./internal/wire ./internal/diffscan -run 'TestPatchHiddenCharacters|TestEmbeddedPasswordURL' -count=1` failed for missing scalar classes and the empty username, then passed. |
| 312 | - `swift test --package-path native/apple --jobs 2 --filter ChangeDiffTests` failed for missing markers, raw Copy and lost trailing code. The added CRLF test separately failed three assertions before its fix. |
| 313 | - Restored `swift test --package-path native/apple --jobs 2 --filter 'ChangeDiffTests|ChangeFilesTests'`: 21 tests passed. |
| 314 | - Focused wire, scanner, chat, device route and generated OpenAPI contract tests passed, as did the runner credential/URL withholding test. |
| 315 | - String parity (334 web strings), catalog checks, API/Markdown fixtures, Oficina ID and sign-in lifetime checks passed. Mac and iPhone builds use two jobs. Full local suites remain deferred under the loaded-Mac ruling; Linux CI is the full gate. |
| 316 | - `make fmt-check budget copy-release-check` passed. Wire's measured source count is 7,535; no time budget was raised. |
| 317 | |
| 318 | All 19 deliberate mutations failed at runtime, then were restored: |
| 319 | |
| 320 | 1. Go Cf detection removed. |
| 321 | 2. Go Other_Default_Ignorable detection removed. |
| 322 | 3. Go Variation_Selector detection removed. |
| 323 | 4. Go Cc detection removed. |
| 324 | 5. Go U+2028 detection removed. |
| 325 | 6. Go U+2029 detection removed. |
| 326 | 7. Empty URL username refused by the password detector's pattern. |
| 327 | 8. Native Cf detection removed. |
| 328 | 9. Native Default_Ignorable detection removed. |
| 329 | 10. Native Cc detection removed. |
| 330 | 11. Native U+2028 detection removed. |
| 331 | 12. Native U+2029 detection removed. |
| 332 | 13. Copy returns original hidden bytes. |
| 333 | 14. File name rendering returns raw paths. |
| 334 | 15. Rename source rendering returns raw paths. |
| 335 | 16. Display cuts a line at 2,000 characters. |
| 336 | 17. Character wrapping replaced by clipping. |
| 337 | 18. CRLF line counting reverted to Character iteration. |
| 338 | 19. CRLF suffix validation reverted to Character suffix matching. |
| 339 | |
| 340 | The mutation runner, exact commands and per-mutation logs are archived with the |
| 341 | validation evidence. Protocol remains 34. The controller will land/release only |
| 342 | after Assistant attachments 33 lands, or coordinate a separate renumbering. |
| 343 | |
| 344 | Visual evidence was recaptured from this branch: `iphone-hidden-characters.png`, |
| 345 | `mac-hidden-characters.png`, `mac-hidden-filenames.png`, and `mac-long-line.png` |
| 346 | in `site/build/slice5b/`. The long-line capture visibly includes `evil()` after |
| 347 | 2,000 spaces. All were inspected. The owned simulator was terminated, shut down |
| 348 | and deleted, and the Mac fixture apps were closed after capture. |
| 349 | |
| 350 | ## Held-branch follow-ups after approval of be924467 |
| 351 | |
| 352 | Protocol remains 34 and the branch remains held for Assistant attachments 33. |
| 353 | The Mac paragraph style now gives wrapped continuations a font-relative hanging |
| 354 | indent (three times the font’s point size), while each original diff line |
| 355 | starts at zero. The real NSTextView layout test verifies that `evil()` after |
| 356 | 2,000 spaces is below and to the right of its original `+`, at three view widths. |
| 357 | The indent is layout, not inserted text, so Copy retains the displayed contents. |
| 358 | |
| 359 | FE0E and FE0F immediately after an allowed pictographic base remain in their |
| 360 | normal presentation, without a marker or hidden-character flag. Following the |
| 361 | controller's tightening of 37e88207, Go and native use the same pinned Unicode 17 |
| 362 | intersection of Emoji and Extended_Pictographic, excluding bases below U+00FF |
| 363 | and U+203C, U+2049 and U+2122. This retains ⚠️ while excluding ASCII digits, #, |
| 364 | *, ©, ®, ™, ‼, ⁉, regional indicators and emoji modifiers. The source is Unicode's |
| 365 | [Emoji data](https://www.unicode.org/Public/17.0.0/ucd/emoji/emoji-data.txt). |
| 366 | The shared fixture checks every allowed base with both selectors and every |
| 367 | removed Emoji base, plus explicit identifier and keycap sequences. It contains |
| 368 | 412 ranges and 7,664 cases. `admin1` + FE0F, `1` + FE0F, `#` + FE0F, `©` + FE0F, |
| 369 | and digit/#/* keycaps all keep their visible selector markers and flags. |
| 370 | Selector-only text, ordinary text bases, intervening whitespace, repeated |
| 371 | selectors, other variation selectors and tags still get markers and flags. |
| 372 | Filename rendering and Copy share the same contextual exception. The generated |
| 373 | OpenAPI description documents it; no protocol or copy change is involved. |
| 374 | |
| 375 | The new shared-fixture cases failed on Go and Swift before implementation. |
| 376 | The added native layout assertions also failed because the continuation's x |
| 377 | coordinate was zero. Focused tests then passed. Machine checks precede each |
| 378 | heavy command: `sysctl -n vm.loadavg`, `sysctl -n vm.swapusage`, and the process |
| 379 | list, collapsing children of one heavy job. Commands wait above load 20 or when |
| 380 | two other heavy jobs are running. Jobs run serially, with four workers and a |
| 381 | 10-minute timeout; no local full gate or unfiltered suite is run. |
| 382 | |
| 383 | All 11 follow-up mutations failed at runtime and were restored: omit FE0E, |
| 384 | omit FE0F, omit the Emoji-base guard, remember the last Emoji instead of the |
| 385 | immediate predecessor, and exempt other selectors/tags (each on Go and native), |
| 386 | plus removal of the Mac hanging indent. |
| 387 | |
| 388 | The tighter-base regression first failed with the old implementation on both |
| 389 | sides (Go's shared fixture; native's 8-test diff suite, 400 assertion issues). |
| 390 | After implementing the restricted tables, both passed. Eight further mutations |
| 391 | were killed at runtime and restored: re-enable ASCII bases, re-enable ©/®, |
| 392 | re-enable ™/‼/⁉, and re-enable non-pictographic Emoji bases (regional indicators |
| 393 | and modifiers), each in Go and native. These tests cover visible rendering, |
| 394 | the hidden-character notice, and exact displayed Copy text, including keycaps. |
| 395 | The existing Mac continuation screenshot remains representative: ⚠️ is still an |
| 396 | allowed pictographic pair, and the FE0F after ordinary text remains marked. |
| 397 | |
| 398 | Final narrow validation: |
| 399 | |
| 400 | - `GOMAXPROCS=4 GOTOOLCHAIN=go1.26.11 CGO_ENABLED=0 go test -p 4 ./internal/wire ./internal/plan3test -run '^(TestPatchHiddenCharacters|TestPersonAPIDeviceContract)$' -count=1`: passed. |
| 401 | - `swift test --package-path native/apple --jobs 4 --filter ChangeDiffTests`: 8 passed after restoring mutations. |
| 402 | - `swift build --package-path native/apple --jobs 4 --product EquipoMac`: passed. |
| 403 | - Native catalog and web parity checks passed. `make fmt-check budget` passed, |
| 404 | with wire remaining within its 7,709-line cap after restricting the base table. |
| 405 | - `mac-long-line.png` was recaptured and inspected: `evil()` is visibly indented |
| 406 | under its `+`; `⚠️` keeps its normal presentation, while FE0F after `x` is marked. |
| 407 | The bounded capture process terminated and waited for its fixture app. No |
| 408 | simulator was needed or started for these follow-ups. |
| 409 | |
| 410 | Commands, machine checks, red/green and mutation logs, and the final CI receipt |
| 411 | are archived in `site/build/slice5b/validation-held-followups/`. |
| 412 | |
| 413 | ## Renumbered to protocol 35 (2026-11-27) |
| 414 | |
| 415 | Main landed `ProtocolAssistantFiles = 33` and `ProtocolPlaces = 34`, so |
| 416 | this branch merged origin/main `be28c0c8` normally and moved to |
| 417 | `ProtocolChangeDiffs = Protocol35` (`ProtocolCurrent`). |
| 418 | |
| 419 | - **Downgrade (`runners.go`).** Encode runs the diff step first: it refuses a |
| 420 | `change_diff` upload below 35 and drops a step report's `change_diffs`. |
| 421 | Main's Places (below 34) and Assistant-files (below 33) downgrades follow, |
| 422 | and accumulate `changed` instead of overwriting it. |
| 423 | - **Frozen key sets.** StepReport keys are frozen and identical at 32, 33 and |
| 424 | 34 (main changed no StepReport field); `TestDiffDowngradeFrozen32To34` checks |
| 425 | all three. Main's Places test (byte-identical at 34, refused or dropped |
| 426 | at 33) and its Assistant-files test (byte-identical at 33) are unchanged |
| 427 | apart from the current/`Spoken(99)` value. |
| 428 | - **Current-protocol assertions.** Every one now names `ProtocolChangeDiffs`, |
| 429 | or 35. Negotiation now maps 35 to 35 and 99 to 35. |
| 430 | - **Migration.** The branch's `0111_change_diffs.sql` collided with main's |
| 431 | `0111_notification_actions.sql`. It was renamed to `0113_change_diffs.sql` |
| 432 | and its schema block follows main's 0111 and 0112 in `schema.sql`. |
| 433 | `Models` lists both new records. |
| 434 | - **Runner wiring (`run.go`).** Main's Engineer gained `ConfirmMint` and |
| 435 | `SiteChanged`; the branch's `DiffSecrets` is kept beside them. |
| 436 | - **OpenAPI.** A structural three-way merge of base, branch and main. It |
| 437 | had no conflicts, and its changes from main are additions only (ChangeDiff |
| 438 | and its operation beside RetryTask, places and `placement_question`). |
| 439 | - **Strings.** `strings.json` keeps both sides' keys. `check-strings.py`'s |
| 440 | approval comment rule adds the `native.diff.` prefix to main's rule, and |
| 441 | the catalogs were regenerated with `--write`. No new strings. |
| 442 | - **Budgets.** Size exemptions were raised to the measured counts. Main's |
| 443 | card-read comment and the branch's diff perf skip are both kept. |
| 444 | |
| 445 | Checks: |
| 446 | |
| 447 | - `./internal/wire/...` passes. |
| 448 | - These pass with `-tags testbuild`: `internal/equipo` (migrations and |
| 449 | snapshot), `chat`, `thintest` and `plan3test` for Diff, Place, |
| 450 | AssistantFile, Protocol and Contract, and `runner/thin` for TestChangeDiff, |
| 451 | TestDiff, TestPlaces and TestAssistantFile. |
| 452 | - Linux build, budget size, TestBudgetRecordsAreShort, plan3-copy-check and |
| 453 | check-strings pass. |
| 454 | - Native `ChangeDiffTests` pass: 8 of 8. |
| 455 | - A wider `runner/thin` selection hit three tests: |
| 456 | `TestPreviewRejectsDifferentAncestor`, `TestPreviewReplacesInPlace` and |
| 457 | `TestResearchHandoffNothingToPlace`. Those are among the known |
| 458 | macOS-unreliable tests in that package, so hub CI decides them. |
| 459 | |