Repository navigation
refactor(tests): share repeated shell test preambles - #17368
Conversation
Three groups of suites retyped the same block per file: - architecture: 17 suites carried an identical pass/fail/assert_* block. It moves to plugins/architecture/lib/test-helpers.sh, sourced from the plugin's own lib, as the skill suites already source lib/likec4-golden.sh. One plugin, so no cross-plugin copy (ADR 0019 does not apply). The "duplicated on purpose" headers cited docs/contracts/shell-test-helpers, which governs sharing across plugins, not within one; they are removed. - scripts/ci-*.test.sh: 11 suites read a ci-status step and its run body with the same two awk programs and missing-step guard. That is scripts/lib/ci-step.sh (ci_step::read, ci_step::abort). - scripts/check-*.test.sh: seven suites had the same run_case, eight the same discover-mode stdout check, ten the same unknown-mode check. These join scripts/lib/test-harness.sh as test_harness::check_case, assert_discover_quiet and assert_unknown_mode, the harness already owning the shapes a suite driving a script needs. check-test-tmp-cleanup keeps its own run_case: it commits after setup. Assertions, labels and messages are unchanged; every touched suite passes with the same count before and after. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Vcupoo79EqmECYFZ4MTv6C
Codex Review Summary: ✅ CompletedThis 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-security-review reviewed Chunk 1 of 2 (40 files)Security review: chunk 1 of 2 (40 files)No security issues found in this chunk. What changed: this is a test-only refactor. Seventeen architecture-plugin shell suites now source one new file, Checks run:
Chunk 2 of 2 (2 files)Security review: chunk 2 of 2 (
|
|
claude-review reviewed Chunk 1 of 2 (40 files)Code review: chunk 1 of 2 (40 files)No findings in this chunk. This is a refactor that moves repeated shell test setup into shared helpers. I compared each removed block with the helper that replaced it, and they behave the same. What I checked
Review criteria
Verifier dropped 0 of 0 candidates. Chunk 2 of 2 (2 files)Code review: chunk 2 of 2 (
|
No related issue: a duplication sweep the owner requested in a session, with no filed issue
Summary
Shell test preambles that were copied file by file now live in shared helpers, in three groups. No assertion, label or message changes.
Fix
pass/fail/assert_*block, 29 identical lineslib/*-references,redact-connection, 10 skill suites)plugins/architecture/lib/test-helpers.sh, sourced from the plugin's ownlib/, as the skill suites already sourcelib/likec4-golden.shscripts/ci-*.test.shscripts/lib/ci-step.sh(ci_step::read,ci_step::abort)run_case, discover-mode stdout check, unknown-mode exit check)scripts/check-*.test.shscripts/lib/test-harness.sh(test_harness::check_case,assert_discover_quiet,assert_unknown_mode)The 11 architecture headers saying the primitives are "duplicated on purpose, per docs/contracts/shell-test-helpers" are removed. That contract covers sharing across plugins, and these suites all belong to one plugin, so ADR 0019 vendoring does not apply.
check-test-tmp-cleanup.test.shkeeps its ownrun_casebecause it commits after setup.Left as is:
lib/html2md.test.sh/app-controlgroup, the six*-end-of-turn.test.sh, the fiveallowed-tools-pairing.test.sh, and the code-metrics / attribution / harness-config / code-tidying groups across plugins):docs/contracts/shell-test-helpers/README.mddecides that per-plugin assertion primitives stay duplicated ("Duplication of this shape is the accepted default, not an opt-in"). It calls these clone classes "this decision made visible, not debt to fix". Vendoring them would reverse that decision, which belongs to the owner.fanout-diversity-*,code-review-large-diff-*, knowledgedd-*-verifier-arms, discipline, source-controlcommit-*,*-formatsu-*): per https://code.claude.com/docs/en/plugin-evals#add-setup-or-history-with-case-yaml, a scaffold "starts in the empty workspace with a small fixed environment … Nothing else from your shell reaches it, and neither do the case's EVAL_* variables". No documented variable names the case directory, and no scaffold here locates its own directory. A shared fixture would depend on undocumented loader behavior, so each case stays self-contained.explore-directionsandpressure-testdetect-ecosystems.test.shshare 177 lines), guardrails, work-items seeds, docs-naming, instruction-placement, ai-slop, source-control, evalsplugin-eval, corrections, discovery, disk-hygiene, attribution, playbooks, planning, education, the bash-/powershell-/markdown-formatgit-hooks, session-flow, multi-agent and testing.Verification
scripts/check-affected.sh: 19 passed, 1 skipped (ruff, no .py files). fixture-git-isolation, test-tmp-cleanup, plugin-imports, cross-plugin-source-drift, silent-skips and pipefail-grep-q pass. shellcheck is clean on all 41 changed shell files..githubsuite, which CI runs.Related
N/A
🤖 Generated with Claude Code
https://claude.ai/code/session_01Vcupoo79EqmECYFZ4MTv6C