✅ test(api): version-cache reset + adversarial-pass test hygiene#557
Conversation
injectDrydockVersionForTesting now accepts undefined to clear the module-level _drydockVersion cache, and the welcome-version test resets it before asserting getVersion() is consulted — an earlier inject or welcome frame could otherwise leave the cache primed and let the test pass without exercising the canonical version path (#550 review).
The injector suite restored the cache to a literal '1.5.0' after its override test, leaving every later test in the file primed with a stale magic value — the same order-dependency class the previous commit fixed. Reset to undefined so later tests re-prime from getVersion().
🧪 The digest-stickiness and fast-path-eligibility blocks each ran a byte-identical errored broken-reference scenario; the newer test asserts a strict superset (repair + digest + error retention), so the older one is folded into it and its name now carries the digest-preservation intent. Coverage verified 100% across all metrics at directory scope. 📝 The catch-block comment in container-processing.ts overstated the enrichment-failure path: enrichContainerWithReleaseNotes swallows its own errors and never rejects, so the result guard is defense-in-depth, not a live path — the comment now says so.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
@coderabbitai review |
✅ Action performedReview finished.
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (4)
📝 WalkthroughWalkthroughPortwing WebSocket tests can now clear the cached drydock version so canonical-version checks re-prime from Possibly related PRs
🚥 Pre-merge checks | ✅ 2✅ Passed checks (2 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
Closes the round-7 review finding on #550 plus two adjacent test-hygiene issues found by an adversarial pass over the same surface, so the whole batch lands in one review round.
Changes
Version cache reset (CodeRabbit finding on #550,
app/api/portwing-ws.test.ts:324)injectDrydockVersionForTestingnow acceptsundefinedto clear the module-level_drydockVersioncache (the!== undefinedguard indrydockVersion()makes it naturally re-prime fromgetVersion()).vi.mocked(getVersion).mockClear(), so it stays order-independent: an earlier inject or welcome frame can no longer leave the cache primed and let the test pass without exercising the canonicalgetVersion()path.Same bug class one describe block down
'1.5.0'— leaving every later test in the file primed with a stale magic value, the exact order-dependency this PR fixes. It now resets toundefinedlike the new idiom.Duplicate test scenario in the orchestration suite
keeps an errored broken reference on the fast path and preserves its digest(repair-branch digest stickiness) andrepairs a broken reference for an errored container on the fast path(fast-path eligibility) ran byte-identical arrange/act; the newer test asserts a strict superset. Folded into one test whose name now carries both intents. Coverage verified 100% across all metrics at directory scope after the merge.Comment accuracy in
container-processing.tsenrichContainerWithReleaseNotesswallows its own errors and never rejects, so the guard is defense-in-depth. The comment now says so instead of overstating the live path.Verification
npx vitest run api/portwing-ws.test.ts watchers/providers/docker/container-processing.test.ts watchers/providers/docker/docker-image-details-orchestration.test.ts— 158/158 pass.docker-image-details-orchestration.tsandcontainer-processing.tsboth 100% branches/lines/functions/statements.Changelog
undefined.Concerns