Skip to content

chore(ci): green the lint, typecheck, and test jobs - #33

Merged
rlemke merged 2 commits into
mainfrom
chore/ci-health
Aug 2, 2026
Merged

chore(ci): green the lint, typecheck, and test jobs#33
rlemke merged 2 commits into
mainfrom
chore/ci-health

Conversation

@rlemke

@rlemke rlemke commented Aug 2, 2026

Copy link
Copy Markdown
Owner

main's CI is red across all three quality gates. This PR gets them green. No behavior changes beyond one latent-bug removal (noted below).

lint (ruff)

  • ruff format . — reformats the 36 drifted files to project style.
  • ruff check . fixes: import sorting (I001), unused imports (F401), a missing StepStmt import in validator.py (F821), re.split(…, maxsplit=1) (B034), raise … from e (B904), percent→f-string (UP031/UP032), an unused test local (F841).

typecheck (mypy) — 17 errors → 0

Mostly stale/missing annotations. Notable:

  • after_migrator.py: the rewrites tuple annotation was stale (data grew a 5th element, masked by a # type: ignore); corrected it and narrowed a SourceLocation | None before .line.
  • registry_runner.py: removed a call to _update_handled_stats — a RunnerService-only method (RegistryRunner has no _handled_counts). It would AttributeError if that resume-completion path were reached. The lighter RegistryRunner simply doesn't record handled stats. (The one real latent-bug fix.)
  • mapserver.py: # type: ignore[attr-defined] on dynamically-set server attrs (matches the existing write-site pattern).

test

  • Removed examples/osm-equity/tests/__init__.py — the only example tests dir with one; it collides with the top-level tests package and interrupted collection (ModuleNotFoundError: No module named 'tests.conftest'), silently excluding osm-equity's tests since Jul 16.
  • With collection restored, osm-equity's tests need scipy (an optional example dep CI doesn't install) → pytest.importorskip("scipy"/"numpy") so they skip cleanly, matching other optional-dep example tests.

Verification (local)

  • ruff format --check . → clean · ruff check . → clean · mypy facetwork/0 errors · pytest --collect-only0 collection errors
  • Touched suites pass: tests/runtime/ + test_after_migrator + test_validator = 1536 passed.

Pairs with #32 (dispatcher cache-key fix); merging both greens main.

🤖 Generated with Claude Code

main's CI was red across all three quality gates. This gets them green.

lint (ruff):
- `ruff format .` — reformat the 36 drifted files to the project style.
- `ruff check .` fixes: import sorting (I001), unused imports (F401), the
  missing StepStmt import in validator.py (F821), `re.split(..., maxsplit=1)`
  (B034), `raise … from e` (B904), percent→f-string (UP031/UP032), and an
  unused test local (F841).

typecheck (mypy) — 17 errors → 0:
- validator.py: import StepStmt; int() of a validated integer literal.
- runtime/base_runner.py: annotate _provided_envs_cache as `list[Any] | None`.
- runtime/evaluator.py: drop a redundant re-annotation (no-redef).
- runtime/handlers/block_execution.py: annotate get_param results as Any
  (int cap + list of loop values).
- migration/after_migrator.py: correct the stale rewrites tuple annotation
  (it grew a 5th element); narrow a SourceLocation|None before .line.
- runtime/registry_runner.py: drop a call to `_update_handled_stats`, which is
  a RunnerService-only method (RegistryRunner has no _handled_counts) — it would
  AttributeError if that resume-completion path were reached. The lighter
  RegistryRunner simply doesn't record handled stats.
- mapserver.py: type: ignore[attr-defined] on the dynamically-set server attrs.

test:
- Remove examples/osm-equity/tests/__init__.py — the only example tests package
  with one; it collides with the top-level `tests` package and interrupted
  collection (ModuleNotFoundError: No module named 'tests.conftest'), which had
  silently excluded osm-equity's tests since Jul 16.
- With collection restored, osm-equity's tests need scipy (an optional example
  dep CI doesn't install) — `pytest.importorskip("scipy"/"numpy")` so they skip
  cleanly, matching how other optional-dep example tests behave.

Local: `ruff format --check .` clean, `ruff check .` clean, `mypy facetwork/`
0 errors, `pytest --collect-only` 0 collection errors; touched suites pass
(tests/runtime + after_migrator + validator: 1536 passed).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@gemini-code-assist

Copy link
Copy Markdown

Caution

The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased.

Root cause of main going red with no code change: the lint/typecheck jobs ran
`pip install ruff` / `pip install mypy` UNPINNED, so a new ruff release (0.16.1)
started formatting 25 files differently and the job failed `ruff format --check`.

- Pin ruff==0.16.1 and mypy==2.3.0 in CI so a future release can't silently break
  a green main.
- Reformat the 25 files the pinned ruff wants (formatting only).

Verified with the pinned versions: `ruff format --check .` clean, `ruff check .`
clean, `mypy facetwork/` 0 errors.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@rlemke

rlemke commented Aug 2, 2026

Copy link
Copy Markdown
Owner Author

Ready to land — the remaining red checks are pre-existing, now tracked

This PR greened lint and let the full suite run for the first time since Jul 16 (the collection interrupt had hidden everything). Result: 3616 passed, 43 skipped, coverage 77.06% (≥75%).

The only remaining failures both trace to two pre-existing root causes, filed separately:

Neither is introduced by this PR; both are on main today. This PR is a strict improvement (lint green, collection restored, coverage measured, one latent runtime bug removed). Recommend merging and addressing #34/#35 separately.

@rlemke
rlemke merged commit c67447b into main Aug 2, 2026
17 of 22 checks passed
rlemke added a commit that referenced this pull request Aug 2, 2026
The `[mcp]` extra was `mcp>=1.0` (unpinned). mcp 2.0.0 shipped a breaking API
change — `Tool.inputSchema` -> `Tool.input_schema` and dropped `Server.list_tools`
— both of which facetwork/mcp/server.py uses. A fresh CI resolver (Python 3.11,
full extras) pulled 2.0.0, producing 41 mypy errors in server.py (the typecheck
job) and an AttributeError in tests/mcp/test_server.py. (A 3.12 dev box with 1.27.2
cached masked it locally.)

Cap at <2 until server.py is ported to the 2.0 API. Verified in a clean Python
3.11 full-extras venv: with the cap, mcp resolves to 1.29.0, `mypy facetwork/` is
0 errors, and tests/mcp passes (160 tests). Same unpinned-dependency class as the
ruff/mypy pins in #33.

Fixes #34.

Co-authored-by: Claude Opus 4.8 (1M context) <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