refactor(cc-249): PR-B.2 v2 — consumer migration to unified assert_* helpers (3 batches, 10 files)#152
Merged
Merged
Conversation
Per CC-249 spike Q3 (break-and-rewrite) + CC-254 amendment (harness helpers no longer auto-call pass), this batch migrates 4 consumer test scripts from local `assert_exit` + `assert_contains` defs to harness helpers (`assert_exit`, `assert_file_contains`, `assert_string_contains`). All variant A (literal substring); pure rename + delete local defs. Files: - scripts/test-skill-refine.sh - scripts/test-commands-runner.sh - scripts/test-usage-tracker.sh - scripts/test-usage-weekly.sh Out-of-scope local helpers preserved: assert_not_contains, assert_matches, assert_occurrences, assert_line_count, assert_all_case_lines_match (no harness equivalent). Existing `pass "$name"` / `|| return` chains UNCHANGED — works because CC-254 made the harness helpers return-only on success. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…mands regex classify Per CC-249 spike Q3 + CC-254 amendment. Batch B of the 3-batch PR-B.2 consumer migration plan (Batch A in 9ed320e). Migrates: - scripts/test-setup-project.sh (variant A literal, pure rename) - scripts/test-pr-gate.sh (variant A literal, pure rename, 1973 LoC) - scripts/test-install.sh (variant A literal, pure rename, 1869 LoC) - scripts/test-commands.sh (per-call regex-vs-literal classification) test-commands.sh classification per spike Q2: calls with regex metachars (^, $, \|, |, *, .) → assert_file_matches; plain literals → assert_file_contains. Worked examples confirmed: "^\| `off`" → matches "^### Rules: off" → matches "imperative" → contains "`feat`" → contains Out-of-scope local helpers preserved: assert_not_contains, assert_frontmatter, assert_in_section, assert_entry_once, assert_expected_entries_once, assert_symlink_target, assert_dir_not_symlink, assert_file_content (all have no harness equivalent). Existing `pass "$name"` / `|| return` chains UNCHANGED — works because CC-254 made harness helpers return-only on success. Verification: - 0 local defs of assert_exit / assert_contains across 4 files - 0 shadow-shim defs (no consumer redefining the harness helpers) - 0 bare `assert_contains` calls (all renamed) - harness byte-identical (git diff --quiet passed) - 3 excluded files (test-run-all-tests, test-test-harness, test-hooks) byte-identical - test-test-harness.sh 30/30 passes - Golden parity round-trip verified for setup-project, pr-gate, commands (no VERBOSE + VERBOSE=1); test-install.sh round-trip exceeded codex wall-time budget but file-level checks all pass (revisit on next session if golden-diff confirmation needed) Net diff: -83 LoC (213 insertions / 296 deletions) — deletions dominate as spike Cost Estimate predicted. Batch C deferred to next session (per user 2026-05-24): 2 files remain (test-check-docs-freshness arg-order flip, test-patch-gitignore output_contains merge). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…ess + test-patch-gitignore
…-harness / test-run-all-tests / test-hooks) PR-B.2 v2 (CC-249) migrated 10/13 consumers off divergent assert_* helpers onto the unified harness API. The remaining 3 files need per-file analysis rather than a mechanical rename batch: - test-test-harness.sh: cyclic dependency (tests the harness itself) - test-run-all-tests.sh: orchestrator shape, 2 call-sites need review - test-hooks.sh: 0 unified-helper call-sites — audit-confirm-only Filed as P3 reuse-debt so CC-249 epic can close as scoped (10/13). Validator-neutral edit (30 pre-existing E-codes unchanged, tracked by CC-228).
CC-249 (consolidate divergent assert_* helpers) closes via the spike (#146) → PR-B.1 helpers (#148) → CC-254 amendment (#149) → PR-B.2 v2 consumer migration (#152, this branch). 10/13 consumers migrated; 3 excluded files carried as CC-256. Tail commit updates: - index row: 🟢 someday → ✅ closed 2026-05-24; pr ref → pr:#148,#149,#152 - body heading: deferred → closed 2026-05-24 - Outcome + See blocks appended - CC-256 row pr ref: pr:TBD → pr:#152 Validator-neutral edit (30 pre-existing E-codes unchanged, tracked by CC-228).
… (7× command-not-found per invocation) Discovered while running /pr-gate standard on cc-249-pr-b2-consumer-migration-v2 (this branch). Gate verdict + result file emit correctly (Final: GO produced cleanly) but scripts/pr-gate.sh:362 throws 7 "command not found" errors per invocation matching literal `Final:`/`final:`/`**Final:` tokens from inside the codex brief heredoc body. Classified medium per [[feedback_gate_finding_triage]]: no-block gate + no correctness impact, but hits 100% of /pr-gate runs and buries real shell errors under false-positive noise. Hypothesis: unquoted heredoc delimiter `<< BRIEF_EOF` lets bash expand metachars in the body; OR a downstream eval/source re-executes parsed lines. Investigation + fix carried by CC-257. Validator-neutral edit (30 pre-existing E-codes unchanged).
5 tasks
screenleon
added a commit
that referenced
this pull request
May 24, 2026
…e (22/23) + format/fail-fast options + consumer adoption (#153) CC-247 + CC-248 (th_init --format=<preset> + --fail-fast harness options) shipped in PR #142 on 2026-05-23 but BACKLOG status was never flipped. Final consumer adoption verified post PR-B.2 v2 (#152) close-out: - 4 of 10 migrated consumers select a non-default --format preset - 3 of 4 fail-fast consumers use --fail-fast (test-skill-refine, test-usage-tracker, test-usage-weekly) - grep '^(pass|fail)()' scripts/test-*.sh returns 0 (no per-file print-format or fail() overrides remain) CC-203 (shared scripts/lib/test-harness.sh) reaches its closure threshold at 22/23 test-*.sh adoption. The lone non-adopter is the orchestrator scripts/test-run-all-tests.sh which runs other test-*.sh as subprocesses and asserts on aggregated output — not a case-based harness fit; deliberately excluded per the GROUP-B re-analysis. The 3 files excluded from PR-B.2 v2's assert_* migration (CC-256) are on a separate axis and do not block CC-203 closure. Index + body sections updated for all 3 tickets with Outcome / See blocks. Validator-neutral edit (30 → 29 E-codes — opportunistically cleared CC-203 invalid area enum `ops/test/reuse` → `ops/test` as part of the row touch).
5 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
CC-249 PR-B.2 v2 — the clean pure-rename + delete-local-defs migration the spike (
docs/spikes/CC-249.md, #146) originally envisioned. Migrates 10 of 13test-*.shconsumers off divergent localassert_*helpers onto the unified harness API added by PR-B.1 (#148) and amended by CC-254 (#149, no auto-pass).3 commits of migration + 1 commit filing the defer ticket for the remaining 3 excluded files:
9ed320eBatch A — 4 files variant-A literal rename: test-skill-refine, test-commands-runner, test-usage-tracker, test-usage-weekly (-54 LoC)9f05981Batch B — 4 files: test-setup-project, test-pr-gate, test-install (variant-A literal); test-commands.sh (per-call regex-vs-literal classify per spike Q2/U2) (-83 LoC)be7af17Batch C — 2 files: test-check-docs-freshness (assert_exit arg-order FLIP + assert_output_contains→assert_string_contains with explicit$LAST_OUTPUT); test-patch-gitignore (assert_contains→assert_file_contains + assert_output_contains→assert_string_contains)dfa4895CC-256 — defer ticket for the 3 excluded files (test-test-harness cyclic dependency, test-run-all-tests orchestrator shape, test-hooks audit-confirm-only)Net: −114 LoC across the 10 migrated files (≈63% reduction in assert helper boilerplate). Harness untouched; 3 excluded files untouched.
Lineage
docs/spikes/CC-249.md(docs(cc-249): spike result — assert_* consolidation decisions + file cc-252 #146) — Q1-Q5 decisions (rename map, assert_exit canonical arg-order, regex-vs-literal classification)assert_exit,assert_file_contains,assert_file_matches,assert_string_contains)PR-B.2 v1 was abandoned (became CC-253 misdirected output). This v2 is the clean re-execution.
Test plan
scripts/test-test-harness.sh30/30 passes (no regression)grep -cE '^(function )?(assert_exit|assert_file_contains|assert_file_matches|assert_string_contains)\(\)'returns 0 for each)scripts/lib/test-harness.shuntouched (git diff --statempty)scripts/test-run-all-tests.sh,scripts/test-test-harness.sh,scripts/test-hooks.sh(git diff --statempty).github/workflows/lint.ymlignore_names block already includes both Batch C basenames (no edit needed)bash scripts/lint-scripts.shOK (52 files); CI ludeeus shellcheck will run strict layerpm/scripts/validate.sh BACKLOG.md DECISIONS.md CHANGELOG.md— validator-neutral (30 pre-existing E-codes unchanged, tracked by CC-228)/pr-gate standard(critic / qa-tester / architecture-reviewer): Final: GO, 0 findings, escalation empty —.gate-results/gate-20260524-174507.mdProcess notes
[[feedback_codex_brief_discipline]]: every Batch C apply_patch pinnedexpected_head_sha: 9f05981, retry-cap 3 (HALT-and-report); brief delivered asdispatch_handover_v1block per[[feedback_pm_dispatch_handover_inline]].[[feedback_test_migration_format_preservation]]: pre-migration baseline captured for both Batch C files; post-migration diff empty (byte-identical stdout).[[feedback_codex_dispatch_lifecycle_leak]]: dispatched via main-threadBash(codex-dispatch.sh, run_in_background: true), notAgent(codex-executor).[[feedback_pr_gate_before_pr]]: gated locally before opening PR, not after..git/index.lock(known recurring per memory §CC-203 GROUP-B retro 3); main thread committed Batch C manually.🤖 Generated with Claude Code