Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 14 additions & 13 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,16 @@ jobs:
shared-key: conformance
cache-all-crates: true
save-if: ${{ github.ref == 'refs/heads/main' }}
- name: Install the component-test tools at the pinned revision
# Owns the rev derivation, the rev-keyed tools cache, the
# install, and the pins gate; the justfile's _ct-tools
# recognizes the stamped install and does not repeat it.
uses: polymorph-components/polymorph-test/actions/setup@76c094576076284c1a7d0ea1b7bb724e9e7384a5
with:
tools: component-test-cli
js-locks: |
conformance/driver-ct/jco/pnpm-lock.yaml
js/componentize/wpt/parity/pnpm-lock.yaml
- uses: pnpm/action-setup@v4
with:
version: 10.34.5
Expand Down Expand Up @@ -116,21 +126,11 @@ jobs:
# the same aggregate; this re-runs it through component-test's
# composite action for the job summary and finding annotations,
# with the prebuilt CLI so aggregation semantics cannot skew from
# the pin. `uses:` cannot interpolate, so the ref is a literal
# rev; the guard keeps it on the Cargo.lock pin.
- name: Check the aggregate action ref matches the pin
if: always()
run: |
rev=$(grep -m1 -A2 '^name = "component-test-sdk"' Cargo.lock | grep -oE '[0-9a-f]{40}' | head -1)
test -n "$rev"
if grep -E 'polymorph-test/actions/aggregate@[0-9a-f]{40}' .github/workflows/ci.yml | grep -qv "@$rev"; then
echo "aggregate action ref skew: not at the Cargo.lock rev $rev" >&2
exit 1
fi

# the pin. The action's cargo-lock input polices the `uses:` ref
# against the pin.
- name: Publish the conformance matrix
if: always() && hashFiles('conformance/driver-ct/results/*.jsonl') != ''
uses: polymorph-components/polymorph-test/actions/aggregate@824d100349dc7804c9bf1723d9b1ba0ed40fa940
uses: polymorph-components/polymorph-test/actions/aggregate@76c094576076284c1a7d0ea1b7bb724e9e7384a5
with:
lock: conformance/guest-ct/tests.lock
manifest: conformance/driver-ct/targets.toml
Expand All @@ -141,6 +141,7 @@ jobs:
jco-browser=conformance/driver-ct/results/jco-browser.jsonl
summary-title: Conformance matrix
cli: target/ct-tools/bin/component-test
cargo-lock: Cargo.lock

