Skip to content

Add wasm compiler integration tests with golden file comparison#16643

Merged
Mossaka merged 5 commits intomainfrom
feat/wasm-integration-tests
Feb 19, 2026
Merged

Add wasm compiler integration tests with golden file comparison#16643
Mossaka merged 5 commits intomainfrom
feat/wasm-integration-tests

Conversation

@Mossaka
Copy link
Collaborator

@Mossaka Mossaka commented Feb 18, 2026

Summary

  • Add comprehensive golden-file integration tests for the wasm compiler to verify YAML output correctness
  • Cover all 3 engine types (copilot, claude, codex) and various workflow configurations (16 fixtures total)
  • Add both Go-level string API tests and Node.js-level wasm binary tests
  • Integrate into Makefile and CI pipeline

What's included

Go golden tests (pkg/workflow/wasm_golden_test.go)

Test Purpose
TestWasmGolden_CompileFixtures Compiles 16 workflow fixtures via the string API (same code path as wasm) and compares against golden files
TestWasmGolden_CompileWithImports Tests import resolution via filesystem
TestWasmGolden_RoundTrip Verifies compilation determinism (compiles 3 times, compares)
TestWasmGolden_NativeVsStringAPI Informational comparison of native vs string API output differences
TestWasmGolden_AllEngines Verifies all 3 engine types compile successfully

16 test fixtures covering

  • Engines: copilot, claude, codex
  • Triggers: workflow_dispatch, issues, push, pull_request, schedule
  • Features: tools, safe-outputs, permissions, GitHub expressions, imports, network config, strict mode, dispatch inputs

Node.js wasm binary test (scripts/test-wasm-golden.mjs)

Builds the actual .wasm binary, loads it in Node.js using Go's wasm_exec.js, compiles all fixtures, and compares output against the Go golden files.

Makefile targets

make test-wasm-golden     # Run Go golden tests
make test-wasm            # Build wasm + run Node.js comparison
make update-wasm-golden   # Regenerate golden files

CI integration

Added to the existing build-wasm CI job:

  • Go string API golden test step
  • Node.js wasm binary golden test step

Key findings from NativeVsStringAPI comparison

The string API (wasm) path diverges from the native file-based path in expected ways:

  • Pre-activation job: String API includes a pre_activation job not present in native output
  • GH_AW_REQUIRED_ROLES: Empty in string API, populated in native (env var dependent)
  • Safe-outputs: Native path generates additional safe-output processing jobs

These differences are expected — the golden tests verify the string API/wasm path is self-consistent, not identical to the native path.

Test plan

  • All 16 fixtures compile successfully via string API
  • Golden files generated and verified (round-trip match)
  • Determinism test passes (3 compilations produce identical output)
  • Import resolution works via filesystem
  • All 3 engine types compile correctly
  • No regressions in existing unit tests (go test ./... -short passes)
  • Node.js wasm binary test (requires make build-wasm in CI)
  • CI pipeline validation

🤖 Generated with Claude Code


Changeset

  • Type: patch
  • Description: Add wasm compiler golden-file verification tests and CI steps so the wasm build stays validated against the fixtures.

Generated by Changeset Generator

Add a comprehensive test suite to verify the wasm compiler produces
correct YAML output by comparing against golden files.

## What's included

### Go golden tests (pkg/workflow/wasm_golden_test.go)
- TestWasmGolden_CompileFixtures: Compiles 16 workflow fixtures via the
  string API (same code path as wasm) and compares against golden files
- TestWasmGolden_CompileWithImports: Tests import resolution via filesystem
- TestWasmGolden_RoundTrip: Verifies compilation determinism (3 runs)
- TestWasmGolden_NativeVsStringAPI: Informational comparison of native
  vs string API output, logging differences without failing
- TestWasmGolden_AllEngines: Verifies copilot, claude, codex engines compile

### Test fixtures (16 workflows covering)
- All 3 engine types (copilot, claude, codex)
- Multiple trigger types (workflow_dispatch, issues, push, PR, schedule)
- Tool configurations, safe-outputs, permissions, expressions, imports
- Network configurations, strict mode, dispatch inputs

### Node.js wasm binary test (scripts/test-wasm-golden.mjs)
- Builds the actual wasm binary, loads in Node.js, compiles fixtures
- Compares wasm binary output against Go golden files

