Reduce dogfood false positives from Phase B audit #118

Open
codex wants to merge 8 commits from codex/phase-b-fp-reductions into main
Collaborator

Canary Context Pack

Product story

The 2026-06-15 dogfood precision audit found that first-run fallow-py output has useful signal but too much avoidable false-positive noise. This PR implements the smallest evidence-derived Phase B slice so the next dogfood round starts from less noise instead of only documenting it.

What changed

  • #115: guarded optional imports are no longer emitted as missing-runtime-dependency blockers when there is no unguarded production use; TYPE_CHECKING imports remain type-scope signals.
  • #114: no-config discovery now keeps first-run analysis inside likely package trees and skips setup/docs/examples/.github/scripts-style non-product trees unless explicitly configured.
  • #117: requirements*.txt / requirements/*.txt are recorded as dependency files but not treated as runtime manifests; _typeshed is excluded from dependency rules; sibling absolute imports such as local settings / apps.sitemaps resolve locally when the matching sibling module exists.
  • #116: function annotations, including string annotations, count as symbol usage; explicit __all__ re-exports from __init__.py are treated as medium-or-better public API.

Why it changed

These are direct fixes for the largest systematic FP clusters from PR #113. The goal is not a new analyzer category; it is to make the existing rules less wrong on common real-world Python layouts.

Files touched

  • src/fallow_py/discovery.py
  • src/fallow_py/dependencies.py
  • src/fallow_py/resolver.py
  • src/fallow_py/ast_index.py
  • src/fallow_py/analysis.py
  • tests/test_pyfallow.py

Runtime evidence

  • python3 -m pytest -q
  • python3 -m compileall -q src tests mcp/src mcp/tests
  • python3 -m fallow_py analyze --root . --fail-on warning --min-confidence medium --format text

Known constraints

This PR uses compact regression fixtures inside the existing Python test suite rather than committing the large /tmp/fallow-dogfood corpus. A corpus re-run should follow after merge to quantify the precision delta against the #113 baseline.

Explicit out-of-scope

  • No new rules or categories.
  • No configured-mode rewrite.
  • No performance or cache changes.
  • No release/version bump.

Requested decision

approve_merge after CI is green if the behavior matches the four issue scopes.

Closes #114.
Closes #115.
Closes #116.
Closes #117.

## Canary Context Pack ### Product story The 2026-06-15 dogfood precision audit found that first-run `fallow-py` output has useful signal but too much avoidable false-positive noise. This PR implements the smallest evidence-derived Phase B slice so the next dogfood round starts from less noise instead of only documenting it. ### What changed - #115: guarded optional imports are no longer emitted as `missing-runtime-dependency` blockers when there is no unguarded production use; `TYPE_CHECKING` imports remain type-scope signals. - #114: no-config discovery now keeps first-run analysis inside likely package trees and skips setup/docs/examples/.github/scripts-style non-product trees unless explicitly configured. - #117: `requirements*.txt` / `requirements/*.txt` are recorded as dependency files but not treated as runtime manifests; `_typeshed` is excluded from dependency rules; sibling absolute imports such as local `settings` / `apps.sitemaps` resolve locally when the matching sibling module exists. - #116: function annotations, including string annotations, count as symbol usage; explicit `__all__` re-exports from `__init__.py` are treated as medium-or-better public API. ### Why it changed These are direct fixes for the largest systematic FP clusters from PR #113. The goal is not a new analyzer category; it is to make the existing rules less wrong on common real-world Python layouts. ### Files touched - `src/fallow_py/discovery.py` - `src/fallow_py/dependencies.py` - `src/fallow_py/resolver.py` - `src/fallow_py/ast_index.py` - `src/fallow_py/analysis.py` - `tests/test_pyfallow.py` ### Runtime evidence - `python3 -m pytest -q` - `python3 -m compileall -q src tests mcp/src mcp/tests` - `python3 -m fallow_py analyze --root . --fail-on warning --min-confidence medium --format text` ### Known constraints This PR uses compact regression fixtures inside the existing Python test suite rather than committing the large `/tmp/fallow-dogfood` corpus. A corpus re-run should follow after merge to quantify the precision delta against the #113 baseline. ### Explicit out-of-scope - No new rules or categories. - No configured-mode rewrite. - No performance or cache changes. - No release/version bump. ### Requested decision `approve_merge` after CI is green if the behavior matches the four issue scopes. Closes #114. Closes #115. Closes #116. Closes #117.
Refs: #115

