refactor: repo-wide behavior-preserving simplification sweep (batch-simplify) - #3454
Conversation
Repo-mode batch-simplify wave 1 (groups: root-config, scripts-lib,
claude-config-lib). Groups 01 and 09 reviewed clean, no changes needed.
Group 02: fix a self-contradictory comment on the expect() helper in
read-list.test.sh ("NUL-joined" -> "newline-joined"; the helper joins
with printf '%s\n'). Comment-only, behavior-preserving, adversarially
refutation-verified; suite 29/29, portability gate clean.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JCpHV7rFh5QiekTCPmN2qT
…og-parity gate Repo-mode batch-simplify wave 2 (groups: scripts-top entrypoints, sync, checks-1..4). Five of six groups reviewed clean, no changes needed. Group checks-1: remove the absorbed_reported dedup guard in check-changelog-parity.sh's --check-bump absorbed-heading loop - provably unreachable since introduction (touched_changelogs is already deduplicated by the seen_changelog guard at both build sites; confirmed via git log -L and an adversarial rename/copy fixture attack). Output bytes and exit taxonomy unchanged; suite 82/82; refutation verifier compared old vs new byte-for-byte across five fixture scenarios including dual-changelog absorption and merge-commit HEAD shapes - identical. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JCpHV7rFh5QiekTCPmN2qT
… scripts Repo-mode batch-simplify wave 3 (groups: claude-config permission-state / structure audits / instruction audits, claude-ops audits / runtime). Groups 11 and 13 reviewed clean. Applied, each adversarially refutation-verified against the pre-change script byte-for-byte: - claude-config audit-instructions/restatement-scan.py: drop a redundant "nunit and" truthiness test (length guard already excludes empty) and the main() empty-file-list special case (general path proven byte-identical; 20k-case differential fuzz). - claude-config audit-permission-state/automode-block-lint.test.sh: drop a duplicate command -v bash reassignment (62/62 checks, old-vs-new run byte-identical). - claude-ops inventory/inventory.py: hoist duplicated candidate_binaries() call into one snapshot; docstring em-dash normalization; formatter-hook layout churn AST-verified neutral (31/31 tests; --disk-only smoke byte-identical). - claude-ops plugins/normalize-enabled-plugins.sh: drop dead shellcheck disable=SC2064 above a single-quoted trap (31 checks pass). claude-config 0.40.12, claude-ops 0.38.12 with changelog entries. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JCpHV7rFh5QiekTCPmN2qT
Repo-mode batch-simplify wave 4 (groups: claude-ops observability,
course-digest extraction top-level + adapters/lib, knowledge misc,
video-digest extraction core). Four of five groups reviewed clean.
Group course-digest-scripts: drop a dead return { modulesDir } from
runLessonExtraction and the destructure feeding only it - repo-wide
call-site census shows the sole caller awaits without reading the value;
package suite 10 files / 91 tests green (npm ci + tsc + vitest);
refutation verifier confirmed no reader of the resolution value and no
getter side effects.
knowledge 0.13.15 with changelog entry.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JCpHV7rFh5QiekTCPmN2qT
Repo-mode batch-simplify wave 5 (groups: acquisition, adapters, evals, lib, transcript of video-digest extraction). Groups evals and lib reviewed clean. Applied, each adversarially refutation-verified with emitted bytes unchanged: - adapters/x.js: fold twice-built degraded-acquisition failure message into one failDegraded() helper; drop per-iteration Set + spread inside files.filter for a plain array (dedup unobservable under .some). - adapters/adapter-contract.js: collapse the two near-identical extractorArgs/allowedExtractors validation branches into one loop; violation strings and push order byte-identical. - adapters/youtube.js: single-use /^\// regex replaced by .slice(1) (WHATWG pathname always /-prefixed when hostname non-empty; probed); per-call Set literal hoisted to module scope. - transcript/transcript-strategy.js: fold two byte-identical no-transcript degradation returns into noTranscriptPlan(). - acquisition/build-yt-dlp-args.js: collapse redundant "&& length > 0" conjunct to "||" (value domain is undefined | trimmed string). Suites: adapters 112/112, transcript 58/58, acquisition 93/93, tsc --noEmit clean. knowledge 0.13.16 with changelog entry. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JCpHV7rFh5QiekTCPmN2qT
…ideo-digest Repo-mode batch-simplify wave 6 (groups: watch-a, watch-b, watching, machine-health checks-security, checks-system; machine-health groups reviewed clean). knowledge/video-digest extraction: - Complete the lib/cli-entrypoint.js isMainModule() rollout started by the prior sweep: 30 hand-rolled ESM main-module checks across watch/, watching/, transcript/, evals/, acquisition/ migrated to the helper; orphaned node:url (and where fully unused node:path) imports dropped. The only main-module check remaining in the package is the helper itself. - watch/watch-state.test.js: four hand-rolled Map-backed fs fakes consolidated into one memoryStore(seed) helper (57/57 assertions line-identical); watch/snapshot-bootstrap.test.js: byte-identical fixture setup hoisted into beforeEach. All batches adversarially refutation-verified (expression-identity tables, URL-normalization probes, HEAD-baseline spot-runs, HEAD-copy test-run parity). Full package suite 71 files / 494 tests green; tsc --noEmit clean. knowledge 0.13.17 with changelog entry. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JCpHV7rFh5QiekTCPmN2qT
…t-runner cleanups Repo-mode batch-simplify wave 7 (groups: machine-health lib catalog-helpers, lib discovery Get-*, lib orchestration/IO, core + test-infra, miro). Four of five groups reviewed clean (miro verified green across tsc, vitest 32/32, biome, and dist parity). Group core-test-infra applied two edits, each refutation-verified by empirical pwsh probes: - Clear-TempFiles.ps1: drop dead sync-back after [ref] counter (write-through confirmed across the function/pipeline boundary; emitted after.skipped_reparse byte-identical). - Invoke-MachineHealthTests.ps1: hoist duplicated failed-container predicate into one $failedContainers behind the existing guard (7-case differential harness under StrictMode 3.0 + ErrorActionPreference=Stop shows identical output, order included). machine-health 0.11.10 with changelog entry. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JCpHV7rFh5QiekTCPmN2qT
origin/main advanced and claimed machine-health 0.11.10 and knowledge 0.13.15 for other change sets. Renumber this branch's bumps strictly above main's current versions: machine-health 0.11.10 -> 0.11.11; knowledge changelog chain 0.13.15/16/17 -> 0.13.16/17/18 with manifest at 0.13.18. Content of the entries unchanged. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JCpHV7rFh5QiekTCPmN2qT
…ing-batch-twhddw # Conflicts: # plugins/knowledge/.claude-plugin/plugin.json # plugins/knowledge/CHANGELOG.md # plugins/machine-health/.claude-plugin/plugin.json # plugins/machine-health/CHANGELOG.md
…e cleanups Repo-mode batch-simplify wave 8 (groups: repo-hygiene git-ops + clean-ops reviewed clean; babysit-prs engine + state/queue; source-control misc core). Each change adversarially refutation-verified, emitted bytes unchanged, full 643-test babysit suite green: - babysit_feedback/babysit_delta: human_stop_from_feedback extracted as the single definition of the human-stop record; classify_pr delegates (1800-case differential matrix: field/key-set/key-order identical; closes a two-copy drift risk on the external_required presence branch). - babysit_resolve_thread: seven summary-count comprehensions folded into one acted() counter (eight-site census verified). - request_review: eight record_attempt_problem sites over the same five fixed args folded into a record_problem closure (capture-mutation trace clean). - babysit_review_trigger: thrice-spelled gate-context predicate extracted into is_gate() (400-fixture differential; CheckRun/ StatusContext asymmetry preserved). - test_babysit_merge: stale line-number docstring anchor replaced with a symbol anchor per guard-contract convention. - worktree-claim.sh: main-vs-linked flush branches collapsed; readiness-gate suite resolves its python probe once (HAVE_PY311); worktree-root-doctor.test.sh gains fgit() wrapping the git-config isolation prefix at ten fixture sites; reap suite hoists uname -s; reap script uses $'\t' directly. Suites 53/163/37/45 baseline-identical; shellcheck + portability gate clean. source-control 0.55.24 with changelog entry. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JCpHV7rFh5QiekTCPmN2qT
…eanups
Repo-mode batch-simplify wave 9 (groups: source-control pr/commit
scripts reviewed clean; tracker core lib; work-items misc scripts;
gitea, github, jira adapters — jira reviewed clean). Each change
adversarially refutation-verified, byte-identical output and exit
codes:
- work-item-tracker.sh: fail_usage() helper replaces five open-coded
usage-error sites (per-site byte comparison table: 591-byte stderr,
exit 2, identical everywhere).
- lib/binding.sh: wit_role_label if/else collapsed to
${configured:-$3} (always-assigned trace + falsy-value drive).
- onboard-adapter generate-adapter.sh: three spec reads routed through
the file's own sget helper (generated trees diff -r identical across
three spec shapes; 140-case suite green).
- gitea create-item.sh: per-page label count captured once (LABEL_GOT)
instead of re-running jq length (four-path pagination harness
byte-identical, including unreachable-input analysis).
- github renew-lease.sh: lease-comment emptiness check uses [[ -n ]]
(token-stream identity via bash --pretty-print), plus repo-hook shfmt
normalization of case arms.
Suites green at baseline counts (tracker 56, binding 69, adapters
45/3/25, generator 140). work-items 0.39.33 with changelog entry.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JCpHV7rFh5QiekTCPmN2qT
…eck-skill fork drop Repo-mode batch-simplify wave 10 (groups: linear adapter, local-markdown adapter, conformance harness, two cross-plugin audit-check bundles — three reviewed clean). Each change adversarially refutation-verified: - local-markdown adapter (6 verbs): usage string previously duplicated verbatim at the help and usage-error sites hoisted into one usage= literal (paired literals byte-identical at HEAD; 24-invocation differential drive byte-identical on stdout/stderr/rc; 8 suites, 79 checks green), plus repo shfmt hook case-arm normalization. - skill-quality check-skill.sh: vc_lead_mutate pipes its helper directly into grep -qE instead of re-materializing via printf+command substitution (one fork per call on a CI-hot predicate; pipefail rc trace deterministic-zero; 11-input newline probe against the verbatim regex; full suite green). work-items 0.39.34 and skill-quality 0.20.5 with changelog entries. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JCpHV7rFh5QiekTCPmN2qT
…, disk-hygiene engine Repo-mode batch-simplify wave 11 (groups: update-family, runtime-misc, autonomy setup, claude-memory, code-tidying, disk-hygiene — three reviewed clean). Each change adversarially refutation-verified with byte-identical output and exit codes: - autonomy setup gates: nested single-branch if collapsed to && in check-signal-envelope.mjs (three-envelope differential drive identical); loop-push to spread in resolve-prerequisites.mjs (findings arrays proven bounded and plain); dead local removed from the fixtures runner. Suites 22/22 + 4/4; generated/ unchanged. - code-tidying dead-code-scan.sh: dead store removed (ts="" in the branch only reachable when ts is already empty); suite 162/162; git and no-git fixture runs byte-identical. - disk-hygiene hygiene.py: accumulator loop to the file's own walrus-filter sum idiom (callee pure, one eval per entry) and two byte-identical isinstance branches merged; ruff-format hook reflowed token-identical regions; a test file moves to parenthesized context managers. Suites 317 + 10 green; guard/kill-switch code untouched. autonomy 0.22.15, code-tidying 0.14.8, disk-hygiene 0.20.28 with changelog entries. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JCpHV7rFh5QiekTCPmN2qT
…session-flow, guardrails, docs/specs Behavior-preserving simplifications across the final six batch-simplify groups (57-62), each refutation-verified: - docs-hygiene: drop duplicate glob alternative in compress/audit-scan.sh; replace manual chunk loop with array slices and drop dead `local tier` in audit-noise/detect.sh; remove duplicate awk counter in audit-noise/emit-findings.sh (0.21.19) - instruction-placement: collapse bracket-negation if/elif in glob-tools.sh; merge two sed passes in render-index.sh (0.11.9) - rate-limit-guard: name repeated bash-version checks as _rlg_bash_at_least with per-site floors; extract _rlg_read_settings_json helper; use lines+=() append in statusline-tee.sh (0.7.15) - session-flow: collapse boolean ladder and use `or` fallback for the UTC zone in keep-going/check-usage-limit-reset.py (0.34.9) - guardrails: whitespace/comment cleanup in lib/powershell/ps-command.sh, generated PowerShell pretty-prints identically (0.29.18) - docs/specs d1_proxy.py: collapse is_instruction tail to a single return; use maxsplit on the keyword split Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JCpHV7rFh5QiekTCPmN2qT
…ing-batch-twhddw # Conflicts: # plugins/claude-config/CHANGELOG.md # plugins/claude-ops/CHANGELOG.md # plugins/disk-hygiene/CHANGELOG.md # plugins/knowledge/.claude-plugin/plugin.json # plugins/knowledge/CHANGELOG.md # plugins/machine-health/CHANGELOG.md # plugins/session-flow/CHANGELOG.md # plugins/work-items/.claude-plugin/plugin.json # plugins/work-items/CHANGELOG.md
|
Claude finished @kyle-sexton's task in 3m 54s —— View job Code review complete
Scope: reviewed the full Method: traced control flow before/after for every file with a non-trivial diff, cross-checked each "simplification" against its call sites and surrounding invariants rather than trusting the description. Two independent subagents (producer ≠ verifier, per this lane's adversarial-validation rule) covered the highest-diff clusters — Result: no findings. Spot-checked reasoning for a few of the less-obvious collapses, since a "behavior-preserving" claim this broad is exactly where a subtle regression would hide:
No correctness or maintainability issues met this lane's high-signal bar (see Branch: |
|
Claude finished @kyle-sexton's task in 1m 49s —— 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. |
…1 redundancies removed (#3486) Full-repository /code-tidying:batch-simplify re-sweep. 3,375 tracked files filtered to 1,031 code files, divided into 73 groups, reviewed group by group by fresh-context agents. Eleven files carried a real redundancy; the rest came back reviewed-clean — the expected ratio for a tree swept the previous day by #3454, #3453 and #3404. Dead code and dead bookkeeping removed: - scripts/check-fleet-finding-test-coverage.sh: intermediate missing_tmp pass - instruction-placement/scripts/detect.sh: manual -- capture loop, dead SECTION_COUNT=0 - claude-ops lanes/machine-behavior.sh: WT_COUNT shadow counter - knowledge docpage-digest/digest_fences.py: dead `unclosed` bookkeeping - video-digest build-yt-dlp-args.js: born-dead YT_DLP_CAPTION_ONLY_SLEEP_SUBTITLES_SEC - video-digest setup-deps.mjs: redundant per-directory localeCompare sort - video-digest acquisition/acquire.js: double-defaulting spread at the call site Duplication collapsed onto an existing in-repo form: - babysit-prs pr_queue_snapshot.py: resolve_self_logins now uses dict.setdefault, as babysit_gh.resolve_authors already does - machine-health Clear-TempFiles.Tests.ps1: parses via the shared ConvertFrom-CheckOutput - repo-hygiene clean/scan.sh: one echo with ${STALE_REFS:-none} - planning test suites, claude-config automode-entry-diff.sh, disk-hygiene alias probe, work-item-tracker local-markdown and lease suites: small local collapses - work-items linear/common.sh: duplicated comment clause that inverted its own meaning Every shipped edit was cleared by a fresh-context refutation verifier briefed to break the claim rather than confirm it. Notably: 33,825-input exhaustive differential over casefold-colliding tokens plus 200,000 random sequences for the Python change; 14 input shapes executed side by side plus a Pester replica under 5.7.1 and 6.1.0 for the PowerShell change; a 27-value byte-differential plus three end-to-end fixtures for scan.sh. Test lanes: 209 shell suites passed; 12 Python suites OK; Node 502 + 91 + 41 tests passed. The 29 Pester suites are OS-gated to Windows and were not run — reported as unrunnable rather than claimed as passing. Two valid cleanups under adapters/linear/schema-check were deliberately reverted: those files map to zero test suites, no CI lane covers them, and the no-suite allowlist states that an uncovered .mjs should fail rather than be exempted. High-priority findings filed: #3482, #3483, #3484, #3485. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
No linked issue
Summary
Repo-wide behavior-preserving simplification sweep (
/code-tidying:batch-simplifyrepo mode): 986 swept code files in 62 groups across 12 waves, delivering byte-preserving cleanups in 34 groups and leaving 28 groups untouched with recorded reasons. Every changed group passed a fresh-context adversarial refutation verifier.Fix
One wave commit per group batch (W1-W12), each with per-plugin patch bumps and CHANGELOG entries:
fail_usage()helper,memoryStore(seed)test fixture consolidation, sed/glob chain merges, array slices over manual chunk loops)isMainModule()helper rollout completed package-wide (30 remaining hand-rolled ESM main checks)_rlg_bash_at_least,_rlg_read_settings_json,failDegraded(),noTranscriptPlan())${configured:-$3},isinstancemerges)Deferred everything that changes emitted bytes, exit codes, or crosses contract boundaries: 237 items inventoried; the 28 High items are filed as #3424-#3451 (24 bugs, 4 dedicated-PR refactors). Two mid-run merges of origin/main resolved parallel version claims by renumbering sweep entries above main's (latest: claude-config 0.40.13, claude-ops 0.38.13, disk-hygiene 0.20.29, knowledge 0.13.19, machine-health 0.11.12, session-flow 0.34.10, work-items 0.39.35).
Verification
scripts/affected-tests.sh --run, per-ecosystem gates (shellcheck, pinned ruff wrapper, package vitest/tsc, pwsh parse), plus a mandatory fresh-context refutation verifier per changed group (differential drives, byte-equality probes, AST/token identity, up to 20k-case fuzz)check-shell-portability.sh --allclean over 1506 shell files;check-changelog-parity.sh --check-bump origin/maingreen; pwsh parse 0 errorshygiene.py) covered by repo-wide ruff and its suites in that runRelated
Refs #3424, #3425, #3426, #3427, #3428, #3429, #3430, #3431, #3432, #3433, #3434, #3435, #3436, #3437, #3438, #3439, #3440, #3441, #3442, #3443, #3444, #3445, #3446, #3447, #3448, #3449, #3450, #3451 (High-priority deferrals filed by this sweep's closeout). Precedent: #3379 (prior sweep).
🤖 Generated with Claude Code
https://claude.ai/code/session_01JCpHV7rFh5QiekTCPmN2qT
Generated by Claude Code