Skip to content

FE-1414: Support Python packages in the architecture docs - #9230

Draft
kube wants to merge 1 commit into
cf/fe-1412-python-client-support-seeded-trials-in-the-optimizer-servicefrom
cf/fe-1414-arch-docs-support-python-packages-layers-and-docstring
Draft

FE-1414: Support Python packages in the architecture docs#9230
kube wants to merge 1 commit into
cf/fe-1412-python-client-support-seeded-trials-in-the-optimizer-servicefrom
cf/fe-1414-arch-docs-support-python-packages-layers-and-docstring

Conversation

@kube

@kube kube commented Aug 16, 2026

Copy link
Copy Markdown
Collaborator

🌟 What is the purpose of this PR?

The architecture docs generator only accepted TypeScript packages, so apps/petrinaut-opt and the new @local/petrinaut-python bindings could not be documented. This teaches it Python: layer pages, roles, file counts, and diagrams for Python packages, with @layerRoot/@role read from docstrings. Import edges for Python remain out of scope (FE-1415, backlog).

Stack #9226 (top): FE-1410FE-1411FE-1408FE-1413FE-1270FE-1412this PR.

🔗 Related links

  • FE-1414 (internal) — this PR
  • FE-1415 (internal) — follow-up: Python import edges

🔍 What does this change?

Generator (@local/petrinaut-arch-docs)

  • Source extensions resolve per package language (.py for Python); the TypeScript-only gate in the extractor is gone. The graph builder still receives only TypeScript packages, exactly as before.
  • The tag scanner reads @layerRoot/@role from triple-quoted docstrings (both quote styles). Module docstrings are the Python analog of a file's doc comment; # comments are deliberately not scanned. The tag grammar, duplicate detection, and miscasing hints are shared across languages.
  • __pycache__ and .venv join the ignored directories; the generated edge-table caption now states that Python packages contribute no edges yet.

Registrations (42 layers, 433 files — up from 40/423)

  • @apps/petrinaut-opt → root layer optimizer, declared in optimization_api.py's docstring.
  • @local/petrinaut-python → root layer bindings, declared in the package docstring.
  • Both roots get diagram colours.

Authored content

  • content/optimizer/subprocess-boundary.mdx (attached to optimizer): the optimizer↔CLI relationship is a process contract a static import graph cannot represent — this page is the missing arrow, covering the spawn handshake, the ownership split, isolation, and the bounded limits, linking the cli, bindings, and cli.runtime layers and the usage manual.

Pre-Merge Checklist 🚀

🚢 Has this modified a publishable library?

This PR:

  • modifies workspaces but not a publishable library

📜 Does this require a change to the docs?

The changes in this PR:

  • are docs (architecture). In-app user docs unaffected.

🕸️ Does this require a change to the Turbo Graph?

The changes in this PR:

  • do not affect the execution graph

🛡 What tests cover this?

  • Arch-docs suite grows to 79: new tests for docstring tag scanning (module docstrings, single-quoted docstrings, #-comment/JSDoc-in-string non-matches, duplicate/miscasing diagnostics in Python).
  • lint:arch-docs validates the real registrations end to end (full file coverage of both Python packages, attachTo resolution); a full bundle build is part of verification.
  • Both Python suites (75 + 27) still pass with the docstring declarations in place.

❓ How to test this?

  1. yarn workspace @local/petrinaut-arch-docs lint:arch-docs
  2. turbo run dev --filter @apps/petrinaut-docs and open Architecture → optimizer / bindings; the boundary guide hangs off the optimizer page.

🤖 Generated with Claude Code

The generator only accepted TypeScript packages; apps/petrinaut-opt and
the new Python bindings could not be documented. The layer pipeline was
already language-agnostic, so this teaches the two gates Python: source
extensions are resolved per package language, and the tag scanner reads
@layerRoot/@ROLE from triple-quoted docstrings (module docstrings are
the Python analog of a file's doc comment; # comments are deliberately
not scanned). The import graph still receives only TypeScript packages -
Python layers render with no edges, and the generated edge-table caption
says so. Registers @apps/petrinaut-opt (layer: optimizer) and
@local/petrinaut-python (layer: bindings) with docstring declarations,
gives both roots diagram colours, and adds an authored page on the
optimizer-CLI subprocess boundary, which a static import graph cannot
represent. Python import edges are FE-1415.
@vercel

vercel Bot commented Aug 16, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
hash Ready Ready Preview Aug 16, 2026 7:22pm
petrinaut Ready Ready Preview Aug 16, 2026 7:22pm
1 Skipped Deployment
Project Deployment Actions Updated (UTC)
hashdotdesign-tokens Ignored Ignored Preview Aug 16, 2026 7:22pm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/apps area/libs Relates to first-party libraries/crates/packages (area) type/eng > backend Owned by the @backend team

Development

Successfully merging this pull request may close these issues.

1 participant