Skip to content

hotfix(codegen/js): handle Pattern::Or, Expr::Todo, Expr::Panic#720

Merged
danieljohnmorris merged 2 commits into
mainfrom
hotfix/js-codegen-new-variants
May 22, 2026
Merged

hotfix(codegen/js): handle Pattern::Or, Expr::Todo, Expr::Panic#720
danieljohnmorris merged 2 commits into
mainfrom
hotfix/js-codegen-new-variants

Conversation

@danieljohnmorris
Copy link
Copy Markdown
Collaborator

Summary

Main is broken — cargo build fails on E0004 non-exhaustive match in src/codegen/js.rs. PRs #706 (todo/panic, ILO-410) and #709 (| match alternatives, ILO-411) added new AST variants; #713 added src/codegen/js.rs without arms for them. Every PR's CI build job has been red since.

Diff

  • src/codegen/js.rs — match arms for the new variants
  • src/parser/mod.rs — drive-by clippy fixes
  • tests/capability_flags.rs — backfill missing env field on 4 Caps::Restricted literals
  • tests/regression_js_emit_new_variants.rs (new) — exercises all 3 variants
  • ai.txt — regenerated

Test plan

  • cargo build green
  • cargo clippy -- -D warnings clean
  • cargo fmt --check clean
  • new + capability_flags tests pass
  • CI green

Main is broken: PRs #706 (todo/panic) and #709 (or-pattern) added new
AST variants, then PR #713 added src/codegen/js.rs without arms for
them. Every PR's CI build job has been failing on E0004 non-exhaustive
match since.

Adds the missing arms:
- Pattern::Or → JS disjunction: `subj === a || subj === b`
- Expr::Todo → `(() => { throw new Error('TODO: ' + msg) })()`
- Expr::Panic → same shape with 'PANIC:' prefix

Drive-by clippy fixes in src/parser/mod.rs (needless return, saturating
sub) and tests/capability_flags.rs (missing `env` field after Caps
gained env-policy support).

Regression test: tests/regression_js_emit_new_variants.rs exercises all
three variants via `ilo --emit js`.

ai.txt regen included.
@danieljohnmorris danieljohnmorris added the mac-reviewing Currently being merge-prepped by mac-side agent label May 22, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented May 22, 2026

❌ 1 Tests Failed:

Tests completed Failed Passed Skipped
688 1 687 0
View the full list of 1 ❄️ flaky test(s)
ilo::interpreter::tests::interpret_braced_guard_in_loop_no_early_return

Flake rate in main: 100.00% (Passed 0 times, Failed 2 times)

Stack Traces | 0.011s run time
thread 'interpreter::tests::interpret_braced_guard_in_loop_no_early_return' (32889) panicked at src/interpreter/mod.rs:10202:9:
parse errors: [ParseError { code: "ILO-P003", position: 27, span: Span { start: 35, end: 36 }, message: "expected `{`, got `;`", hint: Some("ilo bodies are single-line, `;`-separated — not python/swift-style indented. Use either the brace-block form `name p:t>r;{body1;body2}` or the single-line form `name p:t>r;body1;body2`. For statements that require a block (`@k xs{...}`, `wh cond{...}`, `?subj{...}`), the `{...}` must be on the same line as the head.") }]
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

To view more test analytics, go to the Test Analytics Dashboard
📋 Got 3 mins? Take this short survey to help us improve Test Analytics.

@danieljohnmorris danieljohnmorris merged commit ec7e243 into main May 22, 2026
8 of 11 checks passed
@danieljohnmorris danieljohnmorris deleted the hotfix/js-codegen-new-variants branch May 22, 2026 10:25
danieljohnmorris added a commit that referenced this pull request May 22, 2026
hotfix(codegen/js): handle Pattern::Or, Expr::Todo, Expr::Panic
danieljohnmorris added a commit that referenced this pull request May 22, 2026
hotfix(codegen/js): handle Pattern::Or, Expr::Todo, Expr::Panic
danieljohnmorris added a commit that referenced this pull request May 22, 2026
hotfix(codegen/js): handle Pattern::Or, Expr::Todo, Expr::Panic
danieljohnmorris added a commit that referenced this pull request May 22, 2026
hotfix(codegen/js): handle Pattern::Or, Expr::Todo, Expr::Panic
danieljohnmorris added a commit that referenced this pull request May 22, 2026
hotfix(codegen/js): handle Pattern::Or, Expr::Todo, Expr::Panic
danieljohnmorris added a commit that referenced this pull request May 22, 2026
hotfix(codegen/js): handle Pattern::Or, Expr::Todo, Expr::Panic
danieljohnmorris added a commit that referenced this pull request May 22, 2026
hotfix(codegen/js): handle Pattern::Or, Expr::Todo, Expr::Panic
danieljohnmorris added a commit that referenced this pull request May 22, 2026
hotfix(codegen/js): handle Pattern::Or, Expr::Todo, Expr::Panic
danieljohnmorris added a commit that referenced this pull request May 22, 2026
hotfix(codegen/js): handle Pattern::Or, Expr::Todo, Expr::Panic
danieljohnmorris added a commit that referenced this pull request May 22, 2026
hotfix(codegen/js): handle Pattern::Or, Expr::Todo, Expr::Panic
danieljohnmorris added a commit that referenced this pull request May 22, 2026
hotfix(codegen/js): handle Pattern::Or, Expr::Todo, Expr::Panic
danieljohnmorris added a commit that referenced this pull request May 22, 2026
hotfix(codegen/js): handle Pattern::Or, Expr::Todo, Expr::Panic
danieljohnmorris added a commit that referenced this pull request May 22, 2026
hotfix(codegen/js): handle Pattern::Or, Expr::Todo, Expr::Panic
danieljohnmorris added a commit that referenced this pull request May 22, 2026
hotfix(codegen/js): handle Pattern::Or, Expr::Todo, Expr::Panic
danieljohnmorris added a commit that referenced this pull request May 22, 2026
hotfix(codegen/js): handle Pattern::Or, Expr::Todo, Expr::Panic
danieljohnmorris added a commit that referenced this pull request May 22, 2026
hotfix(codegen/js): handle Pattern::Or, Expr::Todo, Expr::Panic
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

mac-reviewing Currently being merge-prepped by mac-side agent

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant