T-SYM2-run-quality-checks-test-fixtures
Status: closed/obsoleted · Impact: low · Complexity: small
Auto-generated from a /sdlc:task-work post-mortem. Review and
promote to open/ready before picking up.
plugin/scripts/run_quality_checks.ts is the executor underneath two
distinct consumers — quality_checks: (Step 7’s gate) and
worktree_init: (Step 4’s setup). It has no unit-test coverage:
behaviour was verified ad-hoc with /tmp smoke runs during the
--key extension landed in
T-K7FR-task-work-worktree-init-language-agnostic. The next
flag addition has no regression net. This task closes that gap, and
in doing so establishes plugin/scripts/tests/ as the canonical
home for plugin-script unit tests — the new suite is the first
occupant. Existing scattered test_*.py siblings stay where they are
(migration is a separate concern); the convention applies going
forward.
| Location | Role today |
|---|---|
plugin/scripts/run_quality_checks.ts | Executor used by two consumers: Step 7 quality_checks (gates the PR) and Step 4 worktree_init (project setup verbs). Accepts --config <path>, --key <name>, --allow-empty, plus positional verbs (—config-less invocation). No unit tests; behaviour verified ad-hoc with /tmp smoke runs during the --key extension. |
plugin/scripts/test_*.py | Five existing pytest files live as siblings to scripts in plugin/scripts/ (test_count_inflight_tasks.py, test_lease_heartbeat_loop.py, test_schema_patterns.py, test_quality_baseline.py, test_example_script.py). Layout is ad-hoc — no centralized tests/ subdirectory exists at this level. |
plugin/scripts/lease_cli/tests/ | The lease CLI subdirectory already runs its own tests/ convention (with conftest.py and test_subcommands.py). Precedent that a tests/ subdirectory is acceptable layout. |
sdlc.yaml | Declares quality_checks: and worktree_init: as the two known keys consumed by the executor. Step 7 reads quality_checks:; Step 4 reads worktree_init:. |
Proposed
Section titled “Proposed”A pytest fixture suite at
plugin/scripts/tests/test_run_quality_checks.py — creating the
plugin/scripts/tests/ directory in the process — that exercises:
- config absent -> exit 2 (or 0 with
--allow-empty) - config present, key absent -> exit 2 (or 0 with
--allow-empty) - config present, key empty list -> exit 2 (or 0 with
--allow-empty) - config present, key with one passing verb -> exit 0
- config present, key with one failing verb -> exit 1
- positional verbs (no —config) -> exit 0/1 by verb result
--configand positional verbs both set -> exit 2- malformed YAML -> exit 2
- non-list key value -> exit 2
--key worktree_initexercises the same matrix above against the alternate key
Approach
Section titled “Approach”- Create
plugin/scripts/tests/(with__init__.pyif Python needs it to be importable fromplugin/scripts/). - Author the fixture matrix above as
plugin/scripts/tests/test_run_quality_checks.py; each case is atmp_pathsdlc.yaml + a subprocess invocation + assert on (exit_code, stdout, stderr-substring). Match the existing siblingtest_*.pyfiles’ shape (pytest, norun_evals.pywrapper) —plugin/scripts/lease_cli/tests/is the closest precedent. - Add the new runner to
sdlc.yaml’squality_checks:so the gate fires on every /sdlc:task-work run.
Files to touch
Section titled “Files to touch”| Location | Kind | Change |
|---|---|---|
plugin/scripts/tests/ | new | Create the directory; add __init__.py if Python’s import resolution needs it for the new test file to find run_quality_checks.py. |
plugin/scripts/tests/test_run_quality_checks.py | new | pytest fixture suite covering the matrix above. |
sdlc.yaml | modify | Add the new test runner to quality_checks: so the gate fires on every /sdlc:task-work Step 7. |
Acceptance criteria
Section titled “Acceptance criteria”- AC-1:
plugin/scripts/tests/exists and containstest_run_quality_checks.py. - AC-2: All matrix cases above are covered by an assertion in the new test file; the file exits 0 when invoked from a clean checkout.
- AC-3: Adding a deliberate regression (e.g. flipping a default exit code) causes the new test file to exit non-zero.
- AC-4: The test file is wired into
sdlc.yaml’squality_checks:so /sdlc:task-work Step 7 runs it.
Out of scope
Section titled “Out of scope”- Refactoring
run_quality_checks.tsinternals — this is a coverage task, not a redesign. - Migrating the existing five sibling
test_*.pyfiles inplugin/scripts/into the newtests/directory. The convention applies going forward; pre-existing files stay where they are until a future task explicitly opts to relocate them. - Adding tests for
detect_quality_runners.ts(separate concern; open a sibling task if needed).
Dependencies
Section titled “Dependencies”- none
Discovery context
Section titled “Discovery context”Spawned by /sdlc:task-work post-mortem of T-K7FR-task-work-worktree-init-language-agnostic on 2026-05-20.
Depends on
Section titled “Depends on”T-44OO-plugin-scripts-self-discover-project-root