Repository navigation
test(ci): the duplication-guard explain tests no longer read the real /tmp logs (#17377) - #21817
Conversation
…ation (#17377) tools/lint/file_size_engine.py holds the ratchet once: enumeration, line count, three-way verdict, unmeasured/vanished/reach findings, the audit and the commit path. scripts/check_{python,shell,frontend}_file_size.py are now a GateConfig plus thin delegations, built from module globals at call time and passing their own collaborators in, so every monkeypatch in the ratchet and parity tests is still obeyed. Rebuilt on current main rather than revived: the frontend gate (#17885) landed separately and is folded in here, and the shared configure_logging from _scan_helpers is kept. Output parity: 19 invocations across the three gates (audit, real files, oversized/missing fixtures, excluded paths, cwd-relative runs from scripts/, --help, bad flags) produce byte-identical stdout/stderr and exit codes to origin/main. Two per-gate differences that were outside #17377's enumerated surface are kept as explicit config rather than unified: the summary noun (files vs file(s)) and whether the commit path skips excluded prefixes (python never did, and resolves against cwd; shell/frontend do, against repo_root). repo_tests/one_file_size_engine_17377_test.py fails any scripts/check_* size gate that does not import the engine, or that compares against the limit, opens a file or spawns a process, or spells a ratchet finding outside a docstring. AST-based, with a thin/forked contrast pair; main's three gate versions each trip it with 14 findings.
…module patches (#17377) AC3. The six audit tests that did monkeypatch.setattr(hook, ...) on repo_root, KNOWN_LARGE, tracked_python_files and audit_ceilings now take the gate's real GateConfig (hook._config(), varied with dataclasses.replace) and call engine.audit_tracked / engine.run_audit with a tmp root and an explicit file list. engine.audit_tracked is the new seam: the audit over a given list with the engine's own scanner. Zero monkeypatch calls remain in the file. Each rewritten test was shown to fail against a deliberately broken engine (six breaks applied to a temporary copy, restored byte-identical, 31 passed after): B1 no plain-limit verdict -> discovers_an_unlisted_oversized_file B2 over-ceiling passes -> surfaces_a_ceiling_violation B3 vanished pass dropped -> reports_a_vanished_entry B4 reach floor ignored -> fails_when_the_scan_reached_nothing B5 problems swallowed -> 5 of 6, incl. problems_are_reported B6 scan flags every file -> clean_for_an_unlisted_compliant_file
…> 11604 and 2831 -> 2830 (#17377) Measured with this workflow's exact flags and jscpd 5.0.6 (the version CI pins), over git-archive exports of origin/main and of this branch: main scope: 11,604 dup lines, 672 clones, 1,603,884 lines -- base and branch identical SLM scope: 2,830 dup lines, 123 clones, 265,516 lines -- base and branch identical The figures are the same on both trees, so this lowering is reclaimed slack from other merges, not a reduction made by the consolidation: the size gates live in scripts/ and tools/lint/, which neither scope scans. The comment says so, so the next reader can tell the two apart.
…scripts/ (#17377) Owner decision: widen the main scope to the repo's own tooling, so the size-gate consolidation (and any future fork there) is measurable at all. MAX_DUP_LINES 11604 -> 11881. The pin RISES only because the scope widened; against the same scope it falls. Measured with this workflow's exact flags and jscpd 5.0.6 (the CI pin) over git-archive exports, widened scope on both: (a) origin/main 12,108 dup lines, 694 clones, 1,638,816 lines, 4,475 files (b) this branch 11,881 dup lines, 686 clones, 1,638,643 lines, 4,476 files The 227-line drop is the size gates alone: clones among scripts/check_*_file_size.py went 12 -> 4 (318 -> 83 clone lines), and the clone set outside those files is identical between (a) and (b). The workflow's own scan steps, run locally over (b), print 11881 against an 11881 pin (rc 0) and 2830 against 2830 for the unchanged SLM scope. Nothing gates a raised pin yet (#16393), so the scope change and both figures are stated in the workflow comment. The scope is now stated once: MAIN_SCOPE_DIRS / SLM_SCOPE_DIRS in the job env, read by both scan steps and by "Explain failure". The paths: triggers cannot read env, so duplication_guard_scope_is_stated_once_17377_test.py asserts the pull_request and push trigger lists name exactly the scanned trees, with a contrast pair for each direction of drift. The names-the-failing-scope test now derives its scope labels from the same env instead of restating them.
… /tmp logs (#17377) test_a_missing_log_reports_no_figure_rather_than_a_guessed_one asserted the "no captured log" path, but the step it runs defaulted to /tmp/main-dup.log and /tmp/slm-gate.log -- files any local scan leaves behind. With them present the test measured a real log and failed, so its verdict depended on the machine, not the code. The log paths are now stated once, as MAIN_LOG / SLM_LOG in the job env, and the scan's tee, its gate call and "Explain failure" all read them (each was a separate /tmp literal before; scripts/duplication_gate.py takes the path as an argument and holds none). _run_explain gives every run its own empty TemporaryDirectory for both logs, and the scope test pins that the steps tee and gate through the env values. Proof, with both /tmp files created first: the rewritten test passes (1 passed; whole file 14 passed), and the previous version of the same test fails against the same files (1 failed). The files were then removed.
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
Auto-sync: merging
|
| side | commit | subject | issue refs |
|---|---|---|---|
| main | bfed335ff3 |
fix(ci): every job that runs repo python sets up the .python-version floor (#20903) | #20903 |
| main | e3c3ffbe8e |
fix(toolchain): review -- install.sh's minimum Node is the engines floor, the range check reads partial and hyphen ranges and fails closed, and the stale Node 20 comments name the home (#19328) | #19328 |
| main | d8b4a84aed |
dedup(toolchain): the Node.js major has one home -- the repo-root .nvmrc (22, maintainer decision); workflows read it, installers, Ansible, Dockerfiles and the sandbox image pin one guarded copy each (#19328) | #19328 |
| main | 00b80975d0 |
fix(ci): the three 18559 failure reports take overridable log paths and are tested (#18559) | #18559 |
| main | 66583b7d2e |
ci(duplication-guard): pins move to a data file, PAT-only bot PR, trigger coverage per extension (#18559, #16324, #18461) | #18559, #16324, #18461 |
| main | 073e5c05f7 |
ci(duplication-guard): mirror the draft gate on lower-pins (#18559, #16324, #18461) | #18559, #16324, #18461 |
| main | 4c2506c41d |
ci(duplication-guard): scope the tooling trees and two cross-tree sets, lower pins after merge (#18559, #16324, #18461) | #18559, #16324, #18461 |
| main | 51b441e75c |
ci(dup): the SLM pin is the final-head measurement, 1964 (#18819) | #18819 |
| main | ce02fb7c0d |
ci(dup): lower both jscpd pins to the #18819 measurement — SLM 2617 -> 1959, main 11231 -> 11197 (#18819) | #18819 |
| main | 5ae92c9f48 |
ci(duplication-guard): lower both pins to the counts main measures — 11707 -> 11231 and 2831 -> 2617 (#16324) | #16324 |
| main | 3ffda6346f |
refactor(slm-agent): the role deploys the agent from its one source tree; mirror, drift check and guard exclusion retired (#18548, #16100) | #18548, #16100 |
| this branch | bc7f7c8d56 |
test(ci): the duplication-guard explain tests no longer read the real /tmp logs (#17377) | #17377 |
| this branch | 68d7a6398c |
chore(ci): the duplication guard scans scripts/, tools/ and pipeline-scripts/ (#17377) | #17377 |
| this branch | 85e3616038 |
chore(ci): pin the duplication guard at its measured figures, 11707 -> 11604 and 2831 -> 2830 (#17377) | #17377 |
repo_tests/duplication_guard_names_the_failing_scope_test.py
| side | commit | subject | issue refs |
|---|---|---|---|
| main | 00b80975d0 |
fix(ci): the three 18559 failure reports take overridable log paths and are tested (#18559) | #18559 |
| main | 66583b7d2e |
ci(duplication-guard): pins move to a data file, PAT-only bot PR, trigger coverage per extension (#18559, #16324, #18461) | #18559, #16324, #18461 |
| main | 4c2506c41d |
ci(duplication-guard): scope the tooling trees and two cross-tree sets, lower pins after merge (#18559, #16324, #18461) | #18559, #16324, #18461 |
| this branch | bc7f7c8d56 |
test(ci): the duplication-guard explain tests no longer read the real /tmp logs (#17377) | #17377 |
| this branch | 68d7a6398c |
chore(ci): the duplication guard scans scripts/, tools/ and pipeline-scripts/ (#17377) | #17377 |
repo_tests/python_file_size_ratchet_test.py
| side | commit | subject | issue refs |
|---|---|---|---|
| main | 0f1f7cc6e5 |
fix(test): gate the size ratchets against the merge base, not a shared ceiling table (#19673) | #19673 |
| main | 82e2fad6f9 |
perf(ci): the last guards parse through the shared parse cache (#20814) | #20814 |
| main | 9554e1b5d5 |
docs(ratchet): review -- the ratchet test docstring and the release-flip design doc no longer present the retired RATCHET_BASELINE mirror as live (#19544) | #19544 |
| main | ad4e03163c |
dedup(ratchet): one ceiling table per size gate, checked against the base commit; a guard bars a second one (#19544) | #19544 |
| main | 404c92d204 |
fix(ratchets): a raise its spanning run missed stays red -- every entry is also held to the last green main (AUTOBOT_RATCHET_ANCHOR); merge groups and pushes use their real base; a moved table reads its old path (#19283) | #19283 |
| main | 361f419f52 |
test(ratchets): no hand-summed totals -- each entry is ratcheted against the base commit's own table (#19283) | #19283 |
| this branch | b9a867b027 |
test(gates): the python ratchet tests inject through the engine, not module patches (#17377) | #17377 |
scripts/check_frontend_file_size.py
| side | commit | subject | issue refs |
|---|---|---|---|
| main | 336cd2dcfd |
fix(test): share one size-checker command line to clear the duplication guard (#19673) | #19673 |
| main | 4a85f9aecf |
fix(test): answer review on the base-gated size ratchets; state the base and drop the train-repin claim (#19673) | #19673 |
| main | 0f1f7cc6e5 |
fix(test): gate the size ratchets against the merge base, not a shared ceiling table (#19673) | #19673 |
| main | ad4e03163c |
dedup(ratchet): one ceiling table per size gate, checked against the base commit; a guard bars a second one (#19544) | #19544 |
| main | c7d1ebc4cd |
refactor(tooling): tracked_*_files reads EXCLUDED_PREFIXES at call time, not bound at import (#18954) | #18954 |
| main | 58bf9ee7b8 |
refactor(tooling): one flatten, ReportError, iter_ansible_files and tracked-file binding (#18954) | #18954 |
| main | 57c9349393 |
refactor(tooling): one file-size guard core for the python, shell and frontend gates (#18954) | #18954 |
| this branch | 720457911e |
refactor(gates): one ratchet engine, all three size gates as configuration (#17377) | #17377 |
scripts/check_python_file_size.py
| side | commit | subject | issue refs |
|---|---|---|---|
| main | 4a85f9aecf |
fix(test): answer review on the base-gated size ratchets; state the base and drop the train-repin claim (#19673) | #19673 |
| main | 0f1f7cc6e5 |
fix(test): gate the size ratchets against the merge base, not a shared ceiling table (#19673) | #19673 |
| main | ad4e03163c |
dedup(ratchet): one ceiling table per size gate, checked against the base commit; a guard bars a second one (#19544) | #19544 |
| main | c7d1ebc4cd |
refactor(tooling): tracked_*_files reads EXCLUDED_PREFIXES at call time, not bound at import (#18954) | #18954 |
| main | 58bf9ee7b8 |
refactor(tooling): one flatten, ReportError, iter_ansible_files and tracked-file binding (#18954) | #18954 |
| main | 57c9349393 |
refactor(tooling): one file-size guard core for the python, shell and frontend gates (#18954) | #18954 |
| this branch | 720457911e |
refactor(gates): one ratchet engine, all three size gates as configuration (#17377) | #17377 |
scripts/check_shell_file_size.py
| side | commit | subject | issue refs |
|---|---|---|---|
| main | 336cd2dcfd |
fix(test): share one size-checker command line to clear the duplication guard (#19673) | #19673 |
| main | 4a85f9aecf |
fix(test): answer review on the base-gated size ratchets; state the base and drop the train-repin claim (#19673) | #19673 |
| main | 0f1f7cc6e5 |
fix(test): gate the size ratchets against the merge base, not a shared ceiling table (#19673) | #19673 |
| main | 6507821100 |
fix(install): new installs generate the encryption key once, and every env render keeps it (#19864) | #19864 |
| main | a74de0c4ff |
Merge remote-tracking branch 'origin/main' into issue-19544-one-ceiling-table | none |
| main | cc5fb53ba9 |
Merge #19365 @ 15441fd into the merge train | #19365 |
| main | 2e3a41a9c8 |
Merge remote-tracking branch 'origin/main' into issue-19544-one-ceiling-table | none |
| main | ad4e03163c |
dedup(ratchet): one ceiling table per size gate, checked against the base commit; a guard bars a second one (#19544) | #19544 |
| main | 6ad97ff80e |
fix(ansible): deploy.sh, the ansible README, two role templates and the deployment docs stop naming playbooks that do not exist (#19239) | #19239 |
| main | 00d788b370 |
Merge remote-tracking branch 'origin/main' into issue-19232-redis-one-source | none |
| main | 57b33c0824 |
fix(redis): review round -- guard-scope read, one override contract, no Redis URL outside the resolver (#19232) | #19232 |
| main | 7c2acc66a6 |
refactor(preflight): the fleet-IP derivation moves to scripts/lib/fleet-ip-rule.sh with its own tests, so pr-preflight.sh meets its ceiling by splitting (now 815), not by trimming its comments (#19233) | #19233 |
| main | c69ae198a5 |
fix(install): the password vars file lives in a private run dir removed on any exit; the HTTPS wait needs a 2xx (#19236, #19234) | #19236, #19234 |
| main | 90284442d5 |
fix(install): pinned defaults follow their sources, the IP cache is root-only and validated, the interface choice reads /dev/tty (#19239, #17929) | #19239, #17929 |
| main | 36c83435a6 |
fix(install): a failed health, HTTPS, login or registration step stops the install, names the step and writes no marker (#19234) | #19234 |
| main | 6 more commit(s) not listed | ||
| this branch | 720457911e |
refactor(gates): one ratchet engine, all three size gates as configuration (#17377) | #17377 |
|
Needs a decision before this can merge; the merge into current main was not forced. Clash. This branch adds Options
Recommendation: option 1. The branch is left untouched at its previous head. |
|
Decision (owner, 2026-11-18): drop this branch's ratchet engine — main's shared core |
|
Scope reduced to the explain-test log isolation only. The shared size-gate engine, the scripts/tools widening and the scope-stated-once feature were superseded by main: the engine by #18954, the pins and re-pin tooling by #19544/#19673, the tooling gate by #18461 and the cross-tree scopes by #18559 (pins live in |
✅ SSOT Configuration Compliance: Passing🎉 No new hardcoded values of either class — Known backlog in |
Thinking Path
This PR was opened for an existing branch that never had one (triage status UNFINISHED). The branch carries 5ahead commit(s) of work not on main, linked to #17377 (The Python and shell size gates duplicate ~90% of their logic, and the Python ratchet test's monkeypatching blocks the obvious fix). It still needs a conflict sync with main and a review before it can merge. Acceptance criteria have not been verified against this branch.
What Changed
Commits on the branch (not on main):
Diff summary: 9 files changed, 835 insertions(+), 657 deletions(-)
Verification
Not yet verified. No CI evidence: this is a draft; no CI has run on it yet, and it needs a conflict sync with main and a review first.
Model Used
Branch authored by earlier Claude sessions; PR opened by Claude Sonnet 5.5.
Refs #17377
🤖 Generated with Claude Code
Summary by CodeRabbit