Repository navigation
Handle failed changelog fetches gracefully and mock changelog in E2E - #23258
Merged
Merged
Conversation
In E2E smoke runs, UpdateStore.onUpdateNotAvailable called generateReleaseSummary(), which fetched the hardcoded central.github.com changelog.json URL instead of the local mock update server. When CI runners received HTTP 403, getChangeLog() returned [] and generateReleaseSummary() unconditionally indexed lastTenReleases[0], throwing a TypeError before UpdateStore could transition to UpdateNotAvailable. - Guard against empty changelogs, non-array payloads, and fetch errors in getChangeLog(), generateReleaseSummary(), and generateDevReleaseSummary() - Guard empty newReleases arrays in UpdateStore.isUpdateShowcase() and UpdateAvailable so empty release summaries fall back safely - Introduce __CHANGELOG_URL__ in app-info.ts (resolving to /changelog.json on the mock update server when DESKTOP_E2E_UPDATES_URL is set) and serve /changelog.json from mock-update-server.ts - Add unit tests for getChangeLog() and generateReleaseSummary()
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues block the changelog error-handling and E2E routing changes.
No open issues 🎉
What changed in this PR
This PR prevents changelog fetch failures from interrupting GitHub Desktop’s update checks and redirects E2E release-note requests to the local mock server.
Changes:
- Handle failed fetches, JSON parsing errors, non-array payloads, and empty changelogs safely.
- Guard update UI consumers against empty release summaries, with an external release-notes fallback.
- Add configurable changelog URLs, a mock endpoint, unit coverage, and E2E documentation.
| File | Description |
|---|---|
docs/technical/e2e-smoke-tests.md |
Documents E2E changelog URL routing and overrides. |
app/test/unit/release-notes-test.ts |
Adds fetch-failure, empty-result, and release-selection tests. |
app/test/globals.mts |
Defines the changelog URL for unit tests. |
app/test/e2e/mock-update-server.ts |
Serves an empty changelog from the mock server. |
app/src/ui/lib/update-store.ts |
Skips update showcases when release summaries are empty. |
app/src/ui/banners/update-available.tsx |
Guards empty summaries and falls back to external release notes. |
app/src/lib/release-notes.ts |
Handles changelog failures and empty results safely. |
app/src/lib/globals.d.ts |
Declares the build-time changelog URL constant. |
app/app-info.ts |
Configures production and E2E changelog URLs. |
Review effort: Balanced
Review feedback: F1 (PR #23258 adversarial review). When generateDevReleaseSummary() returns an empty array (for example when changelog fetching fails or returns no releases), showFakeReleaseNotesPopup() previously still dispatched PopupType.ReleaseNotes with newReleases: []. Because ReleaseNotes.render() returns null for an empty list, currentPopup remained set with no visible dialog to dismiss, leaving modal state stuck active. This PR introduced that path by making generateDevReleaseSummary() return [] instead of throwing when no releases are available. Skip dispatching PopupType.ReleaseNotes when generateDevReleaseSummary() returns an empty array. Validation: npx tsc -p tsconfig.json --noEmit and npx eslint --rulesdir eslint-rules app/src/ui/lib/test-ui-components/test-ui-components.ts passed.
Review feedback: F2 (PR #23258 adversarial review). Returning [] from getChangeLog() on fetch or JSON errors caused getUserContributions() to return null, which checkIfThankYouIsInOrder() treated as 'checked, no contributions' and persisted via updateLastThankYou(). That permanently skipped thanking a contributor for the current version after a transient network or parse failure. This PR exacerbated a pre-existing HTTP-error path by also catching fetch and JSON rejections into the same empty-array return value. Return null from getChangeLog(), getThankYouByUser(), and getUserContributions() when changelog retrieval fails, while returning [] from getUserContributions() when retrieval succeeds with no matching entries. In checkIfThankYouIsInOrder(), return early without persisting when userContributions is null and persist only when it is empty. Validation: npm test -- app/test/unit/release-notes-test.ts (18/18 passed), npx tsc -p tsconfig.json --noEmit, and eslint on changed files passed.
Review feedback: F3 (PR #23258 adversarial review). getChangelogURL() previously checked DESKTOP_E2E_CHANGELOG_URL and DESKTOP_E2E_UPDATES_URL against undefined rather than non-empty strings, and getChangeLog() constructed new URL(__CHANGELOG_URL__) outside its try/catch block. An empty or malformed env var could throw at build time or throw an unhandled TypeError at runtime when fetching release notes. This PR introduced both getChangelogURL() and __CHANGELOG_URL__. Trim and require non-empty values for DESKTOP_E2E_CHANGELOG_URL and DESKTOP_E2E_UPDATES_URL in getChangelogURL(), move URL construction inside the try/catch block of getChangeLog(), and add a unit test for an invalid __CHANGELOG_URL__. Validation: npm test -- app/test/unit/release-notes-test.ts (19/19 passed), npx tsc -p tsconfig.json --noEmit, npx tsc -p script/tsconfig.json --noEmit, and npm run lint:fix passed.
sergiou87
marked this pull request as ready for review
December 1, 2026 21:01
sergiou87
enabled auto-merge
December 1, 2026 21:01
niik
approved these changes
Dec 2, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Agent assessment
Self-reported assessment, not an independent review.
Assessed revision:
263d6cefe0ee7a4e2a695a274236058348ce4a40app/test/unit/release-notes-test.ts(15/15) cover HTTP 403, network error, non-array payload, and empty changelog paths.↑
npm run lint:fix,npm run markdownlint, and TypeScript checks (tsc -p tsconfig.json --noEmitandtsc -p script/tsconfig.json --noEmit) passed.↓ Full E2E smoke suite was not run locally; CI E2E Smoke jobs will verify packaged macOS and Windows behavior.
app/src/lib/release-notes.tsandapp/src/ui/lib/update-store.tsconfirmsgetChangeLog()returns[]on non-OK responses andgenerateReleaseSummary()unconditionally indexeslastTenReleases[0].↑
app/app-info.tsonly overrode__UPDATES_URL__for E2E builds, leavingchangelog.jsonhardcoded to livecentral.github.com.[e2e:console:error] Failed to load resource: the server responded with a status of 403 ()and[e2e:pageerror] TypeError: Cannot read properties of undefined (reading 'notes')in CI runs 46607295614 and 46697645033, which abortedUpdateStore.onUpdateNotAvailablebefore updatingstatustoUpdateNotAvailable.Description
Fixes the failing E2E Smoke test (
Auto-update › About dialog › shows up-to-date status after no-update check) observed ondevelopmentin CI runs 46607295614 and 46697645033 on macOS arm64 and Windows x64.Root cause
__UPDATES_URL__viaDESKTOP_E2E_UPDATES_URLto target the local mock update server, butgetChangeLog()inapp/src/lib/release-notes.tshardcodedhttps://central.github.com/deployments/desktop/desktop/changelog.json. On CI runners, that live request returned HTTP 403.getChangeLog()returned[](and did not catchfetchor JSON parsing errors).generateReleaseSummary()then calledgetReleaseSummary(lastTenReleases[0])withundefined, throwingTypeError: Cannot read properties of undefined (reading 'notes')insideUpdateStore.onUpdateNotAvailablebeforethis.status = UpdateStatus.UpdateNotAvailablecould run, leaving#about .update-statusstuck on"checking for updates…".Changes
app/src/lib/release-notes.ts:__CHANGELOG_URL__.fetch/JSON errors, log warnings/errors, and validate that the parsed payload is an array ingetChangeLog().[]early ingenerateReleaseSummary()andgenerateDevReleaseSummary()when no releases are available.app/src/ui/lib/update-store.ts&app/src/ui/banners/update-available.tsx:newReleasesarrays before indexingnewReleases[0]inisUpdateShowcase(),renderMessage(),dismissUpdateShowCaseVisibility(), andshowReleaseNotes()(falling back to opening the external release notes URL).app/app-info.ts,app/src/lib/globals.d.ts,app/test/globals.mts,app/test/e2e/mock-update-server.ts,docs/technical/e2e-smoke-tests.md:__CHANGELOG_URL__(defaults tohttps://central.github.com/deployments/desktop/desktop/changelog.json; derives/changelog.jsonon the mock server whenDESKTOP_E2E_UPDATES_URLis set; overridable viaDESKTOP_E2E_CHANGELOG_URL).[]from/changelog.jsoninmock-update-server.ts.app/test/unit/release-notes-test.ts:getChangeLog()andgenerateReleaseSummary()(HTTP 403, network rejection, non-array JSON, empty changelog, fallback to latest release, and newer releases).Validation (commit
263d6cefe0ee7a4e2a695a274236058348ce4a40)npm test -- app/test/unit/release-notes-test.ts— passed (15/15 tests)npm run lint:fix— passednpm run markdownlint— passednpx tsc -p tsconfig.json --noEmit— passednpx tsc -p script/tsconfig.json --noEmit— passedScreenshots
N/A — non-visual defensive fix for update-check release notes fetching and E2E mock server support.
Release notes
Notes: [Fixed] Checking for updates no longer gets stuck if fetching release notes fails.
Team-authored review
Evidence: Unit test and lint/typecheck results in the Validation section above (covering commit
263d6cefe0ee7a4e2a695a274236058348ce4a40); visual artifact N/A (no UI layout changes). Pending CI E2E Smoke verification and author confirmation before marking ready.Review path: Lightweight review (pending author confirmation; note that
app/src/ui/lib/update-store.tsandapp/app-info.tsare touched, though changes are limited to defensive empty-array guards and E2E changelog URL redirection — escalate toneeds-deep-reviewif the author or reviewer wants extra scrutiny on the updater/build-replacement paths).