fix(contract): read every text file a directory boundary scan selects #9422
All Vouch review confidence checks passed
Residual risk 0.22 = Change Risk (0.52) × (1 − Review Confidence (0.57)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.52 · 650 lines diff across 8 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.388
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #9422"
general
weight: 0.35
JasonBuildAI
Goal And Delivered Outcome
loopx check --scan-path <directory>is the documented pre-publication boundary gate (CONTRIBUTING.md,AGENTS.md,docs/public-private-boundary.md), but_resolve_scannable_fileinloopx/contract.pyselected directory candidates with a seven-entry suffix allow-list. Every other file was dropped before it was opened: 2,745 of 8,647 tracked files (31.7%, including 1,564 TypeScript sources) are UTF-8 text that the gate never read, while it still printedpublic boundary scan clean.notes.txtinside a scanned directory producedok: true/public boundary scan clean: 1 filesbefore, and producesok: false/notes.txt:1: credentialafter. The documented four-root scan reads 4,485 files before and 5,567 after, with zero blocking hits in both. Proven by thereal_entrypointrow below.upstream/main216757852.Author Declaration
Implemented against
docs/public-private-boundary.mdat216757852(§ "loopx check treats that as a file-state boundary") and the linked issue.| Criterion (spec clause) | Disposition | Symbol / path | Test or command |
| --- | --- | --- | --- |
| A git-tracked file "enters the public boundary and is scanned like any other publishable file" (
docs/public-private-boundary.md:257-261) | implemented |_resolve_scannable_file,BINARY_MEDIA_SUFFIXESinloopx/contract.py|tests/test_contract_scan_text_coverage.py,tests/test_contract_public_boundary_prefilter.py|| A
--scan-pathdirectory is reviewed for outgoing private material (loopx check --help) | implemented | same | CLI reproduction below andtests/test_contract_scan_text_coverage.py|| Binary media stays skipped so a mixed tree still scans | implemented |
BINARY_MEDIA_SUFFIXES,_is_binary_media_path|test_directory_scan_skips_binary_media_without_failing|| Untracked OS metadata is skipped only when its own header proves the format; a text lookalike and a tracked file stay scanned (
docs/public-private-boundary.md:263-267) | implemented |LOCAL_METADATA_HEADERS,_has_local_metadata_header,tracked_pathsinloopx/contract.py|tests/test_contract_scan_text_coverage.py(gitignored.DS_Store/AppleDouble clean;git add -f .DS_Storestill fails closed; no-Git staging text lookalike scanned) || BOM-marked UTF-16 text is decoded before content rules; other undecodable input still fails closed (
docs/public-private-boundary.md:263-269) | implemented |_decode_bom_utf16,_read_utf8inloopx/control_plane/runtime/file_reads.py|tests/test_contract_scan_text_coverage.py(UTF-16desktop.iniclean; direct/directory parity; malformed UTF-16 rejected) || Unreadable input fails closed instead of passing silently | implemented | existing strict UTF-8 read |
test_undecodable_file_with_an_unknown_suffix_stays_unexamined;tests/control_plane/test_public_boundary_parallel_reads.py|| Symlink eligibility follows the resolved target, not the alias name | implemented |
_resolve_scannable_file|tests/test_contract_public_boundary_prefilter.py::test_scan_enumeration_follows_the_resolved_target_and_binary_media(POSIX run) |--changed-from 216757852), which flagsBINARY_MEDIA_SUFFIXESas a new local closed set — kept local deliberately because it is file-format classification for this one scanner, and the closest existing list (public_safe_outbound.scan_cli.BINARY_SUFFIXES) answers a different question by also pruning build output and opaque packages; the intermediate name-based metadata set is replaced at the exact head by a header table in the same local scope. The credential blocking rules are unchanged; the reference classifier additionally recognizes a bare${interpolation template (a runtime expression cannot be a literal). Two workbench fixtures the wider scan now reaches were normalized: the fake-Codex payload emitsnullfor an agent-approved review (matching theinProgressevent; no workbench code reads the field), and the calendar fixture uses a reserved example app-link host (https://applink.example.com/...); neither fixture value is read by product code. The modified enumeration test still pins resolved-target and alias-name behavior after its suffix cases moved from.tsto binary media. Review follow-up: reproduced the reported.DS_Storefailure atab45c7113(ok: false,unreadable_files: [".DS_Store: invalid UTF-8"]) and fixed it in73aab878bby skipping known OS metadata names only while Git does not track them; the tracked case still fails closed. Second review follow-up: a Git-less staging directory lost a valid Markdown file named._README.mdbecause the name alone decided;8eda65fc3requires the Finder\x00\x00\x00\x01Bud1or AppleDouble\x00\x05\x16\x07header before skipping, so text lookalikes stay in the scan. Covered by no-Git-index, read-only-directory and text-lookalike cases. Third review follow-up: a BOM-marked UTF-16LEdesktop.iniwas reported as invalid UTF-8;5b79cb162retries an explicit UTF-16 BOM as strict UTF-16 in the existing reader, while bare, UTF-32 and malformed BOM payloads stay undecodable. Covered by clean-directory, direct-file, content-rule and malformed cases.Scope And Continuation
loopx check, its regression coverage, and the expectations that encodedpyvenv.cfgas unscannable; plus the two fixture normalizations and the${reference precision needed to keep the repository's own default scan green after it starts reading those files. A known OS metadata file is skipped only when Git does not track it and its own header proves the Finder or AppleDouble format, so a normal macOS checkout stays clean without dropping text lookalikes; tracked content remains verified. Directory text is decoded as UTF-8, with an explicit UTF-16 BOM decoded as strict UTF-16 (Windowsdesktop.ini); other undecodable input stays fail-closed. No remaining work in this gate.Validation
89fbe0e5f109a8ac8793735582a3c18d604be249oncodex/boundary-scan-text-coverage-m5k2, merged onto currentmain81ff83a0193a93e737862e1adf3bcebdf104a953| Check kind | Result | Public-safe evidence / limitation |
| --- | --- | --- |
|
real_entrypoint|passed|loopx check --scan-path <tmp>: baseok: true,public boundary scan clean: 1 files; headok: false,notes.txt:1: credential. Direct file scan rejects the same bytes in both. ||
real_entrypoint|passed| Review finding re-run with an isolated runtime home: untracked gitignored.DS_Store(b"\x00\x00\x00\x01Bud1\xff\xfe...") beside a trackedREADME.md→ exit 0,public boundary scan clean: 2 files, no unreadable files; the same bytes committed withgit add -f→ exit 1,scan file could not be read: .DS_Store: invalid UTF-8. ||
real_entrypoint|passed| Second review finding re-run: a Git-less staging directory withREADME.mdand a valid text._README.md→ exit 0,public boundary scan clean: 2 files(before8eda65fc3: 1 file); binary-format.DS_Storeand AppleDouble files in the same Git-less shape are still skipped by their header. ||
real_entrypoint|passed| Third review finding re-run (isolated runtime home): UTF-16LE-with-BOMdesktop.inibesideREADME.md→ exit 0,public boundary scan clean: 2 files; directdesktop.iniscan → exit 0, 1 file; a malformed UTF-16LE BOM fixture → exit 1,scan file could not be read: desktop.ini. ||
real_entrypoint|passed| Bareloopx check(default--scan-root ., isolated runtime home): baseok: true, 0 errors, 122 warnings, 5,306 files; headok: true, 0 errors, 309 warnings, 8,056 files. The three source constructs first surfaced at the widened head are now reference warnings (index.ts:321${...},fake-codex.mjs:361null) or absent (personal-plan.test.ts:67reserved example host). ||
regression_parity|passed| Same four-root command at base and head: 4,485 → 5,567 scanned files, zero blocking hits in both; 55 → 67 non-blocking boundary warnings (summary 57 → 69 with registry warnings), all pre-existing references. ||
static|passed|python -m ruff check(5 changed Python files),python -m py_compile, andpython scripts/generate_semantic_inventory.py --changed-from 216757852(advisory disposition above).mypyreports 16 Windows-only platform-stub errors, identical at base. ||
integration|passed|loopx canary premerge --from-git-diff --git-diff-base 216757852, re-run at5b79cb162: all direct checks, the public-boundary check over the changed paths, risk-profile smokes 8/8, and 10/10 catalog canaries passed. ||
unit|passed| Newtests/test_contract_scan_text_coverage.py13 passed, 1 skipped on Windows: the four text-coverage cases, header-proven.DS_Store/AppleDouble (gitignored and Git-less staging), a text._README.mdstaging lookalike with a credential, a trackedgit add -f .DS_Storethat still fails, a BOM-marked UTF-16desktop.iniclean case with direct/directory content-rule parity, a malformed UTF-16 rejection, and a POSIX-only read-only-directory case.tests/test_contract_credential_pattern_precision.py+ the coverage file 171/171 on Windows. The existing blocking cases for literalAuthorization:values are unchanged; the new reference cases cover${(await ...)}and a named runtime value. ||
unit|passed| Workbench fixtures:personal-plan.test.ts7/7 andadapters.test.ts82/82 undernpx tsx --testinapps/workbench/packages/daemon. ||
integration|passed| Linux boundary suites:tests/test_contract_.py,tests/test_public_.py,tests/control_plane/test_public_boundary_parallel_reads.py,tests/control_plane/test_contract_health.py,tests/canary/test_premerge_public_boundary_run.py,tests/canary/test_git_path_display.py— 511 passed; focused boundary set 275 passed. ||
unit|passed| Windows focused runs: 62 passed with the known base-identical CRLF failure; contract set re-run after the UTF-16 fix: 255 passed, 12 skipped, the same 7 host-only failures (os.symlinkprivilege — WinError 1314 — and one CRLF line-number case, identical at base); control-plane boundary suite failed only on the sameos.symlinkprivilege;tests/canary/test_git_path_display.py8 failures identical at base (unrelated byte-path tests). ||
integration|not_run| GitHub required checks run only after this PR exists; verification is deferred to the published CI run. |.txt/.ts/.html/extensionless files, binary media, undecodable input, header-proven versus text OS metadata (.DS_Store, AppleDouble) in Git and Git-less staging shapes, BOM-marked UTF-16desktop.ini(directory and direct input, content-rule parity, malformed payload), a read-only directory on POSIX, and POSIX resolved-symlink cases. The bare-scan disposition is covered by the repository's own tree at base and head plus the two workbench test files. Not covered locally: Windows symlink creation (host privilege, base-identical), and the slow delegation suites that hang on this Windows host both at base and head; neither exercises the selector. The credential patterns and literal-blocking cases are unchanged; only the reference classifier recognizes bare${templates.Frontend / Visual Evidence
Type of Change
LoopX Area
Technical Direction
Shared-authority RFC fixture impact
Boundary Checklist
.loopx/,.codex/goals/, and liveACTIVE_GOAL_STATE.md).${reference case exist only because the widened default scan now reaches those files; neither changes product behavior, and the literal credential blocking cases stay unchanged.python3 scripts/check_rfc_bilingual.py --base origin/main --head HEADpasses, or no paired RFC changed.none.Signed-off-bytrailer (git commit -s).