Skip to content

test(wasm): gate and report the WASM ABI apart from Rust coverage - #952

Open
owjs3901 wants to merge 1 commit into
mainfrom
test/wasm-abi-coverage
Open

owjs3901 wants to merge 1 commit into
mainfrom
test/wasm-abi-coverage

Conversation

@owjs3901

Copy link
Copy Markdown
Contributor

Summary

INF-04: Rust 100% 커버리지가 실제 JS/WASM ABI를 측정하지 않는 문제를 다룹니다.

wasm-bindgen 래퍼(importSheet, codeExtract, setModuleResolver 등)는 모두 cfg(not(tarpaulin_include))라서 tarpaulin이 경계를 세지 않습니다. 저장소에는 이미 두 엔진을 함께 검증하는 오라클이 있었지만(e2e/binding/identity.mjs, e2e/binding/validation.mjs) CI에서 WASM 대상으로 돌지 않았습니다(native-coverage는 네이티브만 실행).

  • e2e/binding/wasm-abi/run.mjs (bun run test:wasm-abi)
    • identity.mjs: 공개 코퍼스 25개 시나리오를 WASM, 네이티브 각각 3회 실행하고 기록을 바이트 단위로 비교합니다(ABI 이름, arity 검사 포함).
    • validation.mjs: 45개 인자 위치 × 267개 잘못된 입력을 두 엔진에서 실행하고, 같은 TypeError 메시지와 상태 불변을 확인합니다.
    • 두 실행이 끝나면 생성된 pkg/index.d.ts와 실제로 도달한 호출을 합쳐 ABI 커버리지 리포트를 Rust 커버리지와 따로 만듭니다. 결과는 step summary와 evidence 디렉터리의 abi-coverage.json에 남습니다.
  • e2e/binding/wasm-abi/coverage.mjs: 리포트 로직입니다. 다음 경우 실패합니다.
    • export 함수나 Output 멤버(getter, free, Symbol.dispose)가 한 번도 호출되지 않은 경우
    • .d.ts에 선언된 인자 위치에 rejection 케이스가 없는 경우
    • 선언 순서와 검증 순서가 다르거나, 사라진 파라미터에 대한 케이스, 오래된 예외 항목이 남은 경우
    • 현재 예외는 hasDevupUI.import_aliases 하나입니다. argument-validation.cjs가 검증하지 않는 위치라 사유와 함께 명시했습니다.
  • 현재 결과: 36/36 export와 Output 멤버 호출, 45/46 인자 위치 검증, 267 케이스, 두 엔진 534회 실행 전부 통과
  • CI: publish 검사 job에서 테스트 후 WASM ABI coverage 단계로 실행합니다(로컬 기준 약 1.5분). release/publish 동작은 변경하지 않았습니다.

packages/* 변경이 없어서 changepack은 추가하지 않았습니다.

Test plan

  • node --test e2e/binding/wasm-abi/coverage.test.mjs (7 pass)
  • bun run test:wasm-abi: 로컬 WASM, 네이티브 빌드로 identity PASS, validation 534/534, ABI 리포트 ok
  • bunx prettier --single-quote --no-semi --check e2e/binding/wasm-abi
  • CI publish job의 WASM ABI coverage 단계와 step summary 표 확인

Refs #683

🤖 Generated with Claude Code

Every wasm-bindgen wrapper is cfg(not(tarpaulin_include)), so the Rust
100% never measures the JS/WASM boundary. The existing identity and
validation oracles already drive it but nothing ran them against WASM.

test:wasm-abi runs both against the built WASM package next to the host
native addon (public corpus byte-identical across engines, every invalid
argument shape rejected with the same TypeError and no state change),
then joins the generated index.d.ts with what the runs reached: every
export and Output member must be called and every argument position
must have a rejection case, except documented exemptions. The table goes
to the CI step summary. The publish check job runs it after the tests.

Refs #683 (INF-04)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@codecov

codecov Bot commented Nov 15, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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