Repository navigation
test(ts): compare wasm32 aborts in the differential - #393
Conversation
Quest-Claim: 9c7c5e02b69f7e78
A trap without a panic hook's message is an abort natively, and the runtime's `RwLock` re-lock throws `rt.Abort`, so the lang differential compares the two by kind and keeps comparing panics by message. `locks::relock` now re-locks a mutex and a read-write lock through each guard, mapped or not. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars.
|
|
quest land removed this pull request from the queue: Conflicts with the base: ts/fixtures/lang/caller.ts |
|
codex / Codex land fixer: Compiling vsimd v0.8.0
Compiling oxc_sourcemap v9.0.0
Compiling escape-simd v0.1.0
Compiling winnow v1.0.4
Compiling outref v0.5.2
Compiling rustc-hash v2.1.3
Compiling toml_writer v1.1.3+spec-1.1.0
Compiling json-escape-simd v3.1.2
Compiling toml_parser v1.1.5+spec-1.1.0
Compiling base64-simd v0.8.0
Compiling syn v3.0.9
Compiling toml_datetime v1.1.2+spec-1.1.0
Compiling serde_spanned v1.1.2
Compiling toml v1.1.8+spec-1.1.0
Compiling serde_derive v1.0.229
Compiling rust2-driver v0.0.0 (/work/driver)
error[E0463]: can't find crate for `rustc_driver`
--> /work/driver/src/lib.rs:10:1
|
10 | extern crate rustc_driver;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ can't find crate
|
= help: maybe you need to install the missing components with: `rustup component add rust-src rustc-dev llvm-tools-preview`
error[E0463]: can't find crate for `rustc_session`
--> /work/driver/src/lib.rs:11:1
|
11 | extern crate rustc_session;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't find crate
|
= help: maybe you need to install the missing components with: `rustup component add rust-src rustc-dev llvm-tools-preview`
For more information about this error, try `rustc --explain E0463`.
error: could not compile `rust2-driver` (lib) due to 2 previous errors
warning: build failed, waiting for other jobs to finish...
exec
/bin/bash -lc "python3 - <<'PY'
from pathlib import Path
p=Path('/work/ts/fixtures/lang/caller.ts')
s=p.read_text()
a=s.index('<<<<<<< HEAD\\n')
b=s.index('=======\\n',a)
c=s.index('>>>>>>> base\\n',b)
s=s[:a]+s[b+len('=======\\n'):c].replace('...mappedLocks, ...rwlocks','...mappedLocks, ...relocks, ...rwlocks')+s[c+len('>>>>>>> base\\n'):]
p.write_text(s)
PY
git add ts/fixtures/lang/caller.ts
git diff --check --cached" in /work
succeeded in 0ms:
exec
/bin/bash -lc 'cargo test --locked --package rust2-ts' in /work/ts
exited 101 in 6ms:
Compiling rust2-driver v0.0.0 (/work/driver)
error[E0463]: can't find crate for `rustc_driver`
--> /work/driver/src/lib.rs:10:1
|
10 | extern crate rustc_driver;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ can't find crate
|
= help: maybe you need to install the missing components with: `rustup component add rust-src rustc-dev llvm-tools-preview`
error[E0463]: can't find crate for `rustc_session`
--> /work/driver/src/lib.rs:11:1
|
11 | extern crate rustc_session;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't find crate
|
= help: maybe you need to install the missing components with: `rustup component add rust-src rustc-dev llvm-tools-preview`
For more information about this error, try `rustc --explain E0463`.
error: could not compile `rust2-driver` (lib) due to 2 previous errors
codex
The conflict can be resolved mechanically, but both build and tests stop with `error[E0463]: can't find crate for rustc_driver`. I’ll hand back PR #393 with that validation blocker and restore its branch unchanged.
exec
/bin/bash -lc "git merge --abort
python3 - <<'PY'
import json
from pathlib import Path
result=[{'number':393,'action':'handback','diagnosis':'Base conflicts in ts/fixtures/lang/caller.ts; preserving relocks and capacityCases resolves it mechanically, but from ts/ both "'`cargo build --locked --package rust2-ts` and `cargo test --locked --package rust2-ts` fail: "error[E0463]: can'"\\'t find crate for "'`rustc_driver`" (also rustc_session).'"','recommendation':'Provide the pinned nightly toolchain with rustc-dev; merge base preserving both case lists, then rerun the build and full package tests. PR branch left unchanged.'}]
Path('quest-land-result.json').write_text(json.dumps(result,indent=2)+'\\n')
PY
git status --short
git rev-parse pr-393" in /work
succeeded in 0ms:
?? quest-land-result.json
5c4cf2172096eae8add3b754775634f2d970a7b3
codex
PR #393 handed back: build and tests fail because `rustc_driver` and `rustc_session` are unavailable. The conflict is mechanically resolvable, but validation is blocked.
Branch unchanged. Result saved uncommitted in [quest-land-result.json](/work/quest-land-result.json).
tokens used
34,603
PR #393 handed back: build and tests fail because `rustc_driver` and `rustc_session` are unavailable. The conflict is mechanically resolvable, but validation is blocked.
Branch unchanged. Result saved uncommitted in [quest-land-result.json](/work/quest-land-result.json).
fixer result written
(written by codex / Codex) |
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
codex / Codex land fixer note:
(written by codex / Codex) |
|
codex / Codex land fixer: Conflicts with the base: ts/fixtures/lang/caller.ts, ts/fixtures/lang/expected/lib.ts, ts/fixtures/lang/expected/locks.ts, ts/fixtures/lang/src/locks.rs (written by codex / Codex) |
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Problem
The lang differential could not compare wasm32's aborts. std's
rtabort!traps without running the panic hook, so the native side saw an empty "panic" message where the runtime threwrt.Panic("rwlock locked for reading"). Fixtures avoided re-locking anRwLockwhile a guard held it (see #384 and #392). Completes quest/m3/ts-abort-differential.md.Approach
fixtures/wasm.rskeeps the hook's message as anOption, andmessage()returns null when no hook ran.Wasm.callreturns the outcome directly: the output,{ panic }, or"abort".rt.Abort, aPanicsubclass named"Abort", is thrown where wasm32's std aborts. Today that isRwLock::readwhile written andRwLock::writewhile held.fatal runtime error: ..., aborting. Panics still compare by exact message. The summary line now counts aborts.locks::relocknow re-locks through every guard while the guard is held, then locks once more after it drops. A mutex guard taken bylockor bytry_lockpanics, since wasm32's mutex usesassert_eq!. A read-write lock is read or written again through a read guard, a write guard, a mapped guard of either, or a mapped guard's own map; this aborts unless both locks are reads.caller.tsruns all 16 picks.Lang differential:
656402 cases, 79299 panics, 9 aborts, 0 differences.A wrong classification fails the test. I ran each mutation against the same build (
node tests/differential.ts <wasm> <caller.ts> 0):rt.Panicforrwlock locked for readingnative abort/ts panic "rwlock locked for reading")rt.Abortfor the mutex re-locknative panic "assertion ... cannot recursively acquire mutex ..."/ts abort)native panic ""/ts abort)Impact
rt.Abort. AnRwLocklocked again while held now throwsrt.Abortinstead of a plainrt.Panic, with the same message. It is stillinstanceof rt.Panic, so callers that catch panics are unchanged, and noMIGRATE.mdentry is needed. The README documents it.Wasm.callreturns theOutcome, andpanicMessageis gone.Choices made without the maintainer
rt.Abortextendsrt.Panic, so a caller that catches one catches both. The alternatives were a separateErrorclass, which callers catching onlyPanicwould miss, or aPaniccarrying std'sfatal runtime error: ..., abortingtext, which the differential would have to parse by prefix and could confuse with a user panic of that text.Abort's message isrtabort!'s argument, asPanic's is the payload, without std'sfatal runtime error:frame.locks::relockrather than adding a sibling case, so every re-lock lives in one function.Alternatives
showbranches make plain. The runs above record the evidence instead.Follow-ups
MutexGuard::map. Re-locking a mutex there is a panic on wasm32, not an abort, so it can test that directly. I left a comment on that PR.Review
quest review --base origin/main), gpt-6.1-sol, medium effort.origin/mainatfbc8410d(feat(ts): hold std's capacity guarantees for Vec, VecDeque, and BinaryHeap, with pushes untouched #372, fix(ffi): build the C++ test on Windows, and print paths as escape_ascii does #388, chore(quest): finish Kotlin bindings on Android in the nightly #389, feat(ts): translate the rest of a guard's methods #392, chore(quest): plan the 2026-11-01 follow-ups #395, chore(quest): plan the moq pin's way past moq-wasm and moq-tokio's recursion limit #396, chore(quest): plan the fresh-write shapes #394 left refused #399). The merge kept both sides' cases incaller.ts, combinedlocks.rs's module doc, regenerated snapshots, and dropped feat(ts): translate the rest of a guard's methods #392's wrong note onlocks::mutex_mappedthat relocking aMutexaborts (it panics on wasm32), as this PR already did forlocks::mapped. Three findings, all refuted: each is inuniffi/(templates/python/Async.py:27,dart/src/gen/objects.rs:313,dart/src/gen/types.rs:436), which this branch doesn't touch (git diff origin/main...HEAD -- uniffiis empty). The reviewer's base had moved toaf523c7b(fix(uniffi): port current binding ownership fixes #364), so it read fix(uniffi): port current binding ownership fixes #364's changes as reverted here.origin/mainat34a00df6(feat(ts): translate BufMut's provided writes through a &mut or a Box #401, feat(ts): translate a guard's downgrade, leak, and whole byte-array map #402, chore(quest): plan a crate's own double-ended, exact-size, and fused iterators #404, chore(quest): make the translated model moq's browser route, not a track beside WASM #405, chore(quest): plan a spike translating moq's codec to pure Go #408) against base05e8203f: no findings. The merge kept feat(ts): translate a guard's downgrade, leak, and whole byte-array map #402'sdowngradesandleaksbeside this PR'srelocksincaller.ts, combinedlocks.rs's module doc, and regenerated the lang snapshots.just cipasses locally on70d22d65.🤖 Generated with Claude Code