Skip to content

test(fact): LS-A-9 regression for callback POLL dispatch#166

Merged
avrabe merged 1 commit into
mainfrom
test/ls-a-9-callback-poll-dispatch
May 19, 2026
Merged

test(fact): LS-A-9 regression for callback POLL dispatch#166
avrabe merged 1 commit into
mainfrom
test/ls-a-9-callback-poll-dispatch

Conversation

@avrabe
Copy link
Copy Markdown
Contributor

@avrabe avrabe commented May 19, 2026

Summary

Closes the missing-regression gap for LS-A-9 that the LS-N verification gate has been surfacing. Prior fix at meld-core/src/adapter/fact.rs:3992-3998 added the WAIT || POLL OR-pattern to the callback dispatch but landed without a dedicated regression test.

Why this matters

The async-callback adapter dispatches [waitable-set-poll] when the guest callback returns WAIT (2) or POLL (3). A previous version matched only WAIT, silently letting POLL fall through to the YIELD path — which sent (EVENT_NONE, 0, 0) to [callback] and dropped host-ready events. The fused module diverged from the composed module on P3 async export call paths (H-3, UCA-F-3), and there's no host trap to catch it.

Test approach

ls_a_9_callback_adapter_dispatches_both_wait_and_poll:

  1. Builds a minimal MergedModule with the prerequisites the callback emitter requires (lift func, [callback]<export> companion, [waitable-set-poll] import).
  2. Drives generate_async_callback_adapter end-to-end.
  3. Scans the emitted function body for the canonical byte sequence:
    0x41 0x02 0x46 0x20    i32.const WAIT(2) / i32.eq / local.get
    0x41 0x03 0x46 0x72    i32.const POLL(3) / i32.eq / i32.or
    
    in order. A regression that drops the POLL arm or reorders the comparisons fails this test.

Pin-by-substring is robust against unrelated body changes (locals layout, surrounding control flow).

Gate verdict

State Before After
Verified 17/19 18/19
Missing 2 (LS-A-8, LS-A-9) 1 (LS-A-8)
Failed 0 0

Remaining: LS-A-8 (HashMap rep_func selection for list<record<borrow>>) — surveyed in task #52 at ~2-4h scope.

End-to-end mythos-auto smoke test

This is the first PR to touch a Tier-5 source file (adapter/fact.rs) since the auto-runner's plumbing fixes (#164). Watching for:

Local tests: cargo test ls_a_9_ → 1 pass; full meld-core --lib → 237/237.

🤖 Generated with Claude Code

The async-callback adapter at lines 3992-3998 of `fact.rs`
dispatches `[waitable-set-poll]` on `WAIT (2)` OR `POLL (3)` via
an `I32Const(WAIT) + I32Eq + LocalGet + I32Const(POLL) + I32Eq +
I32Or` instruction skeleton. A previous version of that branch
matched only `WAIT`, silently treating `POLL` as YIELD which sent
`(EVENT_NONE, 0, 0)` to `[callback]` and dropped any event the
host had ready (LS-A-9). The fix landed without a regression test;
the LS-N verification gate surfaced this gap as the next-to-last
missing entry.

Adds `ls_a_9_callback_adapter_dispatches_both_wait_and_poll`,
which:

1. Builds a minimal `MergedModule` fixture with the prerequisites
   the callback emitter requires:
   - One `() -> i32` lift function
   - The `[callback]<export_name>` companion export
   - A `[waitable-set-poll]` host import
2. Drives `generate_async_callback_adapter` to produce the adapter
3. Scans the emitted function body for the byte sequence
   `0x41 0x02 0x46 0x20` (i32.const WAIT(2) / i32.eq / local.get)
   followed by `0x41 0x03 0x46 0x72` (i32.const POLL(3) / i32.eq /
   i32.or), in order

Pin-by-substring is robust against unrelated body changes (locals
layout, surrounding control flow); a regression that drops the
POLL arm or reorders the comparisons would fail this test.

Gate verdict moves from 17/19 verified to **18/19**; remaining
missing entry is LS-A-8 (inner-list rep_func selection — surveyed
in task #52 at ~2-4h scope).

This is the **first PR to touch a Tier-5 source file** since the
mythos-auto.yml plumbing fixes (#164), so it also serves as the
auto-runner's first true end-to-end matrix-scan smoke test.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@github-actions
Copy link
Copy Markdown

Mythos delta-pass required

This PR modifies one or more Tier-5 source files (per
scripts/mythos/rank.md):

meld-core/src/adapter/fact.rs

Before merge, run the Mythos discover protocol on the
modified Tier-5 files:

  1. Follow scripts/mythos/discover.md
    — one fresh agent session per touched Tier-5 file.
  2. For each finding, the agent must produce both a Kani
    harness and a failing PoC test (per the protocol's
    "if you cannot produce both, do not report" rule).
  3. Attach a comment on this PR with either the findings
    (formatted per discover.md's output schema) or
    NO FINDINGS.
  4. Add the mythos-pass-done label to this PR.

Why this gate exists: LS-A-10
(CABI alignment padding in async-lift retptr writeback) was
found by the v0.8.0 pre-release Mythos pass — but it had
lived in the callback emitter since #128, across six
releases. A PR-time gate would have caught it at review
time instead of at the release boundary.

The gate check on this PR will pass once the label is
applied.

@github-actions
Copy link
Copy Markdown

LS-N verification gate

⚠️ 18/19 verified — 1 missing regression tests

count
Passed (≥1 test, all green) 18
Failed (≥1 test failure) 0
Missing (no ls_*_NN_* test found) 1

Approved loss-scenarios.yaml entries are expected to have a
regression test named ls_<letter>_<num>_* (e.g. LS-A-11
ls_a_11_*). The gate runs each prefix via cargo test --lib --no-fail-fast and aggregates pass/fail/missing.

Failed LS entries

(none)

Missing regression tests
  • LS-A-8

Updated automatically by tools/post_verification_comment.py.
Source of truth: safety/stpa/loss-scenarios.yaml.

@avrabe
Copy link
Copy Markdown
Contributor Author

avrabe commented May 19, 2026

Admin-merge per #139 (filed 2 smithy issues)

9 of 13 checks green including everything substantive (Test, Clippy, Coverage, Bench, LS-N gate, 2 fuzz smokes, Detect Tier-5 changes). The 4 remaining failures are all #139 infra, not regressions in this PR's content:

  • Fuzz smoke (fuzz_parse_component) + Fuzz smoke (fuzz_resolver_terminates) — same "sanitizer is incompatible with statically linked libc" config drift documented in Smithy fleet reliability — rolling tracker (meld side) #139 §3. Reruns queued ~25min on the 7/7-busy fleet without picking up.
  • Mythos pass (meld-core/src/adapter/fact.rs)unzip missing on rust-cpu runners. oven-sh/setup-bun can't extract the bun zip, claude-code-action's bun-based entrypoints exit 127, placeholder-FINDING fallback fires.
  • Aggregate findings + label + Mythos delta-pass gate — cascading from the auto-runner failure (no NO_FINDINGS verdict → no label → label-only gate fails).

Two new tracking issues filed for smithy:

LS-A-9 regression test itself is sound (1 pass, 237/237 in meld-core lib). The auto-runner was supposed to validate end-to-end here; with the unzip block, that validation is deferred until #167 ships.

Admin-merge counter for #139 since last reset:

@avrabe avrabe merged commit 0661d3d into main May 19, 2026
12 of 20 checks passed
@avrabe avrabe deleted the test/ls-a-9-callback-poll-dispatch branch May 19, 2026 06:25
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