Add unit test coverage and PR-level CI - #33
Merged
Conversation
- Added 24 spec files covering controllers (webhook signature verification, event routing), services (config, es/gh clients), bull processors, and all fetchNode payload processors (113 tests) - Vendored the @bit/zencrepes.zindexer tarballs in .yarn-offline-mirror since the bit.dev registry is gone, so fresh installs work again - Updated lint-test workflow to run on pull requests, pinned to node:22-alpine (matching the Dockerfile) with frozen lockfile installs - Added a util.isString shim for @nestjs/bull on Node >= 23
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
Adds a unit test suite (24 new spec files, 113 tests, all passing) and makes lint + tests + build run on every pull request.
Tests added
github,perfs,testing): HMAC signature verification (valid/invalid/missing), ping handling, event-to-entity mapping, and include/exclude routing to the bull queues — using real computed signatures, not mocked crypto.ConfigService(default config bootstrap + exit, loading an existing config, env handling — against a temp dir),EsClientService(cloud / SSL / plain host connection branches),GhClientService(rate-limit tracking, graphql error logging,fetchNodesByIdretry/give-up logic).testingStorePayload(state/run/cases enrichment, success rates, cases stripping) andperfsStorePayload(transaction dedup, resources, tags handling).Coverage of the meaningfully testable code is near-complete; overall statements sit around 90% (the remainder is mostly the apollo client constructor wiring and module definitions).
Making CI installable again: vendored @bit tarballs
Fresh
yarn installwas impossible — the bit.dev npm registry is gone (returns HTTP 423 "no longer supported"; the suggested replacement host errors as well). Any PR-level CI would have failed at install. This PR vendors the 15@bit/zencrepes.zindexer.*tarballs (~250 KB, packed from the known-good installed versions) into.yarn-offline-mirror/, wired via.yarnrc, with the matching checksums updated inyarn.lock. Verified with a clean-cacheyarn install --frozen-lockfilein an empty directory. A.gitignoreinside the mirror keeps yarn from committing tarballs of regular npm packages it copies there.CI changes (
lint-test.yml)pull_request(and pushes tomaster) instead of pushes to all branches.node:22-alpinematching the Dockerfile (@nestjs/bull0.1.x breaks on Node ≥ 23 —util.isStringremoval).yarn install --frozen-lockfile, tests run with coverage, removed the stale globaltypescript@3.8.3install from the build job.test/jest.setup.jsshimsutil.isStringso the suite also runs on newer local Node versions.Pre-existing bugs noticed while testing (left as-is, candidates for the modernization pass)
src/github/fetchNode/processIssue.ts:84— the delete error handler logspayload.label.node_idfor an issue payload (copy-paste), which itself throws.src/ghClient.service.ts:126— if the graphql query throws,data.datais undefined andgraphqlQuerycrashes with a TypeError instead of returning gracefully.src/github/fetchNode/processRepository.ts— readsdataIndices.GithubRepos(capital G, always undefined) and runs the alias step outside the fetched-data guard.🤖 Generated with Claude Code