fix(upgrade): force-quote releaseDate in updater yml and tolerate Date payloads#2025
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)
📝 WalkthroughWalkthroughRelease assembly preserves string release dates during YAML serialization, while upgrade event contracts and version mapping normalize ChangesRelease date normalization
Estimated code review effort: 3 (Moderate) | ~20 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 Biome (2.5.3)src/main/upgrade/index.tsFile contains syntax errors that prevent linting: Line 439: Catch clause variable type annotation must be 'any' or 'unknown' if specified.; Line 513: Catch clause variable type annotation must be 'any' or 'unknown' if specified. 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 |
Problem
Auto-update breaks for existing clients (v1.0.3-beta.5 ~ v1.1.0-beta.5) when checking for v1.1.0-beta.6:
Root Cause
#2012 introduced
scripts/ci/assemble-release.mjsto re-assemble updater yml files (latest*.yml). It serializes with theyamlpackage (eemeli/yaml), which does not quote an ISO timestamp string. Previously electron-builder published yml directly via js-yaml, which quotes ISO timestamps.electron-updater parses the yml with js-yaml, which turns an unquoted ISO
releaseDateinto aDate. The typed-IPC zod contract requiresreleaseDate: z.string(), so.parse()throws synchronously inside theupdate-availablehandler — blocking auto-download for all affected clients.CI self-validation did not catch this: it also uses the
yamlpackage, whose parser returnsStringfor unquoted ISO (unlike js-yaml).Fix — three layers of defense
scripts/ci/assemble-release.mjs): force-quotereleaseDateviaScalar+QUOTE_SINGLEso js-yaml round-trips it as a string. Protects all existing clients.src/main/upgrade/index.ts):toVersionInfocoerces aDateback to ISO string before emitting, so a legacy yml artifact can never leak aDateinto the IPC payload.src/shared/contracts/events/upgrade.events.ts):releaseDateschema acceptsstring | Dateand transformsDateto ISO string. Final backstop against future regressions.Validation
typecheck:node+typecheck:webpasstest/main/upgrade(8) +test/main/scripts/releaseAssembly(9) passlint,format:check,i18ncleanRelease ops
latest*.ymlwill carry quotedreleaseDateSummary by CodeRabbit
Bug Fixes
Tests