Skip to content

✅ test(api): version-cache reset + adversarial-pass test hygiene#557

Merged
scttbnsn merged 3 commits into
dev/v1.6from
feat/v1.6-version-cache-reset
Jul 17, 2026
Merged

✅ test(api): version-cache reset + adversarial-pass test hygiene#557
scttbnsn merged 3 commits into
dev/v1.6from
feat/v1.6-version-cache-reset

Conversation

@scttbnsn

@scttbnsn scttbnsn commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

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)

  • injectDrydockVersionForTesting now accepts undefined to clear the module-level _drydockVersion cache (the !== undefined guard in drydockVersion() makes it naturally re-prime from getVersion()).
  • The welcome-version test resets the cache before 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 canonical getVersion() path.

Same bug class one describe block down

  • The injector suite ended by "restoring" the cache to a literal '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 to undefined like 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) and repairs 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.ts

  • The catch-block comment implied release-notes enrichment can reject after a fresh result; enrichContainerWithReleaseNotes swallows 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.
  • Directory-scope coverage: docker-image-details-orchestration.ts and container-processing.ts both 100% branches/lines/functions/statements.
  • Full pre-push gate (biome, qlty, coverage, build) green on push.

Changelog

  • ✨ Added support for clearing the cached Drydock version with undefined.
  • 🔧 Changed API tests to reset the version cache, preventing order-dependent behavior.
  • 🔧 Clarified the defensive result-restore comment in Docker container processing.
  • 🗑️ Removed a duplicate errored fast-path repair test and consolidated digest assertions.

Concerns

  • Verify the targeted test suite and pre-push checks remain green.

scttbnsn added 3 commits July 17, 2026 07:52
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.
@vercel

vercel Bot commented Jul 17, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
drydock-website Ready Ready Preview, Comment Jul 17, 2026 12:07pm
drydockdemo-website Ready Ready Preview, Comment Jul 17, 2026 12:07pm

@scttbnsn

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 17, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai

coderabbitai Bot commented Jul 17, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: c9e6b64e-3d67-487d-b3b4-0ab068737058

📥 Commits

Reviewing files that changed from the base of the PR and between bdb8f3f and c22c75d.

📒 Files selected for processing (4)
  • app/api/portwing-ws.test.ts
  • app/api/portwing-ws.ts
  • app/watchers/providers/docker/container-processing.ts
  • app/watchers/providers/docker/docker-image-details-orchestration.test.ts

📝 Walkthrough

Walkthrough

Portwing WebSocket tests can now clear the cached drydock version so canonical-version checks re-prime from getVersion() and run independently of test order. Docker orchestration coverage now verifies that the errored-container fast path repairs broken references while preserving the reconciled digest and error. An existing container-result restoration comment was expanded to document its defensive guard.

Possibly related PRs

  • CodesWhat/drydock#536 — Relates to preserving stored digest values during errored-container rebuilds.
  • CodesWhat/drydock#550 — Modifies the same Portwing WebSocket version cache and welcome handshake behavior.
  • CodesWhat/drydock#554 — Updates the same errored-container fast-path reference and digest coverage.
🚥 Pre-merge checks | ✅ 2
✅ Passed checks (2 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/v1.6-version-cache-reset

Comment @coderabbitai help to get the list of available commands.

@scttbnsn
scttbnsn merged commit 399aeb1 into dev/v1.6 Jul 17, 2026
5 checks passed
@scttbnsn
scttbnsn deleted the feat/v1.6-version-cache-reset branch July 17, 2026 12:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant