Skip to content

refactor: batch-simplify sweep, waves 4-12 + deferred-work pass - #3494

Merged
kyle-sexton merged 10 commits into
mainfrom
claude/repo-code-tidying-simplify-8g3ttk
Aug 31, 2026
Merged

refactor: batch-simplify sweep, waves 4-12 + deferred-work pass#3494
kyle-sexton merged 10 commits into
mainfrom
claude/repo-code-tidying-simplify-8g3ttk

Conversation

@kyle-sexton

@kyle-sexton kyle-sexton commented Aug 30, 2026

Copy link
Copy Markdown
Contributor

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.ai/code/session_01W61wikkiEK5StWgg9rfEQW

…ry, claude-ops

Repo-wide batch-simplify sweep, wave 4 of 12 (claude-config audit +
permission skills, claude-memory, claude-ops hooks/lanes/audits). 121
files read end to end; 9 files edited, every group's diff cleared by a
fresh-context refutation verifier - including one refutation that
REVERTED two edits before delivery:

- claude-config: run-state.sh header usage block synced to its real
  usage() (comment-only; negative-test sed targets verified untouched);
  dead grep prerequisite guard removed from conflict-scan.test.sh
  (nothing in the suite or script invokes grep; skip-discipline gates
  re-run clean).
- claude-memory: memory-dir-stats.test.sh fixture normalized to the
  file's \n-escape style; fixture bytes sha256-identical.
- claude-ops hooks: hook-failure-audit.sh skips its summary jq spawn
  when the pre-filter matched nothing (one spawn saved per Stop turn;
  all paths byte-identical). A jq_fields consolidation in the two
  skill-usage hooks was attempted, refuted by adversarial payload
  probes (trailing-newline trimming, non-string tostring, two-doc
  handling), and reverted rather than shipped.
- claude-ops lanes/brief: five formerly implicit globals made local in
  restart-consumer.sh process_lane (full caller-graph and trap audit:
  no post-return reader); redundant lock_rc defaults dropped;
  morning-brief.sh scratch array declared local; two test assertions
  moved to the section whose fixture they read.
- claude-ops audits: install_state.py unused os.walk slot renamed to
  _dirnames per the file's own convention.

Version bumps + changelog entries: claude-config 0.40.20,
claude-memory 0.11.9, claude-ops 0.38.21.

Verification: shellcheck clean on all touched shell; ruff wrapper clean;
suites 48+84+12+64+30+28+88+146+83+50 all green plus adapter fan-outs;
changelog-parity and catalog gates pass.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01W61wikkiEK5StWgg9rfEQW
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Aug 30, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-08-30T23:56:12.806774Z 2059871 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@claude

claude Bot commented Aug 30, 2026

Copy link
Copy Markdown
Contributor

Claude finished @kyle-sexton's task in 2m 14s —— View job


Code review complete ✅

Tasks

  • Gather context (PR diff, files, CLAUDE.md/AGENTS.md conventions)
  • Run /review:code-review procedure against the diff
  • Post inline findings (if any)
  • Post summary review comment

Findings

No correctness or maintainability issues found. I read every changed hunk end-to-end against origin/main and verified the specific claims made in the PR description and CHANGELOG entries rather than taking them at face value:

  • hook-failure-audit.sh — the new RECORDS/early-exit 0 short-circuit is behavior-preserving. Traced the empty-match case through the old code: jq -cRs on empty stdin yields ""split("\n")[""]fromjson? drops the unparsable empty string → empty array → group_by/map stays [] → the pre-existing [[ -n "$SUMMARY" && "$SUMMARY" != "[]" ]] || exit 0 guard already exited 0. The new guard just avoids paying for the jq spawn to reach the same outcome.
  • restart-consumer.sh — confirmed against origin/main that instance, req, comment_marker, sibling_request, sibling_instance were used inside process_lane() without ever being declared local, i.e. genuine implicit-global leakage. Adding them to the local declaration is a real fix, not just tidying. The lock_rc simplification (${lock_rc:-0}lock_rc) is also sound: lock_rc is declared local ... lock_rc=0 a few lines above, so it's always set before use.
  • conflict-scan.test.sh — confirmed grep is not actually invoked by the suite or the script under test (only appears as a fixture filename and in a comment), so the removed prerequisite guard was dead.
  • run-state.sh — the usage-header changes (--plugin-data on lease acquire, [--epoch <n>] on partial append) now match the actual die/flag-parsing logic further down the file; doc-only, no behavior change.
  • memory-dir-stats.test.sh — the fixture rewrite from embedded-literal-newline printf strings to \n-escape form is byte-identical: bash's printf builtin processes backslash escapes in the format operand itself regardless of whether the newline is written literally or as \n.
  • install_state.pydirnames_dirnames rename is on a genuinely unused os.walk() loop variable.
  • morning-brief.test.sh — the two re-homed assert_contains calls read $OUT_ERR, which is set once and not reassigned between the old and new locations; the move is a pure readability fix (assertions were previously stranded two blocks past their own fixture setup), not a behavior change.
  • Version bumps (claude-config 0.40.20, claude-memory 0.11.9, claude-ops 0.38.21) and CHANGELOG entries match the shipped diffs.

No inline comments filed — nothing rose to a reportable finding.

Note on verification depth: this sandbox's Bash tool required approval for running scripts/affected-tests.sh --run, shellcheck, and the co-located test suites, and no approval prompt was available in this run, so I could not independently execute them. All conclusions above come from static reading of the diffs against origin/main and manual tracing of the affected logic, not from re-running the suites the PR's own verification section reports as green. If you'd like the mechanical test/lint pass independently re-run, --allowedTools would need to include unrestricted Bash execution for this job.

@claude

claude Bot commented Aug 30, 2026

Copy link
Copy Markdown
Contributor

Claude finished @kyle-sexton's task in 59s —— View job


Security review — no issues found

  • Gather context (PR diff, changed files)
  • Invoke /review:security-review and follow its instructions
  • Post findings/results

Skip gate: this PR has no security-relevant surface. All 14 changed files are a behavior-preserving refactor sweep (waves 4–12 of the batch-simplify pass): version/changelog bumps, comment wording, local variable declarations, test-fixture reformatting (byte-identical), and one perf tweak in plugins/claude-ops/hooks/hook-failure-audit.sh that adds an early exit before the jq spawn when the grep pre-filter finds no matches — same downstream jq invocation and inputs otherwise.

Reviewed for the criteria this lane covers (injection surfaces, auth/access-control gaps, unsafe secret/token handling, dangerous Actions patterns, trust-boundary issues):

  • No command/SQL/path/template injection surfaces touched.
  • No authentication, authorization, or access-control logic changed.
  • No secrets, tokens, or credentials handling changed.
  • No GitHub Actions workflow files, permissions:, or trigger patterns changed (no .github/** in the diff).
  • No supply-chain / dependency-pin changes.
  • install_state.py's only change is renaming an unused os.walk loop variable to _dirnames.
  • restart-consumer.sh's changes are new local declarations for existing variables and dropping a redundant ${lock_rc:-0} default (the variable is always set by this point) — no behavior change to lock-acquisition control flow.

No security findings to report.

@github-actions

github-actions Bot commented Aug 30, 2026

Copy link
Copy Markdown

Last security-reviewed head: 7ea0ec067d7d8b2f19d2054962649ffa4ccbd746. On the next push, the relevance gate compares only the commits since this SHA; delete this comment to force a full re-review.

@github-actions

github-actions Bot commented Aug 30, 2026

Copy link
Copy Markdown

Claude has reviewed this PR 5 times. The lane skips further automatic reviews after 5; deleting this comment resets the count.

…ene race fix, formatter hooks

Repo-wide batch-simplify sweep, wave 5 of 12 (code-tidying, context-budget,
context-guard, discovery, disk-hygiene, docs-hygiene, ai-slop, and the
first five formatter-hook plugins). 89 files read end to end; 3 files
edited, each cleared by a fresh-context refutation verifier:

- disk-hygiene: the queued wave-1 finding is fixed - both sink tests in
  lib/test_hook_telemetry.py raced the fire-and-forget sink (the sink's
  > redirect creates its file empty before cat writes it), failing
  ~3/4 runs on a fast host at HEAD. They now poll for non-empty,
  parseable content with a 5s deadline, retrying a truncated mid-write
  read, mirroring the sibling suites' _wait_for_file discipline.
  Deterministic over 12/12 runs; production hook_telemetry.py untouched.
- markdown-format: two inert hook::ctx_reset calls removed from the
  hook (nothing in it ever writes or reads the ctx buffer - verified
  down to the buffer's only readers in hook-utils), and a three-line
  no-op `for ... do :; done` loop removed from its test. The test-file
  deletion is deliberate, not a silent revert. Suite 161/161.

The other six groups (code-tidying scripts, context-budget +
context-guard, discovery gates, docs-hygiene + ai-slop detectors)
reviewed clean with zero edits - 1,200+ baseline assertions green,
detector-crosswalk gate green.

Version bumps + changelog entries: disk-hygiene 0.20.35,
markdown-format 0.11.35.

Verification: shellcheck clean on touched shell; pinned-ruff clean;
disk-hygiene python suites 317+23+17+10 OK; markdown-format fan-out
4 suites incl. shell-portability 345/345; changelog-parity, vendor-bump,
and catalog gates pass vs origin/main.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01W61wikkiEK5StWgg9rfEQW
@claude

claude Bot commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

Claude finished @kyle-sexton's task in 1m 25s —— View job


Code review complete ✅

Tasks

  • Gather context (PR diff, files, CLAUDE.md/AGENTS.md conventions)
  • Run /review:code-review procedure against the diff
  • Post inline findings (if any)
  • Post summary review comment

Scope

This lane already reviewed commit 2059871 (wave 4) in a prior run on this PR. Since then, d0b1a5e (wave 5) added 7 files: disk-hygiene and markdown-format version/changelog bumps plus two source changes. I diffed 2059871..HEAD to isolate what's new and confirmed the wave-4 files (claude-config, claude-memory, claude-ops) are byte-identical to what was already reviewed — no re-review needed there.

Findings

No correctness or maintainability issues in the new wave-5 changes. I read both non-trivial hunks end-to-end and independently verified the claims rather than trusting the CHANGELOG text:

  • test_hook_telemetry.py — the new _wait_for_envelope helper replaces two duplicated existence-polling loops. It's a genuine flakiness fix, not just tidying: the old code polled for the file to exist then did one unconditional json.loads(...), but the sink writes via > (truncate-create) followed by a separate cat write, so a poll that lands between those two steps reads an empty file and throws json.JSONDecodeError instead of retrying. The new version polls for non-empty, parseable content, catches JSONDecodeError on a truncated mid-write read to keep polling, and only fails via an explicit self.fail(...) after a 5s deadline. Sound fix for a real race.
  • markdown-format.sh — confirmed by grep that this file never calls hook::ctx_append, hook::ctx_flush, or reads _HOOK_CTX_BUFFER anywhere, so the two removed hook::ctx_reset calls were dead (the buffer starts empty and nothing in this file ever appends to it). Removal is behavior-preserving.
  • markdown-format.test.sh — the removed for field in ...; do : ; done loop had a no-op body (just a comment); the fail "telemetry/envelope: ..." calls immediately following it are unchanged and still cover the six fields the loop enumerated. No assertion coverage was lost.
  • Version bumps (disk-hygiene 0.20.35, markdown-format 0.11.35) and their CHANGELOG entries match the shipped diffs.

Verification note: as in the prior run on this PR, this sandbox's Bash tool required approval to run scripts/affected-tests.sh --run / shellcheck / the co-located suites, and no approval prompt was available, so these conclusions come from static reading and manual tracing against origin/main/2059871, not from independently re-running the suites the PR body reports as green.

@claude

claude Bot commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

Claude finished @kyle-sexton's task in 1m 0s —— View job


Security review — no issues found

  • Gather context (PR diff, changed files)
  • Invoke /review:security-review and follow its instructions
  • Post findings/results

Skip gate: the prior review already covered 2059871 (waves 1–4). This push (d0b1a5e) adds only wave 5, and the incremental diff (2059871..d0b1a5e) has no security-relevant surface:

  • test_hook_telemetry.py — test-only change, replaces an existence-poll with a poll for non-empty/parseable content to fix a race in the test suite itself. Production hook_telemetry.py untouched.
  • markdown-format.sh — removes two hook::ctx_reset calls. Confirmed this hook never calls hook::ctx_append/hook::ctx_flush (grep returns nothing), so the buffer these calls reset is never populated by this script; dead-code removal, not a change to the trust-gate logic around it.
  • markdown-format.test.sh — removes a for … do :; done no-op loop from the test suite.
  • plugin.json/CHANGELOG.md bumps for disk-hygiene (0.20.35) and markdown-format (0.11.35) match the diffs.

No authentication, authorization, injection, secret-handling, or GitHub Actions surfaces touched by this push. Combined with the prior clean review of 2059871, no security findings for the PR as it now stands.

…dead fallback removed

Repo-wide batch-simplify sweep, waves 6 and 7 of 12 (formatter/notification
hooks second half, guardrails blocking + advisory hooks, instruction-placement,
kindle-dedrm, and the whole knowledge plugin: course-digest adapters/lib/
pipeline, docpage-digest, map-corpus, video-digest acquisition/adapters/
harvesting/liveness/transcript). 199 files read end to end across 11 groups.

Wave 6 was a pure verification wave: zero edits across all five groups
(~1,100 baseline assertions re-proven green; the guardrails enforcement
core is deliberately dense and every candidate was incident-pinned).

Wave 7 landed one edit: video-digest acquisition acquire.js drops a
`?? "staged acquire failed"` default that could never fire (both ok:false
sites in acquireFullStaged construct non-empty string errors; old ??
replaced only null/undefined). Enumerated, tsc-checked, and cleared by a
fresh-context refutation verifier.

The same verifier REFUTED a second candidate - merging the duplicated
initial spawn in spawn-yt-dlp-with-auth-fallback.js - with an executed
counterexample (the cookie-config probe it would skip emits a
once-per-process deprecation warning via env-compat and mutates its
dedupe set). That edit was reverted, not shipped.

Version bump + changelog: knowledge 0.13.27.

Verification: acquisition suite 93/93 post-revert, adapters 112/112,
transcript 54/54, course-digest 91/91 x2 runs, docpage/map-corpus python
117 tests + ruff clean; changelog-parity and catalog gates pass.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01W61wikkiEK5StWgg9rfEQW
@claude

claude Bot commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

Claude finished @kyle-sexton's task in 58s —— View job


Code review complete ✅

Tasks

  • Gather context (PR diff, files, CLAUDE.md/AGENTS.md conventions)
  • Run /review:code-review procedure against the diff
  • Post inline findings (if any)
  • Post summary review comment

Scope

This lane already reviewed 2059871 (wave 4) and d0b1a5e (wave 5) in prior runs on this PR. Since then, cd92a3f (waves 6–7) added only the knowledge plugin: plugin.json/CHANGELOG.md version bump and one source line in acquire.js. Diffed d0b1a5e..cd92a3f to isolate what's new; all other files in the PR's changed-file list are unchanged since the last review.

Findings

No correctness or maintainability issues in the new wave-6/7 change. Verified the claim rather than trusting the CHANGELOG text:

  • acquire.js#L307-L310failVideo(staged.error ?? "staged acquire failed")failVideo(staged.error). Traced both ok: false return sites inside acquireFullStaged (lines 226–227 and 235–236 of the file): one uses videoPass.detail || "yt-dlp video-only pass failed", the other a literal "yt-dlp did not download video file" — both always non-empty strings, never null/undefined. The ?? fallback could never fire, so removing it is behavior-preserving dead-code removal, not a logic change.
  • The CHANGELOG entry also states a second candidate (merging the duplicated initial spawn in spawn-yt-dlp-with-auth-fallback.js) was refuted and reverted. Confirmed that file has no diff between d0b1a5e and cd92a3f, consistent with a clean revert leaving no partial state.
  • Version bump (knowledge 0.13.27) and CHANGELOG entry match the shipped diff.

No inline comments filed — nothing rose to a reportable finding.

Verification note: as in prior runs on this PR, this sandbox's Bash tool required approval to run scripts/affected-tests.sh --run / the co-located acquisition suites, and no approval prompt was available, so this conclusion comes from static reading and manual call-site tracing against d0b1a5e, not from independently re-running the 205/205 suite the PR body reports as green.

@claude

claude Bot commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

Claude finished @kyle-sexton's task in 1m 8s —— View job


Security review — no issues found

  • Gather context (PR diff, changed files)
  • Invoke /review:security-review and follow its instructions
  • Post findings/results

Skip gate: prior runs on this PR already reviewed through d0b1a5e (waves 1–5) with no findings. This push adds only cd92a3f (waves 6–7, knowledge sweep), and the incremental diff (d0b1a5e..cd92a3f) has no security-relevant surface — 3 files, 16 insertions / 2 deletions:

  • acquire.js — drops a ?? "staged acquire failed" fallback on staged.error. Verified both ok: false return sites in acquireFullStaged (lines 226–227, 235–236 of the same file) always set a non-empty error string (videoPass.detail || "yt-dlp video-only pass failed" and a literal string respectively), so the ?? default could never fire. Dead-code removal, not a behavior or security change — no path where an error message becomes undefined/empty as a result.
  • plugin.json / CHANGELOG.md — version bump (knowledge 0.13.27) and changelog entry matching the diff, no functional change.

No authentication, authorization, injection, secret-handling, or GitHub Actions surfaces touched by this push. Combined with the prior clean reviews of 2059871 and d0b1a5e, no security findings for the PR as it now stands (HEAD cd92a3f).

…-health test scaffolding

Repo-wide batch-simplify sweep, wave 8 of 12 (video-digest watch halves +
watching pipeline; machine-health check tests, lib tests, harness, and
check sources). 129 files read end to end across 6 groups; 5 files
edited, every diff cleared by a fresh-context refutation verifier:

- knowledge video-digest: watch/synthesis-naming.js drops the
  synthesisDestNameForSlice export nothing imports (introduced Jul 2026,
  never consumed; proven across code, markdown, and fixtures), its
  orphaned loadPromotionNameMap import, and the export keyword on the
  internal-only sourceStem. Watch suites 58/58; tsc clean.
- machine-health: tests/helpers/Mock-Helpers.psm1 drops the
  New-MockWinGetPackage factory nothing references; two suites drop
  Import-Module lines feeding nothing (mock-target and side-effect
  angles verified); ConvertFrom-Jsonc.Tests.ps1 inlines a single-use
  intermediate. All suite counts byte-identical pre/post, including the
  pre-existing Linux cmdlet-gap failures (reported, unchanged).

The other groups (watch-a, watching pipeline, check sources + scaffold)
reviewed clean with zero edits.

Version bumps + changelog entries: knowledge 0.13.28,
machine-health 0.11.17.

Verification: watch/watching vitest 48+58+29 pass; machine-health
runnable Pester baselines identical pre/post; parse checks clean;
changelog-parity and catalog gates pass vs origin/main.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01W61wikkiEK5StWgg9rfEQW
@claude

claude Bot commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

Claude finished @kyle-sexton's task in 1m 16s —— View job


Code review complete ✅

Tasks

  • Gather context (PR diff, files, CLAUDE.md/AGENTS.md conventions)
  • Run /review:code-review procedure against the diff
  • Post inline findings (if any)
  • Post summary review comment

Scope

This lane already reviewed 2059871 (wave 4), d0b1a5e (wave 5), and cd92a3f (waves 6–7) in prior runs on this PR. This push (099f056, wave 8) adds only 9 files: knowledge and machine-health version/changelog bumps plus two source changes. Diffed cd92a3f..HEAD to isolate what's new — all other files in the PR's changed-file list are unchanged since the last review.

Findings

No correctness or maintainability issues in the new wave-8 changes. Verified the claims rather than trusting the CHANGELOG text:

  • synthesis-naming.js — removes the synthesisDestNameForSlice export, its now-unused loadPromotionNameMap import, and unexports the internal-only sourceStem. Grepped the whole repo for synthesisDestNameForSlice/sourceStem/promotion-name-map outside this file and the CHANGELOG entry — zero other references, confirming the dead-export claim. Also read promotion-name-map.js: it only exports a function, no load-time side effects, so dropping the import is safe.
  • Mock-Helpers.psm1 — removes New-MockWinGetPackage and its Export-ModuleMember entry. Grepped for New-MockWinGetPackage repo-wide — only the CHANGELOG entry mentions it now, confirming it was unused.
  • Test-WindowsUpdate.Tests.ps1 and Test-WingetUpgrades.Tests.ps1 — both drop the Import-Module Mock-Helpers line. Grepped each file for any New-Mock*/Remove-MachineHealthTempDir helper usage — none found, so the import was dead weight.
  • ConvertFrom-Jsonc.Tests.ps1 — inlines $parsed = $out | ConvertFrom-Json; $parsed.url into a single expression; the intermediate variable was used exactly once, matching the sibling assertion's style. Behavior-preserving.
  • Version bumps (knowledge 0.13.28, machine-health 0.11.17) and CHANGELOG entries match the shipped diffs.

No inline comments filed — nothing rose to a reportable finding.

Verification note: as in prior runs on this PR, this sandbox's Bash tool required approval to run the co-located watch/Pester suites, and no approval prompt was available, so this conclusion comes from static reading and repo-wide grep against cd92a3f, not from independently re-running the 58/58 watch suite or Pester suites the PR body reports as green.

@claude

claude Bot commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

Claude finished @kyle-sexton's task in 46s —— View job


Security review — no issues found

  • Gather context (PR diff, changed files)
  • Invoke /review:security-review and follow its instructions
  • Post findings/results

Skip gate: prior runs on this PR already reviewed through cd92a3f (waves 1–7) with no findings. This push adds only 099f056 (wave 8: knowledge video-watch trees + machine-health test scaffolding), and the incremental diff (cd92a3f..099f056) has no security-relevant surface — 9 files, 30 insertions / 45 deletions, entirely dead-code removal and test-only cleanup:

  • synthesis-naming.js — removes the unused synthesisDestNameForSlice export (and its now-dead loadPromotionNameMap import), and narrows sourceStem from exported to file-private. No behavior or data-flow change to the exports still in use.
  • Mock-Helpers.psm1 / Test-WindowsUpdate.Tests.ps1 / Test-WingetUpgrades.Tests.ps1 — removes an unused New-MockWinGetPackage test-fixture factory and the now-unneeded Import-Module of that helper file in two Pester specs. Test-only, no production code touched.
  • ConvertFrom-Jsonc.Tests.ps1 — inlines a temp variable in one assertion. Test-only.
  • plugin.json / CHANGELOG.md bumps for knowledge and machine-health match the diffs, no functional change.

No authentication, authorization, injection, secret-handling, or GitHub Actions surfaces touched by this push. Combined with the prior clean reviews of 2059871, d0b1a5e, and cd92a3f, no security findings for the PR as it now stands (HEAD 099f056).

Repo-wide batch-simplify wave 9 (groups 48-53: miro, planning,
prototype, plugin-quality, skill-quality, provenance, rate-limit-guard,
repo-hygiene clean core). Five groups closed with zero edits; the one
shipped edit collapses the duplicate --* arm of from_label() in
plugins/provenance/skills/audit/scripts/check-stamps.sh into its
identical fallback arm.

A fresh-context refutation verifier executed a 25-case old-vs-new input
matrix (flag forms, config-layer paths, format-string hazards,
whitespace, multi-arg and no-arg calls) plus end-to-end --show-config
runs: byte-identical output everywhere. Suite: 71 passed. shellcheck
clean. provenance bumped to 0.4.2 with a changelog entry;
changelog-parity, vendor-bump, and catalog gates pass.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01W61wikkiEK5StWgg9rfEQW
@claude

claude Bot commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

Claude finished @kyle-sexton's task in 46s —— View job


Code review complete ✅

Tasks

  • Gather context (PR diff, files, CLAUDE.md/AGENTS.md conventions)
  • Run /review:code-review procedure against the diff
  • Post inline findings (if any)
  • Post summary review comment

Scope

Prior runs on this PR already reviewed through 099f056 (waves 1–8). This push (1ef2e48, wave 9) adds only the provenance plugin: a version/changelog bump and one source change in check-stamps.sh. Diffed 099f056..HEAD to isolate what's new — no other files in the PR's changed-file list moved since the last review.

Findings

No correctness or maintainability issues in the new wave-9 change. Verified the claim rather than trusting the CHANGELOG text:

  • check-stamps.sh#L198-L205from_label()'s three-way if [[ -z "$1" ]] ... elif [[ "$1" == --* ]] ... else collapses to a two-way if/else. Read both removed and retained arms: the deleted --* branch and the remaining else branch both executed exactly printf '(from %s)' "$1" — character-identical, so the split carried no behavior. Grepped the whole plugin for other from_label call sites — only the two --show-config call sites in the same file (EXPIRY_FROM, and the trigger-less/other config vars further down), none of which depend on distinguishing a --flag-shaped argument from any other non-empty string. Collapse is behavior-preserving.
  • Version bump (provenance 0.4.1 → 0.4.2) and the CHANGELOG entry (which itself documents a 25-case matrix + the existing 71-case suite passing unchanged) match the shipped diff.

No inline comments filed — nothing rose to a reportable finding.

Verification note: as in prior runs on this PR, this sandbox's Bash tool required approval to run the co-located check-stamps suite, and no approval prompt was available, so this conclusion comes from static reading and call-site tracing against 099f056, not from independently re-running the 71-case suite the PR body/changelog reports as green.

@claude

claude Bot commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

Claude finished @kyle-sexton's task in 45s —— View job


Security review — no issues found

  • Gather context (PR diff, changed files)
  • Invoke /review:security-review and follow its instructions
  • Post findings/results

Skip gate: prior runs on this PR already reviewed through 099f056 (waves 1–8) with no findings. This push adds only 1ef2e48 (wave 9: provenance check-stamps.sh duplicate-branch collapse), and the incremental diff (099f056..1ef2e48) has no security-relevant surface — 3 files, 12 insertions / 3 deletions:

  • check-stamps.sh#L199-L204 — collapses the --*-prefixed arm of from_label()'s conditional into the fallback arm. Verified both arms printed the character-identical format string '(from %s)' with the same argument ($1), so the branches were behaviorally redundant; removing one is dead-code removal, not a logic change. The %s argument is passed as a printf argument (not interpolated into the format string), so there was no format-string injection risk before or after this change.
  • plugin.json / CHANGELOG.md — version bump (provenance 0.4.2) and changelog entry match the diff, no functional change.

No authentication, authorization, injection, secret-handling, or GitHub Actions surfaces touched by this push. Confirmed the full PR diff (origin/main...HEAD, 34 files) matches what prior review rounds already covered plus this wave-9 addition — no security findings for the PR as it now stands (HEAD 1ef2e48).

Repo-wide batch-simplify wave 10 (groups 54-57: repo-hygiene git
scripts + repo-fleet-hygiene, session-flow, small skill scripts, small
updaters). Three groups closed with zero edits; the one shipped edit
removes a stale "shellcheck disable=SC2086" directive above a quoted
eval in plugins/repo-hygiene/skills/clean/scripts/git-prune.sh.

A fresh-context refutation verifier confirmed the directive was inert:
ShellCheck 0.11.0 with the repo rcfile produces identical output and
exit code with and without it, no repo tooling inventories or pins
disable comments, and the mapped suites (clean-batch 84 checks,
git-prune) pass. repo-hygiene bumped to 0.10.19 with a changelog entry;
changelog-parity, vendor-bump, and catalog gates pass.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01W61wikkiEK5StWgg9rfEQW
@claude

claude Bot commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

Claude finished @kyle-sexton's task in 55s —— View job


Security review — no issues found

  • Gather context (PR diff, changed files)
  • Invoke /review:security-review and follow its instructions
  • Post findings/results

Skip gate: prior runs on this PR already reviewed through 1ef2e48 (waves 1–9) with no findings. This push adds only 0ac2653 (wave 10: repo-hygiene git-prune.sh), and the incremental diff (1ef2e48..0ac2653) has no security-relevant surface — 3 files, 12 insertions / 2 deletions:

  • git-prune.sh#L63-L66 — removes a # shellcheck disable=SC2086 comment above eval "$op". Traced the actual risk surface: $op is only ever an element of GIT_PRUNE_OPS, a fixed constant array defined in lib/cleanup-paths.sh#L60-L64 ('git worktree prune', 'git remote prune origin', 'git gc --auto --quiet') — no user input, no interpolation, no path/env expansion into that array anywhere in the plugin. eval "$op" was already quoted before this change, so SC2086 (word-splitting on an unquoted expansion) could never have fired on this line regardless of the directive; removing the stale annotation changes no runtime behavior and doesn't widen the eval surface, which remains a fixed-string dispatch, not attacker-influenced.
  • plugin.json / CHANGELOG.md — version bump (repo-hygiene 0.10.19) and changelog entry match the diff; the changelog's ShellCheck-parity claim is consistent with the code (comment-only removal), no functional change.

No authentication, authorization, injection, secret-handling, or GitHub Actions surfaces touched by this push. Combined with the prior clean reviews through 1ef2e48, no security findings for the PR as it now stands (HEAD 0ac2653).

Verification note: as in prior runs on this PR, this sandbox's Bash tool required approval to run ShellCheck / the co-located suites, and no approval prompt was available, so this conclusion comes from static reading and repo-wide grep for GIT_PRUNE_OPS, not from independently re-running ShellCheck with/without the directive as the changelog entry reports.

Repo-wide batch-simplify wave 11 (groups 58-62, the source-control
plugin: babysit-prs source and tests, bin + hooks, pull-request skill
scripts, plugin scripts + commit skill). Four groups closed with zero
edits (babysit source 643-test baseline OK; babysit tests likewise; bin
+ hooks and scripts trees confirmed frozen fail-closed surface). The
one shipped edit rewords a comment in
plugins/source-control/skills/pull-request/scripts/fetch-annotations.sh
that misdescribed its own exit-code capture ("captured via PIPESTATUS"
where no pipeline ever existed) to "captured separately".

A fresh-context refutation verifier confirmed the comment was wrong
from the file's first commit, nothing pins the old string, and the
suite passes (8/8). source-control bumped to 0.55.32 with a changelog
entry; changelog-parity, vendor-bump, and catalog gates pass.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01W61wikkiEK5StWgg9rfEQW
@claude

claude Bot commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

Claude finished @kyle-sexton's task in 53s —— View job


Security review — no issues found

  • Gather context (PR diff, changed files)
  • Invoke /review:security-review and follow its instructions
  • Post findings/results

Skip gate: prior runs on this PR already reviewed through 0ac2653 (waves 1–10) with no findings. This trigger adds only 6f31429 (wave 11: source-control fetch-annotations.sh comment-accuracy fix), and the incremental diff (0ac2653..6f31429) has no security-relevant surface — 3 files, 14 insertions / 2 deletions:

  • fetch-annotations.sh#L105-L111 — the only source change in this wave. It edits a comment, not code: the text above the gh api --paginate ... | — wait, correction — above CHECK_RUNS_RAW=$(gh api --paginate ...) previously claimed the exit code is "captured via PIPESTATUS"; the code has always captured $? from a plain command substitution (api_rc=$? at line 112), with no pipeline present. Read the full function (lines 95–124): HEAD_SHA resolution, the gh api call, the api_rc check with exit 2 on failure, and the downstream jq filter are all byte-identical to what was previously reviewed. Comment-only correction, no control-flow, error-handling, or data-flow change.
  • plugin.json / CHANGELOG.md — version bump (source-control 0.55.31 → 0.55.32) and changelog entry match the diff exactly (comment-only, behavior untouched), no functional change.

No authentication, authorization, injection, secret-handling, or GitHub Actions surfaces touched by this push — confirmed no .github/** files appear anywhere in the full PR diff (origin/main...HEAD, 40 files). Combined with the prior clean reviews through 0ac2653, no security findings for the PR as it now stands (HEAD 6f31429).

claude added 2 commits August 31, 2026 05:19
The repo-wide batch-simplify sweep (68 groups, 12 waves) recorded every
deferred finding with a disposition; this commit works all the
actionable ones in-branch, per-fix verified with reproduce-then-fix
evidence and reviewed as a whole by a fresh-context adversarial pass.

Root scripts: check-changelog-parity.sh emits "lists X more than once"
with its missing space (test pinned); check-hook-exec-form.test.sh
garbled ok-string reworded; generate-cheatsheet.mjs names the offending
file on a frontmatter-less SKILL.md instead of a raw TypeError;
package.json allowScripts pin restored to the 2.1.246 devDependency.
affected-tests.sh gains deletion awareness: a changed path that no
longer exists and that nothing claims reports a visible "deleted:" note
instead of the UNMAPPED error, while a deletion a surviving suite still
names keeps selecting it (two new suite cases; README contract updated).

guardrails 0.29.24: verify-cli-flag.sh streams help output through a
printf pipe instead of staging it in a here-string (strace-confirmed
mechanism; ten-case byte-identical differential), and the
require-jq-notice-isolation test no longer emits a two-line count on
its zero-match path.

machine-health 0.11.18: correlation-rules.md names the real
Get-CorrelationRule; Write-ElevationBanner tests capture
[Console]::Error output for real; Restart-StoppedService tests run on
Linux via the established stub pattern (0 to 10 passing); Scaffold
tests pin empty USERNAME/COMPUTERNAME with restore (17+3 to 20).

claude-config 0.40.21: duplicate test case labels renumbered.
discovery 0.16.18: unreadable-ledger case skips visibly as root.
instruction-placement 0.11.14: render-index.sh no longer corrupts
brace globs when prettifying rule glob lists (fix plus two test pins).

rate-limit-guard 0.7.21 and context-guard 0.7.28: the statusline tees
exchange their proven hardening patterns; payloads over 1MiB pass
through intact, temp writes refuse pre-planted symlinks, and SIGKILL
no longer leaks temp files (traps plus age-filtered sweep). Zero-fork
assertions and bench spawn floor unchanged.

source-control 0.55.33: three scripts stop truncating --help via the
derived header printer babysit-readiness-gate.sh already ships.

work-items 0.39.42: conformance e2e-probe drops a vacuous assertion;
the linear schema-check tree gets an accurate fidelity.sh comment, an
optional catch binding, and a no-suite allowlist entry recording its
on-demand lane.

knowledge 0.13.29: orphaned promotion-name-map.js removed with
independently re-proven zero importers.

Adversarial review over the whole diff: both findings fixed (the
UNMAPPED deletion via the affected-tests deletion handling above; a
too-strong changelog claim reworded); full-suite union run green (146
shell suites), parity/order/vendor/catalog gates green.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01W61wikkiEK5StWgg9rfEQW
testResults.xml is Invoke-Pester run output from the deferred-work
verification, not repository content.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01W61wikkiEK5StWgg9rfEQW
@claude

claude Bot commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

Claude finished @kyle-sexton's task in 1m 34s —— View job


Security review — no issues found

  • Gather context (PR diff, changed files, prior review history)
  • Invoke /review:security-review and follow its instructions
  • Post findings/results

Skip gate: prior runs on this PR already reviewed through 6f31429 (waves 1–11) with no findings ("Last security-reviewed head: 6f31429"). This trigger's HEAD is 7ea0ec0, adding two commits since then:

  1. 7b6ce07 (deferred-work pass — fixes every actionable finding deferred from the 12-wave sweep, 55 files)
  2. 7ea0ec0 (drops a stray testResults.xml Pester-output artifact, pure deletion)

Diffed 6f31429..HEAD to isolate what's new and read every non-doc/non-changelog hunk end-to-end. No security-relevant regressions — most of the diff is test fixtures, CHANGELOG/version bumps, and usage-text derivation fixes. Two files carry genuine security-adjacent changes, and both are hardening, not new risk:

  • context-guard/scripts/statusline-tee.sh and rate-limit-guard/scripts/statusline-tee.sh — the deferred-work pass adds set -o noclobber on the temp-file write (refuses to follow a pre-planted symlink or clobber an existing path at that name), widens the temp-name entropy ($RANDOM$RANDOM), and adds EXIT/TERM/INT/HUP traps plus an age-filtered sweep so a killed/crashed process doesn't leak temp files in the shared session directory. Traced the noclobber path: the subshell write is (umask 077; set -o noclobber; printf '%s\n' "$payload" >"$tmp"), and on failure (including a clobber refusal) it calls reclaim_tee_tmp rather than leaving anything behind — no TOCTOU window introduced, since the temp name is process+PID+double-$RANDOM unique and noclobber's atomicity comes from the kernel O_EXCL-equivalent open, not from a separate existence check. Rate-limit-guard's read_tee_input change (single -N read → draining loop) only affects how much of stdin is buffered before handoff to jq; still fails closed (tee skips the refresh) on a truncated/stalled payload.
  • guardrails/lib/verification/verify-cli-flag.sh#L157-L167 — replaces a here-string (grep ... <<<"$HELP_OUTPUT") with printf '%s\n' "$HELP_OUTPUT" | grep ... to avoid bash's here-string temp-file fallback for large payloads. $HELP_OUTPUT is process output already captured into a shell variable earlier in the script (not re-interpreted or eval'd), and printf '%s\n' passes it as a literal argument, so no injection surface is introduced or removed by this change.

The three source-control usage() rewrites (fetch-all-pr-comments.sh, reap-project-plugin-records.sh, worktree-root-doctor.sh) and instruction-placement/scripts/render-index.sh#L132-L140 only read/format each script's own header comments or its own repo's rule-glob lists — fixed, non-attacker-controlled input, no new surface. package.json's allowScripts entry moves from a pinned 2.1.209 to a pinned 2.1.246 (still a single exact-version pin, not a loosening). scripts/affected-tests.sh's new deletion-awareness branch and the work-items schema-check no-suite allowlist entry are test-selection/CI-plumbing logic only.

No authentication, authorization, injection, secret-handling, or GitHub Actions surfaces touched by either commit — no .github/** files anywhere in 6f31429..HEAD. Combined with the prior clean reviews through 6f31429, no security findings for the PR as it now stands (HEAD 7ea0ec0).

The purged-em-dashes hygiene gate failed on the previous push:
README.md is a declared-purged surface and the new affected-tests
deletion paragraph introduced one em dash. The sentence is now two.
check-purged-em-dashes.sh passes locally (21 declared paths, 30 files,
no em dashes).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01W61wikkiEK5StWgg9rfEQW
@kyle-sexton
kyle-sexton enabled auto-merge (squash) August 31, 2026 05:27
@kyle-sexton
kyle-sexton merged commit 7cd56c9 into main Aug 31, 2026
60 checks passed
@kyle-sexton
kyle-sexton deleted the claude/repo-code-tidying-simplify-8g3ttk branch August 31, 2026 05:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants