refactor: repo-wide batch-simplify re-sweep — 1,031 files reviewed, 11 redundancies removed - #3486
Conversation
…test-coverage (batch-simplify wave 1) Repo-mode batch-simplify wave 1 (groups: root-config, scripts/lib, scripts parts 1-4). Sole change: check-fleet-finding-test-coverage.sh drops the intermediate missing_tmp build-then-read pass and tests "! kind_asserted && un-baselined" directly over emitted_tmp in --check mode (-8 lines, one fewer temp file). All other 130 files in the wave reviewed clean. Behavior preserved: black-box old-vs-new comparison was byte-identical across green/discover/forced-red runs, a fresh-context refutation verifier could not construct a counterexample across 19 attack scenarios, and the suite passes (11/11) via affected-tests.sh. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FXfW1Ro1VBjjHSBewern3X
… drop dead initializer (batch-simplify wave 3)
Repo-mode batch-simplify wave 3 (groups: code-tidying, context-guard,
discovery, docs-hygiene, guardrails lib, instruction-placement). Sole
change: detect.sh replaces the manual `--` capture loop with the
marketplace-precedented `EXPLICIT+=("$@"); break` and removes a dead
SECTION_COUNT=0 initializer. All other 61 files in the wave reviewed
clean. Behavior preserved: fresh-context refutation verifier ran 23
argv/edge-case attacks old-vs-new (byte-identical stdout/exit codes)
plus the full 40-case suite; changelog parity (--check, --check-bump)
and the 16 affected suites pass. instruction-placement 0.11.10 ->
0.11.11 with changelog entry.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FXfW1Ro1VBjjHSBewern3X
…t (batch-simplify wave 4) Repo-mode batch-simplify wave 4 (groups: planning, plugin-quality, rate-limit-guard, session-flow, skill-quality, source-control misc). Sole change: the check-open-questions and goal-condition-length test suites use their own expect_exit helper for the --help exit-code case instead of a hand-rolled inline assertion. All other 66 files in the wave reviewed clean. Behavior preserved: fresh-context refutation verifier compared old-vs-new suites byte-for-byte on the passing path, verified argv is uncontaminated by the helper's stdin argument, and confirmed identical detection power against mutated subjects (--help exiting 1; --help reading stdin); both suites pass via affected-tests.sh. planning 0.34.11 -> 0.34.12 with changelog entry. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FXfW1Ro1VBjjHSBewern3X
…helper (batch-simplify wave 5)
Repo-mode batch-simplify wave 5 (groups: work-items misc, small-plugins
parts 1-2, disk-hygiene lib+clean, disk-hygiene setup, autonomy setup).
Sole change: test_python3_alias_probe.py's make_file helper drops a
hand-rolled open("wb") context manager with a dead zero-size guard for
path.write_bytes(b"\0" * size). All other 90 files in the wave reviewed
clean. Behavior preserved: fresh-context refutation verifier confirmed
byte-identical contents/permissions across all sizes the suite uses
(matching CPython's own write_bytes implementation) and 10/10 tests
pass in the python lane. disk-hygiene 0.20.30 -> 0.20.31 with
changelog entry.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FXfW1Ro1VBjjHSBewern3X
…r in automode-entry-diff (batch-simplify wave 6) Repo-mode batch-simplify wave 6 (groups: ai-briefing build+tests, claude-config audit/audit-instructions/audit-permission-state, claude-memory skills). Sole change: automode-entry-diff.sh's empty-prediction guard loses its printf command-substitution wrapper; the value's grammar (non-empty IFS-trimmed rules each followed by one newline) makes the wrapper's trailing-newline stripping unobservable, so the two tests are equivalent in every reachable state. All other 70 files in the wave reviewed clean. A first attempt at this group was interrupted by a rate limit and its partial edit reverted; the retry re-derived the change independently with a full equivalence proof, and a fresh-context refutation verifier could not refute it (static trace, 12-case empirical matrix, 63/63 suite checks, no-writes property intact). claude-config 0.40.14 -> 0.40.15 with changelog entry. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FXfW1Ro1VBjjHSBewern3X
…atch-simplify-bx7vgv # Conflicts: # plugins/claude-config/.claude-plugin/plugin.json # plugins/claude-config/CHANGELOG.md # plugins/disk-hygiene/.claude-plugin/plugin.json # plugins/disk-hygiene/CHANGELOG.md # plugins/instruction-placement/CHANGELOG.md # plugins/planning/.claude-plugin/plugin.json # plugins/planning/CHANGELOG.md
…(batch-simplify wave 7)
Repo-mode batch-simplify wave 7 (groups: claude-ops lanes +
observability, docs-hygiene audit-noise, kindle-dedrm manage,
knowledge docpage-digest + map-corpus). Changes: lanes'
machine-behavior.sh drops the WT_COUNT parallel counter in favor of
${#WT_LINES[@]}; observability's claude-observability.test.sh collapses
two case-based substring checks into its own assert_contains helper;
docpage-digest's digest_fences.py removes dead `unclosed` bookkeeping
from parse_claims. All other 66 files in the wave reviewed clean. Each
change refutation-verified by a fresh-context agent (divergence traces,
old-vs-new fixture matrices, glob-metacharacter probes; 26/26, 33/33,
and 30-test suites identical), and the 5 affected suites pass via
affected-tests.sh on the merged tree. claude-ops 0.38.17 -> 0.38.18,
knowledge 0.13.23 -> 0.13.24, with changelog entries.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FXfW1Ro1VBjjHSBewern3X
…ocument absorbed wave-7 edits (batch-simplify wave 8) Repo-mode batch-simplify wave 8 (groups: course-digest extraction top + adapters/lib, video-digest extraction top + acquisition + adapters/evals + harvesting/lib). One new change: acquisition/acquire.js passes mergedDeps directly to acquireFullStaged instead of re-injecting a withThrottle value that was by construction mergedDeps' own value or the same default the callee re-derives; a fresh-context refutation verifier traced the full case matrix (function, absent, null, falsy non-callable) and found no divergent reachable shape. This commit also expands the knowledge 0.13.24 changelog entry to name two edits that wave 7's broad staging absorbed into 282a837 before their write-ups: setup-deps.mjs's redundant inner sort removal and build-yt-dlp-args.js's born-dead export removal - both since refutation-verified byte-identical (stamps identical under readdir scrambling; zero references to the dead export at any commit, no export-enumeration observers). All other 108 files across the wave reviewed clean. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FXfW1Ro1VBjjHSBewern3X
…simplify waves 9-11)
Final wave of the repo-wide /code-tidying:batch-simplify re-sweep. Groups G58-G73
(machine-health Pester suites, repo-hygiene clean, babysit-prs, the pull-request
skill, and the whole work-item-tracker tree including all five adapters and
plugins/miro) were reviewed file by file; ~200 files came back reviewed-clean and
these six carried a real redundancy.
- machine-health Clear-TempFiles.Tests.ps1: parse check output through the shared
ConvertFrom-CheckOutput helper, as sixteen sibling suites already do, instead of
inlining the helper's own body.
- repo-hygiene scan.sh: one echo with ${STALE_REFS:-none} in place of a two-branch
if that repeated the output label in both arms.
- source-control pr_queue_snapshot.py: resolve_self_logins dedupes via
dict.setdefault, matching babysit_gh.resolve_authors, instead of carrying a
parallel seen set.
- work-items linear/common.sh: drop a duplicated comment clause that inverted its
own meaning; the restored sentence is what gitea/common.sh already carries.
- work-items local-markdown/common.test.sh: source via the SCRIPT_DIR the previous
line already computed.
- work-items lib/lease.test.sh: name the injected fixed clock directly rather than
recomputing it as BOUNDARY_EXPIRY - BOUNDARY_TTL * 3600.
Behavior preservation was checked by fresh-context refutation verifiers, which were
asked to break each claim rather than confirm it. The PowerShell change was cleared
against fourteen input shapes executed side by side plus a Pester replica passing
under both 5.7.1 and 6.1.0; the Python change against an exhaustive differential
fuzz over casefold-colliding tokens; the scan.sh change against a twenty-value byte
differential and three end-to-end fixtures.
Two candidate edits under adapters/linear/schema-check were reverted rather than
shipped: those files map to no test suite, and this repo deliberately treats that as
an error rather than as nothing to run. No CI lane covers them, so an allowlist entry
would have been a coverage claim the repo cannot honor.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FXfW1Ro1VBjjHSBewern3X
origin/main advanced nine commits while the sweep's final wave ran. No code conflicts: none of main's 126 changed files overlaps any file this branch touched. Eight conflicts, all in version manifests and CHANGELOGs where both sides bumped the same plugin. Resolved by renumbering this branch's entries strictly above main's current versions and keeping both sides' prose, ordered descending: - claude-ops 0.38.18 -> 0.38.20 (main took 0.38.18 and 0.38.19) - instruction-placement 0.11.12 -> 0.11.13 (collision: both wrote 0.11.12) - knowledge 0.13.24 -> 0.13.25 (collision: both wrote 0.13.24) - source-control 0.55.31 kept (already above main's 0.55.30) - work-items 0.39.40 kept (already above main's 0.39.39) check-changelog-parity.sh --check and --check-bump origin/main both pass. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FXfW1Ro1VBjjHSBewern3X
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Claude finished @kyle-sexton's task in 2m 47s —— View job Code review complete
Scope. This repo carries a Findings: none. Every non-mechanical hunk holds up as behavior-preserving:
Version bumps are all patch-level ( No inline comments were posted since no findings survived review. |
|
Claude finished @kyle-sexton's task in 48s —— View job Security review —
|
|
Last security-reviewed head: |
|
Claude has reviewed this PR 1 time. The lane skips further automatic reviews after 5; deleting this comment resets the count. |
…ed) (#3492) No linked issue ## Summary Full-repository `/code-tidying:batch-simplify repo` sweep: 1,154 code files in 68 dependency-ordered groups across 12 waves, each group read end to end by a dedicated simplifier agent and every non-empty diff adversarially checked by a fresh-context refutation verifier. Only behavior-preserving changes land; deferred findings are being worked in this same branch rather than filed as issues. This PR grows by one commit per wave; this body's Verification section is updated as waves land. ## Fix Wave 1 (root config, `lib/` SSOT, `scripts/`; 98 files read, 5 changed): - `scripts/affected-tests.sh`: `lang_family()` converted from command-substitution return to a `LANG_FAMILY` global (one fork saved per frontier path and per reverse-lookup hit, per the header's Windows spawn budget); single-use `invoke_print_manifest` wrapper inlined. Selection proven byte-identical old-vs-new across ten seed scenarios. - `scripts/check-fleet-finding-test-coverage.sh`: baseline temp file replaced by an ordered in-memory array (same order/duplicate semantics, one fewer mktemp + trap arg). - `scripts/check-orphaned-fixtures.sh`: nested two-`find` walk collapsed to one `find -print0 | sort -z` pipeline; live-tree discovery byte-identical (363 entries). Only delta: a synthetic `evals/fixtures` nested inside another fixtures tree was double-reported by the old code and is reported once now. - `scripts/check-plugin-catalog-enablement.sh`: header env-override list gains the missing `PLUGIN_CATALOG_ENABLEMENT_BOOTSTRAP` entry (comment-only). - `lib/hook-utils.test.sh`: seven stale `hook-utils.sh:<line>` comment references refreshed (stale since #3463; comments only). Waves 2–12 and a deferred-work pass follow on this branch. ## Verification - shellcheck (repo `.shellcheckrc`) clean on every touched file. - `scripts/affected-tests.sh --run` over all five changed files: 124 selected shell suites pass; the seven delegated Python suites run directly, all pass except `plugins/disk-hygiene/lib/test_hook_telemetry.py`, whose `test_absolute_sink_used_as_is` races a fire-and-forget subprocess and fails at HEAD too on fast machines (untouched by this wave; robustness fix queued for the disk-hygiene wave in this branch). - All four `lib/` sync clusters verified drift-free (`scripts/sync-*.sh --check`). - Per-group fresh-context refutation verifiers: NOT-REFUTED for the `affected-tests.sh` and `lib/hook-utils.test.sh` diffs (differential runs byte-identical); the orphaned-fixtures nested-double-report delta above was surfaced by its verifier and accepted as strictly more correct. ## Related Refs #3486 (prior repo-wide simplify sweep this run re-verifies), #3463 (source of the stale test-comment line numbers), #3488 (recent shell-portability perf work in the same scripts area). 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01W61wikkiEK5StWgg9rfEQW --- _Generated by [Claude Code](https://claude.ai/code/session_01W61wikkiEK5StWgg9rfEQW)_ --------- Co-authored-by: Claude <noreply@anthropic.com>
## Summary Second and final delivery of the repo-wide `/code-tidying:batch-simplify` sweep (waves 1-3 merged in #3492). This PR carries waves 4-12 of the 68-group sweep plus the deferred-work pass that closes out every actionable finding the sweep recorded. Sweep waves (each edit refutation-verified by a fresh-context verifier before shipping; near-zero yield expected and confirmed after the #3486 sweep two days prior): - Waves 4-8 (previously pushed): claude-ops hook-failure-audit early exit and restart-consumer locals, disk-hygiene telemetry test race fix, markdown-format inert ctx_reset removal, knowledge dead-export removals, machine-health dead test helpers, plus per-wave version bumps (claude-ops 0.38.21, disk-hygiene 0.20.35, markdown-format 0.11.35, knowledge 0.13.28, machine-health 0.11.17, and siblings). - Wave 9: provenance 0.4.2, `check-stamps.sh` duplicate-branch collapse (25-case executed input matrix, byte-identical). - Wave 10: repo-hygiene 0.10.19, stale `shellcheck disable=SC2086` removed from `git-prune.sh` (proven inert under the pinned ShellCheck). - Wave 11: source-control 0.55.32, `fetch-annotations.sh` comment-accuracy fix (comment was wrong from its first commit). - Wave 12: zero net edits; three provably-locally-stale SC2154 disables were reverted by an orchestrator consistency ruling to keep the 51-file byte-uniform disable header intact. - Two refutations led to full reverts earlier in the run (claude-ops jq_fields consolidation; knowledge spawn merge), both with executed counterexamples. ## Fix Deferred-work pass (commit "Deferred-work pass", reviewed as a whole by a fresh-context adversarial pass): root scripts (changelog-parity message spacing plus test pin, cheatsheet named diagnostic for frontmatter-less SKILL.md, allowScripts lockstep to 2.1.246, deletion-aware `affected-tests.sh` with two suite cases and README contract update); guardrails 0.29.24 (verify-cli-flag printf-pipe with ten-case byte-identical differential, require-jq zero-match count fix); machine-health 0.11.18 (doc name fix, real `[Console]::Error` capture in ElevationBanner tests, Restart-StoppedService Linux stubs 0 to 10 passing, Scaffold env pin 17+3 to 20); claude-config 0.40.21 (case-label renumber); discovery 0.16.18 (root-env visible skip); instruction-placement 0.11.14 (render-index brace-glob corruption fix plus pins); rate-limit-guard 0.7.21 and context-guard 0.7.28 (statusline tees exchange proven hardening: >1MiB pass-through, noclobber temp writes, SIGKILL temp reclaim; zero-fork assertions and bench floor unchanged); source-control 0.55.33 (three `--help` printers stop truncating, one recovering 38 lines); work-items 0.39.42 (vacuous conformance assert removed, schema-check tree comment fix plus no-suite allowlist entry); knowledge 0.13.29 (orphaned `promotion-name-map.js` removed, zero importers re-proven). ## Verification - Every sweep edit passed a fresh-context refutation verifier with executed evidence; every deferred fix shipped with reproduce-then-fix evidence and before/after suite counts. - Full-suite union run vs origin/main: 146 shell suites passed or skipped; non-shell lanes run directly (Pester file-by-file under pwsh 7.6.5, Python lanes, knowledge vitest 154/154 plus tsc, miro npm typecheck/lint/test/verify-bundle). - Gates green at every push: changelog parity (`--check-bump`, `--check-order`), vendor bump, catalog `--check`, cheatsheet `--check`. - An independent adversarial review over the deferred-work diff surfaced two findings; both are fixed in this PR (the deletion-aware affected-tests handling and a changelog wording correction). ## Related No linked issue. Follows #3492 (waves 1-3) and the prior repo sweep #3486. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01W61wikkiEK5StWgg9rfEQW --------- Co-authored-by: Claude <noreply@anthropic.com>
No linked issue
Summary
A full-repository
/code-tidying:batch-simplifyre-sweep. The 3,375 tracked files were filtered to 1,031 code files, divided into 73 groups, and reviewed group by group by fresh-context agents. Eleven files carried a real redundancy; the other ~1,020 came back reviewed-clean.That ratio is the expected result, not a shortfall. PR #3454 (the previous repo-wide batch-simplify), #3404 (dissolve-comments) and #3453 (audit-comment-residue) all merged the day before this sweep started, so the prompts were calibrated hard against churn: no style preferences, no comment rewording, no reordering, no "modernization" a reviewer could not distinguish from noise. An edit had to be a genuine simplification — redundancy removed, dead code removed, a real duplication collapsed — with behavior provably identical.
Fix
Eleven files, grouped by what was removed.
Dead code and dead bookkeeping
scripts/check-fleet-finding-test-coverage.sh— dropped an intermediatemissing_tmppass.plugins/instruction-placement/scripts/detect.sh— replaced a manual--argument-capture loop with the marketplace's precedentedEXPLICIT+=("$@"); break, and removed a deadSECTION_COUNT=0initializer.plugins/claude-ops/skills/lanes/scripts/machine-behavior.sh— removed theWT_COUNTparallel counter; both reads now use${#WT_LINES[@]}directly, matching the file's existingWANT_PLUGINSidiom.plugins/knowledge/skills/docpage-digest/scripts/digest_fences.py— removedunclosedbookkeeping fromparse_claims; the flag was assigned on both arms of the try and the trailingif unclosedcould never change the already-computed value.plugins/knowledge/skills/video-digest/extraction/acquisition/build-yt-dlp-args.js— removed the born-dead exportYT_DLP_CAPTION_ONLY_SLEEP_SUBTITLES_SEC(zero references at any commit; the consumed constant lives inacquire-retry-policy.js).plugins/knowledge/skills/video-digest/extraction/setup-deps.mjs— removed a redundant per-directorylocaleComparesort insidecomputeStamp's walk; the final code-unit path sort alone determines hash-input order.plugins/knowledge/skills/video-digest/extraction/acquisition/acquire.js— dropped a double-defaulting spread at theacquireFullStagedcall site.Duplication collapsed onto an existing in-repo form
plugins/source-control/skills/babysit-prs/scripts/pr_queue_snapshot.py—resolve_self_loginskept a result list alongside aseenset whose only job was tracking keys the result already implied; now thedict.setdefaultform the siblingbabysit_gh.resolve_authorsalready uses.plugins/machine-health/.../tests/windows/remediations/Clear-TempFiles.Tests.ps1— parses check output throughConvertFrom-CheckOutput, as sixteen sibling suites already do, instead of inlining that helper's own body.plugins/repo-hygiene/skills/clean/scripts/scan.sh— a two-branchifprinted the literalGit stale refs dry-run:in both arms; now oneechowith${STALE_REFS:-none}, matching the sentinel form the preceding line uses.plugins/planning/scripts/{check-open-questions,goal-condition-length}.test.sh— inline--helpassertions replaced with the suite's ownexpect_exit.plugins/claude-config/.../automode-entry-diff.sh:365,plugins/claude-ops/.../claude-observability.test.sh,plugins/disk-hygiene/.../test_python3_alias_probe.py,plugins/work-items/.../local-markdown/common.test.sh,plugins/work-items/.../lib/lease.test.sh— small local collapses of the same kind.plugins/work-items/.../adapters/linear/common.sh— removed a duplicated comment clause that inverted its own meaning; the restored sentence is whatadapters/gitea/common.sh:43-45already carries verbatim.Verification
Behavior preservation. Every shipped edit was cleared by a fresh-context refutation verifier briefed to break the claim, with "looks fine" explicitly rejected. All returned NOT-REFUTED. The strongest evidence:
pr_queue_snapshot.py— exhaustive differential over a 33-token casefold-colliding alphabet (ß/SS/ẞ, U+212A Kelvin,İ/ı, ligatures, combining iota) for lengths 0–3: 33,825 inputs, 0 divergences; plus 200,000 random sequences and a 67,584-group codepoint sweep, also zero. Every call site traced; the sole production consumer wraps the result infrozenset(...).Clear-TempFiles.Tests.ps1— 14 input shapes executed side by side (blank-line interleave,@(),$null, top-level and nested arrays, falsy0/$false/'', non-JSON), plus a Pester-structure replica passing under both 5.7.1 and 6.1.0 confirming mocks still intercept through the new call path.scan.sh— 27-value byte-differential under four shell option combinations, plus old-vs-new whole-script runs over three git fixtures; stdout, stderr and exit status byte-identical throughout.Test lanes (all run sequentially, as the guardrails suites assert wall-clock ceilings):
scripts/affected-tests.sh --run(38 changed files)tests/windowsis OS-gated (Invoke-MachineHealthTests.ps1:102) and this is Linux; the runner selects atests/linuxtree that does not exist. The one edited file parse-checks clean under pwsh 7.6.5.Gates:
check-changelog-parity.sh --checkand--check-bump origin/mainboth pass;check-cross-plugin-source-drift.sh --checkreports no unregistered or drifted clusters.Two things I did not ship, deliberately. Two valid cleanups in
adapters/linear/schema-check/were reverted: those files map to zero test suites, and this repo treats that as an error rather than "nothing to run". No CI lane covers them (they need a fetched schema and a manualnpm install graphql), andaffected-tests-no-suite.txtsays in its own header that an uncovered.mjsshould fail there — so an allowlist entry would have been a coverage claim the repo cannot honor. A dead= []initializer is not worth that.Related
Findings filed from this sweep's deferral ledger, High priority only:
clean-batch.shrejects a--repos-fromfile whose last line is blank, with a "file not found" message naming the wrong problemfetch-all-pr-comments.shmasks a failed finaljqmerge behind a trailingexit 0create-item.shlabel paging continues past a malformed page instead of breakingPrior sweeps this one re-swept: #3454, #3453, #3404. Open findings from those (#3407–#3451, #3374–#3375) were treated as a skip list and left alone.
Follow-up not addressed here: the garbled comment clause fixed in
adapters/linear/common.shalso lives in the adapter generator template atplugins/work-items/skills/onboard-adapter/scripts/templates/common.sh.tmpl:43-45, so newly generated adapters will reproduce it..tmplfiles were excluded from this sweep as rendered content, and no gate diffs shipped adapters against the template, so nothing currently breaks.Roughly 160 sub-High deferrals (dedup candidates blocked by the recorded per-plugin test-helper decision, perf items that would change process counts or failure isolation, and cosmetic items rejected as churn) were recorded and not filed, per repo-mode policy.
Generated by Claude Code