Skip to content

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.

LocationRole today
plugin/scripts/run_quality_checks.tsExecutor 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_*.pyFive 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.yamlDeclares quality_checks: and worktree_init: as the two known keys consumed by the executor. Step 7 reads quality_checks:; Step 4 reads worktree_init:.

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
  • --config and positional verbs both set -> exit 2
  • malformed YAML -> exit 2
  • non-list key value -> exit 2
  • --key worktree_init exercises the same matrix above against the alternate key
  1. Create plugin/scripts/tests/ (with __init__.py if Python needs it to be importable from plugin/scripts/).
  2. Author the fixture matrix above as plugin/scripts/tests/test_run_quality_checks.py; each case is a tmp_path sdlc.yaml + a subprocess invocation + assert on (exit_code, stdout, stderr-substring). Match the existing sibling test_*.py files’ shape (pytest, no run_evals.py wrapper) — plugin/scripts/lease_cli/tests/ is the closest precedent.
  3. Add the new runner to sdlc.yaml’s quality_checks: so the gate fires on every /sdlc:task-work run.
LocationKindChange
plugin/scripts/tests/newCreate 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.pynewpytest fixture suite covering the matrix above.
sdlc.yamlmodifyAdd the new test runner to quality_checks: so the gate fires on every /sdlc:task-work Step 7.
  • AC-1: plugin/scripts/tests/ exists and contains test_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’s quality_checks: so /sdlc:task-work Step 7 runs it.
  • Refactoring run_quality_checks.ts internals — this is a coverage task, not a redesign.
  • Migrating the existing five sibling test_*.py files in plugin/scripts/ into the new tests/ 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).
  • none

Spawned by /sdlc:task-work post-mortem of T-K7FR-task-work-worktree-init-language-agnostic on 2026-05-20.

T-44OO-plugin-scripts-self-discover-project-root


← Back to Tasks