feat: treat generated bundle docs as sources - #786
Conversation
License Check Results🚀 The license check job ran with the Bazel command: bazel run --lockfile_mode=error //src:license-checkStatus: Click to expand output |
f368aa8 to
ea70678
Compare
|
Documentation preview for this pull request is available at: |
a6459b6 to
568c659
Compare
568c659 to
83900dc
Compare
82fa9c0 to
37fc389
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 15 out of 15 changed files in this pull request and generated 1 comment.
Suppressed comments (1)
Previously missed (1) — in code that hasn't changed since the last review.
docs.bzl:125
- The documented
srcscontract omits a second enforced restriction:_source_targets_runtime_pathrejects any mix of workspace and generated files, even when they have the same logical parent. A caller following this doc could put a handwritten page and generated diagram in one explicit bundle and receive an undocumented analysis failure. Document that all entries must also be uniformly workspace or generated sources (and keep the reference documentation in sync).
be807ac to
4ef3b50
Compare
There was a problem hiding this comment.
🟡 Changes recommended
The unresolved moderate issues affect bundle composition, source isolation, and portable generated-path serialization.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Review details
Suppressed comments (2)
Previously missed (2) — in code that hasn't changed since the last review.
bzl/bundle_rules.bzl:338
- Explicit bundles are still deduplicated solely by
entry.runtime_pathin_ensure_unique_entries. Consequently, two bundles that select different files from the same parent directory now collide during composition, even though file-list mode keeps those source sets independent and the public contract only requires each bundle's files to share a parent. Update uniqueness validation to compare explicit file identities/allowlists (while retaining directory-mount conflicts) so disjoint explicit bundles can share a parent.
src/extensions/score_sync_toml/_mounts.py:25 - Resolving the path before classifying it makes generated
srcsunstable in the generatedubproject.toml: underbazel run,<workspace>/bazel-binis a symlink, sopath.resolve()turnsbazel-bin/pkg/index.rstinto a machine-specific Bazel cache path outside both the Git root and runfiles tree. The new file-list mount is therefore serialized as an absolute cache path instead ofbazel-bin/...(and external runfile symlinks have the same issue). Classify the lexical absolute path first, then fall back to the resolved path for existing canonical-path cases.
- Files reviewed: 19/19 changed files
- Comments generated: 2
- Review effort level: Balanced
| if spec.files: | ||
| # Explicit source bundles use sphinx-mounts' file-list mode so the | ||
| # original files are read directly without discovering siblings. | ||
| source_files = resolve_source_files(manifest, spec, ws_root, runfiles_dir) |
There was a problem hiding this comment.
Thanks, this is valid for the transitional compatibility implementation, but I am intentionally not fixing it in this PR. The recursive data mount exists only to preserve legacy docs_bundle(data = [...]) behavior. Once legacy data discovery is removed, explicit-source bundles will no longer receive that recursive data mount, so the srcs file allowlist cannot be bypassed. I will address this as part of removing the legacy behavior rather than add a separate temporary mounting path here.
| Supporting or runtime files owned by this bundle. These files are part of the | ||
| bundle payload and are available at the bundle's eventual mount path, but are | ||
| not processed as the bundle's documentation sources. Use ``docs(data = [...])`` | ||
| for supporting files in the root bundle and this attribute for child bundles. |
There was a problem hiding this comment.
Agreed, the current wording describes the intended new API but not the transitional compatibility behavior. I am intentionally not changing the documentation in this PR because legacy data discovery is being retained only temporarily. When that behavior is removed, data will be strictly supporting/runtime input and srcs will be the documentation-source path, so the existing wording will become accurate again. I will update the documentation together with that legacy removal instead of documenting a behavior that is about to disappear.
|
Regarding Copilot's suppressed note at docs.bzl:125 about mixing workspace and generated srcs: I agree this identifies an implementation restriction, but I am intentionally not changing this PR. It is an uncommon edge case without a current supported use case, and adding it to the public documentation would add noise around an internal limitation. The existing analysis error already names the restriction. If mixed source kinds become a required use case, I would redesign the runtime path resolution and update the public contract then, rather than expand the documentation now. |
MaximilianSoerenPollak
left a comment
There was a problem hiding this comment.
Some questions but overall this looks quiet good I would say.
Lot's we already talked about in the call yesterday so I only commented what I now saw and noticed.
|
Addressed the two suppressed findings from review 5086178986 in 2f93014:
Validation: These were suppressed review findings rather than inline threads, so GitHub provides no individual threads to resolve. |
MaximilianSoerenPollak
left a comment
There was a problem hiding this comment.
Seems fine now for me.
THe comments make it a bit clearer and hopefully will help us in the future whne we look at this again.
Summary
docs_bundle(srcs = [...])support for generated documentation sources.docs_bundle(data = [...])for supporting/runtime files.bazel-binunderbazel run.Design notes
The generated metamodel RST and Mermaid output remain together in
srcs, because the RST references the Mermaid file by a relative path and both files form one documentation source tree. Explicit bundle sources must share one parent directory and cannot be combined withsource_dir.Validation
pre-commit run --all-filesbazel test //src/extensions/score_mounts:score_mounts_tests --noshow_progressbazel run //src/tests/docs_bzl/scenarios/data_files_runfiles:docs --noshow_progressbazel run //src/tests/docs_bzl/scenarios/nested_bundles:docs --noshow_progressbazel build //:needs_json --noshow_progressbazel run //:docs --noshow_progress