### Makefile targets
- make test-wasm-golden: Run Go golden tests
- make test-wasm: Build wasm + run Node.js comparison
- make update-wasm-golden: Regenerate golden files

### CI integration
- Added golden test + Node.js wasm test steps to build-wasm CI job

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings February 18, 2026 21:06
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds comprehensive golden-file integration tests for the wasm compiler to verify YAML output correctness. The implementation includes both Go-level string API tests and Node.js-level wasm binary tests, covering 16 workflow fixtures across 3 engine types (copilot, claude, codex) with various configurations.

Changes:

  • Added Go test suite (wasm_golden_test.go) with 5 test functions covering compilation, imports, determinism, API comparison, and all engines
  • Created Node.js test runner (test-wasm-golden.mjs) for wasm binary validation against golden files
  • Added 16 test fixtures covering different engines, triggers, and features (tools, safe-outputs, permissions, imports, expressions, strict mode)
  • Integrated tests into Makefile with new targets (test-wasm-golden, update-wasm-golden, test-wasm) and CI pipeline

Reviewed changes

Copilot reviewed 38 out of 38 changed files in this pull request and generated no comments.

Show a summary per file
File Description
pkg/workflow/wasm_golden_test.go Main Go test suite with 5 test functions for wasm compiler validation
scripts/test-wasm-golden.mjs Node.js script to test actual wasm binary output against golden files
pkg/parser/virtual_fs_test_helpers.go Test helper for overriding file reading function
pkg/workflow/testdata/wasm_golden/fixtures/*.md 16 workflow fixtures covering various engine types, triggers, and features
pkg/workflow/testdata/wasm_golden/fixtures/shared/tools.md Shared import fixture for testing import resolution
pkg/workflow/testdata/wasm_golden/TestWasmGolden_CompileFixtures/*.golden Golden output files for each fixture
Makefile Added test targets for wasm golden tests and updated help documentation
.github/workflows/ci.yml Integrated wasm golden tests into CI pipeline

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Go 1.24+ moved wasm_exec.js from misc/wasm/ to lib/wasm/. Update the
test script to check lib/wasm/ first with fallback to misc/wasm/ for
older Go versions, matching the pattern already used in bundle-wasm-docs.sh.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…orts

- Wasm API: accept optional filename parameter (3rd arg) so
  GH_AW_WORKFLOW_FILE matches golden files
- JS test: pass fixture filename and virtual files for import resolution
- Lint: remove unused abs() function, add nolint for golden comparison
  (exact string match is intentional for golden tests)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@pelikhan
Copy link
Contributor

@copilot keep working

Copy link
Contributor

Copilot AI commented Feb 19, 2026

@pelikhan I've opened a new pull request, #16694, to work on those changes. Once the pull request is ready, I'll request review from you.

@github-actions
Copy link
Contributor

🧪 Smoke Project is now testing project operations...

@github-actions
Copy link
Contributor

github-actions bot commented Feb 19, 2026

✨ The prophecy is fulfilled... Smoke Codex has completed its mystical journey. The stars align. 🌟

@github-actions
Copy link
Contributor

📰 BREAKING: Smoke Copilot is now investigating this pull request. Sources say the story is developing...

@github-actions
Copy link
Contributor

github-actions bot commented Feb 19, 2026

💫 TO BE CONTINUED... Smoke Claude failed! Our hero faces unexpected challenges...

@github-actions
Copy link
Contributor

🧪 Smoke Temporary ID is now testing temporary ID functionality...

@Mossaka Mossaka merged commit 02de894 into main Feb 19, 2026
88 of 92 checks passed
@Mossaka Mossaka deleted the feat/wasm-integration-tests branch February 19, 2026 01:21
@github-actions
Copy link
Contributor

Smoke Temporary ID encountered failures. Check the logs for details.

@github-actions
Copy link
Contributor

📰 DEVELOPING STORY: Smoke Copilot reports failed. Our correspondents are investigating the incident...

@github-actions
Copy link
Contributor

Smoke Project completed successfully. All project operations validated.

@github-actions
Copy link
Contributor

Smoke test summary
PRs: #16699 Remove GitHub API call from CLI initialization hot path
PRs: #16690 Add blocked pattern matching for add-labels and remove-labels
GitHub MCP: ✅
Serena MCP: ✅
Playwright: ✅
File write/read: ✅
Build (make build): ✅
Overall: PASS

🔮 The oracle has spoken through Smoke Codex for issue #16643

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

Comments