fix: restore ci test integrity and close audit findings#111
Merged
Conversation
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.
Closes #22
The important part: CI was green but hollow
A re-audit found that 31 database-backed tests were silently skipping in CI. Turbo v2 runs tasks in strict env mode, and
turbo.jsondeclared noenvallowlist, so the job-levelDATABASE_URLnever reached vitest —hasDbwas false and everydescribe.skipIfquietly skipped. The real CI logs showed db 4/7, api 20/23 and worker 7/11 skipped. Every green check on the recent PRs verified only the non-database paths.Fixes:
turbo.jsondeclaresenv: ["DATABASE_URL", "REQUIRE_DB"]on thetesttask.REQUIRE_DB=1, and each global setup now throws when it is set without aDATABASE_URL, so this can never silently regress again. Local runs without a database still skip gracefully.prisma migrate deploycontention on a cold database.CI went from 91 tests actually executing to 122, with zero skips.
Defects found in the same audit
size()probe and a test.queue.depth()ignored in-flight jobs — it counted onlypending, so backpressure under-reported the real backlog. Now countspending + processing, with a test.COUNT(*)per ingest request when backpressure was enabled, on the path whose whole design goal is to stay fast. Depth is now cached with a TTL (test asserts three requests hit the database once).buildAppcall — moved to the service entry point so it registers once.Dead code and hygiene
test.retry_ofwas declared in the conventions but never emitted. Now emitted explicitly, with the mapper preferring it and falling back to attempt-order reconstruction.publicProcedureandpaginatedSchema.CONVENTIONS_VERSIONnow derives fromCONTRACT_VERSIONso the two cannot drift.IngestClientclock defaulted to() => 0, making the buffer filename timestamp meaningless — nowDate.now.@flakemetry/aiis markedprivateuntil it has an implementation, since publishing an empty package would be worse than not publishing.Also closes #22, which was implemented in #96 but never linked.
Testing
REQUIRE_DBguard fails the run when the database is absentKnown, not fully resolved
One db queue test flaked once in roughly ten cold-database runs. The most likely source of nondeterminism (concurrent migrations) is removed, but the root cause is not proven. If it recurs, the next place to look is
FOR UPDATE SKIP LOCKEDbehaviour under concurrent load.