Skip to content

fix(upgrade): force-quote releaseDate in updater yml and tolerate Date payloads#2025

Merged
zerob13 merged 1 commit into
devfrom
fix/updater-release-date
Jul 25, 2026
Merged

fix(upgrade): force-quote releaseDate in updater yml and tolerate Date payloads#2025
zerob13 merged 1 commit into
devfrom
fix/updater-release-date

Conversation

@zerob13

@zerob13 zerob13 commented Jul 25, 2026

Copy link
Copy Markdown
Collaborator

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:

[ { "expected": "string", "code": "invalid_type", "path": [ "info", "releaseDate" ], "message": "Invalid input: expected string, received Date" } ]

Root Cause

#2012 introduced scripts/ci/assemble-release.mjs to re-assemble updater yml files (latest*.yml). It serializes with the yaml package (eemeli/yaml), which does not quote an ISO timestamp string. Previously electron-builder published yml directly via js-yaml, which quotes ISO timestamps.

                releaseDate output      parser          result
beta.1..beta.4  js-yaml dump  '...Z'    js-yaml load    String ✓
beta.6          yaml stringify ...Z     js-yaml load    Date   ✗

electron-updater parses the yml with js-yaml, which turns an unquoted ISO releaseDate into a Date. The typed-IPC zod contract requires releaseDate: z.string(), so .parse() throws synchronously inside the update-available handler — blocking auto-download for all affected clients.

CI self-validation did not catch this: it also uses the yaml package, whose parser returns String for unquoted ISO (unlike js-yaml).

Fix — three layers of defense

  1. Publish pipeline (scripts/ci/assemble-release.mjs): force-quote releaseDate via Scalar + QUOTE_SINGLE so js-yaml round-trips it as a string. Protects all existing clients.
  2. Client normalize (src/main/upgrade/index.ts): toVersionInfo coerces a Date back to ISO string before emitting, so a legacy yml artifact can never leak a Date into the IPC payload.
  3. Contract tolerance (src/shared/contracts/events/upgrade.events.ts): releaseDate schema accepts string | Date and transforms Date to ISO string. Final backstop against future regressions.

Validation

  • typecheck:node + typecheck:web pass
  • test/main/upgrade (8) + test/main/scripts/releaseAssembly (9) pass
  • lint, format:check, i18n clean

Release ops

  1. Revert/retract v1.1.0-beta.6
  2. Merge this PR
  3. Republish (beta.7 or re-issued beta.6) — new latest*.yml will carry quoted releaseDate
  4. Affected clients resume auto-update without any client-side change

Summary by CodeRabbit

  • Bug Fixes

    • Fixed release dates being misinterpreted during update processing.
    • Ensured release dates remain consistently formatted as ISO strings in upgrade information and status events.
  • Tests

    • Added coverage for update notifications containing date-formatted release dates.

@coderabbitai

coderabbitai Bot commented Jul 25, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 36bd27c8-5fd7-4964-bb31-e5ff0068731c

📥 Commits

Reviewing files that changed from the base of the PR and between fd7eb9f and 7313e26.

📒 Files selected for processing (4)
  • scripts/ci/assemble-release.mjs
  • src/main/upgrade/index.ts
  • src/shared/contracts/events/upgrade.events.ts
  • test/main/upgrade/upgradeService.test.ts

📝 Walkthrough

Walkthrough

Release assembly preserves string release dates during YAML serialization, while upgrade event contracts and version mapping normalize Date values to ISO strings. A unit test verifies the emitted upgrade status payload.

Changes

Release date normalization

Layer / File(s) Summary
Release metadata serialization
scripts/ci/assemble-release.mjs
Release metadata is copied before writing, and string releaseDate values are wrapped in single-quoted YAML scalars.
Upgrade event normalization
src/shared/contracts/events/upgrade.events.ts, src/main/upgrade/index.ts, test/main/upgrade/upgradeService.test.ts
Upgrade schemas and version mapping convert Date release dates to ISO strings, with a test covering the emitted status event.

Estimated code review effort: 3 (Moderate) | ~20 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the main fix: quoting releaseDate in updater YAML and handling Date payloads.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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 fix/updater-release-date

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.ts

File 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.

❤️ Share

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

@zerob13
zerob13 merged commit 5f0925a into dev Jul 25, 2026
12 checks passed
@zerob13 zerob13 mentioned this pull request Jul 25, 2026
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