Commit Graph
4 Commits
Author SHA1 Message Date
timothy a706784881 fix(780): lint an explicit git population — discovery-based ruff was defeatable in three ways
Re-review of the previous fix commit found the population guard did not close the
vacuity it was added for. `ruff check . --show-files` reports DISCOVERY, and an
`exclude` defeats discovery in three config scopes — including `[format]`, which
is where an appended line lands by TOML rules. Measured with 0.12.11 against a
tracked file holding an unused import, a hardcoded credential and a formatting
error (GREEN = gate silently off):

  exclude in        check .   explicit   format --check .   explicit
  top level         GREEN     red        GREEN              red
  [lint]            GREEN     red        red                red
  [format]          red       red        GREEN              red
  + force-exclude   -         GREEN      -                  red with --no-force-exclude

So both steps now pass an explicit population from
`git ls-files -z '*.py' '*.pyi' '*.ipynb'` with `--no-force-exclude`, guarded by
an empty-list arm. All five mutants above are detected; an empty population
errors. This also fixes the count-comparison's three defects in one move: it
covers `.pyi` (which the old `git ls-files '*.py'` miscounted into a false red),
tracked-but-gitignored files (a permanent false red — `git add -f` under an
ignored path is established practice here), and compensating drift that a count
comparison nets to zero.

RUF100 is now selected. The previous commit added a `# noqa: UP031` to a site the
FIRST commit had already fixed in code — a suppression suppressing nothing, in a
change whose whole premise is that suppressions must stay honest — and two more
had been dead in the tree for months. All three removed. The split is 55 fixed in
code / 17 suppressed, not 54/18.

The `git` half of `Preflight external tools` moves back ahead of the lint steps,
which now consume `git`: without it a missing git kills the step at the population
assignment under `-e`, and the step's own `::error::` never prints. The orphaned
pytest/PyYAML rationale comment goes back onto its own step.

Docs: the record's mutation paragraph called the `[format]` exclude a
mutation-construction pitfall when it was a live coverage hole — it now carries the
measured matrix instead; `mechanics:` frontmatter rewritten; "all eight S105 hits"
scoped (there are nine in the tree, one pre-existing); the defect-shapes
reproduction block now actually runs (`mkdir -p`, `;` not `&&`, a sha not `main`,
not /tmp).

Refs: #780
Decisions-Edit: yes
2026-08-21 23:44:54 +02:00
timothy 85ecd352f4 fix(780): address cold review — narrow S105, guard the population, fix the doc claims
Cold review (Opus, isolated worktree) cleared the mechanical reformat: 25 of 33
files AST-identical, the suite's collected node IDs identical to main, and the
three percent-format -> f-string conversions byte-equivalent at both call sites.
Everything below is config/CI/doc layer.

M4: `S105` is no longer exempted directory-wide. A blanket over `scripts/tests/**`
gives up hardcoded-credential coverage over the largest Python surface in the repo
— permanently, and this is the only Python lint we run — to suppress 8 known
lines. Those 8 now carry a per-site `# noqa: S105`; removing one is red
(witnessed). Only `S101` stays directory-wide.

M1: `ruff check .` on an empty population prints a stderr warning and exits 0, so
a stray `exclude` would switch the gate off silently — the vacuity failure
`testing.guard-derives-population-from-source` is about. The step now compares
`--show-files` against `git ls-files '*.py'` and fails on drift. Mutation proof:
a top-level `exclude = ["scripts"]` takes `ruff check` to green and the step to
`::error::… 0 Python files but git tracks 33`. Note the same exclude under
`[format]` does NOT reproduce it — it scopes to the formatter, and a mutation
written that way passes while proving nothing.

M3: lint moved ahead of the preflights. Behind `Preflight jq version` (a hard
`--expect` tripwire) the lint would go dark for as long as the jq contract is
broken, under a red that names jq.

H3: ruff.toml named a `Script lint (ruff)` job that does not exist — wrong on the
day it shipped.

