Skip to content

fix: restore master to green (ruff + mypy debt from the loop) - #69

Merged
rslayer merged 3 commits into
masterfrom
fix/restore-ci-green
Jul 22, 2026
Merged

fix: restore master to green (ruff + mypy debt from the loop)#69
rslayer merged 3 commits into
masterfrom
fix/restore-ci-green

Conversation

@rslayer

@rslayer rslayer commented Jul 22, 2026

Copy link
Copy Markdown
Owner

Restores the two CI gates the Auto-SDLC loop keeps leaving red. Loop eval runs only pytest; CI also runs ruff+mypy, so lint/type debt lands on master every cycle. Current: 9 ruff + 4 mypy (its 202 tests pass). ruff --fix (8) + justified noqa (N818) + a mypy-narrowing assert on a provably-non-None value. Fully green locally. Stopgap — see analysis for the root-cause loop-gate fix.

rslayer and others added 3 commits July 22, 2026 00:08
The Auto-SDLC loop's regression gate runs only pytest (loop.yml eval), while CI
also runs `ruff check bhulan/ scripts/ tests/` + `mypy bhulan/`. So the loop
commits lint/type-dirty code straight to master and CI goes red every cycle.
Current debt: 9 ruff + 4 mypy errors. Its tests all pass (202) — only the extra
gates were broken.

- ruff: 8 auto-fixable (I001 import-sort, F401 unused pytest) via `ruff --fix`;
  N818 on StopScanBudgetExceeded suppressed with a justified noqa (the name is
  clear; renaming would churn 5 call sites).
- mypy: stops.py:375-380 dereferenced `prev_original: Optional[Stop]`. It is set
  on the first loop iteration and only read once `groups` is non-empty, so it's
  never None there — added an `assert` that documents the invariant and narrows
  the type. No runtime behaviour change.

Stopgap: this greens master now, but the loop will re-introduce the debt next
cycle until its eval gate also runs ruff+mypy (or it commits via PR). See the
analysis notes for that root-cause fix.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The loop added InsightsOptions.progressive_drift_fraction (71b2463) without
regenerating the schema snapshot, so CI's openapi-drift check failed on master —
a third CI gate (besides ruff+mypy) the loop's eval doesn't run.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Frontend gen:api:check regenerates TS types from openapi.json; updating the
schema for progressive_drift_fraction left api.gen.ts stale. (On master both
were stale-but-consistent, so it passed there.)

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@rslayer
rslayer merged commit cf488fe into master Jul 22, 2026
2 checks passed
@rslayer
rslayer deleted the fix/restore-ci-green branch July 22, 2026 05:18
rslayer added a commit that referenced this pull request Jul 22, 2026
#71)

Root cause of the recurring red master: the loop's EVAL is pytest-only, but
ci.yml (which runs on the loop's PR) also enforces ruff, mypy, an openapi.json
drift check, and the frontend gen:api:check. The build agent's Python-only
runner can't even regenerate the frontend types. So every cycle's PR is red on
those extra gates, and merging it reddens master (cleaned up manually in #69,
and again this round).

Close the gap at the source:
- Add a Node 20 setup step (needed to regenerate web/src/lib/api.gen.ts).
- Add a "CI parity" step after BUILD that deterministically fixes the MECHANICAL
  gates: `ruff --fix` (import order / unused), regenerate openapi.json, and
  regenerate the frontend API types. Non-fatal by design (the loop must still
  open a PR for review); anything left red is surfaced as a ::warning and by
  ci.yml on the PR itself. Placed before EVAL and the product-snapshot so the
  changes are part of the reviewed cycle.
- Add a HARD RULE to the build prompt: run ruff + mypy and fix real errors, and
  regenerate openapi.json on model changes (mypy/non-autofix lint can't be fixed
  mechanically).

NOTE: workflow_dispatch workflows can't be run from here, so this is
static/YAML-validated only. Review and do one test dispatch before relying on
it — hence left as a PR, not merged.

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
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