fix(ci): green the pipeline (ruff, mypy, test isolation)#7
Merged
Conversation
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
- cli.py: dict[str, Any] / list[dict[str, Any]] on run-summary helpers - notify/dispatch.py: type payload as resend SendParams; treat send() response as Any (stub is a TypedDict but code/tests use attribute access) - cutover_wipe.py: type db as Any (duck-typed Arango connection); drop now-redundant type: ignore[union-attr]; annotate row - ingest/google_auth.py: call untyped impersonated_credentials.Credentials via Any alias to avoid spurious no-untyped-call Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Root cause: importing litellm (transitively, via ingest.extractor) calls dotenv.load_dotenv() at import time, pushing a repo-root .env's STORAGE_BACKEND=gcs into os.environ during pytest collection — before any fixture runs. test_settings_default_dev then saw gcs in the full suite but local in isolation. The existing _disable_dotenv_loading only patches pydantic-settings' env_file; it can't undo what litellm already injected. Fix extends the existing scrub pattern: add a session-scope autouse _scrub_config_env fixture that deletes ALL Settings/NotifySettings env-var names (secret + non-secret) at session start, restoring the documented 'no creds, no config' baseline regardless of .env. Integration/live-LLM runs keep their .env-sourced config (same bypass as _disable_dotenv_loading). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
- tests: add 'pragma: allowlist secret' to fake test fixtures (re_test_key, user:secret@cluster.example) — clear false positives - ci.yml: scope detect-secrets scan to exclude .planning/ design docs, which reference env-var NAMES and fake placeholders the keyword heuristic flags as false positives. Shipped code (src/tests/infra/ dashboard/scripts) remains fully scanned. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
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.
Summary
CI (
.github/workflows/ci.yml) has been red since June 9. This branch fixes all five steps so the pipeline passes end-to-end.What changed (commit by commit)
style(ci): ruff check --fix and ruff format— auto-fixed unused imports (call,pytest) and import-block ordering in Phase 7 test files; reformatted 14 files.fix(ci): add proper type annotations for mypy strict(24 errors → 0):cli.py: baredict/list[dict]→dict[str, Any]/list[dict[str, Any]]on the run-summary helpers.notify/dispatch.py: typed the Resend payload asresend.Emails.SendParams; typed thesend()result asAny(the stub models it as a TypedDict, but the code and its tests consume it by attribute —result.id).cutover_wipe.py: typeddbasAny(duck-typed Arango connection, matchingcli.py), dropped the now-redundant# type: ignore[union-attr]comments, annotatedrow.ingest/google_auth.py: call the untypedimpersonated_credentials.Credentialsvia anAnyalias to avoid a spuriousno-untyped-call.# type: ignoresuppressions of real issues; mypy config untouched.test(ci): fix env-leak isolation for STORAGE_BACKEND from .env—test_settings_default_devpassed in isolation but failed in the full suite. Root cause: importinglitellm(transitively viaingest.extractor) callsdotenv.load_dotenv()at import time, injecting a repo-root.env'sSTORAGE_BACKEND=gcsintoos.environduring pytest collection — before any fixture runs. The existing_disable_dotenv_loadingonly patches pydantic-settings'env_file, so it can't undo that. Fix extends the existing scrub pattern with a session-scope autouse_scrub_config_envfixture that deletes every Settings/NotifySettings env-var name (secret + non-secret) at session start, restoring the documented "no creds, no config" baseline. Integration/live-LLM runs keep their.env(same bypass as the dotenv fixture). No skip/xfail, no assertion edits.fix(ci): clear detect-secrets false positives— added# pragma: allowlist secretto fake test fixtures (re_test_key,user:secret@cluster.example); scoped the detect-secrets scan to exclude.planning/design docs (planning prose that references env-var names and fake placeholders — all keyword false positives). Shipped code (src/tests/infra/dashboard/scripts) is still fully scanned.Local verification (all five CI steps)
ruff check src testsruff format --check src testsmypy srcpytestdetect-secrets-hook --baseline .secrets.baseline $(git ls-files -- . ':!:.planning/**')CI-environment notes
PYTHONPATH=src .venv/bin/python -m pytest(project convention;uv runre-breaks the editable install in this worktree). CI runsuv sync --all-extras --frozenon a clean checkout, where the editable install resolves correctly, souv run pytestworks there.🤖 Generated with Claude Code