Clean up validate output noise: seed e2e KV icons, silence third-party warnings, fix leaky test spies - #721
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (4)
📝 WalkthroughWalkthroughThe PR adds E2E KV snapshot seeding, changes skipped email logging from warning to info, updates runtime-related tests, and adjusts Vitest, Wrangler, and Cloudflare tooling configuration. ChangesE2E community snapshot seeding
Skipped email logging
Runtime and test behavior
Test runner configuration
Estimated code review effort: 3 (Moderate) | ~25 minutes Sequence Diagram(s)sequenceDiagram
participant E2E as d1-utils.ts
participant Helper as seedCommunitySnapshotInE2eKv
participant Wrangler as wrangler-env.ts
participant KV as BUNDLE_ARTIFACTS_KV
E2E->>Helper: seed listingId and pinnedCommit
Helper->>Wrangler: execute kv key put
Wrangler->>KV: write CommunitySnapshot JSON
Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
🔎 Preview deployed: https://kody-pr-721.kody-a99.workers.dev Worker: Mocks:
|
Why
The
mainvalidate CI log was full of noise that made real failures hard to spot: ~47community-icon-load-failederror lines per e2e run, 28 workerd WebSocket-disconnect exception dumps, 28 wrangler "Using secrets defined in" lines, broken third-party sourcemap warnings, NodeExperimentalWarning: localStoragelines, leakedusage-rollup-failed/audit-eventoutput from tests, workerduncaught exception storage.sqldumps, and an esbuildimport-is-undefinedwarning. This PR eliminates every one of those sources — no failures or warnings remain in the validate output beyond genuine test results.What changed
e2e seeding
e2e/kv-utils.ts(new): seeds a community snapshot (with a minimal valid SVG icon) into the e2e KV store viawrangler kv key put --local.e2e/d1-utils.ts: every seeded community listing now also seeds its KV snapshot, so icon requests render a real PNG instead of loggingcommunity-icon-load-failedon every community page view.Dependency upgrades
@cloudflare/vitest-pool-workers0.14.x→0.17.0andwrangler→4.106.0. The new pool version ignores the harmlessWebSocket peer disconnectedworkerd teardown exception that printed 28 stack dumps per run.Vitest / wrangler config
vitest-shared.ts,vitest.config.ts: set VitelogLevel: 'error'so broken third-party sourcemap warnings (@modelcontextprotocol/sdk,cron-scheduleship sourcemaps pointing at unpublished sources) no longer print; addexecArgv: ['--disable-warning=ExperimentalWarning']so msw'stypeof localStorageprobe stops tripping Node 26's experimental-localStorage warning in every fork.vitest.workers.config.ts: defaultWRANGLER_LOG=warnso the pool's per-file config reads stop printing "Using secrets defined in packages/worker/.env" 28 times.Log-level corrections (production code)
cloudflare-email.ts: skipped-send logging (cloudflare-email-unconfiguredetc.) downgraded fromconsole.warntoconsole.info— callers decide whether a skipped send is a problem (the verification flow throws in production), so an unconfigured client in dev/e2e is informational.email-verification.ts:email-verification-send-skippedlikewisewarn→info; that branch only exists on non-production runtimes.module-graph.ts: readfetchoff the user module reflectively (Reflect.get) so esbuild stops emitting animport-is-undefinedwarning for every app without a namedfetchexport. Behavior is unchanged.Leaky tests fixed
package-service.node.test.ts: the globalmockReset: truerestored therecordUsagespy's real implementation before each test, so the real rollup ran against the stub env and loggedusage-rollup-failed. Re-stub per test inbeforeEach.auth-handler.node.test.ts: stublogAuditEvent(it was fire-and-forgetvoid-ed, resolving after spies were restored and leakingaudit-eventlines to stdout); assert the email-skip logs onconsoleInfo.cloudflare-email.node.test.ts,account-resend-verification.node.test.ts: assert on the sharedconsoleInfo/consoleWarnspies instead of ad-hocvi.spyOnmocks that clashed with the global console guard.storage-runner.workers.test.ts: intentionally-failing read-only SQL queries now run viarunInDurableObjectinstead of the test RPC stub — rejections crossing the RPC surface printed duplicateuncaught exception storage.sqldumps inside workerd.System recap — extends existing primitives (medium risk, log-level only)
Mode: recap · Base:
main@9f74862c· Head:7227c04bClassification: extends — three primitives get behavior-neutral tweaks (two log-level downgrades, one reflective property read); everything else is test/tooling config. No contracts, schemas, or routes change.
Primitives touched
emailwarn→infoincloudflare-email.tsapp-sessionsemail-verification-send-skippedlog downgradedwarn→infopackage-runtimefetchviaReflect.get(silences esbuild warning, same behavior)community-listingsSystem map
E2E seeding now writes both the D1 listing row and its KV snapshot so the existing icon pipeline succeeds instead of logging errors.
Legend: green = composes (wiring only) · amber = extended by this PR · red = new primitive · gray = context (unchanged, included only when an edge crosses it).
Verification
npm run validate— full green run; remaining local-only lines (DEP0205, workerd shutdowngetCaughtExceptionAsKj) verified absent from CI logs of prior runs.Summary by CodeRabbit