Skip to content

Commit 76e0c23

Browse files
mo4islonaclaude
andcommitted
ci(portal): fix coverage path (fast-check + denominator), bump testTimeout, add skills symlink
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']. - vite.portal.config.ts: bump testTimeout 15000 -> 30000 as general headroom for the real-backoff head-probe tests + coverage instrumentation on a loaded CI box. - .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 76e0c23

3 files changed

Lines changed: 24 additions & 11 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: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,21 +14,24 @@ export default defineConfig({
1414
'src/sync-historical/portal*.test.ts',
1515
'src/sync-historical/realtime*.test.ts',
1616
],
17-
testTimeout: 15000,
17+
// 30s (not 15s): portal-shell's heavy fake-timer/retry tests run ~15s under coverage
18+
// instrumentation, which flakes on a loaded CI server. Give per-test headroom.
19+
testTimeout: 30000,
1820
// Coverage is scoped to the Portal layer (the whole diff vs upstream ponder). Inert on a plain
1921
// `--test` run: it only activates under `--coverage` (see scripts/sync-upstream.sh --coverage),
2022
// so the normal path needs no coverage provider installed.
2123
coverage: {
2224
provider: 'v8',
2325
reporter: ['json-summary', 'text-summary'],
2426
reportsDirectory: 'portal-coverage',
27+
// Match the copy step's GLOB (scripts/sync-upstream.sh: portal*.ts + realtime*.ts) so a
28+
// newly added Portal module is never silently dropped from the coverage denominator.
29+
// Tests are excluded so they don't inflate the numbers.
2530
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',
31+
'src/sync-historical/portal*.ts',
32+
'src/sync-historical/realtime*.ts',
3133
],
34+
exclude: ['**/*.test.ts'],
3235
},
3336
},
3437
});

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)