Verified: python3 -m pytest -q tests/test_pyfallow.py::test_undeclared_guarded_and_type_checking_imports_are_not_runtime_blockers tests/test_pyfallow.py::test_guarded_optional_import_does_not_count_as_runtime_violation tests/test_pyfallow.py::test_tuple_import_error_guard_marks_imports_guarded
Refs: #114

Verified: python3 -m pytest -q tests/test_pyfallow.py::test_no_config_src_layout_does_not_analyze_non_package_trees tests/test_pyfallow.py::test_no_config_top_level_package_filters_non_package_trees tests/test_pyfallow.py::test_inferred_source_roots_prefer_specific_children_before_repo_root
Refs: #117

Verified: python3 -m pytest -q tests/test_pyfallow.py::test_config_parsers_cover_pep621_poetry_and_requirements tests/test_pyfallow.py::test_requirements_files_are_not_runtime_dependency_manifests tests/test_pyfallow.py::test_sibling_absolute_imports_are_local_not_missing_dependencies tests/test_pyfallow.py::test_typeshed_stub_namespace_is_not_missing_dependency
Refs: #116

Verified: python3 -m pytest -q tests/test_pyfallow.py::test_annotation_only_typevars_and_aliases_count_as_symbol_usage tests/test_pyfallow.py::test_explicit_init_all_reexport_marks_compat_alias_public tests/test_pyfallow.py::test_reexports_and_from_package_submodule_alias_usage tests/test_pyfallow.py::test_export_mutations_aliases_and_star_exports
fix: tighten local import and reexport heuristics
All checks were successful
CI / Python 3.11 (push) Successful in 54s
CI / Python 3.12 (push) Successful in 1m0s
CI / Python 3.13 (push) Successful in 58s
CI / Python 3.11 (pull_request) Successful in 54s
CI / Python 3.12 (pull_request) Successful in 59s
CI / Python 3.13 (pull_request) Successful in 1m0s
9689827c97
Refs: #116, #117

Verified: python3 -m pytest -q

Verified: python3 -m compileall -q src tests mcp/src mcp/tests

Verified: python3 -m fallow_py analyze --root . --fail-on warning --min-confidence medium --format text
codex requested review from claude 2026-06-17 23:09:59 +02:00
Merge remote-tracking branch 'origin/main' into HEAD
All checks were successful
CI / Python 3.11 (push) Successful in 53s
CI / Python 3.12 (push) Successful in 59s
CI / Python 3.13 (push) Successful in 59s
CI / Python 3.11 (pull_request) Successful in 56s
CI / Python 3.12 (pull_request) Successful in 57s
CI / Python 3.13 (pull_request) Successful in 57s
e011a4b572
fix: document legacy shim dynamic import exception
Some checks are pending
CI / Python 3.11 (push) Waiting to run
CI / Python 3.12 (push) Waiting to run
CI / Python 3.13 (push) Waiting to run
CI / Python 3.11 (pull_request) Waiting to run
CI / Python 3.12 (pull_request) Waiting to run
CI / Python 3.13 (pull_request) Waiting to run
9ff723d036
Verified:
- python3 -m pytest -q
- python3 -m compileall -q src tests mcp/src mcp/tests
- python3 -m fallow_py analyze --root . --fail-on warning --min-confidence medium --format text
- local self-dogfood artifact drops from 2 to 1 decision_needed finding
docs: align dogfood readout with PR self-audit result
All checks were successful
CI / Python 3.11 (push) Successful in 54s
CI / Python 3.12 (push) Successful in 58s
CI / Python 3.13 (push) Successful in 58s
CI / Python 3.11 (pull_request) Successful in 55s
CI / Python 3.12 (pull_request) Successful in 58s
CI / Python 3.13 (pull_request) Successful in 57s
9c201c75d2
All checks were successful
CI / Python 3.11 (push) Successful in 54s
CI / Python 3.12 (push) Successful in 58s
CI / Python 3.13 (push) Successful in 58s
CI / Python 3.11 (pull_request) Successful in 55s
Required
Details
CI / Python 3.12 (pull_request) Successful in 58s
Required
Details
CI / Python 3.13 (pull_request) Successful in 57s
Required
Details
This pull request is blocked because it's outdated.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin codex/phase-b-fp-reductions:codex/phase-b-fp-reductions
git switch codex/phase-b-fp-reductions
Sign in to join this conversation.
No description provided.