-
Notifications
You must be signed in to change notification settings - Fork 6
fix(test): restore strict parity assertions and add CI parity job #916
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
1f6ebab
2f9f450
f6172ef
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -134,6 +134,76 @@ jobs: | |
| STRIP_FLAG=$(node -e "const [M]=process.versions.node.split('.').map(Number); console.log(M>=23?'--strip-types':'--experimental-strip-types')") | ||
| node $STRIP_FLAG scripts/verify-imports.ts | ||
|
|
||
| parity: | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| os: [ubuntu-latest, macos-latest, windows-latest] | ||
|
|
||
| runs-on: ${{ matrix.os }} | ||
| name: Engine parity (${{ matrix.os }}) | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@v6 | ||
|
|
||
| - name: Setup Node.js | ||
| uses: actions/setup-node@v6 | ||
| with: | ||
| node-version: 22 | ||
|
|
||
| - name: Install dependencies | ||
| shell: bash | ||
| run: | | ||
| for attempt in 1 2 3; do | ||
| npm install && break | ||
| if [ "$attempt" -lt 3 ]; then | ||
| echo "::warning::npm install attempt $attempt failed, retrying in 15s..." | ||
| sleep 15 | ||
| else | ||
| echo "::error::npm install failed after 3 attempts" | ||
| exit 1 | ||
| fi | ||
| done | ||
|
|
||
| - name: Verify native addon is available | ||
| shell: bash | ||
| run: | | ||
| node -e " | ||
| const { createRequire } = require('node:module'); | ||
| const r = createRequire(require.resolve('./package.json')); | ||
| const os = require('os'); | ||
| const fs = require('fs'); | ||
| const plat = os.platform(); | ||
| const arch = os.arch(); | ||
| let libc = ''; | ||
| if (plat === 'linux') { | ||
| try { | ||
| const files = fs.readdirSync('/lib'); | ||
| libc = files.some(f => f.startsWith('ld-musl-') && f.endsWith('.so.1')) ? 'musl' : 'gnu'; | ||
| } catch { libc = 'gnu'; } | ||
| } | ||
| const pkgs = { | ||
| 'linux-x64-gnu': '@optave/codegraph-linux-x64-gnu', | ||
| 'linux-x64-musl': '@optave/codegraph-linux-x64-musl', | ||
| 'linux-arm64-gnu': '@optave/codegraph-linux-arm64-gnu', | ||
| 'linux-arm64-musl': '@optave/codegraph-linux-arm64-musl', | ||
| 'darwin-arm64': '@optave/codegraph-darwin-arm64', | ||
| 'darwin-x64': '@optave/codegraph-darwin-x64', | ||
| 'win32-x64': '@optave/codegraph-win32-x64-msvc', | ||
| }; | ||
| const key = libc ? plat + '-' + arch + '-' + libc : plat + '-' + arch; | ||
| const pkg = pkgs[key]; | ||
| if (!pkg) { console.error('No native package for ' + key); process.exit(1); } | ||
| try { r(pkg); console.log('Native addon loaded: ' + pkg); } | ||
| catch (e) { console.error('Failed to load ' + pkg + ': ' + e.message); process.exit(1); } | ||
| " | ||
|
|
||
| - name: Run parity tests | ||
| shell: bash | ||
| env: | ||
| CODEGRAPH_PARITY: '1' | ||
| run: npx vitest run tests/engines/ tests/integration/build-parity.test.ts --reporter=verbose | ||
|
|
||
| rust-check: | ||
| runs-on: ubuntu-latest | ||
| name: Rust compile check | ||
|
|
@@ -154,7 +224,7 @@ jobs: | |
|
|
||
| ci-pipeline: | ||
| if: always() | ||
| needs: [lint, test, typecheck, audit, verify-imports, rust-check] | ||
| needs: [lint, test, typecheck, audit, verify-imports, rust-check, parity] | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
The PR description explicitly states: "The parity job will fail until a new native binary is published from current source." Adding this job to Either coordinate the binary publish to happen before this PR merges, or use parity:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
continue-on-error: true # remove once updated binary is published
runs-on: ${{ matrix.os }}
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The parity job is now passing on all three platforms (ubuntu, macos, windows) — the native binary was published before CI ran. The That said, if this becomes an issue in the future (e.g. binary lags behind a source change), the coordinated approach is to publish the binary first. Adding |
||
| runs-on: ubuntu-latest | ||
| name: CI Testing Pipeline | ||
| steps: | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
isNativeAvailable()The verification step hardcodes
linux-x64→@optave/codegraph-linux-x64-gnu, butnative.ts'sresolvePlatformPackage()callsdetectLibc()and resolves tolinux-x64-muslon a musl host. On such a runner the step would succeed (gnu package loads), thenisNativeAvailable()would try the musl package (not installed), returnfalse, and the tests would silently skip — giving false confidence.The fix is to mirror the musl detection in the verification script, or simply invoke
isNativeAvailable()directly via a small Node script that importssrc/infrastructure/native.js:(Adjust the strip-types flag the same way
verify-importsdoes.)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in 2f9f450 — the verification script now mirrors the
detectLibc()logic fromnative.ts: on Linux, it reads/libforld-musl-*entries and resolves to the correct-gnuor-muslpackage. Also addedlinux-arm64-gnuandlinux-arm64-muslentries for completeness.The key-construction now uses
plat-arch-libcon Linux (matchingresolvePlatformPackage()) andplat-archon other platforms.