Repository navigation
Conversation
…abs#4002) A configurable directive such as export 'service_stub.dart' if (dart.library.io) 'service_io.dart'; was matched only up to its first quoted string, so the `if` alternatives were dropped. In the usual Flutter facade the stub is an empty placeholder and the real implementation lives in the conditional branch, which left the implementation unreachable from the facade and its importers. Parse the whole directive and emit one edge per URI: the default URI keeps its plain edge (unchanged), each alternative gets the same relation tagged context="conditional_uri" with its own source line. A string literal inside the condition (`if (app.flavor == 'prod')`) is part of the URI test and is not mistaken for a URI. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Thanks for the pull request, @brlumen. A maintainer will review it soon. Want to talk it through while it is in review? Come join us on our Discord server. For longer-form discussion there is also GitHub Discussions. A couple of things that speed up review: make sure the test suite passes on Python 3.10 and 3.13, and that the change keeps extraction deterministic. |
There was a problem hiding this comment.
Graphify reviewed this change.
Looks safe to merge — no coupling regressions and no blocking issues, checked against the code graph (not a self-assessment).
Graphify review — findings
Adds support for Dart configurable imports/exports (import 'x_stub.dart' if (dart.library.io) 'x_io.dart';) in extract_dart. Every if (...) branch now gets its own imports/exports edge tagged context="conditional_uri", alongside the plain edge for the default URI, and each edge points at that branch's own line. A string literal inside the condition itself, such as == 'prod', is treated as part of the test and never becomes a node.
No blocking issues surfaced.
Analysis details — impact, health, verification
Impact & health
Graphify review
Impact — 34 functions depend on the 33 functions this change touches.
Health — this change adds coupling hotspots:
- new:
extract_dart()— 12 callers, 7 callees
Verification — 34 functions in the blast radius were not formally verified this run (proofs are advisory here).
Gate & verification
graphify gate
PASS — objectively clean (no health regressions, tests not run — proofs not run this pass (advisory)). Grounded, not self-assessed.
Advisory (not blocking):
- verification_scope: 34 function(s) in the blast radius were not formally verified this run
Test selection
Test selection
2 of 318 test file(s) selected (1%) via static blast radius.
tests/test_dart.py— impact, changed-testtests/test_extract.py— impact
Selection is safe under the controlled-regression assumption; always-run tests + a periodic full run are the backstops. Advisory — it never changes the check verdict.
Docs that may be stale (advisory)
CHANGELOG.md§ 0.9.74 (2026-10-02) (lines 5-20): references changed symbolstargetsCHANGELOG.md§ 0.9.20 (2026-07-18) (lines 662-668): references changed symbolstargets
· 1 more finding(s) on lines outside this diff (see the check run).
|
Shipped in v0.9.75 (live on PyPI as Closing as shipped. |
What does this PR do?
Fixes #4002.
The Dart extractor matched
import/exportdirectives only up to the first quoted string, so everyif (...)alternative of a configurable directive was dropped:produced only
exports -> service_stub.dart. In the usual Flutter facade the stub is an empty placeholder and the real implementation lives in the conditional branch, so the implementation was unreachable from the facade and everything importing it.Change (section "6. Imports and Exports" of
graphify/extractors/dart.py):if (<dotted.name> [== '<value>']) '<uri>'branches (single or double quotes, across line breaks);imports/exports) taggedcontext="conditional_uri"and its ownsource_location, so consumers can tell the platform-selected branches from the default one;if (app.flavor == 'prod')) is part of the URI test and is not emitted as a URI.Type of change
Verification & Invariants
Invariant: an import/export edge is emitted for every library URI the directive names, and only for those. The default-URI edge is unchanged (same target, relation, line, no context), so existing graphs and caches do not change for non-configurable directives; only new
conditional_uriedges (and their target stub nodes) appear for configurable ones. No persisted-state format change.Limitations: URIs are still minted as unresolved targets keyed by the URI string, exactly like the default URI today; resolving Dart URIs to file nodes is #2329 / #2570 and out of scope here. String interpolation in a URI is not valid Dart and is not handled.
How was this tested?
Also ran
graphify extract . --code-onlyon a ~300-file Flutter app: all four conditional-export facades in the project now link to their*_io.dartimplementations (before: no edge from any facade to its implementation).Graphify-specific checklist
uv run python -m tools.skillgen --bless) when changing their source fragments. (N/A - no skill fragments touched)