Skip to content

Commit ad4e54d

Browse files
mo4islonaclaude
andauthored
ci(portal): fix coverage path (fast-check + denominator), add skills symlink (#18)
Portal test-infra fixes exposed by the invariant-first refactor (#6); the S1 timeout itself is fixed separately by #19, so this no longer touches portal-shell.test.ts. - scripts/sync-upstream.sh: the --coverage branch never provisioned fast-check (only --test did), so the 5 property-test files failed with "Failed to load url fast-check" — the coverage path is broken on main today. Extract a shared provision_fastcheck() called by both branches; in --coverage AFTER `pnpm add` (which re-resolves node_modules and would prune the manually-copied tree). - vite.portal.config.ts: coverage `include` was a stale hand-list of 5 files; the refactor's 10 new portal-*.ts modules were silently dropped from the denominator. Switch to a glob matching the copy step (portal*.ts + realtime*.ts) with exclude ['**/*.test.ts']. - .claude/skills -> .agents/skills: a single directory-level symlink so any skill added under the tracked .agents/skills/ is picked up automatically (force-added past the .claude/ gitignore). Verified: --test 140/140; --coverage 140/140 (fast-check provisioned, 94.86% stmts / 85.11% branches / 95.89% funcs on the full glob denominator). Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
1 parent 8301386 commit ad4e54d

3 files changed

Lines changed: 21 additions & 10 deletions

File tree

.claude/skills

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../.agents/skills

portal/vite.portal.config.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,14 @@ export default defineConfig({
2222
provider: 'v8',
2323
reporter: ['json-summary', 'text-summary'],
2424
reportsDirectory: 'portal-coverage',
25+
// Match the copy step's GLOB (scripts/sync-upstream.sh: portal*.ts + realtime*.ts) so a
26+
// newly added Portal module is never silently dropped from the coverage denominator.
27+
// Tests are excluded so they don't inflate the numbers.
2528
include: [
26-
'src/sync-historical/portal.ts',
27-
'src/sync-historical/portal-transform.ts',
28-
'src/sync-historical/portal-realtime.ts',
29-
'src/sync-historical/portal-realtime-wire.ts',
30-
'src/sync-historical/realtime.ts',
29+
'src/sync-historical/portal*.ts',
30+
'src/sync-historical/realtime*.ts',
3131
],
32+
exclude: ['**/*.test.ts'],
3233
},
3334
},
3435
});

scripts/sync-upstream.sh

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -64,18 +64,24 @@ let n=0; for(const s of ['dependencies','devDependencies','peerDependencies']){
6464
fs.writeFileSync(pkgPath, JSON.stringify(pkg,null,2)+'\n'); console.log(' rewrote '+n+' workspace dep(s)');
6565
"
6666

67-
if [ "${2:-}" = "--test" ]; then
68-
# `fast-check` (property tests) is a DEV-ONLY dep of the clone — never a runtime dep of the published
69-
# package. We provision it straight into the core's node_modules rather than adding it to package.json,
70-
# because renaming the core to @subsquid/ponder orphans sibling workspace packages (e.g. benchmark's
71-
# `ponder@workspace:*`), so a lockfile re-resolve (which a new package.json dep would force) fails.
67+
# `fast-check` (property tests) is a DEV-ONLY dep of the clone — never a runtime dep of the published
68+
# package. We provision it straight into the core's node_modules rather than adding it to package.json,
69+
# because renaming the core to @subsquid/ponder orphans sibling workspace packages (e.g. benchmark's
70+
# `ponder@workspace:*`), so a lockfile re-resolve (which a new package.json dep would force) fails.
71+
# Both --test and --coverage need it (the property tests import fast-check), so it's a shared step.
72+
provision_fastcheck() {
7273
echo "▶ provisioning fast-check (dev-only, for the property tests)"
7374
# OUTSIDE the clone so npm doesn't walk up into the pnpm workspace root. Pinned exactly for
7475
# reproducible CI; the whole resolved tree is copied so transitive deps can never be missed.
76+
local FCDIR
7577
FCDIR="$(mktemp -d)"
7678
( cd "$FCDIR" && npm init -y >/dev/null 2>&1 && npm install --no-audit --no-fund --silent fast-check@3.23.2 )
7779
cp -R "$FCDIR/node_modules/." "$CORE/node_modules/"
7880
rm -rf "$FCDIR"
81+
}
82+
83+
if [ "${2:-}" = "--test" ]; then
84+
provision_fastcheck
7985
echo "▶ running Portal-layer tests"
8086
( cd "$CORE" && pnpm exec vitest run --config vite.portal.config.ts )
8187
fi
@@ -91,6 +97,9 @@ if [ "${2:-}" = "--coverage" ]; then
9197
echo "▶ installing @vitest/coverage-v8@$VITEST_VER (matching installed vitest)"
9298
( cd "$CORE" && $PNPM add -D "@vitest/coverage-v8@$VITEST_VER" --ignore-workspace )
9399

100+
# AFTER `pnpm add` — it re-resolves node_modules and would prune the manually-copied tree.
101+
provision_fastcheck
102+
94103
echo "▶ running Portal-layer tests with coverage"
95104
( cd "$CORE" && pnpm exec vitest run --config vite.portal.config.ts --coverage )
96105
echo "✓ coverage summary → $CORE/portal-coverage/coverage-summary.json"

0 commit comments

Comments
 (0)