[P0][phase:b] Guarded imports (TYPE_CHECKING / try-except) must not be blocking missing-runtime-dependency #115
Labels
No labels
area:ci
area:docs
area:engineering
area:framework-fp
area:test-coverage
dogfood:fn
dogfood:fp
dogfood:friction
dogfood:tp
phase:b
phase:c
severity:critical
severity:high
severity:low
severity:medium
source:deepseek-v4-pro
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
pdurlej/fallow-py#115
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Source: evidence-derived from the 2026-06-15 real-world precision audit (
docs/dogfood/real-world-precision-2026-06-15.md).Problem
fallow-pyflags imports that are guarded byif TYPE_CHECKING:ortry/except ImportError:asmissing-runtime-dependency— the onlyblocking/error-severity rule. This means a first-time CI integration fails the build on type-only and optional imports.This is the most damaging defect found, because it is
blocking.missing-runtime-dependencymeasured 3% precision (29 of 30 sampled findings were false positives).Evidence (real repos, no config)
celery/app/base.py:if typing.TYPE_CHECKING: from pydantic import BaseModel→ flagged as a blocking missing dependency (the import never runs)flask/config.py:if t.TYPE_CHECKING: import typing_extensions as te→ blocking errorclick/_winconsole.py:if t.TYPE_CHECKING: ... from typing_extensions import Buffer→ blocking errorcelery/backends/arangodb.py:try: from pyArango import ... except ImportError:(handled optional driver) → flagged missingrequests/__init__.py,httpx/_transports/asgi.py:try/except ImportErroroptional imports → flagged missingcelery:_patch_eventlet()/_patch_gevent()function-local optional-backend imports → flagged missingThe analyzer already records
evidence.guarded: truefor several of these, yet still emits them aterrorseverity.Proposed fix
TYPE_CHECKING-guarded imports are never runtime dependencies — exclude them frommissing-runtime-dependencyentirely (at most aninfonote).try/except ImportError-guarded imports are optional — do not emitblocking; at mostdecision_needed.evidence.guardedsignal: a guarded import must never beblocking.Acceptance criteria
TYPE_CHECKING-guarded ortry/except ImportError-guarded import is ever reported atblocking/error severity.benchmarks/fp-cases/type-checking-guarded-import/fixture added and passes.missing-runtime-dependencyprecision rising substantially from the 3% baseline.Priority
P0. This is the adoption-breaker — it is the difference between "noisy" and "actively fails first-time CI." Fix first regardless of volume rank.
Opened by
claude(Opus 4.8) from the 2026-06-15 precision audit. Audit PR: #113.