Skip to content

Add cycle-detection for nested env vars#27

Merged
MikeGarde merged 1 commit into
mainfrom
fix/circular-logic
Jul 12, 2026
Merged

Add cycle-detection for nested env vars#27
MikeGarde merged 1 commit into
mainfrom
fix/circular-logic

Conversation

@MikeGarde

Copy link
Copy Markdown
Owner
  • Implement cycle detection in resolve_value by tracking seen results with a HashSet, seeded with the initial input to catch oscillations like A=${B} / B=${A}.
  • Replace the per-iteration previous-value check with a set-based bailout that stops when the new result is the same as the current one or has already been seen, ensuring safe termination.
  • Extend tests in tests/resolve_nested_variables.rs to cover circular dependencies, verifying two-way and three-way references terminate and leave unresolved placeholders intact (contain ${), i.e., graceful degradation.

- Implement cycle detection in `resolve_value` by tracking seen results with a `HashSet`, seeded with the initial input to catch oscillations like `A=${B}` / `B=${A}`.
- Replace the per-iteration previous-value check with a set-based bailout that stops when the new result is the same as the current one or has already been seen, ensuring safe termination.
- Extend tests in `tests/resolve_nested_variables.rs` to cover circular dependencies, verifying two-way and three-way references terminate and leave unresolved placeholders intact (contain `${`), i.e., graceful degradation.
@MikeGarde
MikeGarde merged commit 3c42fdf into main Jul 12, 2026
1 check passed
@codecov

codecov Bot commented Jul 12, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

Files with missing lines Coverage Δ
src/env_object.rs 80.48% <100.00%> (+0.48%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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