Test coverage: gate + nightly live tests for devnet/mainnet/mesa (#181) - #199
Test coverage: gate + nightly live tests for devnet/mainnet/mesa (#181)#199dkijania wants to merge 2 commits into
Conversation
…mesa Two gaps from the test-coverage audit (#181): no coverage threshold in CI, and no live integration tests against real per-network data (devnet existed only as a static dump; mainnet was one skipped endpoint; mesa had none). - Add a coverage gate to `test:coverage` via c8 `--check-coverage` (lines 50, functions 50, statements 50, branches 80). Current coverage (~53% lines, 95% branches) clears it; the floor blocks regressions and rises as the suite grows. - Add a `test:live-api` script that runs the live-api suite against `STAGING_GRAPHQL_ENDPOINT`. - Add the `Live Integration` workflow: nightly + manual, runs the live-api suite against devnet/mainnet/mesa using per-network repo variables (`*_ARCHIVE_API_URL`), skipping any network without a configured endpoint so it stays green until they're set. `fail-fast: false` keeps networks independent. - Document the setup and the remaining `actions`/successful-`zkappCommands` fixture work in the live-api README. Closes #181. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QSuak9smCHbp4N17xjjLF6
|
Thanks for pushing coverage forward here — the design is solid: scheduled-only (never on PRs), One heads-up before the Since the goal is catching real per-network drift, it'd help to gate the fixture-pinned env:
STAGING_GRAPHQL_ENDPOINT: ${{ steps.endpoint.outputs.url }}
LIVE_API_NETWORK: ${{ matrix.network }}// events.test.ts
const FIXTURE_NETWORK = 'mainnet'; // wherever the J1fu fixtures were captured
const canonical = process.env.LIVE_API_NETWORK === FIXTURE_NETWORK ? describe : describe.skip;
canonical('Canonical Chain', () => { /* the deepStrictEqual cases */ });To be clear, All nightly-only, so nothing blocks merges today — just flagging it so turning on the endpoints doesn't immediately light up part of the matrix. Thanks again for closing the coverage gap! |
…nnet Two problems that would have surfaced the moment the *_ARCHIVE_API_URL variables were set. The fixtures never reached the test. events.test.ts read them relative to __dirname, but the suite runs compiled out of build/ and tsc emits only JavaScript — the .json files stay in the source tree. So the read threw ENOENT at module load and took the whole file down before any test ran, on every network, not just two. Fixtures now resolve from the source tree via process.cwd(), matching tests/integration/setup.ts. The fixture-pinned cases only hold on one network. They deepStrictEqual against a captured stateHash / parentHash / eventData at fixed heights, so elsewhere they fail deterministically — drift-looking failures that aren't drift. Confirmed against the live networks: at blocks 433465–433466 this address returns exactly the fixture data on mainnet and nothing at all on devnet and mesa, so the fixtures are mainnet. They now run only there, with the matrix network passed in as LIVE_API_NETWORK; when it is unset (local runs) they still run, preserving current behaviour. Verified end-to-end: the cases skip cleanly under LIVE_API_NETWORK=devnet and both pass against a live mainnet archive endpoint. Only the fixture-pinned data is gated. networkState.test.ts's pendingMax − canonicalMax === 290 is the protocol-wide finality depth and holds on every network, so it keeps running everywhere — that cross-network invariant is the point of the matrix. Addresses review feedback on #199. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
Thanks @SanabriaRusso — fixed in Your finding, confirmed empirically. Rather than assume where the J1fu fixtures came from, I queried all three live networks for the fixture's exact block range:
So the fixtures are mainnet, and on the other two the The bigger one: the fixtures never loaded at all. That's worse than the 2-of-3 you predicted — the events suite would have failed on all three networks, mainnet included, and as a module-load crash rather than an assertion, so the reason wouldn't have been obvious. Fixtures now resolve from the source tree via Verified end-to-end, since a fix here is only worth as much as its proof:
And +1 on your |
What & why
Part of the production-readiness epic (#163). Closes #181.
Two gaps from the test-coverage audit: no coverage threshold in CI, and no live integration tests against real per-network data (devnet existed only as a static dump; mainnet was a single skipped endpoint; mesa had none).
Changes
test:coveragenow runs c8 with--check-coverage --lines 50 --functions 50 --statements 50 --branches 80. Current coverage (~53% lines, 95% branches) clears it; the floor blocks regressions and can be raised as the suite grows (this epic adds ~10 test files).test:live-apiscript — runs the live-api suite againstSTAGING_GRAPHQL_ENDPOINT.Live Integrationworkflow — nightly + manual; runs live-api against devnet/mainnet/mesa using per-network repo variables (DEVNET_/MAINNET_/MESA_ARCHIVE_API_URL). A network with no configured endpoint is skipped, so the job is green until the maintainer sets the URLs;fail-fast: falsekeeps networks independent.Honest remaining work (documented, not silently skipped)
*_ARCHIVE_API_URLrepo variables for the nightly runs to actually exercise each network.actions.test.tsis still a placeholder and a successful-zkappCommandsfixture is still needed — both require known mainnet/mesa zkApps to snapshot against. Noted in the README.Testing
npm run test:coverage→ passes the gate locally (exit 0)npm run lint/npx prettier --debug-check .— clean🤖 Generated with Claude Code