Skip to content

A used child's refusal is reported once - #2477

Merged
ccheever merged 3 commits into
expo:mainfrom
Weesofficial:contract-child-refused-once
Dec 1, 2026
Merged

ccheever merged 3 commits into
expo:mainfrom
Weesofficial:contract-child-refused-once

Conversation

@Weesofficial

@Weesofficial Weesofficial commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor

Stacked on #2476 (the lifted names PR): it adds to the same test module in contract/analyze/src/lib.rs, and without it the copy kept for send twice and then self send is the root's, which prints the hashed name. Only the last commit here is new.

In check_all, check_mutation_then and sends::check run on the expanded root (ci == 0) and then again on each authored child, so one mistake in a used child produces two identical refusals at one span, and the CLI prints both. cli/tests/it/mutation.rs's a_send_twice_is_found_through_a_tail_call_once shows the intended behaviour is once.

component App
  view
    Child()
component Child
  state n = 0
  mutation m as shape string then after
  action after(x: number)
    n = x
  view
    text "x"
Diagnostic in a used child Before After
analyze-handler-arity (7:30, after takes 1 parameter) printed twice once
analyze-send-twice twice once
analyze-then-self-send twice once

Fix: at the end of check_all, keep only the first error for each (id, span) (4 lines), as sends::check already de-duplicates by span within itself.

Test: lifted_child_tests::a_used_childs_refusal_is_reported_once (the three diagnostics), failing without the fix. cargo test -p contract-analyze -p contract-checking, the related CLI it groups (queue, calls, match_guards, diagnostics, mutation, child_state_lifetime, recovery), clippy with -D warnings, fmt and scripts/caps.mjs pass.

When the root uses a child component, check_all reads the expanded root, where the child's declarations are lifted and renamed name#<hash>. Several analysis diagnostics took their names from there without contract_syntax::inline::calls::shown, so the author saw `m#ac4664e4...5d74`, and analyze-send-twice even suggested writing `mutation m#... queue`, which is not Contract. analyze-send-twice, analyze-send-assigned, analyze-then-self-send, analyze-task-gate-clock, analyze-sequence-clock and analyze-change-cycle now pass their names through shown().
check_mutation_then and sends::check ran on the expanded root and again on each authored child, so one mistake in a used child (handler arity, send twice, then self send) was refused twice at the same span; cli/tests/it/mutation.rs a_send_twice_is_found_through_a_tail_call_once shows the intended once. check_all now keeps the first error for each (id, span), as sends::check already does within itself.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Dec 1, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-12-01T11:08:41.097787Z a5f588c PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

# Conflicts:
#	contract/analyze/src/lib.rs
@ccheever
ccheever merged commit 9ca1871 into expo:main Dec 1, 2026
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.

2 participants