Skip to content

fix(lab): discover_lab_context walks up to the lab root - #38

Open
jordanauge wants to merge 1 commit into
mainfrom
fix/lab-context-parent-walk
Open

fix(lab): discover_lab_context walks up to the lab root#38
jordanauge wants to merge 1 commit into
mainfrom
fix/lab-context-parent-walk

Conversation

@jordanauge

@jordanauge jordanauge commented Aug 25, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • discover_lab_context() now walks up from the experiment YAML to the nearest lab-config.yaml, so libraries:/plugins: declarations apply regardless of nesting depth.
  • find_ancestor_with_file() in mas.library_roots is the single shared implementation of that walk; discover_lab_context(), _find_library_root(), and three other call sites all use it now.
  • "lab-config.yaml"/"library.yaml" are named constants (mas.runtime.constants) rather than literals repeated across 3 packages.

Test plan

  • New unit tests for find_ancestor_with_file() (basic match, multi-level walk, absent case, suffix-boundary behavior)
  • New unit tests for discover_lab_context()/_discover_lab_name() covering the nested-experiment regression and the "don't cross into an outer lab" boundary case
  • Verified against a real consumer: ioc-core-mas-lab's sre-triage.lab now resolves its step types via the plain dotted lib.steps.<name>:<ClassName> form, no relative-path workaround needed

discover_lab_context() now walks up from the experiment YAML to the
nearest lab-config.yaml, so libraries:/plugins: declarations apply
regardless of how deeply the experiment is nested under the lab root.

find_ancestor_with_file() in mas.library_roots is the single shared
implementation of that walk; discover_lab_context(), _find_library_root(),
and three other call sites all use it now. "lab-config.yaml"/
"library.yaml" are named constants (mas.runtime.constants) rather than
literals repeated across 3 packages.

Covered by new tests for both the helper and the nested-experiment case.
ioc-core-mas-lab's sre-triage.lab now resolves its step types via the
plain dotted lib.steps.<name>:<ClassName> form, no relative-path
workaround needed.

Signed-off-by: Jordan Augé <augjorda@cisco.com>
@jordanauge
jordanauge force-pushed the fix/lab-context-parent-walk branch from 5463ad1 to 6b77a29 Compare August 25, 2026 08:59
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.

1 participant