Skip to content

feat(core): add strict validation for with_vars conflicts(Fixes #688) - #689

Merged
Tsuyoposon merged 1 commit into
BrainPad:masterfrom
Tsuyoposon:688
Jun 23, 2026
Merged

feat(core): add strict validation for with_vars conflicts(Fixes #688)#689
Tsuyoposon merged 1 commit into
BrainPad:masterfrom
Tsuyoposon:688

Conversation

@Tsuyoposon

@Tsuyoposon Tsuyoposon commented Jun 19, 2026

Copy link
Copy Markdown
Collaborator

Brief

Fixes #688
This PR introduces a strict validation (fail-fast mechanism) when merging with_vars to prevent silent overwrites.

Previously, if the same with_vars key was defined in multiple places (e.g., across multiple common files passed to ScenarioManager, or between global and step scopes), the framework silently overwrote the value. This PR updates ScenarioModel and _BaseWithVars to explicitly raise an InvalidFormat exception whenever a with_vars conflict is detected.

Note: The shallow-merge behavior for step arguments remains unchanged.

Points to Check

  • Raised InvalidFormat in _BaseWithVars._merge_static_vars when there is a scope conflict between global and step levels.
  • Raised InvalidFormat in ScenarioModel.merge when there is a global with_vars conflict across multiple files.
  • Raised InvalidFormat in ScenarioModel._merge_step when there is a step-level with_vars conflict across multiple files.

Test

Confirmed

Updated test_model.py to cover both normal scenarios (successful merges without overlaps) and abnormal scenarios (triggering InvalidFormat on with_vars conflicts). All tests and lint.sh checks (including Black, isort, and flake8) passed successfully.

Review Limit

  • Around 06/30

@skxeve
skxeve self-requested a review June 19, 2026 06:16
@skxeve skxeve added the enhancement Improvement to an existing feature label Jun 19, 2026

@skxeve skxeve 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.

Thanks for your PR!
LGTM!

@Tsuyoposon
Tsuyoposon merged commit 4f4c76b into BrainPad:master Jun 23, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement Improvement to an existing feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add strict validation for with_vars conflicts to prevent silent overwrites

2 participants