Skip to content

fix(ci): make lint + typecheck green on main#22

Merged
rlemke merged 1 commit into
mainfrom
fix/ci-lint-typecheck
Jul 13, 2026
Merged

fix(ci): make lint + typecheck green on main#22
rlemke merged 1 commit into
mainfrom
fix/ci-lint-typecheck

Conversation

@rlemke

@rlemke rlemke commented Jul 13, 2026

Copy link
Copy Markdown
Owner

Fixes the two pre-existing CI failures on main (they predate the thesis-docs PR #21 — that PR was docs-only and did not introduce them).

lint (ruff format --check / ruff check)

  • ruff format reformats 23 files left untouched by the earlier relative-scoping / BaseRunner work.
  • ruff check: one unused os import (docker/bake-domains.py), one import-sort (tests/runtime/test_relative_scoping.py), two C416 list-comprehensions (tests/test_relative_scope_migrator.py).

typecheck (mypy facetwork/, 8 errors in 5 files)

  • BaseRunnerConfig attrs (5 errors)BaseRunner declares _config: BaseRunnerConfig, which subclasses inherit, so mypy didn't see RunnerConfig.http_port / http_max_port_attempts / shutdown_timeout_ms and RegistryRunnerConfig.registry_refresh_interval_ms. Fixed by re-declaring the narrowed _config type in each subclass. These exist at runtime (the instance is the subclass) — a typing gap, not a runtime bug.
  • evaluator._find_statement_body — widened return to dict | list | None; it already returns the chained co-clause list, and callers take Any.
  • dashboard/auth.py — narrow presented with is not None for hmac.compare_digest (outcome-equivalent to the old bool(...) guard).
  • relative_scope_migrator.py — annotate _current_block_steps: set[str].

Verification

  • mypy facetwork/: 0 errors (157 files).
  • ruff format --check + ruff check: clean.
  • Touched-path tests green: 24 (migrator / scoping / auth) + 437 (runtime evaluator / runner / registry).

🤖 Generated with Claude Code

Two pre-existing CI failures (predating the thesis-docs PR), fixed:

- lint: `ruff format` reformats 23 files left untouched by the earlier
  relative-scoping / BaseRunner work; `ruff check` clears one unused
  import, an import-sort, and two C416 list-comprehensions.
- typecheck (mypy, 8 errors in 5 files):
  - Narrow the inherited `BaseRunner._config: BaseRunnerConfig` to the
    concrete `RunnerConfig` / `RegistryRunnerConfig` in each subclass, so
    their http-server / shutdown / registry-refresh fields type-check
    (they exist at runtime — the instance is the subclass; this was a
    typing gap, not a runtime bug).
  - Widen `_find_statement_body` return to `dict | list | None` (it
    already returns the chained co-clause list; callers take `Any`).
  - `auth.py`: narrow `presented` with `is not None` for
    `hmac.compare_digest` (outcome-equivalent to the old `bool(...)`).
  - Annotate `_current_block_steps: set[str]` in the migrator.

mypy: 0 errors (157 files). ruff format+check clean. Touched-path tests
green (24 migrator/scoping/auth + 437 runtime evaluator/runner/registry).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request primarily focuses on code formatting, style cleanups, and minor type annotation improvements across various files, such as narrowing the _config type in runner services and updating the return type of _find_statement_body. It also refines token validation in the authentication middleware by explicitly checking for None. The review feedback correctly points out an opportunity to improve file handling in tests/test_relative_scope_migrator.py by using a with statement and specifying an explicit encoding to prevent resource leaks and platform-dependent decoding errors.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment on lines +140 to +141
errs = list(validate(parse(res.source), relative_scoping=True).errors)
base = list(validate(parse(open(matches[0]).read()), relative_scoping=False).errors)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Opening a file using open() without a with statement leaves the file descriptor open until garbage collection, which can cause resource leaks. Additionally, reading files without specifying an explicit encoding (such as encoding='utf-8') can lead to platform-dependent UnicodeDecodeError issues (e.g., on Windows systems where the default encoding might not be UTF-8). Using a with statement and specifying the encoding is safer and more robust.

        errs = list(validate(parse(res.source), relative_scoping=True).errors)\n        with open(matches[0], encoding="utf-8") as f:\n            base = list(validate(parse(f.read()), relative_scoping=False).errors)

@rlemke rlemke merged commit 038afd9 into main Jul 13, 2026
22 checks passed
@rlemke rlemke deleted the fix/ci-lint-typecheck branch July 13, 2026 23:24
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