fix: prevent duplicate logging of warnings during wrangler dev server lifecycle events (v3 backport)#10230
fix: prevent duplicate logging of warnings during wrangler dev server lifecycle events (v3 backport)#10230devin-ai-integration[bot] wants to merge 4 commits intov3-maintenancefrom
Conversation
|
|
can you undo all the V3 Adaptations Made? this PR should only contain the logging changes and nothing else it should be as close as possible to #10225 |
The test 'should not warn when run in remote mode with disabled containers' expects a SQLite warning to appear in the output, but logger.once.warn() prevents it from appearing if it was already logged earlier in the test suite. Adding logger.clearHistory() before this test ensures the warning appears as expected while maintaining the duplicate logging prevention. Co-Authored-By: [email protected] <[email protected]>
Address GitHub comment by replacing dynamic fs imports with a proper
top-level import. This follows standard Node.js patterns and improves
code readability.
- Replace 'const fs = await import("node:fs");' with top-level import
- Use 'writeFileSync' directly instead of 'fs.writeFileSync'
- Maintains same functionality while following better practices
Co-Authored-By: [email protected] <[email protected]>
- Add comments explaining why controller.set() is called 3 times (to test duplicate prevention) - Add comment explaining why Analytics Engine test uses service worker format (to trigger specific warning) - Keep authentication mocks as they are required for remote mode and container tests Addresses GitHub comments from dario-piotrowicz on PR #10225 Co-Authored-By: [email protected] <[email protected]>
- Update globalThis declarations to use namespace syntax for v3 compatibility - Remove unused import for getClassNamesWhichUseSQLite in ConfigController Co-Authored-By: [email protected] <[email protected]>
94904ab to
6a1de82
Compare
|
Closing since I've closen #10225, recreating both the original PR and this backport should be pretty simple |
Fixes #6855
This is a manual v3 backport of PR #10225 to fix duplicate logging of warnings during wrangler dev server lifecycle events.
Problem
The original issue reported that warnings were being duplicated on state changes during
wrangler devsessions. For example, queue warnings or service binding warnings would appear multiple times instead of once, cluttering the developer console output.Solution
This backport adapts the duplicate logging fix to work with the v3 codebase by:
logger.warn()withlogger.once.warn()in key locations to ensure warnings appear only once per dev sessionKey Changes
logger.once.warn()for lifecycle warnings, adapted function signatures for v3 compatibilitywarnOrErrorfunction to uselogger.once.warn()for binding warningslogger.clearHistory()before test that expects SQLite warningV3 Adaptations Made
legacyAssets,containers) from function callsgetBindingssignature from 5 args to 4 args to match v3 APIprintBindingssignature from 4 args to 3 args to match v3 APIglobalThisdeclarations frommoduletonamespacesyntax for v3 compatibilitygetClassNamesWhichUseSQLiteHigh Priority - Potential Issues:
logger.warn()→logger.once.warn()replacements are complete and in correct locationsMedium Priority:
legacyAssets,containers)Link to Devin run: https://app.devin.ai/sessions/328baf572c9d40c38d5f7f5256dacaa7
Requested by: @dario-piotrowicz
Original PR: #10225