Backend test coverage: CI ingestion, webhooks, badges, admin, scheduled rollup - #53
Merged
Conversation
Add a backend-coverage job to ci.yml that runs the Worker vitest suite with Istanbul coverage (v8 is unsupported under vitest-pool-workers) and reports coverage/lcov.info to the coverage-tracker Worker via the report Action. Broaden the workflow path filter to backend files and scope the OIDC/checks-write permissions to the new job only. Drop the copied Python coverage.yml example. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…rollup Backend test coverage was ~21% and never exercised auth success paths, GitHub API calls, or the cron entry point beyond direct calls to rollupAndPrune(). Adds a test/helpers layer (signed OIDC tokens, HMAC signing, and a fake GitHub REST API wired up via Miniflare's outboundService, since fetchMock isn't exported by the installed vitest-pool-workers version) and route/middleware/lib tests built on it, bringing coverage to ~88% lines with ci.ts, badge.ts, admin.ts, webhook.ts, and oidc.ts at or near 100%. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
coverage/lcov.infoto the coverage-tracker Worker itself (already on this branch)./api/ci/coverage), the GitHub webhook handler, the badge endpoint, the admin API, and the scheduled cron rollup — plus the OIDC/webhook-HMAC middleware gating them and supportinglib/helpers.test/helpers/(signed OIDC tokens via a keypair generated fresh per test run, HMAC signing, and a fake GitHub REST API wired up through Miniflare'soutboundService) so tests can exercise real auth success paths and GitHub API calls instead of only asserting "missing credential → 401".routes/ci.tsroutes/webhooks.tsroutes/badge.tsroutes/admin.tsroutes/api.tsmiddleware/webhook.tsmiddleware/oidc.tslib/github.tslib/resync.tslib/db.tsindex.tsscheduled()Not touched (out of scope):
routes/baseline.ts,middleware/access.ts— admin/api tests use the existingENVIRONMENT=developmentdev-bypass instead of a full Access-JWT test harness.Test plan
npm test— 91 tests passing across 13 filesnpm run typecheck— cleannpm run test:coverage— 87.78% lines / 85.3% statements / 77.77% branches / 89.65% functions overall🤖 Generated with Claude Code