Skip to content

test(explain): cover scalar inner-loop summaries - #990

Merged
Anand Krishnamoorthi (anakrish) merged 1 commit into
microsoft:mainfrom
snehabandla:test/explain-scalar-inner-loop
Nov 24, 2026
Merged

Anand Krishnamoorthi (anakrish) merged 1 commit into
microsoft:mainfrom
snehabandla:test/explain-scalar-inner-loop

Conversation

@snehabandla

Copy link
Copy Markdown
Collaborator

Summary

Clarify that an empty or non-collection loop input skips iteration body checks but can still produce a guarded loop-level Iteration check.

Extend the existing inner-loop tests with number, string and null inputs for both some and indexed loops inside every. Assert exactly one inner failure followed by the enclosing every failure, with the expected collection and source location, in both VM execution modes. Ordinary-loop controls emit no loop-level Iteration checks.

Compatibility

No runtime, public API or serialization changes.

Related

Follows #968.

Testing

  • Explanation-hook suite with default features and a minimal feature configuration.
  • Library and integration suites with explanations enabled and disabled.
  • cargo +1.95.0 fmt --all -- --check.
  • cargo +1.95.0 clippy --all-features --all-targets -- -D warnings.
  • cargo +1.95.0 clippy --no-default-features -- -D warnings.
  • cargo +1.95.0 test --doc --features explanations.

Clarify that skipped iteration bodies do not preclude guarded loop-level checks. Cover number, string and null inputs for some and indexed loops in every, retaining silent ordinary-loop controls in both VM execution modes.

Co-authored-by: Copilot <[email protected]>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

The tests can pass despite unexpected body-check events or incorrect provenance because they filter events and do not verify exact source coordinates.

2 open issues
What changed in this PR

Extends regression coverage for scalar loop inputs in RVM explanations and clarifies the documented behavior. No runtime, public API, or serialization changes are introduced.

Changes:

  • Add number, string, and null cases for some and indexed loops inside every, exercised in both VM execution modes.
  • Add scalar controls for ordinary loops that must not emit loop-level Iteration checks.
  • Clarify that skipped iteration bodies can still produce guarded loop-level checks.
File Description
tests/​rvm/​explain_hooks.rs Adds scalar inputs to inner-loop summary tests and ordinary-loop controls.
src/​explain/​recorder.rs Clarifies the distinction between iteration-body checks and loop-level checks.

Review effort: Max

Comment on lines +1231 to +1233
("42", Failure, Value::Undefined),
(r#""text""#, Failure, Value::Undefined),
("null", Failure, Value::Undefined),
Comment on lines +1231 to +1233
("42", Failure, Value::Undefined),
(r#""text""#, Failure, Value::Undefined),
("null", Failure, Value::Undefined),
@anakrish
Anand Krishnamoorthi (anakrish) merged commit 43461b5 into microsoft:main Nov 24, 2026
61 checks passed
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.

3 participants