compass(tests): pin the citation check's atom/model_engine/ prefix strip - #413
Conversation
The docstring citation check keys a site by its path with `atom/model_engine/` stripped, so a site in a same-named file elsewhere keeps a `/` that no citation matches. Nothing held that: switching the key back to the base name left every test green. `cite` moves to module level as `_cite`, unchanged, and one test feeds it a cited site moved to `atom/diffusion/engine/`, asserting the original is cited and the moved one is not. Closes #411 Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
| citation matches. A base name would let it satisfy the citation. | ||
| """ | ||
| site = next(s for n in UNWAITED for s in SITES[n]) | ||
| moved = site._replace(file=f"atom/diffusion/engine/{pathlib.Path(site.file).name}") |
There was a problem hiding this comment.
Non-blocking. The test catches a base-name _cite, but one other spelling of the strip survives it.
I measured this on xiaobizh_n18_cpu, on the merged tree d358a0253. Each mutant replaced the one return line in _cite; the line count stayed at 1236.
| mutant | whole file | with a plant |
|---|---|---|
R1: re.sub(r'^atom/[a-z_]+/', '', s.file) (strip any atom/<pkg>/) |
70 passed | C3: an unwaited call_func("exit") at atom/zz_plant/engine_core.py:260. Head: cite 1 failed at :1177. R1 + C3: 2 passed (cite and new). |
So R1 reopens the collision for a same-named file one level under any sibling package. The moved path here is two levels down (atom/diffusion/engine/). Under R1 it keeps an engine/ segment, so R1 leaves it uncited. R1 still catches the real C1 file: R1 + C1 is red at :1177.
The brief's required finding is M2, and M2 is pinned. I reproduced it red by name at :1194. R1 is not the obvious "simplification". It does not hold APPROVE.
If you want it closed at zero lines, f"atom/diffusion/{pathlib.Path(site.file).name}" kills M2, R1 and rsplit('/', 1)[-1]. The cost is that the test no longer names the real same-named file. Declining is fine.
Principle 6, "Refuse rather than fall back. ... A guessed one is a defect." AI_DEV_RULES gate 4, "A check counts only once someone has seen it fire."
| """ | ||
| site = next(s for n in UNWAITED for s in SITES[n]) | ||
| moved = site._replace(file=f"atom/diffusion/engine/{pathlib.Path(site.file).name}") | ||
| cited = set(re.findall(CITATION, PACKAGE_DOC)) |
There was a problem hiding this comment.
Non-blocking, ponytail. L1192: shrink: cited = set(re.findall(CITATION, PACKAGE_DOC)) repeats L1174. Add a module-level CITED = set(re.findall(CITATION, PACKAGE_DOC)) beside CITATION and use it in both tests: net -1.
This is optional. The duplicate is one line, and both copies read the same constant.
Principle 3: "Prioritise simplicity. Add only what is necessary, and nothing more."
|
Review cycle 1: APPROVE, head There are no blocking findings. Two non-blocking findings are inline. What was checkedEvery changed line. The diff is
MutantsThese ran on
The brief's named result is met:
Finding 1 (non-blocking, inline at L1191): R1 survives. It is not the obvious simplification, and M2, the required finding, is pinned, so it does not hold APPROVE. AI_DEV_RULES gate 4: "An inert pin on a required finding blocks APPROVE." The pin on M2 is not inert. A zero-line option is inline. ponytail-review
net: -1 lines possible. Gate 1The tip moved from
Suite delta: +1 id, the new test. No flake class fired. The tip baseline is #410's gate on the same tree, For the next task in this area
|
…ile citation test (#418) Stripping any atom/<pkg>/ prefix (R1) survived test_a_site_in_a_same_named_file_elsewhere_is_not_a_cited_one. That test planted its site two levels below atom/, where R1 still left a "/" behind. The site now sits at atom/diffusion/<name>, one level below atom/, and the docstring names the atom/<pkg>/ strip next to the base name. These _cite mutants now fail the test by name: - R1 and M2, from the #413 review; - R3, taking the text after the last "/"; - two added in this review: strip atom/ plus one or two segments, and endswith. Both citation tests now read one module-level CITED frozenset. A missing runner package docstring now surfaces as a collection error at import, not as 8 named failures. That is filed as a follow-up. Gate (node 18, CPU tier, merged tree on 29006c6): 5275 passed, 155 skipped, 3 xfailed, GATE_CPU_RC=0. Closes #416 Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Closes #411
What changed
tests/compass/test_runner_rpc_surface.pyonly, +19 / -6 (net +13, brief 5-15):citeintest_every_site_the_package_docstring_cites_is_one_no_caller_waits_formoves to module level as_cite. Its body and its parameter name are unchanged, so the reviewer's M2sedfrom compass(tests): key broadcast sites by their repo-relative path, not the base name engine_core.py #407 still applies verbatim.test_a_site_in_a_same_named_file_elsewhere_is_not_a_cited_one. It takes a real cited site fromSITESand moves it toatom/diffusion/engine/<same base name>. It then asserts that the original is cited and the moved one is not. The first assertion keeps the second from passing vacuously.Nothing near
test_what_the_comment_says_a_hole_at_exit_loses_is_what_exit_doesis touched.Mutant table
Measured on
xiaobizh_n18_cpu, on the merged treed358a0253(tip60186b80c+ heade5b4d4007). Each plant ran on a copy that was restored afterwards, anddiff -rqagainst the staged tree was checked empty.atom.__file__resolved under the staged root.test_a_site_in_a_same_named_file_elsewhere_is_not_a_cited_onetest_every_site_the_package_docstring_cites_is_one_no_caller_waits_for_citereturnspathlib.Path(s.file).name(the reviewer's sed, line count 1236 kept)FAILED ...::test_a_site_in_a_same_named_file_elsewhere_is_not_a_cited_oneat:1194,assert 'engine_core.py:500' not in {...}call_func("exit")atatom/diffusion/engine/engine_core.py:260:1177atom/model_engine/zz/engine_core.py:260:1177:1194,assert 'engine_core.py:260' not in {...}Under M2 the failing assertion is the
not inone (:1194), not the non-vacuity guard. The sitenext()picks depends on set order. Every cited site gives the same verdict, so the order does not matter.Gate 1
Merged tree
git merge-tree --write-tree 60186b80c e5b4d4007=d358a0253. It was gated once, onxiaobizh_n18_cpu, with its ownscripts/compass/gate_cpu.sh.git archiveof stamp commit1ea8471ca(parents tip60186b80cand heade5b4d4007). The tarball md5ff5ab2fcd7574a379f5293f70a11edc2matched on both ends..compass-changed=tests/compass/test_runner_rpc_surface.py.commit: 1ea8471ca (stamp)andatom: /tmp/i411/merged/ATOM/atom/__init__.py.timeout -k 10 3000, not piped, and ran alone.GATE_CPU_RCd358a0253Suite delta: +1 id, the new test. #402, which moved the tip from
4116a63a9to60186b80cduring this work, changes only the package docstring and adds no test. No flake class fired.ruff checkandruff format --checkon the changed file are clean.🤖 Generated with Claude Code