Skip to content

fix(ci): repair ruff lint, pre-commit hook scope, and matrix job name - #2

Merged
docxology merged 8 commits into
mainfrom
ci/fix-lint-precommit-matrix
Sep 10, 2026
Merged

docxology merged 8 commits into
mainfrom
ci/fix-lint-precommit-matrix

Conversation

@docxology

Copy link
Copy Markdown
Collaborator

Repairs three CI defects on merged main:

1. Lint (ruff) — ruff format --check failure
tests/property/test_correctness_laws.py was not formatter-clean (the step that actually failed the Lint job; ruff check itself passes in scope). Reformatted. Also fixes the two sort-import I001 findings in root scripts/ (batch_cogsec_improve.py:10, z_generate_manuscript_variables.py:93).

2. Pre-commit hooks — hook self-modified files
The ruff/ruff-format files regex \^(cogant/)?(py/cogant/|tests/) also swept the repo-root tests/ tree (tools audit tests), which is outside the CI ruff ratchet and formats under a different ruff config — on CI the format hook rewrote 24 files and failed every run (24 reformat + 1 end-of-file fix). Tightly scoped to \^cogant/(py/cogant|tests)/; also fixed the trailing-newline drift in cogant/benchmarks/results/suite_20260818.md.

3. Test job name rendered literally
Test (py${{ matrix.python-version }}) renders raw because matrix context in jobs.<job_id>.name only expands for executed jobs — and this job was always skipped (needs: lint failing). Removed the explicit name so GitHub default matrix naming (test (3.11)) renders expanded both when skipped and when run.

Bonus (unblocks template stage_03): tools/figures/copier.py omitted alt_text in template figure registry records, so the template HTML renderer failed with 5 'missing accessibility alt text' render errors. Registry records now carry the registered alt text; pinned registry-shape test updated; METRICS.yaml regenerated against the new HEAD.

Local gate: ruff check + format green (859 files), all 5 lint-job audit gates green, check_metrics_fresh --fail-on-dirty green, mypy --strict green (246 files), pre-commit --all-files green, fast suite 9542 passed / 45 skipped, property suite 48 passed, template stage_03 render + stage_04 validate exit 0.

- Reformat tests/property/test_correctness_laws.py so 'ruff format --check
  py/cogant/ tests/' passes (the step that actually failed the Lint job).
- Fix sort-import I001 findings in scripts/code_quality/batch_cogsec_improve.py
  and scripts/z_generate_manuscript_variables.py.
- Tighten pre-commit ruff/ruff-format 'files' regex to ^cogant/(py/cogant|tests)/:
  the bare 'tests/' alternative also swept the repo-root tests/ tree, which is
  outside the CI ruff ratchet and formats under a different ruff config, so the
  hook rewrote 24 files and failed 'Pre-commit hooks' on every CI run.
- Fix end-of-file newline in cogant/benchmarks/results/suite_20260818.md
  (end-of-file-fixer failure).
- Drop the explicit 'Test (py${{ matrix.python-version }})' job name: matrix
  context in jobs.<job_id>.name only expands for executed jobs, so while the
  job is skipped GitHub rendered the raw expression literally; default matrix
  naming (test (3.11)) renders expanded in both states.

Also fix(figures): carry alt_text into the template figure registry — the
template HTML renderer (require_record_alt) fails any render whose referenced
registry record lacks non-empty alt text; the registry writer omitted the
field, so template stage_03 failed with 5 'missing accessibility alt text'
render errors. Emit the registered alt_text on every record; update the pinned
registry-shape test.
output/ is gitignored, so the relative link exists only on machines that ran
the pipeline — the Folder documentation coverage gate fails on any clean
checkout (including CI) with "broken relative link: 'output/'". Keep the
row (it documents the generated tree) without the markdown link.
check_metrics_fresh.py proves METRICS.yaml freshness by walking ancestry from
generator_git_sha to HEAD. actions/checkout's default depth-1 clone cannot
walk ancestry on the PR merge ref, so the Metrics-freshness gate failed with
'not an ancestor of HEAD' even on an in-sync tree (latent defect: the step was
never reached on earlier runs because ruff format failed first). Give the lint
job's checkout fetch-depth: 0.
The degraded-output allow rule covered README/TODO/manuscript/scripts/tools
prose but not the root ISA.md and REVIEW_LOG_*.md narratives, whose
'fallback contract tests' / 'silent-fallback paths' mentions describe audited
behavior — leaving 2 unclassified occurrences and failing the strict gate.
Extend the existing rule to those root docs.
…an checkouts

--strict also validates generated public artifacts (output/manuscript/,
matrix provenance sidecars) that only exist after a pipeline run, so the
lint job could never pass on a fresh checkout (latent defect: every earlier
run died at the ruff-format step before reaching it). CI enforces the
classification layer; the full --strict lane stays in tools/release_gate.py
on a rendered worktree, per its design.
audit_release_integrity --check-wheel-reproducibility shells out to 'uv build'
to verify wheel reproducibility, but the clean-wheel job never installed uv
(latent defect: the job is needs: lint and lint had never been green until
now). Add the standard setup-uv step.
The release-integrity audit's OpenAPI contract check imports cogant.api from
the job environment, but the clean-wheel job installs the wheel into a
/sys.path target — so the check failed with ModuleNotFoundError: cogant
(latent defect: this job is needs: lint and lint never was green until now).
Point PYTHONPATH at /tmp/cogant-wheel-install so the contract is validated
against the wheel under test.
@docxology
docxology merged commit 7ea746f into main Sep 10, 2026
11 checks passed
@docxology
docxology deleted the ci/fix-lint-precommit-matrix branch September 10, 2026 19:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant