Repository navigation
Allow bundles to resolve links to declared external Needs - #890
AlexanderLanin wants to merge 8 commits into
Conversation
|
Documentation preview for this pull request is available at: |
|
open point: external_needs includes "the entire thing" while upward_bundles includes only the local needs latest idea is to treat external dependencies as "the entire thing" and local dependencies as "local needs only". Since making both parameters available will be too complex for users. |
|
Following up on my API-shape note: I’d like For docs authors, |
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Root owner-only exports do not receive declared external inventories, and public label resolution has an ambiguous docs target case.
Review effort: Balanced
Findings: 2
Open (3)
What changed in this PR
Adds explicit external Needs imports for standalone bundle validation while preserving owner-only exports.
Changes:
- Resolves public documentation labels to local Needs inventories.
- Adds duplicate-ID detection and integration coverage.
- Updates external-Needs documentation and examples.
| File | Description |
|---|---|
docs.bzl |
Adds bundle inventory resolution and dependencies. |
src/helper_lib/external_needs.py |
Resolves internal inventory paths. |
src/extensions/score_metamodel/external_needs.py |
Loads inventories and detects duplicates. |
src/extensions/score_metamodel/tests/test_external_needs.py |
Tests inventory parsing and URLs. |
src/tests/docs_bzl/test_upward_bundles.py |
Tests parent-link resolution and collisions. |
src/tests/docs_bzl/scenarios/upward_bundle_needs/BUILD |
Defines integration fixtures. |
src/tests/docs_bzl/scenarios/upward_bundle_needs/docs/index.rst |
Defines the parent Need. |
src/tests/docs_bzl/scenarios/upward_bundle_needs/component/index.rst |
Defines the child Need. |
src/tests/docs_bzl/scenarios/reference_integration/BUILD |
Uses public docs inventory labels. |
src/tests/docs_bzl/scenarios/reference_integration/modern_module/BUILD |
Migrates external inventory labels. |
docs/reference/bazel_macros.rst |
Documents the new bundle API. |
docs/how-to/source_to_doc_links.rst |
Updates the linking example. |
docs/how-to/setup.rst |
Updates dependency setup. |
docs/how-to/other_modules.rst |
Explains cross-module imports. |
docs/concepts/docs_deps.rst |
Updates dependency concepts. |
BUILD |
Migrates the repository’s external Needs source. |
.bazelrc |
Removes Java configuration flags. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| # from the full project build. Give it the same external Needs context | ||
| # so links in those sources can be checked; the Needs builder still | ||
| # exports only Needs owned by the root source bundle. | ||
| resolved_external_needs_labels = external_needs_labels, |
|
Thanks for the pull request. This thread has been quiet for 30 days, so we are marking it as stale for now. Please take a quick look and let us know whether it is still up to date, still relevant, needs review, or is ready to merge. Any new activity will remove the stale label automatically. If nothing changes in the next 10 days, we will close it to keep the backlog current. |



Why
A bundle can own a Need that links to one owned by another documentation source. When built by itself, Sphinx-Needs sees only the bundle's local inventory and reports the link as unresolved. Sharing
root_docsgives the bundle project settings; it does not make another source's Needs visible. Authors need an explicit way to validate these links without importing the other source's pages or copying its Needs into the bundle's own export.What changes
external_needstodocs_bundle(). Authors can name a publicdocs()target or a nameddocs_bundle()target.docs()accepts those public names too, while continuing to accept legacyneeds_jsonandneeds_json_filelabels.Example
A parent project owns
PARENT-123. A component ownsCHILD-456and links it toPARENT-123. Built alone, the component cannot resolve that link. It lists the parent project inexternal_needs, so Bazel supplies the parent's locally owned Needs inventory for Sphinx-Needs' link check. The link resolves, but the parent's Need is not copied into the component's own Needs JSON, and the parent's pages are not mounted into the component.The declaration is explicit: without the
external_needsentry, the link remains unresolved.🚨 Impact Analysis
✅ Checklist