Skip to content

Add resolved-dependency override mechanism for DR-008#19

Closed
Subramanian-K812 wants to merge 6 commits into
mainfrom
Subramanian-K812_resolve_override_mechanism
Closed

Add resolved-dependency override mechanism for DR-008#19
Subramanian-K812 wants to merge 6 commits into
mainfrom
Subramanian-K812_resolve_override_mechanism

Conversation

@Subramanian-K812

Copy link
Copy Markdown

DR-008: resolved-dependency resolve + override mechanism (PR 1 of 2)

Part of eclipse-score#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 full
integrated dependency set at the reference_integration root and (2) override those
resolved versions directly into an individual module.

  • Resolve (root): merges the override directives ref_int actually declares
    (MODULE.bazel + bazel_common/*.MODULE.bazel) with the post-MVS registry versions
    from bazel mod graph --output=json, and serializes the result to a single
    resolved_versions.json manifest (--export / from_mod_graph / to_file).
  • Override (into a module): scans a module's MODULE.bazel and appends a
    git_override / single_version_override for each declared dependency we have a
    resolved version for, so the module builds/tests against the resolved set
    (scan / overwrite).

Files

File Change
scripts/known_good/resolved_dependencies.py New — the ResolvedDependencies mechanism (resolve + override) + CLI
scripts/known_good/tests/test_resolved_dependencies.py New — 20 self-contained unit tests (no cloned repos / Bazel needed)
scripts/known_good/update_module_from_known_good.py Extract generate_override_directive() (now shared by the generator and overwrite); import guard. Generated output is byte-identical
scripts/known_good/models/module.py Add optional Metadata.bazel_config field (inert here; populated/consumed in PR 2)

Follow-up (PR 2)

The two-stage test_and_docs.yml (Stage 1 resolves + exports the manifest; Stage 2 checks
out 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 the
associated config all land in the follow-up PR, which is stacked on this one.

@PiotrKorkus PiotrKorkus left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

make the script part of //scripts/tooling and enable it in bazel run

Comment thread scripts/known_good/models/module.py Outdated
exclude_test_targets: list[str] = field(default_factory=lambda: [])
langs: list[str] = field(default_factory=lambda: ["cpp", "rust"])
rust_coverage_config: str | None = "ferrocene-coverage" # Optional field for Rust coverage configuration
bazel_config: list[str] = field(default_factory=lambda: [])

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why needed? no updates in json regarding that
is it for holding flags, whole file, or?

Comment on lines +44 to +58
# Import ``models`` + ``generate_override_directive`` whether this file is loaded as
# ``known_good.resolved_dependencies`` (scripts/ on path, e.g. from quality_runners.py)
# or as ``resolved_dependencies`` (scripts/known_good/ on path). Preferring the
# package-qualified form keeps a single ``Module`` class identity in the package context.
_HERE = Path(__file__).resolve().parent
try:
from known_good.models.known_good import load_known_good
from known_good.models.module import Module
from known_good.update_module_from_known_good import generate_override_directive
except ImportError:
if str(_HERE) not in sys.path:
sys.path.insert(0, str(_HERE))
from models.known_good import load_known_good # noqa: E402
from models.module import Module # noqa: E402
from update_module_from_known_good import generate_override_directive # noqa: E402

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

keep only bazel execution

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dont change in this PR

Comment on lines +286 to +287
if name in already_overridden:
continue # respect an override the module already declares

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should decide in reference_integration what version should be used. It has to be always overwritten

Comment on lines +61 to +62
INJECTION_BEGIN = "# --- BEGIN ref_int resolved-deps injection (DR-008 Option 4) ---"
INJECTION_END = "# --- END ref_int resolved-deps injection (DR-008 Option 4) ---"

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(DR-008 Option 4) remove this reference, its not needed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants