FE-1415: Generate import edges for Python packages - #9265
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
1 Skipped Deployment
|
PR SummaryMedium Risk Overview
Captions that said Python contributed no edges are updated. Reviewed by Cursor Bugbot for commit 2047c0a. Bugbot is set up for automated code reviews on this repo. Configure here. |
39ccc33 to
0bc4d8a
Compare
0bc4d8a to
b13e2d8
Compare
b13e2d8 to
109b220
Compare
109b220 to
889d36e
Compare
889d36e to
576cb87
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 576cb87. Configure here.
576cb87 to
8a9b6fa
Compare
8a9b6fa to
f68e94a
Compare
f68e94a to
2047c0a
Compare

🌟 What is the purpose of this PR?
Python packages had layers but no edges, because the import graph came from dependency-cruiser, which reads TypeScript only. The optimizer's real dependency on the Python bindings was invisible, and its diagram suggested dead code. The bundle now derives Python import edges the same way as TypeScript ones:
{ "from": "optimizer", "to": "python-bindings", "provenance": "imports", "fileDependencies": 2, "crossesPackage": true }In stack #9280, FE-1447 (#9264) sits below and FE-1456 (#9266) above.
🔗 Related links
python-bindings → cliedge stays declared, and the duplicate check confirms the two never overlap.🔍 What does this change?
libs/@local/petrinaut-arch-docs:graph.ts):buildGraphsplits covered packages by language. TypeScript goes through dependency-cruiser as before, and Python goes through a new collector. Both produce the same file-level dependency records, so aggregation, intra-layer dropping, example pairs,crossesPackage, rules, and the declared-edge duplicate check apply to Python unchanged.python-imports.ts(new, no dependencies): a line-based parser forimport a.bandfrom a.b import c(aliases, comma lists, parenthesised continuations, relative imports), a module index over the covered Python packages, and a resolver. Imports that resolve to nothing covered (stdlib, third-party) drop silently, matching the TypeScript behaviour. The parser skips strings and comments conservatively: a missed import loses one edge, while an invented one would put a false claim in the docs.content/index.mdxno longer say Python contributes no edges.The one new edge is the optimizer's import of the bindings. Intra-package Python imports aggregate away as intra-layer, as they should.
Review fixes
openDelimiterAftercomment names its reachable failure case: a single-quoted literal containing a triple quote reads as an unclosed docstring and drops imports until the next""", erring toward a lost edge.Pre-Merge Checklist 🚀
🚢 Has this modified a publishable library?
This PR:
📜 Does this require a change to the docs?
The changes in this PR:
🕸️ Does this require a change to the Turbo Graph?
The changes in this PR:
🛡 What tests cover this?
python-imports.test.ts(new): parsing (absolute, from-imports, aliases, relative, continuations, comment and string non-matches), module indexing, the module-name collision diagnostic, and resolution.graph.test.ts: a full-chain assertion that a Python cross-package import aggregates into an edge.lint:arch-docsexercises the real repo with zero diagnostics.❓ How to test this?
yarn workspace @local/petrinaut-arch-docs lint:arch-docspasses.turbo run dev --filter @apps/petrinaut-docs: theoptimizerpage showspython-bindingsunder "Depends on" with an import count, and the overview diagram draws the solid edge beside the dashed declared one.🤖 Generated with Claude Code