From f3f36b3833337a61717d868434e242e726d27296 Mon Sep 17 00:00:00 2001 From: Harshit Nagila Date: Tue, 17 Nov 2026 07:45:26 +0530 Subject: [PATCH] test: add Python tooling command fixtures --- ANALYSIS.md | 21 ++++++++++--------- CHANGELOG.md | 2 ++ README.md | 15 ++++++------- .../.github/workflows/ci.yml | 8 +++++++ fixtures/clean-python-tooling/Makefile | 4 ++++ .../scripts/check_types.py | 9 ++++++++ .../.github/workflows/ci.yml | 7 +++++++ .../tests/test_tooling.py | 1 + run_tests.py | 3 ++- 9 files changed, 50 insertions(+), 20 deletions(-) create mode 100644 fixtures/clean-python-tooling/.github/workflows/ci.yml create mode 100644 fixtures/clean-python-tooling/Makefile create mode 100644 fixtures/clean-python-tooling/scripts/check_types.py create mode 100644 fixtures/missing-python-tooling/.github/workflows/ci.yml create mode 100644 fixtures/missing-python-tooling/tests/test_tooling.py diff --git a/ANALYSIS.md b/ANALYSIS.md index b6b2640..6c9acc9 100644 --- a/ANALYSIS.md +++ b/ANALYSIS.md @@ -1,25 +1,25 @@ # CI Command Truth — Analysis -Date: 2026-11-10. Status: pushed — github.com/RakTikoo/ci-command-truth, v0.2 tagged at commit 1d9cbaa, CI green (run #115, 70 tests). (Corrected 2026-11-11: the original status line said "local build only (not pushed)", which went stale after the approved push; the H-1B gate still applies to promotion/monetisation.) +Date: 2026-11-17. This issue #5 fixture-only update is on branch `test/5-python-tooling-fixtures`; scanner behavior is unchanged. ## Fixture corpus score -Corpus first, tool second. 44 fixture repositories under `fixtures/` -(after the fix pass below): +Corpus first, tool second. 55 fixture repositories under `fixtures/`: | Group | Count | Expectation | Result | |---|---|---|---| -| Clean (`clean-*`) | 29 | 0 findings, exit 0 | **29/29 pass** | -| Planted missing (`missing-*`) | 6 | exactly 1 finding, correct kind, exit 1 | **6/6 found, 0 extra findings** | +| Clean (`clean-*`) | 35 | 0 findings, exit 0 | **35/35 pass** | +| Planted missing (`missing-*`) | 11 | exactly 1 finding, correct kind, exit 1 | **11/11 found, 0 extra findings** | | Edge (`edge-*`) | 8 | see below | **8/8 pass** | | Special (`special-downgrade`) | 1 | warning-severity findings only, exit 0 | **pass** | -(Pre-fix-pass corpus was 21 fixtures: 9 clean / 6 missing / 6 edge.) +(Before this Python tooling pack, the registered corpus contained 53 fixtures: 34 clean / 10 missing / 8 edge / 1 special.) Planted misses, one per fixture: missing npm script, missing make target, missing just recipe, missing `./script` file, missing Python module (`python -m absentpkg.mod`), missing requirements file -(`pip install -r requirements-missing.txt`). +(`pip install -r requirements-missing.txt`), and missing repository-local +Python script (`python3 tests/test_ci.py`). Edge cases: workflow with no run steps (exit 0, 0 checked), uses:-only workflow (exit 0), empty workflow file (**listed as unscanned, exit 2 — @@ -35,13 +35,14 @@ Clean fixtures cover: npm/pnpm/yarn forms, make (incl. `-C` and bare `&&`/`||`/`;`/`|` chains, env-var prefixes, `sudo`, `${{ }}` expressions, `$VAR` script names, multi-line `|` and `>` blocks, step `working-directory:`, and runner wrappers (`uv run make test`, -`poetry run npm run test`). +`poetry run npm run test`), and a Makefile target wrapping pytest with +a direct repository-local Python script invoked by a workflow. -**Tests: `python3 run_tests.py` — 33 tests, all passing** (corpus +**Tests: `python3 run_tests.py` — 83 tests, all passing on Python 3.13** (corpus subprocess tests, edge tests, parser/tokeniser unit tests, annotation format, fix-pass regression units, and a static-safety test asserting the tool source contains no `subprocess`/`eval`/`exec`/`os.system`). -Plus `python3 spotcheck_fp.py` — 10 fresh-sandbox false-positive +Plus `python3 spotcheck_fp.py` — 16 fresh-sandbox false-positive headline cases, all passing (see Adversarial review). ### Bugs the corpus caught during the build diff --git a/CHANGELOG.md b/CHANGELOG.md index 3335b11..18d5814 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,8 @@ Brief, factual entries for the shipped versions, newest first. ## Unreleased +- **Fixtures**: add clean and planted-missing Python tooling command shapes; registered corpus grows to 35 clean and 11 planted-missing fixtures. + - **Packaging**: new `pyproject.toml` — `pip install git+https://github.com/RakTikoo/ci-command-truth` now installs the single-file module plus a `ci-command-truth` console diff --git a/README.md b/README.md index 77ad778..80ac98c 100644 --- a/README.md +++ b/README.md @@ -242,17 +242,14 @@ $ python3 run_tests.py # 83 tests, zero dependencies $ python3 spotcheck_fp.py # 16 false-positive headline cases, fresh sandboxes ``` -Fixture corpus in `fixtures/`: 32 clean repos that must produce zero -findings, 9 repos with exactly one planted missing reference each, 8 +Fixture corpus in `fixtures/`: 35 clean repos must produce zero +findings, 11 repos exactly one planted missing reference each, 8 edge-case repos (no-run, uses-only, empty, malformed, CRLF, nested workflow subdirectory, empty workflows dir, malformed package.json), -and 1 downgrade repo (warning-severity findings, exit 0). A further -3 cargo repos (2 clean, 1 planted-missing) sit alongside them with -documented expectations in their `EXPECTED.md` files; they join the -registered corpus when a cargo resolver lands, since cargo segments -are currently skipped as external tools. See -ANALYSIS.md for the score, including the v0.2 section. - +and 1 downgrade repo (warning-severity findings, exit 0). Python +tooling fixtures cover a Makefile target wrapping pytest, a +repository-local script invoked from CI, and a missing script path. +See `ANALYSIS.md` for the fixture score and coverage details. ## License MIT — see `LICENSE`. diff --git a/fixtures/clean-python-tooling/.github/workflows/ci.yml b/fixtures/clean-python-tooling/.github/workflows/ci.yml new file mode 100644 index 0000000..2803f55 --- /dev/null +++ b/fixtures/clean-python-tooling/.github/workflows/ci.yml @@ -0,0 +1,8 @@ +name: Python tooling +on: push +jobs: + test: + runs-on: ubuntu-latest + steps: + - run: make test-python + - run: python3 scripts/check_types.py diff --git a/fixtures/clean-python-tooling/Makefile b/fixtures/clean-python-tooling/Makefile new file mode 100644 index 0000000..595dae2 --- /dev/null +++ b/fixtures/clean-python-tooling/Makefile @@ -0,0 +1,4 @@ +.PHONY: test-python + +test-python: + python3 -m pytest tests/unit diff --git a/fixtures/clean-python-tooling/scripts/check_types.py b/fixtures/clean-python-tooling/scripts/check_types.py new file mode 100644 index 0000000..98cc2ef --- /dev/null +++ b/fixtures/clean-python-tooling/scripts/check_types.py @@ -0,0 +1,9 @@ +"""Repository-local type check entry point used by CI.""" + + +def main(): + return 0 + + +if __name__ == "__main__": + raise SystemExit(main()) diff --git a/fixtures/missing-python-tooling/.github/workflows/ci.yml b/fixtures/missing-python-tooling/.github/workflows/ci.yml new file mode 100644 index 0000000..9cb8ac0 --- /dev/null +++ b/fixtures/missing-python-tooling/.github/workflows/ci.yml @@ -0,0 +1,7 @@ +name: Python tooling +on: push +jobs: + test: + runs-on: ubuntu-latest + steps: + - run: python3 tests/test_ci.py diff --git a/fixtures/missing-python-tooling/tests/test_tooling.py b/fixtures/missing-python-tooling/tests/test_tooling.py new file mode 100644 index 0000000..cee8579 --- /dev/null +++ b/fixtures/missing-python-tooling/tests/test_tooling.py @@ -0,0 +1 @@ +"""The real test module is named differently from the workflow command.""" diff --git a/run_tests.py b/run_tests.py index 2e04514..91775dc 100644 --- a/run_tests.py +++ b/run_tests.py @@ -29,7 +29,7 @@ def run_tool(fixture): "clean-working-dir", "clean-wrappers", # Fix-pass regression fixtures (adversarial-review findings): "clean-pnpm-yarn-bun", "clean-folded", "clean-per-job-defaults", - "clean-python-known", "clean-nested-run", "clean-matrix-steps", + "clean-python-known", "clean-python-tooling", "clean-nested-run", "clean-matrix-steps", "clean-just-advanced", "clean-make-advanced", "clean-heredoc", "clean-trailing-comment", "clean-if-false", "clean-workspaces", "clean-backslash", "clean-created", "clean-shell-skip", @@ -47,6 +47,7 @@ def run_tool(fixture): "missing-just-recipe": "missing-just-recipe", "missing-script-file": "missing-script-file", "missing-python-module": "missing-python-module", + "missing-python-tooling": "missing-script-file", "missing-requirements": "missing-requirements-file", # v0.2: planted missing submodule in a repo-local package "missing-python-submodule": "missing-python-module",