Skip to content

Add Hydra composition for GiGL configs - #726

Draft
kmontemayor2-sc wants to merge 16 commits into
mainfrom
codex/hydra-config-composition
Draft

Add Hydra composition for GiGL configs#726
kmontemayor2-sc wants to merge 16 commits into
mainfrom
codex/hydra-config-composition

Conversation

@kmontemayor2-sc

@kmontemayor2-sc kmontemayor2-sc commented Jul 30, 2026

Copy link
Copy Markdown
Collaborator

Why

GiGL configs today are monolithic YAML files, so anything shared between pipelines has to be copy-pasted. Our own e2e resource configs carried three near-identical copies of the same infrastructure and preprocessing sections, and they drifted apart the way copies always do. Users maintaining families
of related pipelines (per-region, per-experiment, per-environment) face the same problem at a larger scale.

This PR lets task and resource configs use Hydra Defaults Lists so shared fragments live in one place and each pipeline's config declares only what makes it different. Dynamic values (dates, env vars, git hashes) resolve through OmegaConf resolvers instead of being hand-edited before every launch.

Design decisions

  • Resolve once, at the pipeline entry point. ConfigValidator composes the source configs, then publishes fully resolved snapshots to GCS that every downstream component consumes. Composition can depend on sibling files, the environment, and time-based resolvers — resolving it once and freezing the
    result is what keeps a pipeline run reproducible and every component in agreement about its config. Retries reuse the frozen snapshots rather than re-resolving (the validator follows run-level KFP caching).
  • One reader API. ProtoUtils.read_proto_from_yaml now composes everything it reads. A config without a defaults list composes to itself, so there is no separate "composing" code path for users to know about, and a Hydra-authored config works anywhere a plain one did — not just through the KFP
    pipeline. Composition also snapshots and restores any active Hydra context, so GiGL reads keep working inside user applications that use Hydra themselves.
  • Snapshots carry provenance. The resolved snapshots are machine-written YAML, so source comments cannot survive; each one instead starts with a comment naming the source config it was composed from (including the docker image for container-local sources), so an artifact found in GCS can always be
    traced back.

The e2e resource configs are migrated to shared fragments as the in-repo example. A new user guide (docs/user_guide/config_guides/hydra_composition.md) covers authoring, remote configs, and the pipeline behavior.

Testing

  • Unit tests for composition, resolver handling, thread safety, and foreign-Hydra-context restoration, plus ConfigValidator resolution/materialization and compiled-pipeline wiring.
  • assert_yaml_configs_parse runs all 240 repo YAML configs through the composing reader.

kmontemayor and others added 14 commits July 30, 2026 16:22
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Drop a redundant genericity test and an implementation-pinning
assertion, and assert compiled-pipeline wiring structurally instead of
matching the KFP compiler's text layout.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Forcing enable_caching=False re-ran composition on every relaunch, so a
retry could overwrite the job's resolved snapshots with different
dynamically resolved values while downstream cached steps kept the old
ones. Recompose by launching with a new job name or with run-level
caching disabled.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Every YAML read now composes; plain configs and materialized snapshots
compose to themselves. compose_yaml_config snapshots and restores any
foreign GlobalHydra context instead of refusing to run, so reads work
inside a user application under @hydra.main. Local files not named
*.yaml are staged like remote URIs.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
file_uri_dst=local_uri,
)
obj_dict = compose_yaml_config(uri=local_uri)
proto = ParseDict(js_dict=obj_dict, message=proto_cls())

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

High severity and reachable issue identified in your code:
Line 65 has a vulnerable usage of protobuf, introducing a high severity vulnerability.

ℹ️ Why this is reachable

A reachable issue is a real security risk because your project actually executes the vulnerable code. This issue is reachable because your code uses a certain version of protobuf.
Affected versions of protobuf are vulnerable to Uncontrolled Recursion. A denial-of-service vulnerability in the Python protobuf library's JSON parser allows deeply nested google.protobuf.Any messages to bypass the configured max_recursion_depth in json_format.ParseDict. Because the internal Any-handling logic does not update the recursion counter, an attacker supplying a JSON payload with repeatedly nested Any messages can exhaust Python's recursion stack (raising RecursionError) instead of a controlled ParseError, potentially crashing or disrupting services that parse untrusted JSON.

References: GHSA, CVE

To resolve this comment:
Upgrade this dependency to at least version 5.29.6 at uv.lock.

💬 Ignore this finding

To ignore this, reply with:

  • /fp <comment> for false positive
  • /ar <comment> for acceptable risk
  • /other <comment> for all other reasons

You can view more details on this finding in the Semgrep AppSec Platform here.

proto_to_yaml re-serializes the parsed protobuf, so source comments
cannot survive composition. Prepend a provenance comment naming the
source config instead, prefixed with the docker image when the source
is a container-local path.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@kmontemayor2-sc

Copy link
Copy Markdown
Collaborator Author

/all_test

@github-actions

github-actions Bot commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

GiGL Automation

@ 17:42:32UTC : 🔄 C++ Unit Test started.

@ 17:44:34UTC : ✅ Workflow completed successfully.

@github-actions

github-actions Bot commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

GiGL Automation

@ 17:42:34UTC : 🔄 Python Unit Test started.

@ 19:20:31UTC : ✅ Workflow completed successfully.

@github-actions

Copy link
Copy Markdown
Contributor

GiGL Automation

@ 17:42:35UTC : 🔄 Integration Test started.

@github-actions

github-actions Bot commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

GiGL Automation

@ 17:42:36UTC : 🔄 E2E Test started.

@ 19:36:12UTC : ❌ Workflow failed.
Please check the logs for more details.

@github-actions

github-actions Bot commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

GiGL Automation

@ 17:42:36UTC : 🔄 Scala Unit Test started.

@ 17:52:37UTC : ✅ Workflow completed successfully.

@github-actions

github-actions Bot commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

GiGL Automation

@ 17:42:36UTC : 🔄 Lint Test started.

@ 17:48:58UTC : ❌ Workflow failed.
Please check the logs for more details.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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