fix: restore master to green (ruff + mypy debt from the loop) - #69
Merged
Conversation
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
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.