Repository navigation
imports: per-document needs imports, followed transitively - #38
Open
tobiaskaestner wants to merge 1 commit into
Open
tobiaskaestner wants to merge 1 commit into
tobiaskaestner wants to merge 1 commit into
Conversation
Every document imported the needs of every needs-publishing peer. A downstream set that builds upstream documents had to list every indirect upstream document, each needs warning repeated once per importing document, and an upstream document built downstream showed the downstream documents' incoming links. A kind: sphinx document may now list the documents whose needs it imports (imports: [sysreq]). The imports of a listed document are followed transitively, so a document lists only its direct upstream documents; a listed document without imports: adds only itself. Without the key nothing changes. Only needs_external_needs is affected: intersphinx, doxylink, TAGFILES and the navigation stay all-to-all. The list is validated at configure time (each id exists, publishes needs, is in the link graph, is not the document itself). The registry schema documents the key; ADR 0017 records the decision (0015 and 0016 are the ADRs of other open branches). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Tobias Kaestner <tobias.kaestner@inovex.de>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #26
Based on
main, independent of #35, #36 and the #25 PR. ADR number: this adds ADR 0017 (0015 is #36, 0016 is the #25 PR). Each PR adds one line after0014indecisions/index.rst, so a trivial conflict there is expected; I can rebase on request.What changed
An optional per-document
imports:list (forkind: sphinx). It names the documents whose needs the document imports. Without the key nothing changes (all-to-all).imports:of a listed document are followed. An imported need keeps its links, which resolve only if their targets are imported too, so a document lists only its direct upstream documents.imports:adds only itself. It does not mean "every peer", which would undo the narrowing for all its importers.needs_external_needschanges. Intersphinx, doxylink,TAGFILESand the navigation stay all-to-all.crossref: false, not the document itself. Onlykind: sphinxdocuments may have the key.imports,needs), the registry explanation, consumer contract wording, ADR 0017.Why
A downstream set that builds upstream documents got all-to-all imports. Each needs warning repeated once per importer, and upstream documents showed the downstream documents' incoming links.
How tested
test_docrefs_imports.py(13 tests) ondocrefs.load(). It covers the default, an empty list, direct and transitive imports, a listed document without a list, a cycle, intersphinx unaffected, and every validation error. Full suites: 569 passed (8.3, CI pins).zdocs-tests, 8.3): 238 passed, 11 failed, 20 skipped: the same failure set asmainin the same environment (the 11 come from the environment and already fail onmain; details in sphinx-needs 9.2; unique prefixes; no group with a document's target name #35).doc-checkOK.check --allpasses on this branch (registries unchanged). In a copy of the downstream ee repo's registry I setse-req: [],se-arch: [se-req],ee-joint: [se-arch]andee-test: [ee-joint]. The strict (-W) ee build passes, so the transitive imports resolve every link (ee-test → ee-joint → se-arch → se-req). The locally built upstreamse-reqpage then shows no downstream "satisfied by" links, the same as in its own repository's build. With all-to-all it showed 2.Open questions
needs.json. Reading theimports:(and the entries) of an upstream repository's owndocuments.yaml, so that a downstream set need not list the indirect upstream documents at all, overlaps with "Import-only" document kind #28 (import-only kind). I left it out. How do you want it shaped?imports:adds only itself. If its needs link into a document that is not imported, the importer warnsneeds.external_link_outgoing. The alternative ("no list = all peers", transitively) is always safe but rarely narrows anything. I chose the explicit variant to match the acceptance criterion "imports only from the documents it lists".imports:also decides which incoming links a document shows.imports: []on an upstream document gives up the downstream impact view (back-links) in that set. This is documented.🤖 Generated with Claude Code