Repository navigation
Conversation
- Run the forge unit tests with mocha --parallel (4 workers), giving each worker its own Postgres database - Hash passwords with bcrypt cost 4 under test - Share compiled route schemas between app instances in a test process - Stop the test jobs waiting on the TypeScript drift check; the summary job still requires it - Fix tests that the faster runs made flaky: order audit entries by id, compare device group members regardless of order - Claim an MCP refresh token rotation before rotating the token, so two simultaneous refreshes cannot both lose the compare-and-swap
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #8999 +/- ##
==========================================
- Coverage 79.44% 79.43% -0.02%
==========================================
Files 475 475
Lines 26017 26024 +7
Branches 6934 6936 +2
==========================================
+ Hits 20670 20672 +2
- Misses 5347 5352 +5
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This branch was successfully deployed
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.
Description
The Backend and Postgres test jobs take about 20 minutes each. Most of that time goes into the hooks that boot the app before each test (
setupAppruns 423 times), not into the tests themselves. Each boot spends most of its time hashing seed passwords at bcrypt cost 10 and recompiling every route schema.test:unit:forge:ciruns with--parallel --jobs 4, which matches the 4 vCPUs of the runner. Under Postgres, each worker gets its own database (<name>_w<MOCHA_WORKER_ID>).test/lib/fast-bcrypt.js, loaded with--require. Production code is unchanged.test/lib/fastify-schema-cache.jspasses fastify acompilersFactorythat reuses compiled validators and serializers across app instances in the same process. Boot time drops from about 530ms to about 210ms.idinstead ofcreatedAt, which ties within the same millisecond.DeviceGroup.byIddoesn't order them.AccessTokenRefreshRotationrecord first; the uniquetokenHashindex lets only one insert succeed, and the other refresh resolves through that record. If the row was revoked between the read and the update, the claim is removed and the refresh returns null.Local timings for the unit suite, 4087 tests:
nyc coverage is still collected from the parallel workers (475 files).
Related Issue(s)
#8478
Checklist