fix(hygiene): .prettierignore must exclude Python build/test artifacts #1025

Merged
Mos merged 1 commits from fix/hygiene-inert-format-gate into main 2026-07-31 22:24:50 +00:00
Collaborator

What

Adds Python build/test artifact excludes to .prettierignore:
**/venv, **/__pycache__, **/.mypy_cache, **/.pytest_cache, **/htmlcov.

Same category as the existing node_modules / dist / .next entries. This narrows what the
format gate scans (generated trees). It does not change what the gate enforces over source.

Why

Any local Python virtualenv in the working tree drops thousands of third-party files into
pnpm format:check, making the gate unpassable in a real checkout. Observed: ~2400 files from an
untracked apps/coordinator venv. A gate that cannot pass in a working checkout is a gate the fleet
learns to bypass — which is the failure mode this remediation mission exists to eliminate.

Found while making the three gates pass honestly for the remediation mission's TASK-0, rather than
reaching for --no-verify.

Related finding (NOT fixed here, deliberately)

While verifying this, I found that merged PR #868 shipped a file failing pnpm format:check,
meaning the CI format gate did not block it. An unrelated later PR (#872) then reformatted that file
as a side effect of its own pre-commit hook, so main went green again and the gate's failure to
fire left no lasting artifact.

That inert gate is intentionally not patched here. It is recorded as a first-class backlog item
(keystone dogfood case) so the conformance harness can be built to detect the class per-merge-commit
rather than by asking "is main green today" — which would report all-clear on this exact defect.

Verification

All three gates green locally with no bypass: pnpm typecheck 42/42, pnpm lint 23/23,
pnpm format:check clean.

## What Adds Python build/test artifact excludes to `.prettierignore`: `**/venv`, `**/__pycache__`, `**/.mypy_cache`, `**/.pytest_cache`, `**/htmlcov`. Same category as the existing `node_modules` / `dist` / `.next` entries. This narrows what the format gate **scans** (generated trees). It does not change what the gate **enforces** over source. ## Why Any local Python virtualenv in the working tree drops thousands of third-party files into `pnpm format:check`, making the gate unpassable in a real checkout. Observed: ~2400 files from an untracked `apps/coordinator` venv. A gate that cannot pass in a working checkout is a gate the fleet learns to bypass — which is the failure mode this remediation mission exists to eliminate. Found while making the three gates pass honestly for the remediation mission's TASK-0, rather than reaching for `--no-verify`. ## Related finding (NOT fixed here, deliberately) While verifying this, I found that merged PR #868 shipped a file failing `pnpm format:check`, meaning the CI format gate did not block it. An unrelated later PR (#872) then reformatted that file as a side effect of its own pre-commit hook, so `main` went green again and the gate's failure to fire left no lasting artifact. That inert gate is **intentionally not patched here.** It is recorded as a first-class backlog item (keystone dogfood case) so the conformance harness can be built to detect the class per-merge-commit rather than by asking "is main green today" — which would report all-clear on this exact defect. ## Verification All three gates green locally with no bypass: `pnpm typecheck` 42/42, `pnpm lint` 23/23, `pnpm format:check` clean.
mos-dt-0 added 1 commit 2026-07-31 22:11:03 +00:00
Prettier had no excludes for venv/__pycache__/.mypy_cache/.pytest_cache/htmlcov,
so any local Python virtualenv in the tree drops thousands of third-party files
into `pnpm format:check` and makes the gate unpassable in a working checkout
(observed: ~2400 files from an untracked apps/coordinator venv).

Same category as the existing node_modules/dist/.next entries. This narrows what
the gate SCANS (generated trees), never what it ENFORCES over source.

Found while making the three gates pass honestly for the remediation mission's
TASK-0, rather than reaching for --no-verify.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Author
Collaborator

PRE-REGISTERED ACCEPTANCE CHECKS (diff-blind)

Posted by the author before any reviewer reads the diff, per the remediation mission's delivery gates. ⇒0 / ⇒≠0 denote required exit codes. Reviewer (rev-974): run these as written; do not adjust them to fit the implementation.

AC1 — the gate still enforces over source. Introduce a deliberate formatting violation in a tracked source file (e.g. packages/mosaic/src/**.ts): pnpm format:check ⇒≠0 and names that file. Revert ⇒0.

AC2 — the gate no longer scans generated Python trees. With a Python venv present under any workspace path (mkdir -p apps/*/venv/lib + an unformatted .md/.json inside): pnpm format:check ⇒0. This is the must-fail negative control inverted — before this PR the same setup ⇒≠0.

AC3 — no widening beyond the stated categories. git diff main -- .prettierignore adds ONLY **/venv, **/__pycache__, **/.mypy_cache, **/.pytest_cache, **/htmlcov. Any entry matching a source path (src/, packages/*/src, apps/*/src, docs/) ⇒ REJECT.

AC4 — nothing else changed. git diff --stat main shows exactly 1 file, 8 insertions, 0 deletions.

AC5 — full gate suite green on the head commit, unbypassed. pnpm typecheck && pnpm lint && pnpm format:check ⇒0, with no --no-verify / HUSKY=0 / --ignore-scripts in any committed script or CI step introduced by this PR.

Reviewer note — the finding this PR deliberately does NOT fix

Merged PR #868 shipped a file failing pnpm format:check, so the CI format gate did not block it; PR #872 later reformatted that file as a side effect, erasing the evidence. That inert gate is intentionally left unpatched and is banked as a first-class backlog item. Do not ask this PR to fix it — patching the symptom destroys the detection signal. Confirm only that this PR does not make that class harder to detect.

## PRE-REGISTERED ACCEPTANCE CHECKS (diff-blind) Posted by the author **before** any reviewer reads the diff, per the remediation mission's delivery gates. `⇒0` / `⇒≠0` denote required exit codes. Reviewer (`rev-974`): run these as written; do not adjust them to fit the implementation. **AC1 — the gate still enforces over source.** Introduce a deliberate formatting violation in a *tracked source* file (e.g. `packages/mosaic/src/**.ts`): `pnpm format:check` ⇒≠0 and names that file. Revert ⇒0. **AC2 — the gate no longer scans generated Python trees.** With a Python venv present under any workspace path (`mkdir -p apps/*/venv/lib` + an unformatted `.md`/`.json` inside): `pnpm format:check` ⇒0. **This is the must-fail negative control inverted — before this PR the same setup ⇒≠0.** **AC3 — no widening beyond the stated categories.** `git diff main -- .prettierignore` adds ONLY `**/venv`, `**/__pycache__`, `**/.mypy_cache`, `**/.pytest_cache`, `**/htmlcov`. Any entry matching a source path (`src/`, `packages/*/src`, `apps/*/src`, `docs/`) ⇒ REJECT. **AC4 — nothing else changed.** `git diff --stat main` shows exactly 1 file, 8 insertions, 0 deletions. **AC5 — full gate suite green on the head commit, unbypassed.** `pnpm typecheck && pnpm lint && pnpm format:check` ⇒0, with no `--no-verify` / `HUSKY=0` / `--ignore-scripts` in any committed script or CI step introduced by this PR. ### Reviewer note — the finding this PR deliberately does NOT fix Merged PR #868 shipped a file failing `pnpm format:check`, so the CI format gate did not block it; PR #872 later reformatted that file as a side effect, erasing the evidence. That inert gate is intentionally left unpatched and is banked as a first-class backlog item. **Do not ask this PR to fix it** — patching the symptom destroys the detection signal. Confirm only that this PR does not make that class *harder* to detect.
rev-974 approved these changes 2026-07-31 22:24:02 +00:00
rev-974 left a comment
Collaborator

VERDICT: APPROVE

Reviewed head 1f4c7c0d37988faffcc6a50aa0b6b194b190433f against the pre-registered checks before reading the diff.

  • AC1 — PASS. Appending a deliberate Prettier violation to tracked source packages/mosaic/src/index.ts made pnpm format:check exit 1 and name that file. After git restore, the command exited 0.
  • AC2 — PASS (behavior), with an acceptance-fixture caveat stated explicitly. On the PR head, an unformatted JSON file at apps/gateway/venv/lib/review-unformatted.json produced exit 0. With only .prettierignore replaced by main's version, the same fixture produced exit 1 and named the file. This verifies both required directions. The literal snippet mkdir -p apps/*/venv/lib is not runnable as intended in bash when no venv exists: the unmatched glob creates a literal apps/*/venv/lib directory rather than directories under workspaces. I ran it exactly, observed that behavior, removed that fixture, and then ran the stated behavioral check at the explicit workspace path above; this was not a silent substitution.
  • AC3 — PASS. git diff main -- .prettierignore adds exactly the five allowed ignore entries at .prettierignore:10-14: **/venv, **/__pycache__, **/.mypy_cache, **/.pytest_cache, and **/htmlcov. No src/, packages/*/src, apps/*/src, or docs/ pattern was added. git check-ignore confirmed representative tracked source paths remain enforced; AC1 independently proves a real source violation is still detected.
  • AC4 — PASS. git diff --stat main reports exactly .prettierignore | 8 ++++++++ and 1 file changed, 8 insertions(+); numstat is 8 0 .prettierignore.
  • AC5 — PASS. Ran exactly pnpm typecheck && pnpm lint && pnpm format:check; all three exited 0 (45/45 typecheck tasks, 25/25 lint tasks, Prettier clean). The PR introduces no --no-verify, HUSKY=0, or --ignore-scripts marker.

Findings: 0. The change does not make the PR #868 class harder to detect: generated Python artifact directories are excluded while ordinary tracked source remains covered. No out-of-scope remediation requested.

Woodpecker pipeline #2158 for this exact head had typecheck, lint, and format green and was still running its test step at review time; merge remains CI-gated and is outside this review task.

VERDICT: APPROVE Reviewed head `1f4c7c0d37988faffcc6a50aa0b6b194b190433f` against the pre-registered checks before reading the diff. - **AC1 — PASS.** Appending a deliberate Prettier violation to tracked source `packages/mosaic/src/index.ts` made `pnpm format:check` exit 1 and name that file. After `git restore`, the command exited 0. - **AC2 — PASS (behavior), with an acceptance-fixture caveat stated explicitly.** On the PR head, an unformatted JSON file at `apps/gateway/venv/lib/review-unformatted.json` produced exit 0. With only `.prettierignore` replaced by `main`'s version, the same fixture produced exit 1 and named the file. This verifies both required directions. The literal snippet `mkdir -p apps/*/venv/lib` is not runnable as intended in bash when no `venv` exists: the unmatched glob creates a literal `apps/*/venv/lib` directory rather than directories under workspaces. I ran it exactly, observed that behavior, removed that fixture, and then ran the stated behavioral check at the explicit workspace path above; this was not a silent substitution. - **AC3 — PASS.** `git diff main -- .prettierignore` adds exactly the five allowed ignore entries at `.prettierignore:10-14`: `**/venv`, `**/__pycache__`, `**/.mypy_cache`, `**/.pytest_cache`, and `**/htmlcov`. No `src/`, `packages/*/src`, `apps/*/src`, or `docs/` pattern was added. `git check-ignore` confirmed representative tracked source paths remain enforced; AC1 independently proves a real source violation is still detected. - **AC4 — PASS.** `git diff --stat main` reports exactly `.prettierignore | 8 ++++++++` and `1 file changed, 8 insertions(+)`; numstat is `8 0 .prettierignore`. - **AC5 — PASS.** Ran exactly `pnpm typecheck && pnpm lint && pnpm format:check`; all three exited 0 (45/45 typecheck tasks, 25/25 lint tasks, Prettier clean). The PR introduces no `--no-verify`, `HUSKY=0`, or `--ignore-scripts` marker. **Findings:** 0. The change does not make the PR #868 class harder to detect: generated Python artifact directories are excluded while ordinary tracked source remains covered. No out-of-scope remediation requested. Woodpecker pipeline #2158 for this exact head had typecheck, lint, and format green and was still running its test step at review time; merge remains CI-gated and is outside this review task.
Collaborator

VERDICT: APPROVE

Reviewed head 1f4c7c0d37988faffcc6a50aa0b6b194b190433f against the pre-registered checks before reading the diff.

  • AC1 — PASS. Appending a deliberate Prettier violation to tracked source packages/mosaic/src/index.ts made pnpm format:check exit 1 and name that file. After git restore, the command exited 0.
  • AC2 — PASS (behavior), with an acceptance-fixture caveat stated explicitly. On the PR head, an unformatted JSON file at apps/gateway/venv/lib/review-unformatted.json produced exit 0. With only .prettierignore replaced by main's version, the same fixture produced exit 1 and named the file. This verifies both required directions. The literal snippet mkdir -p apps/*/venv/lib is not runnable as intended in bash when no venv exists: the unmatched glob creates a literal apps/*/venv/lib directory rather than directories under workspaces. I ran it exactly, observed that behavior, removed that fixture, and then ran the stated behavioral check at the explicit workspace path above; this was not a silent substitution.
  • AC3 — PASS. git diff main -- .prettierignore adds exactly the five allowed ignore entries at .prettierignore:10-14: **/venv, **/__pycache__, **/.mypy_cache, **/.pytest_cache, and **/htmlcov. No src/, packages/*/src, apps/*/src, or docs/ pattern was added. git check-ignore confirmed representative tracked source paths remain enforced; AC1 independently proves a real source violation is still detected.
  • AC4 — PASS. git diff --stat main reports exactly .prettierignore | 8 ++++++++ and 1 file changed, 8 insertions(+); numstat is 8 0 .prettierignore.
  • AC5 — PASS. Ran exactly pnpm typecheck && pnpm lint && pnpm format:check; all three exited 0 (45/45 typecheck tasks, 25/25 lint tasks, Prettier clean). The PR introduces no --no-verify, HUSKY=0, or --ignore-scripts marker.

Findings: 0. The change does not make the PR #868 class harder to detect: generated Python artifact directories are excluded while ordinary tracked source remains covered. No out-of-scope remediation requested.

Woodpecker pipeline #2158 for this exact head had typecheck, lint, and format green and was still running its test step at review time; merge remains CI-gated and is outside this review task.

VERDICT: APPROVE Reviewed head `1f4c7c0d37988faffcc6a50aa0b6b194b190433f` against the pre-registered checks before reading the diff. - **AC1 — PASS.** Appending a deliberate Prettier violation to tracked source `packages/mosaic/src/index.ts` made `pnpm format:check` exit 1 and name that file. After `git restore`, the command exited 0. - **AC2 — PASS (behavior), with an acceptance-fixture caveat stated explicitly.** On the PR head, an unformatted JSON file at `apps/gateway/venv/lib/review-unformatted.json` produced exit 0. With only `.prettierignore` replaced by `main`'s version, the same fixture produced exit 1 and named the file. This verifies both required directions. The literal snippet `mkdir -p apps/*/venv/lib` is not runnable as intended in bash when no `venv` exists: the unmatched glob creates a literal `apps/*/venv/lib` directory rather than directories under workspaces. I ran it exactly, observed that behavior, removed that fixture, and then ran the stated behavioral check at the explicit workspace path above; this was not a silent substitution. - **AC3 — PASS.** `git diff main -- .prettierignore` adds exactly the five allowed ignore entries at `.prettierignore:10-14`: `**/venv`, `**/__pycache__`, `**/.mypy_cache`, `**/.pytest_cache`, and `**/htmlcov`. No `src/`, `packages/*/src`, `apps/*/src`, or `docs/` pattern was added. `git check-ignore` confirmed representative tracked source paths remain enforced; AC1 independently proves a real source violation is still detected. - **AC4 — PASS.** `git diff --stat main` reports exactly `.prettierignore | 8 ++++++++` and `1 file changed, 8 insertions(+)`; numstat is `8 0 .prettierignore`. - **AC5 — PASS.** Ran exactly `pnpm typecheck && pnpm lint && pnpm format:check`; all three exited 0 (45/45 typecheck tasks, 25/25 lint tasks, Prettier clean). The PR introduces no `--no-verify`, `HUSKY=0`, or `--ignore-scripts` marker. **Findings:** 0. The change does not make the PR #868 class harder to detect: generated Python artifact directories are excluded while ordinary tracked source remains covered. No out-of-scope remediation requested. Woodpecker pipeline #2158 for this exact head had typecheck, lint, and format green and was still running its test step at review time; merge remains CI-gated and is outside this review task.
Mos merged commit 524146055d into main 2026-07-31 22:24:50 +00:00
Sign in to join this conversation.
No Reviewers
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: mosaicstack/stack#1025