- name: Upload conformance matrix
if: always()
Expand Down
14 changes: 7 additions & 7 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ default-members = [
# `cargo update component-test-sdk component-test-runner` and
# `pnpm --dir conformance/driver-ct/jco install`; the _ct-tools pins
# gate and the CI ref guard fail on skew.
component-test-sdk = { git = "https://github.com/polymorph-components/polymorph-test", rev = "824d100349dc7804c9bf1723d9b1ba0ed40fa940" }
component-test-runner = { git = "https://github.com/polymorph-components/polymorph-test", rev = "824d100349dc7804c9bf1723d9b1ba0ed40fa940" }
component-test-sdk = { git = "https://github.com/polymorph-components/polymorph-test", rev = "76c094576076284c1a7d0ea1b7bb724e9e7384a5" }
component-test-runner = { git = "https://github.com/polymorph-components/polymorph-test", rev = "76c094576076284c1a7d0ea1b7bb724e9e7384a5" }
anyhow = "1"
bytes = "1"
futures = "0.3"
Expand Down
48 changes: 13 additions & 35 deletions conformance/driver-ct/jco/harness.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@

import { envelope, inventoryLookup, runCases } from "@polymorph/component-test-js/harness";
import { Context } from "@polymorph/component-test-js/context";
import {
bindImports as bindCoreImports,
envInterface,
} from "@polymorph/component-test-js/imports";

// The single-attempt wall bound per case, matching the wasmtime leg's
// --case-timeout: a wedged case is reported (limit-exceeded provenance),
Expand All @@ -30,45 +34,19 @@ import { Context } from "@polymorph/component-test-js/context";
const CASE_TIMEOUT_MS = 60_000;

/**
* The suite's import object, both key spellings (the generated code
* mixes versioned and unversioned): the SUT host, the test-context
* provider (upstream's), the config environment, and the wasi shims.
* The suite's import object over the upstream builder: the SUT host,
* the test-context provider, the config environment, and the wasi
* shims.
*/
export function bindImports({ connections, env, cli, clocks, io }) {
const imports = {};
const bind = (name, impl) => {
imports[name] = impl;
const versioned = name.startsWith("wasi:") ? `${name}@0.2.0` : `${name}@0.1.0`;
imports[versioned] = impl;
};
bind("polymorph:websocket/connections", connections);
bind("polymorph:test/test-context", { Context });
bind("wasi:cli/environment", envInterface(env));
bind("wasi:cli/exit", cli.exit);
bind("wasi:cli/stdin", cli.stdin);
bind("wasi:cli/stdout", cli.stdout);
bind("wasi:cli/stderr", cli.stderr);
bind("wasi:cli/terminal-input", cli.terminalInput);
bind("wasi:cli/terminal-output", cli.terminalOutput);
bind("wasi:cli/terminal-stdin", cli.terminalStdin);
bind("wasi:cli/terminal-stdout", cli.terminalStdout);
bind("wasi:cli/terminal-stderr", cli.terminalStderr);
bind("wasi:clocks/monotonic-clock", clocks.monotonicClock);
bind("wasi:clocks/wall-clock", clocks.wallClock);
bind("wasi:io/error", io.error);
bind("wasi:io/poll", io.poll);
bind("wasi:io/streams", io.streams);
return imports;
return bindCoreImports({
wasi: { cli, clocks, io },
env,
sut: { "polymorph:websocket/connections": connections },
});
}

/** One environment interface for both legs (explicit > shim-internal). */
export function envInterface(vars) {
return {
getEnvironment: () => vars,
getArguments: () => [],
initialCwd: () => undefined,
};
}
export { envInterface };

/**
* Run the whole suite through the upstream case loop. `newInstance()`
Expand Down
4 changes: 2 additions & 2 deletions conformance/driver-ct/jco/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@
"description": "jco legs (Node + headless browser) for the component-test conformance suite: transpile the suite, bind the browser-first host and the test-context shim, emit component-test results JSONL.",
"packageManager": "pnpm@10.34.5",
"scripts": {
"transpile": "node ../../../scripts/jco-transpile.mjs transpile ../../../target/wasm32-wasip2/release/conformance_guest_ct.wasm --name conformance-guest-ct -I async -o generated",
"transpile": "component-test-jco-transpile transpile ../../../target/wasm32-wasip2/release/conformance_guest_ct.wasm --name conformance-guest-ct -I async -o generated",
"run:node": "node --experimental-wasm-jspi run-node.mjs",
"run:browser": "node run-browser.mjs"
},
"devDependencies": {
"@bytecodealliance/jco-transpile": "https://github.com/lann/jco/releases/download/jco-transpile-0.6.2-fa6990d/bytecodealliance-jco-transpile-0.6.2.tgz",
"@bytecodealliance/preview2-shim": "^0.17.2",
"@polymorph/component-test-js": "github:polymorph-components/polymorph-test#824d100349dc7804c9bf1723d9b1ba0ed40fa940",
"@polymorph/component-test-js": "github:polymorph-components/polymorph-test#76c094576076284c1a7d0ea1b7bb724e9e7384a5",
"playwright-core": "^1.61.1"
},
"engines": {
Expand Down
11 changes: 6 additions & 5 deletions conformance/driver-ct/jco/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions conformance/driver-ct/jco/run-browser.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ const IMPORT_MAP = JSON.stringify({
imports: {
"@polymorph/component-test-js/harness": "/ct/harness.mjs",
"@polymorph/component-test-js/context": "/ct/context.js",
"@polymorph/component-test-js/imports": "/ct/imports.mjs",
},
});

Expand Down
20 changes: 12 additions & 8 deletions conformance/driver-ct/justfile
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,18 @@ build-driver:
_ct-tools:
#!/usr/bin/env bash
set -euo pipefail
block="$(grep -m1 -A2 '^name = "component-test-sdk"' '{{root}}/Cargo.lock')"
rev="$(grep -oE '[0-9a-f]{40}' <<< "$block" | head -1)"
url="$(grep -oE 'git\+[^?"]+' <<< "$block" | head -1 | cut -c5-)"
{ [ -n "$rev" ] && [ -n "$url" ]; } || { echo "no component-test git source in Cargo.lock" >&2; exit 1; }
cargo install --locked --git "$url" --rev "$rev" \
component-test-cli --root '{{root}}/target/ct-tools'
'{{ct_cli}}' pins --cargo-lock '{{root}}/Cargo.lock' \
--js-lock jco/pnpm-lock.yaml --expect "$rev" > /dev/null
cd '{{root}}'
src=$(grep -m1 -A2 '^name = "component-test-sdk"' Cargo.lock | grep '^source = "git+')
url=$(printf '%s' "$src" | sed -E 's/^source = "git\+([^?]+)\?.*/\1/')
rev=$(printf '%s' "$src" | grep -oE '[0-9a-f]{40}' | head -n1)
if [ ! -x target/ct-tools/bin/component-test ] || [ "$(cat target/ct-tools/.rev 2>/dev/null)" != "$rev" ]; then
cargo install --locked --root target/ct-tools --git "$url" --rev "$rev" component-test-cli
printf '%s' "$rev" > target/ct-tools/.rev
fi
target/ct-tools/bin/component-test pins --cargo-lock Cargo.lock \
--js-lock conformance/driver-ct/jco/pnpm-lock.yaml \
--js-lock js/componentize/wpt/parity/pnpm-lock.yaml \
--expect "$rev" > /dev/null

build-echod:
cargo build --manifest-path {{root}}/Cargo.toml -p conformance-echod
Expand Down
7 changes: 4 additions & 3 deletions js/componentize/wpt/parity/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
"description": "WPT parity gate: the vendored WebSocket suites run directly against the platform's WebSocket (baseline) and through the componentized shim transpiled by jco against websocket-jco (round trip); compare.mjs holds the round trip to the baseline's pass set.",
"packageManager": "pnpm@10.34.5",
"scripts": {
"transpile": "node ../../../../scripts/jco-transpile.mjs transpile ../build/parity-runner.component.wasm --name parity-runner --async-mode jspi --map 'polymorph:websocket/*@0.1.0=../../../../jco/websocket.js#*' --map 'wpt:parity/reporter@0.1.0=../../reporter.js#reporter' -o generated",
"transpile:web": "node ../../../../scripts/jco-transpile.mjs transpile ../build/parity-runner.component.wasm --name parity-runner --async-mode jspi --map 'polymorph:websocket/*@0.1.0=../../../../jco/websocket.js#*' --map 'wpt:parity/reporter@0.1.0=../../reporter.js#reporter' --map 'wasi:cli/*=../node_modules/@bytecodealliance/preview2-shim/dist/browser/cli.js#*' --map 'wasi:clocks/*=../node_modules/@bytecodealliance/preview2-shim/dist/browser/clocks.js#*' --map 'wasi:filesystem/*=../node_modules/@bytecodealliance/preview2-shim/dist/browser/filesystem.js#*' --map 'wasi:io/*=../node_modules/@bytecodealliance/preview2-shim/dist/browser/io.js#*' --map 'wasi:random/*=../node_modules/@bytecodealliance/preview2-shim/dist/browser/random.js#*' --map 'wasi:sockets/*=../sockets-stub.mjs#*' -o generated-web",
"transpile:smoke": "node ../../../../scripts/jco-transpile.mjs transpile ../build/smoke.component.wasm --name smoke --async-mode jspi --map 'polymorph:websocket/*@0.1.0=../../../../jco/websocket.js#*' --map 'wpt:parity/reporter@0.1.0=../../reporter.js#reporter' -o generated-smoke",
"transpile": "component-test-jco-transpile transpile ../build/parity-runner.component.wasm --name parity-runner --async-mode jspi --map 'polymorph:websocket/*@0.1.0=../../../../jco/websocket.js#*' --map 'wpt:parity/reporter@0.1.0=../../reporter.js#reporter' -o generated",
"transpile:web": "component-test-jco-transpile transpile ../build/parity-runner.component.wasm --name parity-runner --async-mode jspi --map 'polymorph:websocket/*@0.1.0=../../../../jco/websocket.js#*' --map 'wpt:parity/reporter@0.1.0=../../reporter.js#reporter' --map 'wasi:cli/*=../node_modules/@bytecodealliance/preview2-shim/dist/browser/cli.js#*' --map 'wasi:clocks/*=../node_modules/@bytecodealliance/preview2-shim/dist/browser/clocks.js#*' --map 'wasi:filesystem/*=../node_modules/@bytecodealliance/preview2-shim/dist/browser/filesystem.js#*' --map 'wasi:io/*=../node_modules/@bytecodealliance/preview2-shim/dist/browser/io.js#*' --map 'wasi:random/*=../node_modules/@bytecodealliance/preview2-shim/dist/browser/random.js#*' --map 'wasi:sockets/*=../sockets-stub.mjs#*' -o generated-web",
"transpile:smoke": "component-test-jco-transpile transpile ../build/smoke.component.wasm --name smoke --async-mode jspi --map 'polymorph:websocket/*@0.1.0=../../../../jco/websocket.js#*' --map 'wpt:parity/reporter@0.1.0=../../reporter.js#reporter' -o generated-smoke",
"baseline": "node baseline.mjs",
"roundtrip": "node --experimental-wasm-jspi roundtrip.mjs",
"compare": "node compare.mjs"
Expand All @@ -19,6 +19,7 @@
"devDependencies": {
"@bytecodealliance/jco-transpile": "https://github.com/lann/jco/releases/download/jco-transpile-0.6.2-fa6990d/bytecodealliance-jco-transpile-0.6.2.tgz",
"@bytecodealliance/preview2-shim": "^0.19.0",
"@polymorph/component-test-js": "github:polymorph-components/polymorph-test#76c094576076284c1a7d0ea1b7bb724e9e7384a5",
"playwright-core": "^1.61.1"
}
}
10 changes: 10 additions & 0 deletions js/componentize/wpt/parity/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion justfile
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ check-js:
node --check conformance/driver-ct/jco/run-browser.mjs
node --check conformance/server/echod.mjs
node --check scripts/chrome.mjs
node --check scripts/jco-transpile.mjs
node --check examples/jco-demo/run.mjs
@echo "js: ok"

Expand Down
Loading
Loading