Skip to content

fix(ir): treat comprehension guard filters as guards - #58

Merged
mremond merged 2 commits into
mainfrom
fm/task-6119f6a8
Nov 15, 2026
Merged

mremond merged 2 commits into
mainfrom
fm/task-6119f6a8

Conversation

@mremond

@mremond mremond commented Nov 15, 2026

Copy link
Copy Markdown
Member

Why

Raising guard-expression filters should reject an element instead of aborting the comprehension.

What changed

  • Guard-expression filters skip raising elements in list and binary comprehensions.
  • Leading and filter-only comprehensions use the same guard exception handling.
  • Ordinary filters, record updates, generator sources and bodies keep their exceptions.

Before and after

Before: A list containing two nonempty maps, one empty map and one atom aborted with badmap.

After: The same list returns its two nonempty maps, and its binary comprehension returns <<1,1>>.

This changes native program results, not an application screen; command-output comparisons demonstrate the behavior.

Checked

Live validation: Demonstrated for this version. 2 of 2 scenarios driven live in the product.

Scenario Result Evidence
Raising guard-expression filters skip elements in list and binary comprehensions. ✅ Passed live Actual native and BEAM outputs match for mixed maps, binary output, leading guards and arithmetic; the expanded regression completes.
Ordinary filter expressions retain their exceptions. ✅ Passed live Native and BEAM propagate badmap for ordinary maps:size and six record-update positions; the expanded regression covers ten exception controls.
  • Rust workspace and strict clippy: 2,205 tests passed, one release-only measurement ignored, and lint passed.
  • Complete native suite: 519 tests passed; two external-module cases were skipped.
  • Expanded regression stability: Ten consecutive native passes without retries, plus a single-scheduler pass and an unchanged BEAM pass.
  • Allocator and stacktrace probes: Both passed with the matching runtime and compiler.
  • Independent code review: Both findings were resolved; reviewed compiler and regression files remain unchanged after bringing the branch up to date.
How it was checked

cargo build --release --locked -j 4 -p nera-runtime; cargo build --release --locked -j 4

cargo clippy --workspace --all-targets --locked -j 4 -- -D warnings

cargo test --workspace --locked --no-fail-fast -j 4

python3 scripts/test-allocator-config.py; python3 scripts/test-stacktrace-order.py

./target/release/nera test -j 1 --timeout 30

./target/release/nera test comprehension_guard_filter -j 1 --timeout 30, ten consecutive runs; one further run with NERA_SCHEDULERS=1

Compiled and executed the same regression on OTP 29; native and BEAM output probes compared actual results and exception classes.

The source manifest matches all eight committed files; no runtime dependencies or signing material changed.

Risk

Risk: low in every dimension.

Full risk assessment
Dimension Level Why
Blast radius low Only comprehension filter lowering and shared guard classification change.
Behavior low Corrects guard failures while preserving ordinary exceptions.
Undo low Reverting the change needs no data or configuration migration.
Evidence low Native and BEAM behavior matches, with the full local gate passing.
Sensitivity low No sign-ins, keys, payments or saved data are involved.
Novelty low Reuses existing guard validation and exception lowering.
Dependencies low No dependency changes.

Pipeline

Updates from git push no-mistakes

Infinitary checked this version: an independent review that also judged the documents, and live validation the review accepted.

@github-actions github-actions Bot added this to the 0.1.1 milestone Nov 15, 2026
@mremond
mremond merged commit 5cb183b into main Nov 15, 2026
22 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.

1 participant