Repository navigation
refactor(tests): share repeated shell test helpers within four plugins - #17395
Conversation
Suites in prototype, guardrails, docs-naming and instruction-placement retyped the same helpers per file. Each block moves to a helper file inside its own plugin and the suites source it; nothing crosses a plugin boundary, so docs/contracts/shell-test-helpers (cross-plugin duplication) is untouched. - prototype: lib/test-helpers.sh holds the pass/fail/assert block of the three detect-ecosystems suites, and detect_wrapper_contract, the 177-line body the two skill wrapper suites shared. The suites differed only in their own skill name and the sibling's, now arguments. Each wrapper suite keeps its header and declares the canonical detector and the sibling wrapper in test-scope, since the paths that named them moved into the helper. lib/browser-test-helpers.sh holds the five explore-directions browser suites' prerequisite check, scratch dir, playwright session, cleanup trap, ok/bad, bridge start, and the native/result/code/check helpers; browser_setup takes the scratch prefix, session prefix and tool list that were the only differences. playwright-cli keeps its logs and Chromium its sockets in the scratch dir: that is why pw runs there. - docs-naming: lib/test-helpers.sh, the pass/fail/assert_* block of eight suites (assert_lacks and assert_absent stay two functions: their messages differ). - instruction-placement: lib/test-helpers.sh for ten suites, and lib/migrate-test-helpers.sh for the three migrate suites, whose fail() prints a different shape. The migrate file also carries command_not_found_handle: an unknown command counts as a failure through a file, because bash runs the handler in whatever subshell hit it and a subshell's counter increment is lost. - guardrails: the git-hook suites' expect (label want got) goes to lib/git-hooks-test-helpers.sh, apart from hooks/guardrails-test-helpers.sh, whose expect drives guard_invoke. guardrails-test-helpers.sh gains the builders two hook suites each repeated: the 65 KB boundary payload (size_filler, sized_write_json, assert_bounded_exit; jq reads content on stdin because a 65 KB --arg passes the Windows argv limit, and a 124 exit is named as a hang, not a block), the GitHub MCP payloads (mcp_single_json, mcp_push_json, scoped), alias_chain, nul_payload and nul_stderr, and replall_json (replace_all is the one Edit shape where repetition is expected). mcp_push_json's local array is renamed jq_args so it no longer shadows a suite's args for shellcheck. Left as they are: guardrails skip() (three suites, each beside a silent-skip-ok marker), run_bounded (differs per suite), the browser suites' run/relocate/page (differ), harness-browser's script_path (a differently named native), and the result footers. Comments that documented a moved helper are dropped rather than moved: the comment lint judges every added comment line. 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. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 9f349829b3
ℹ️ 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".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
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. Every change here is a test-only refactor. Shell test helpers that each suite used to define for itself now live in one helper file per plugin, and the suites source that file:
What I checked:
Chunk 2 of 2 (10 files)Security review: chunk 2 of 2 (prototype plugin test helpers)No security issues found in this chunk. What was reviewedI read all 10 files in chunk 2:
What the change doesIt is a refactor of test scaffolding only. Two kinds of code move into the new helper files:
Checks
Context
critical-findings: 0 |
|
claude-review reviewed Chunk 1 of 2 (40 files)Code review: chunk 1 of 2 (docs-naming, guardrails, instruction-placement)No findings. I read every hunk of the 40 files in this chunk. The changelog fragment copies listed in What I checked, using the files at head:
Loosened-check verdict: fail (default; the prompt had no No plugin manifest changes in this chunk. Verifier dropped 0 of 0 candidates. Chunk 2 of 2 (10 files)Code review, chunk 2 of 2 (the 10 This chunk moves the repeated shell test helpers into two files that live inside the plugin. Behaviour stays the same.
Loosened checks. No assertion, expected value or check was removed or relaxed. Every moved assertion is carried over as it was. Closing issue. The PR closes none ("No related issue"), so there are no acceptance criteria to check. No plugin manifest changed in this chunk. Settled thread. The one settled thread is on Author's verification. The PR's claims (42 suites with identical results before and after, Verifier dropped 0 of 0 candidates. critical-findings: 0 |
Post-merge mutation testingKilled 3, survived 2, timeout 0, no coverage 0, invalid 0, not run 2.
Surviving mutants
The run's summary has the full report. |
No related issue: in-repository duplication pass (control-hub#17), same-plugin test helpers.
Summary
Shell suites in
prototype,guardrails,docs-namingandinstruction-placementretyped the same test helpers in every file. Each repeated block moves to a helper file inside its own plugin, and the suites source it. Nothing is shared across plugins:docs/contracts/shell-test-helpers/README.mdkeeps cross-plugin duplication by decision, and an installed plugin can only source its own files. Same shape as #17368 did forarchitecture.53 files, +502 / −1417.
Fix
lib/test-helpers.shdetect-ecosystemssuitesdetect_wrapper_contract, the 177-line body the two skill wrapper suites shared, taking the skill and sibling names that were their only differenceslib/browser-test-helpers.shbrowser_setup <prefix> <session> <tools>), bridge start (browser_serve),native/result/code/checklib/test-helpers.shlib/test-helpers.shlib/migrate-test-helpers.shcommand_not_found_handlelib/git-hooks-test-helpers.shhooks/git-hooks-noticeexpect <label> <want> <got>(kept apart fromhooks/guardrails-test-helpers.sh, whoseexpectdrivesguard_invoke)hooks/guardrails-test-helpers.sh(existing)assert_bounded_exit, GitHub MCP payload builders,alias_chain,nul_payload/nul_stderr,replall_jsontest-scopeline naming the canonical detector and the sibling wrapper, since the paths that named them now sit in the helper.bump: nonefragments for the four plugins.Left as they are: guardrails
skip()(three suites, each next to asilent-skip-okmarker),run_bounded(differs per suite), the browser suites'run/relocate/page(differ), harness-browser'sscript_path, and the result footers.Related
architectureandscripts/.docs/contracts/shell-test-helpers/README.md: why helpers stay per plugin.Verification
shellcheck(repo.shellcheckrc) clean on all 53 changed files.shfmt -d(repo.editorconfig): new files clean; every edited file it flags was already flagged onmain.scripts/check-changelog-fragments.sh --check: valid.scripts/affected-tests.sh --base origin/main: every changed file maps, exit 0.🤖 Generated with Claude Code
https://claude.ai/code/session_01Vcupoo79EqmECYFZ4MTv6C