Repository navigation
fix(contract): read every text file a directory boundary scan selects - #9422
huangruiteng merged 7 commits into
Conversation
The directory scan selected candidates with a seven-entry suffix allow-list (.md/.py/.toml/.json/.yaml/.yml/.sh), so every other file under a selected path was dropped before it was opened. On this checkout that excluded all 1,564 TypeScript sources plus .mjs, .tsx, .svg, .html, .txt and extensionless files -- 2,745 UTF-8 text files, 31.7% of the tracked tree -- while the command still printed a clean public boundary receipt. The same bytes were rejected when the file was named directly, so one gate returned opposite verdicts for the same content depending on the input shape. Select by binary media instead: only known binary suffixes are skipped, and an unlisted suffix is read as strict UTF-8 so an incomplete list fails closed as unreadable instead of passing silently. Symlink eligibility still follows the resolved target, never the alias name. The documented four-root scan stays clean at this head: 5,573 files scanned, up from 4,487, zero blocking hits. Signed-off-by: JasonBuildAI <jasonbuildai@gmail.com>
Signed-off-by: JasonBuildAI <jasonbuildai@gmail.com>
Signed-off-by: JasonBuildAI <jasonbuildai@gmail.com>
loopx-agent
left a comment
There was a problem hiding this comment.
Reviewer: model_agent · gpt-6.2-sol · OpenAI (runtime_reported, xhigh)
动机 / Motivation
在普通 Git checkout 运行发布前 loopx check 的维护者需要扩大文本覆盖,同时处理日常产生的非发布二进制元数据。 旧目录扫描只打开七类文件,未计入 TypeScript、TXT、HTML 和无后缀文本。未跟踪的 Finder 元数据不影响扫描。 用同一 Git 工作树和隔离 registry 扫描目录。先测试普通文本与媒体混合树,再测试带仓库常用忽略规则的源目录。 普通混合样例从只读 1 项扩大到 5 项,已知 PNG 仍跳过。直接扫描 TXT 仍通过,非 UTF-8 的未知格式有明确的失败诊断。 项目已忽略的未跟踪 Finder 元数据也被当作文本读,阻断发布检查。 输入为合成公开样例。核验真实本地 CLI 与 Git 枚举,没有操作真实发布。
用仓库同样的 gitignore 规则和 Finder 文件头的合成二进制样例运行实际 CLI。基线退出 0,当前头退出 1 并报告 .DS_Store: invalid UTF-8。移除同一项后普通文本目录通过。
改动思路 / Approach
保留现有 public boundary 扫描 owner、Git 已跟踪文件与严格 UTF-8 判定。目录枚举处处理可证明的未跟踪二进制元数据。 保留扩大的文本覆盖与未知格式的失败反馈,修正已忽略的本机元数据导致的日常阻塞。 处理已确认格式且未跟踪的系统元数据,保留对跟踪内容与未知文件的核验。加上含 Git ignore 规则的混合目录用例。 现有入口依据
具体改动 / Changes
精确 head ab45c7113f111d5ad151aaab5b2ad8d079bf1bfd,比较基线 35cb1d701a4ac85cf4430b48891197a979723d80。GitHub diff 7 个文件,增 166 行删 22 行。核心是目录文件选择与相应的 UTF-8 边界用例。 远端目标 main 为 35cb1d7,七文件 diff 的 merge base 为 2167578。真实 CLI 对照用该 merge base 和精确分支头,虚拟合并无冲突。
关键代码讲解
-
_resolve_scannable_file。按已知二进制类型决定哪些目录文件进入 UTF-8 扫描。 源码 -
_tracked_scan_files。保留对 Git 已跟踪文件的枚举。 源码 -
iter_scan_files。合并跟踪与文件系统枚举,并记录无权读取的输入。 源码 -
混合目录用例。固定文本与已知二进制媒体并存时的退出状态。 源码 -
MIXED_DIRECTORY_WITH_LOCAL_METADATA 尚未满足。目录检查应覆盖可发布文本,同时处理已忽略的未跟踪系统二进制元数据。 定位
对主干的风险 / Risks
[P2] 已忽略的 Finder 元数据会阻断普通目录扫描。 macOS 用户在正常 checkout 中保留 Git 已忽略的未跟踪 .DS_Store。目录内只有普通跟踪文本和该本地元数据。 用仓库同样的 gitignore 规则和 Finder 文件头的合成二进制样例运行实际 CLI。基线退出 0,当前头退出 1 并报告 .DS_Store: invalid UTF-8。移除同一项后普通文本目录通过。 处理已确认格式且未跟踪的系统元数据,保留对跟踪内容与未知文件的核验。加上含 Git ignore 规则的混合目录用例。 问题行
语义与 CI 对齐
git diff --check 通过。聚焦 Python 307 项通过、6 项跳过。用同一合成样例在 merge base 和当前 head 运行 loopx check --scan-path。 基线与新头使用同一 Git 源文件、忽略规则和本地元数据 fixture。git check-ignore 确认未跟踪元数据被忽略,真实 CLI 在基线通过,新头报读失败。 macOS 上用 Finder 文件头的合成二进制值复现。实际 Git 工作树、CLI 输出和退出码直接核验。未核查托管 CI 或其他平台。
我的整体评价 / Verdict
REQUEST_CHANGES。 保留扩大的文本覆盖与未知格式的失败反馈,修正已忽略的本机元数据导致的日常阻塞。 处理已确认格式且未跟踪的系统元数据,保留对跟踪内容与未知文件的核验。加上含 Git ignore 规则的混合目录用例。
English verdict: REQUEST_CHANGES. The text coverage fix works, but an ignored, untracked macOS Finder metadata file now fails an otherwise clean directory scan.
A normal checkout keeps .DS_Store and AppleDouble files untracked and gitignored. The widened text selection read them as UTF-8 and failed an otherwise clean directory scan. Skip a known OS metadata name only while Git does not track it; a tracked file with the same name is still scanned. Document the rule and cover both cases. Signed-off-by: JasonBuildAI <jasonbuildai@gmail.com>
loopx-agent
left a comment
There was a problem hiding this comment.
Reviewer: model_agent · gpt-6.2-sol · OpenAI (runtime_reported, xhigh)
[P2] 目录检查会漏读有效 Markdown。 同一目录有两份有效 Markdown,上一提交扫描 2 项,当前头扫描 1 项并返回成功。明确选中文件时当前头仍扫描该项。 目录排除应要求可识别的元数据格式或独立证据证明属于本地忽略范围。保留无法证明是系统元数据的正常文本,并增加无 Git 索引和只读目录对照。 目录过滤
动机 / Motivation
发布维护者用目录检查验证工作树或导出的暂存目录。 上一提交扩大了 UTF-8 文本覆盖,也让正常工作树里的本机 Finder 二进制记录阻断检查。 比较旧头和新头在同一普通暂存目录、明确文件输入、Git 工作树与跟踪文件上的文件计数和退出状态。 未跟踪且被忽略的带 Finder 文件头的合成样例不再导致失败。跟踪同一份样例后,检查仍报告其 UTF-8 读失败。 普通暂存目录的第二份有效 Markdown 被跳过,整目录仍报告成功;直接扫描该文件会读到它。 实际本地 CLI 使用纯合成目录和文件。未访问任何真实私有材料或发布环境。
同一目录有两份有效 Markdown,上一提交扫描 2 项,当前头扫描 1 项并返回成功。明确选中文件时当前头仍扫描该项。
改动思路 / Approach
复用公共边界扫描入口、Git 文件枚举与 UTF-8 读取。Git 路径缺失或未经跟踪不证明文件是由系统写出的元数据。 保留真元数据的兼容修复,让目录覆盖与明确文件入口对同一有效文本一致。 目录排除应要求可识别的元数据格式或独立证据证明属于本地忽略范围。保留无法证明是系统元数据的正常文本,并增加无 Git 索引和只读目录对照。 现有入口依据
具体改动 / Changes
精确 head 73aab878b5982b6e75433b6a3ea2a323cc7f95e4,比较基线 35cb1d701a4ac85cf4430b48891197a979723d80。目标分支与 head 的 diff 为 8 个文件,新增 262 行、删除 24 行。当前修订主要改扫描选择、说明和反例。 对同一文件树,上一头读到两份普通文本,候选少读一份。Finder 文件走查的旧失败被修复,显式和跟踪文件控制保留。
关键代码讲解
-
_is_local_metadata_name。按名称识别类别,当前没有读取格式或确认 Git 本地忽略。 源码 -
_tracked_scan_files。没有 Git 工作树时返回空集合。 源码 -
iter_scan_files。合并目录走查与跟踪路径,排除本机元数据。 源码 -
目录元数据过滤。正常文档在名称命中且没有索引记录时被遗漏。 源码 -
DIRECTORY_TEXT_COVERAGE 尚未满足。目录扫描区分可发布的文本和已确认的本机系统元数据。 定位
对主干的风险 / Risks
尚无 Git 索引的暂存目录包含普通 Markdown,其文件名恰好与新增的 OS 元数据命名规则重叠。 用同一纯文本暂存目录运行两个精确头的实际 loopx check --scan-path,再直接扫描缺项的那份文档。 已确认的本机元数据可继续跳过,已跟踪内容仍须保留扫描。 边界文档
语义与 CI 对齐
git diff --check 通过。两份工作树实跑相同四组 CLI 对照,覆盖原 Finder 反例、暂存目录、显式路径与跟踪文件。 用同一纯文本暂存目录运行两个精确头的实际 loopx check --scan-path,再直接扫描缺项的那份文档。 复验只使用 macOS 本地 Git 与合成数据。未查询托管 CI。
我的整体评价 / Verdict
REQUEST_CHANGES。 保留真元数据的兼容修复,让目录覆盖与明确文件入口对同一有效文本一致。 目录排除应要求可识别的元数据格式或独立证据证明属于本地忽略范围。保留无法证明是系统元数据的正常文本,并增加无 Git 索引和只读目录对照。
English verdict: REQUEST_CHANGES. The Finder metadata case is fixed. An ordinary UTF-8 document in a Git-less staging directory can still disappear from directory scan coverage based on its name alone.
Directory selection skipped any untracked .DS_Store or ._* file by name alone, so a Git-less staging directory could lose a valid Markdown file named ._README.md while still reporting success. Require the file's own Finder or AppleDouble magic header; text lookalikes stay in the scan. A tracked file is still scanned. Add no-Git-index, read-only-directory, and text-lookalike cases, and document the header rule. Signed-off-by: JasonBuildAI <jasonbuildai@gmail.com>
loopx-agent
left a comment
There was a problem hiding this comment.
Reviewer: model_agent · gpt-6.2-sol · OpenAI · runtime_reported · xhigh
[P2] 常见有 BOM 的 UTF‑16 desktop.ini 会阻断目录检查
以同一无害的 Windows 文件夹配置文本对照两种编码。精确基线遇到带 BOM 的 UTF-16LE desktop.ini 时退出 0。候选遇到 UTF-8 是 0,遇到 UTF-16LE 则退出 1,报 desktop.ini: invalid UTF-8。 新枚举把这种正常的系统配置文本传进仅接受 UTF-8 的 reader,因此目录检查可能仅因本地 Explorer 配置文件而由成功转为失败。 在现有 reader 内对有明确 BOM 的 UTF-16 文本严格解码,再执行同一套内容检查。保留其他无法解码内容的拒绝,补目录与显式输入的对照。 对应源码
动机 / Motivation
本 PR 面向在提交和共享前用 loopx check 检查目录的贡献者。 固定的七种后缀筛选使已知文本在到达内容检查前被丢弃。 扩大目录读取后,普通文本有实际增益,常规 Windows 编码引入了新的读错。 本轮覆盖 CLI 的内容输入、报告及退出状态。 问题报告
改动思路 / Approach
更宽的枚举继续把内容传给原有规则。媒体筛选和本地元数据识别留在枚举层,读取失败继续通过原结构化回执报告。 本轮改动应留在现有目录选择和内容读取边界。 支持更宽的枚举范围需要同时考虑被纳入的文本编码。 维持现有 fail-closed 内容规则,最小修复在同一个文本读取器内处理明确编码。针对文件名的宽泛排除会丢掉可扫描的文本。 当前可验证的效果来自真实 CLI 的目录输入和结果读回。用户的主流程包含对默认扫描结果做发布判断,不需要额外的 App 页面。
具体改动 / Changes
本轮精确 head 8eda65fc3073e0805c66e89e665afe86043c373f。当前评审包基线 35cb1d701a4ac85cf4430b48891197a979723d80,完整差异与源码验证以实际共同祖先 216757852168faa784fe6f621b72d971aee58ee3 为准。相对 73aab87,Finder/AppleDouble 排除加入文件头验证,文本同名文件重新进入选择。上一轮对 Windows 名称的笼统特例也已移除。 上轮评审
- 文本覆盖。新 selector 扩大到普通文本,并保留已声明的媒体、Git 本地状态及 Finder 元数据适用边界。目录中纯文本的同名文件已能进入扫描。
- Windows 文本可读性。扩大目录文本覆盖仍支持常见原生目录文本。能识别编码的内容应进入原有内容检查,损坏或未知编码维持拒绝。
关键代码讲解
全 PR 八个文件增 350 行、删 24 行。包括选择器及引用模板识别、边界说明、四份 Python 测试及两个 Workbench 测试夹具。 _resolve_scannable_file 以解析后的目标判断媒体及本地状态。iter_scan_files 保留 Git 枚举、目录裁剪和失败回执,文件头识别只用于特定未跟踪条目。原 reader 仍严格读取 UTF-8,引用识别只增加模板引用情况。两个 Workbench 变更在测试夹具中。
对主干的风险 / Risks
PASS。普通 .txt、只读目录中的同名 UTF-8 文本、Git 已跟踪的同名文本均从基线读 1 个到候选读 2 个,三个候选目录检查通过。 源码 premerge 6 项直接检查、19 项所选检查均通过。 独立 Python 相关测试 344 通过、6 跳过。 Workbench 两套测试用 UTC 跑 89 项全过。默认时区下基线和候选各 88 过、1 败,均是同一日程日期断言。
FAIL。以同一无害的 Windows 文件夹配置文本对照两种编码。精确基线遇到带 BOM 的 UTF-16LE desktop.ini 时退出 0。候选遇到 UTF-8 是 0,遇到 UTF-16LE 则退出 1,报 desktop.ini: invalid UTF-8。 用单个正常无敏感字段的本地配置,在两种编码下分别核对真实 CLI;再核对坏输入仍拒绝。当前隔离探测在 macOS 执行。
语义与 CI 对齐
更宽文本选择有可核对的收益。UTF-16 格式对照显示已知文本被误归为不可读。在现有读取判断中修正编码可保留扩展扫描及失败边界。 本轮用合成的 Windows 格式文件执行了真实 macOS CLI。未在 Windows Explorer 安装或运行,未查询远端 CI。 Microsoft 的 Desktop.ini 格式说明
我的整体评价 / Verdict
请求修改。新 selector 扩大到普通文本,并保留已声明的媒体、Git 本地状态及 Finder 元数据适用边界。目录中纯文本的同名文件已能进入扫描。 在现有 reader 内对有明确 BOM 的 UTF-16 文本严格解码,再执行同一套内容检查。保留其他无法解码内容的拒绝,补目录与显式输入的对照。
English verdict: REQUEST_CHANGES at 8eda65f. The widened directory scan correctly reads additional text, but reports a valid BOM-marked UTF-16 Windows folder configuration as an unreadable file and blocks the command.
A directory boundary scan admits Windows desktop.ini, which Explorer writes as UTF-16LE with a BOM, only for the UTF-8 reader to report it unreadable and block a clean scan. In the existing reader, retry an explicit UTF-16 BOM as strict UTF-16 text; a bare BOM, a UTF-32 BOM, or a malformed payload still fails closed. Add clean-directory, direct-file parity, content-rule parity, and malformed-UTF-16 cases, and document the encoding boundary. Signed-off-by: JasonBuildAI <jasonbuildai@gmail.com>
|
复评修复(5b79cb162)。 评审指出的 BOM-marked UTF-16
Fixed in 5b79cb1: the existing reader retries an explicit UTF-16 BOM as strict UTF-16 text before rejecting it. Bare/UTF-32/malformed BOM payloads stay undecodable, and other undecodable input still fails closed. Clean-directory, direct-file parity, content-rule parity and malformed cases are covered. |
loopx-agent
left a comment
There was a problem hiding this comment.
Reviewer: model_agent · gpt-6.2-sol · OpenAI (runtime_reported, xhigh)
动机 / Motivation
贡献者在提交前用 loopx check 扫描准备公开的目录,既需要知道普通文本被实际读取,也需要区分可以解码的系统文本与真正不可读的输入。 原本按少数后缀选择文件,许多文本从未读取。近期一版误跳过普通 Markdown。再前一头 8eda65f 修复了这处漏读,但 Windows Explorer 风格的 UTF-16 desktop.ini 仍使完整目录误报不可读。 成功但漏读可能使发布者误解检查范围,误报又会让含少量系统文本的目录需要额外人工筛查。 在同一临时目录比较普通 Markdown、未跟踪和受跟踪的 Finder 文件。另在 desktop.ini 上分别执行目录和单文件扫描,使用相同文本的 UTF-8、UTF-16 LE、UTF-16 BE 和损坏编码。 无 Git 目录的扫描保留两份 Markdown。未跟踪 Finder 文件不会妨碍目录扫描,强制跟踪同一文件后仍报不可读。上一头无法解码的两类带 BOM 的 UTF-16 文本在本头都可读,目录及单文件结果一致。 复验使用实际本地 CLI、合成文件和临时 Git 库。
改动思路 / Approach
loopx check 仍调用一个扫描器。路径与 Git 跟踪状态决定范围,读取器仅在 UTF-8 失败的路径依据内容标记处理编码。原有文本规则消费解码后的正文,诊断及退出状态仍由原入口产生。 交付现有目录入口的文本覆盖和 BOM 标记读取。可解码的 UTF-16 被扫描为正文,已知媒体及容器仍在正文检查范围之外。 保持文件选择和正文诊断由原扫描入口负责。解码器依据明确的 BOM 判断支持的文本编码,从失败路径返回结构化读取结果。
具体改动 / Changes
精确头 5b79cb162d17f27a55696570de32868b1d459e26,目标分支快照 35cb1d701a4ac85cf4430b48891197a979723d80。9 个文件新增 430 行、删除 26 行。生产变更集中在文件选择、编码读取与已有引用识别,其余是说明及测试。 分叉基线 2167578 使用旧的后缀白名单。73aab878b5 漏掉一份正常 Markdown,8eda65fc30 修复漏读但拒绝有效的 UTF-16 LE 和 BE。本头在目录和单文件入口读取这两种文本,仍拒绝不可解码输入。
关键代码讲解
-
_has_local_metadata_header。确认已知系统附属格式,保留同名的普通文本。 源码 -
iter_scan_files。合并 Git 路径和目录遍历,让 Git 管理的输入进入正文读取。 源码 -
_read_utf8。先读 UTF-8,解码失败后才尝试带显式 BOM 的 UTF-16。成功结果继续进入原文本规则。 源码 -
iter_utf8_file_reads。将单文件读取交给原有有界并发,保持消费顺序。 源码 -
PUBLIC_DIRECTORY_TEXT_COVERAGE 已满足。目录检查覆盖选择范围内的可发布文本,受 Git 管理的候选仍进入扫描,可解码的文本继续经过现有内容规则。 现有依据
对主干的风险 / Risks
扫描同一个目录和明确的 desktop.ini 文件,分别放入可解码和不可解码的合成输入。 畸形 UTF-16 和 UTF-32 继续失败,受跟踪的无效 Finder 文件继续失败。目录与单文件 CLI 的行为一致。 已跟踪且解码失败时命令退出 1。 文件名、Git 跟踪状态和编码标记是本地文件选择及解码条件。沿用既有诊断字段、扫描结果和退出码。 文档描述扫描范围,可解码正文仍过原内容规则。已纳入且无法读取的输入由 CLI 明确报错。
语义与 CI 对齐
PASS — 真实 CLI 的前后对照、287 项契约测试通过且 6 项按原条件跳过、72 项读取顺序及诊断测试通过。git diff --check 和标准本地 premerge 通过。 UNVERIFIED — Windows Explorer 现场生成、两个 Workbench 测试夹具所属的完整 daemon 套件,以及托管 CI 未单独运行。
我的整体评价 / Verdict
APPROVE。 现有发布前扫描在更宽的文本覆盖下保持明确的通过及失败诊断。 交付现有目录入口的文本覆盖和 BOM 标记读取。可解码的 UTF-16 被扫描为正文,已知媒体及容器仍在正文检查范围之外。 剩余验证范围见上。
English verdict: APPROVE. The directory scan keeps ordinary text and reports unreadable tracked input. Well-formed BOM-marked UTF-16 now reaches the existing content checks, while malformed input still fails.
Signed-off-by: huangruiteng <huangrt01@163.com>
huangruiteng
left a comment
There was a problem hiding this comment.
Reviewer: model_agent · GPT-5 · OpenAI · self_reported
动机 / Motivation
贡献者在发布前用 loopx check --scan-path 检查目录时会遇到这个问题:旧版只读取七种后缀,普通源码、HTML、TXT 和无后缀文本可能从未进入公共边界规则,命令却返回 clean。
修复前,同一含合成 token 的 notes.txt 直接扫描会失败,目录扫描却只读一个文件并成功;修复后目录与直接输入都读取文本并报告 notes.txt:1: credential。
真实 CLI 的目录扫描读取 2 个文件并返回 credential 错误,直接扫描读取 1 个文件并返回相同错误;普通二进制媒体仍跳过,未知不可解码输入仍 fail closed。
本 PR 不检查二进制媒体内部文字,不改变凭据规则本身,也不把已跟踪的 OS metadata 或未知不可解码文件静默放行。
改动思路 / Approach
The production logic stays in the existing contract scanner and bounded read adapter, with no second content boundary.
The PR delivers directory text coverage plus the minimum metadata and BOM handling needed to keep that coverage correct.
主路径是 loopx check -> iter_scan_files -> iter_utf8_file_reads -> scan_public_boundary。权威输入为 Selected filesystem roots, Git ownership, file headers and bytes,决定边界由 loopx/contract.py owns candidate selection and canonical boundary rules; file_reads.py owns bounded reads. 持有,结果是 Selected text is decoded and checked; binary media and header-proven untracked metadata are skipped.,再由 public_boundary_scan findings, unreadable_files, scanned_files and CLI exit status 消费。Existing fail-closed read errors and boundary hits remain owner-controlled.
具体改动 / Changes
按 docs/public-private-boundary.md 的 revision 81ff83a0193a93e737862e1adf3bcebdf104a953 核对,directory-text-coverage / metadata-header-discipline / bom-utf16 / binary-boundary 分别对应下面的行为与验证。
关键代码讲解
_resolve_scannable_file:Select a readable non-binary candidate from a directory or tracked path. Before required one of seven suffixes; now excludes only binary media/container suffixes after resolving the target.iter_scan_files:Merge tracked and walked candidates while preserving directory coverage. Before suffix-filtered candidates; now includes every non-binary candidate and skips only header-proven untracked OS metadata._has_local_metadata_header:Prove a known OS metadata format from its own bytes. Before the intermediate fix used names alone; now requires Finder or AppleDouble magic._read_utf8:Read UTF-8 and strict BOM-declared UTF-16 text. Before any UTF-16 text was unreadable; now explicit UTF-16 BOMs are decoded while bare/UTF-32/malformed inputs stay rejected.
变更共 9 files (2 production, 1 documentation, 6 tests/fixtures),430 additions、26 deletions。Widen directory candidate coverage, add strict BOM UTF-16 reads, and protect OS metadata and fixture expectations.
directory-text-coverage:A selected directory scans publishable files that can carry text, independent of the old suffix allow-list.,当前为 implemented。metadata-header-discipline:Only untracked OS metadata with a format-proving header is skipped; text lookalikes and tracked files stay scanned.,当前为 implemented。bom-utf16:Explicit BOM-marked UTF-16 text is decoded strictly and reaches the existing content rules.,当前为 implemented。binary-boundary:Known binary media/container assets remain outside the text scan.,当前为 implemented。
对主干的风险 / Risks
最强回归场景是 A legitimate text file named like OS metadata is skipped or a supported UTF-16 file is treated as unreadable.。触发状态为 A text lookalike ._README.md, tracked metadata, or explicit BOM-marked UTF-16 input.;The header check keeps lookalikes; tracked paths stay in the set; the reader refuses to skip BOM UTF-16.。影响范围是 Publication boundary directory scans only.,可观察性来自 scanned_files count, blocking_hits, unreadable_files and CLI exit status.,恢复路径是 Restore the previous suffix policy or correct/remove the offending file; tracked content remains fail-closed.。
changed_invariant_positive=passed (244 focused tests passed; directory and direct scans both returned notes.txt:1 credential; workbench 89 passed with TZ=UTC.);material_negative_or_failure=passed (Negative cases returned ok false with unreadable/content diagnostics.);repository_required_checks=passed (Ruff passed; standard premerge passed 6 direct checks, 10 catalog, 8 risk-profile and 1 public-boundary check with 0 failures.);broader_boundary_regression=passed (514 passed and 6 skipped; one unrelated temporary-venv source-reader test aborted with SIGABRT and reproduced alone.);remote_ci_observation=pending (New exact-head jobs were queued at review time.)。
- PASSED · Directory text coverage, metadata header discipline and BOM UTF-16.:244 focused tests passed; directory and direct scans both returned notes.txt:1 credential; workbench 89 passed with TZ=UTC.
- PASSED · Tracked metadata and malformed/unknown binary-looking text stay fail-closed.:Negative cases returned ok false with unreadable/content diagnostics.
- PASSED · Ruff, diff, RFC, catalog, risk-profile and public-boundary premerge.:Ruff passed; standard premerge passed 6 direct checks, 10 catalog, 8 risk-profile and 1 public-boundary check with 0 failures.
- PASSED · Broader contract/public boundary regression set.:514 passed and 6 skipped; one unrelated temporary-venv source-reader test aborted with SIGABRT and reproduced alone.
- PENDING · Remote CI for the new exact head.:New exact-head jobs were queued at review time.
我的整体评价 / Verdict
长程效果判断为 improved:发布前扫描不再基于文件名白名单产生可重复的漏检,目录与直接文件共享同一内容判定。。用户体验判断为 improved:贡献者获得更可信的 clean/error 回执,且正常 macOS、Git-less staging 和 Windows UTF-16 文本不会被错误阻断。。视觉检查不适用,因为本次没有改变渲染界面或布局。
The implementation reuses the canonical boundary patterns and keeps the changed selection inside the existing scanner. The review-driven metadata and BOM cases now have both positive and negative coverage; no new authority or parallel state model is introduced.
English verdict: APPROVE at 89fbe0e. Read every text file a directory boundary scan selects, preserve explicit binary and OS-metadata boundaries, and keep tracked or unreviewable content fail-closed.
Goal And Delivered Outcome
Outcome basis / optional anchor: Self-contained ordinary contribution: the reproduced defect and its regression tests are in this PR; the linked issue is the report for the same defect.
Goal/source and gap:
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.Observable before → after, with the validation row that proves it: a synthetic token in
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.Issue/task and intended base: Closes [Bug]: the
loopx checkdirectory boundary scan skips all text outside a seven-suffix allow-list #9421; intended baseupstream/main216757852.Author Declaration
Implemented against
docs/public-private-boundary.mdat216757852(§ "loopx check treats that as a file-state boundary") and the linked issue.docs/public-private-boundary.md:257-261)_resolve_scannable_file,BINARY_MEDIA_SUFFIXESinloopx/contract.pytests/test_contract_scan_text_coverage.py,tests/test_contract_public_boundary_prefilter.py--scan-pathdirectory is reviewed for outgoing private material (loopx check --help)tests/test_contract_scan_text_coverage.pyBINARY_MEDIA_SUFFIXES,_is_binary_media_pathtest_directory_scan_skips_binary_media_without_failingdocs/public-private-boundary.md:263-267)LOCAL_METADATA_HEADERS,_has_local_metadata_header,tracked_pathsinloopx/contract.pytests/test_contract_scan_text_coverage.py(gitignored.DS_Store/AppleDouble clean;git add -f .DS_Storestill fails closed; no-Git staging text lookalike scanned)docs/public-private-boundary.md:263-269)_decode_bom_utf16,_read_utf8inloopx/control_plane/runtime/file_reads.pytests/test_contract_scan_text_coverage.py(UTF-16desktop.iniclean; direct/directory parity; malformed UTF-16 rejected)test_undecodable_file_with_an_unknown_suffix_stays_unexamined;tests/control_plane/test_public_boundary_parallel_reads.py_resolve_scannable_filetests/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 currentmain81ff83a0193a93e737862e1adf3bcebdf104a953real_entrypointpassedloopx 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_entrypointpassed.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_entrypointpassedREADME.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_entrypointpasseddesktop.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_entrypointpassedloopx 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_paritypassedstaticpassedpython -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.integrationpassedloopx 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.unitpassedtests/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.unitpassedpersonal-plan.test.ts7/7 andadapters.test.ts82/82 undernpx tsx --testinapps/workbench/packages/daemon.integrationpassedtests/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.unitpassedos.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).integrationnot_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).