H1: the "72 errors" claim is now reproducible against the committed config (it was
only true of the pre-M4 config), carries its reproduction command and base sha, and
splits honestly: 54 fixed in code, 18 per-site `# noqa`s.

H2: `docs/ci-cd.md` still said the suite is ~190 tests / ~10s next to a new
"four-minute" figure. Measured: 773 tests, ~4.5 min. The no-path-filter rationale
rested on the dead number; it now rests on the input set, which is the real reason.

M2: the nine E501 `# noqa`s claimed splitting "would change the payload". Implicit
string concatenation preserves the bytes exactly, so the stated reason was false
nine times. They say what is actually true: kept one-line for greppability.

Nits: the record no longer claims the config is identical to the operator's global
one (per-file-ignores differ), and the unpinned pytest/pyyaml asymmetry is stated
rather than left looking like an oversight.

Refs: #780
Decisions-Edit: yes
2026-08-21 23:12:38 +02:00
timothy 18b2a46beb feat(780): commit a ruff config and enforce it in CI
Python lint here was a property of the operator's laptop, not of the repo: the
global instructions say to run `ruff check`/`ruff format --check`/`pyright`, no
workflow or hook ran any of them, and with no committed config ruff fell back to
whichever `~/.config/ruff/ruff.toml` the machine happened to have. A second
machine lints this repo differently, or not at all — Family E in
docs/defect-shapes-773.md, in our own toolchain.

Option 1 from the issue:

- `ruff.toml` at the root (the operator's global settings, pinned here — that is
  what the tree was de-facto written against, so adopting it cost a mechanical
  reformat rather than a rewrite).
- The `script-tests` job installs a PINNED `ruff==0.12.11` and runs
  `ruff check .` + `ruff format --check .` before pytest, so a style red arrives
  in seconds instead of after the four-minute suite. The pin is the second half
  of the fix: an unpinned install re-introduces the same divergence one layer up.
  Renamed the job to `Script lint and tests (ruff + pytest)` so a lint red is not
  triaged under a name that says pytest.
- Tree made clean: 72 errors and 20 files needing reformatting. Everything fixed
  except two config-level exemptions with reasons in the config (`S101`, `S105`
  under `scripts/tests/**` — the stub credentials that fire `S105` have no true
  positive anywhere in the tree) and two per-site `# noqa`s that carry their
  reason inline.

`pyright` stays ungated: its only findings are `reportMissingImports` for
`etv_client` in scripts/scripted-schedules/entrypoint.py, resolvable only in that
script's deploy environment, and gating it would put a node toolchain on the
git-only `small` lane to find nothing.

Population is what `ruff check .` discovers from the root, so a new `.py`
anywhere is covered without the job enumerating anything.

Docs: new record `ci.python-lint-ruff-config-committed`, cross-ref from
`ci.script-tests-job`, `docs/ci-cd.md` script-tests section, and
`docs/defect-shapes-773.md` §5.2 marked resolved with the measured numbers.

Refs: #780
Decisions-Edit: yes
2026-08-21 22:47:22 +02:00
timothy 499dd348ab feat(776): every hook reports that it fired, and the report is measured (#795)
Build ErsatzTV Image / Delimiter ban (release path) (push) Successful in 25s
Build ErsatzTV Image / Build & test (.NET) (push) Successful in 9m14s
Build ErsatzTV Image / EF migration integrity (SQLite + MySql) (push) Successful in 6m37s
Build ErsatzTV Image / Functional E2E (curl + UI contracts) (push) Successful in 6m16s
Build ErsatzTV Image / API docs in sync (OpenAPI + endpoint index) (push) Skipped
Build ErsatzTV Image / Formatting (changed .cs conform to .editorconfig) (push) Skipped
Build ErsatzTV Image / Build & push image (amd64) (push) Successful in 4m19s
Co-authored-by: Timothy <timothy@noreply.gitea.tblindustries.be>
2026-08-14 19:11:05 +00:00