Add resolved-dependency override mechanism for DR-008#278
Add resolved-dependency override mechanism for DR-008#278Subramanian-K812 wants to merge 6 commits into
Conversation
… markers, simplify imports
…directive inline, add BUILD for bazel run
…wn_good.py, and tooling BUILD format
6d78316 to
fbc58a3
Compare
|
The created documentation from the pull request is available at: docu-html |
|
|
||
| # Alias: expose resolve_deps under //scripts/tooling for `bazel run //scripts/tooling:resolve_deps`. | ||
| alias( | ||
| name = "resolve_deps", |
There was a problem hiding this comment.
Why this alias? This is usually for backwards-compatibility but since this is new functionality it should not be necessary.
There was a problem hiding this comment.
The alias under //scripts/tooling provides reachability alongside other entry points. The implementation itself remains in //scripts/known_good since that’s where its models and tests live. The pipeline continues to call //scripts/known_good:resolve_deps directly; the alias simply exposes it without duplicating the target.
| """Unit tests for ResolvedDependencies (DR-008 Option 4 dependency injection). | ||
|
|
||
| Self-contained: builds the resolved set from a temporary known_good.json and | ||
| overwrites a temporary module MODULE.bazel — no cloned repos or Bazel required. |
There was a problem hiding this comment.
I like this self-contained aspect. It allows to use this in an hermetic way.
However, the tradeoff is that we cannot parallelize the followup actions (build, test, docs, etc) via GitHub actions, can we?
There was a problem hiding this comment.
No, they can still run in parallel. Stage 1 resolves once and uploads resolved_versions.json as an artifact; each Stage 2 module job downloads that same artifact and does its own local override + build/test independently, still as a normal parallel matrix. The hermetic is only about the unit tests not needing real clones/bazel to validate scan()/overwrite() — it doesn't force any job serialization in the actual pipeline.
DR-008: resolved-dependency resolve + override mechanism (PR 1 of 2)
Part of #264. This is the first of two PRs that split the original DR-008 Option 4
change. This PR adds only the mechanism; the follow-up
PR wires it into the test workflow.
What this PR does
Adds
ResolvedDependencies— the mechanism DR-008 Option 4 needs to (1) resolve the fullintegrated dependency set at the
reference_integrationroot and (2) override thoseresolved versions directly into an individual module.
(
MODULE.bazel+bazel_common/*.MODULE.bazel) with the post-MVS registry versionsfrom
bazel mod graph --output=json, and serializes the result to a singleresolved_versions.jsonmanifest (--export/from_mod_graph/to_file).MODULE.bazelfor every declaredbazel_depand appends agit_override/single_version_overridefor each one wehave a resolved version for, so the module builds/tests against the resolved set
(
scan/overwrite). Injection is append-only and idempotent (marked with begin/endcomments), always skips the module-under-test itself (the root is never overridden),
always overwrites any dependency the module already declares an override for (ref_int's
resolved version always wins), and is never committed back to module sources. A declared
dependency with no entry in the resolved set is left to resolve on its own and logs a
warning — this is expected to be effectively impossible once the resolved set comes from
the full
bazel mod graph(a superset of any module's own graph).Files
scripts/known_good/resolved_dependencies.pyResolvedDependenciesmechanism (resolve + override) + CLIscripts/known_good/tests/test_resolved_dependencies.pyscripts/known_good/BUILDpy_library :known_good,py_binary :resolve_deps(Bazel-runnable), andscore_py_pytest :known_good_testsso the unit tests run under Bazelscripts/tooling/BUILDalias :resolve_depsexposing it asbazel run //scripts/tooling:resolve_depsFollow-up (PR 2)
The two-stage
test_and_docs.yml(Stage 1 resolves + exports the manifest; Stage 2 checksout each module, overrides deps via this mechanism, and runs its UT + coverage; then
aggregates), the module-context
quality_runners.py, the dependency pin bumps, and theassociated config all land in the follow-up PR, which is stacked on this one.