Skip to content

Write release JSON as UTF-8 and log desktop update failures#74

Merged
SunkenInTime merged 2 commits into
mainfrom
feature/windows-update-json-utf8
May 11, 2026
Merged

Write release JSON as UTF-8 and log desktop update failures#74
SunkenInTime merged 2 commits into
mainfrom
feature/windows-update-json-utf8

Conversation

@SunkenInTime
Copy link
Copy Markdown
Owner

Summary

  • Adds a shared PowerShell helper to write JSON files as UTF-8 without BOM, then uses it across desktop release and manifest generation scripts.
  • Updates release metadata generation and store packaging outputs to use the new UTF-8 writer.
  • Improves Windows desktop update checks by logging missing metadata and caught failures with context instead of silently swallowing them.
  • Removes the trademark symbol from the online status copy in the release metadata.

Testing

  • Not run (not requested).
  • Reviewed the PowerShell scripts for the new UTF-8 JSON write path.
  • Reviewed the Windows update controller change to confirm failures now report source, archive URL, and exception details.

- Report no-update and failure cases from the Windows desktop updater
- Write release metadata and manifests with UTF-8 no-BOM JSON output
- Update release metadata message to use plain punctuation
- Keep Windows JSON UTF-8 content consistent
Copilot AI review requested due to automatic review settings May 11, 2026 06:18
@SunkenInTime SunkenInTime merged commit c0d7729 into main May 11, 2026
1 of 2 checks passed
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Adds a shared PowerShell helper to consistently write JSON outputs as UTF-8 (no BOM) across release/manifest scripts, and improves observability of Windows desktop update checks by reporting missing metadata and failures with context.

Changes:

  • Introduce Write-JsonFileUtf8 and switch multiple scripts to use it for JSON outputs.
  • Add reporting/logging for “no update found” and for update-check exceptions (including archive URL and stack trace).
  • Update release metadata copy to remove the trademark symbol.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
scripts/generate_update_manifest.ps1 Switch manifest output to shared UTF-8 JSON writer
scripts/common_release.ps1 Add Write-JsonFileUtf8 helper (UTF-8 without BOM)
scripts/build_store_release.ps1 Switch store package info JSON output to UTF-8 writer
scripts/build_desktop_release.ps1 Switch desktop release metadata JSON output to UTF-8 writer
release/metadata/4.3.3+87.json Remove trademark symbol from release note text
lib/services/windows_desktop_update_controller.dart Report “no update” + report failures with context

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +97 to 104
_reportInfoSafely(
'No desktop update detected.',
source: 'WindowsDesktopUpdateController.checkVersion',
error: <String, Object?>{
'appArchiveUrl': _appArchiveUrl.toString(),
},
);
return;
'stackTrace': stackTrace.toString(),
},
);
// Leave the direct installer updater silent if the remote metadata fails.
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented May 11, 2026

Greptile Summary

This PR introduces a shared Write-JsonFileUtf8 PowerShell helper that writes JSON files as UTF-8 without BOM, then migrates all three release/manifest scripts to use it. It also improves observability in the Windows desktop update controller by logging the null response case and capturing error details in the catch block instead of swallowing them silently, and removes a trademark symbol from the changelog copy.

  • common_release.ps1: New Write-JsonFileUtf8 function uses System.Text.UTF8Encoding($false) and File::WriteAllText with GetFullPath path resolution; used by build_desktop_release.ps1, build_store_release.ps1, and generate_update_manifest.ps1 (all three dot-source common_release.ps1 so the function is always in scope).
  • windows_desktop_update_controller.dart: The previously silent catch (_) block now reports source, archive URL, and full error/stack trace via _reportInfoSafely; the versionResponse == null early-return path also gets an info log with the archive URL for context.
  • release/metadata/4.3.3+87.json: Trademark symbol removed from "Online is coming soon" changelog entry.

Confidence Score: 5/5

Safe to merge — changes are additive logging improvements and a well-scoped UTF-8 encoding helper with no behavioral regressions.

The Dart change converts a silent catch into an observable one, which is strictly an improvement. The PowerShell helper is straightforward and all three callers already dot-source common_release.ps1, so the function is always in scope. The metadata edit is cosmetic.

No files require special attention.

Important Files Changed

Filename Overview
scripts/common_release.ps1 Adds Write-JsonFileUtf8 helper that serialises an object to JSON and writes it UTF-8 without BOM using WriteAllText; correctly resolves relative paths via GetFullPath.
lib/services/windows_desktop_update_controller.dart Adds info-level logging for the null-response (no update) path and captures error/stackTrace in the catch block instead of swallowing them silently.
scripts/build_desktop_release.ps1 Replaces two ConvertTo-Json
scripts/build_store_release.ps1 Replaces the single package-info.json write call with Write-JsonFileUtf8; no logic changes.
scripts/generate_update_manifest.ps1 Replaces the manifest write call with Write-JsonFileUtf8; no logic changes.
release/metadata/4.3.3+87.json Removes the trademark symbol from the "Online is coming soon" changelog entry; purely cosmetic data change.

Sequence Diagram

sequenceDiagram
    participant Script as Release Script
    participant Common as common_release.ps1
    participant FS as File System

    Script->>Common: . common_release.ps1 (dot-source)
    Note over Common: Write-JsonFileUtf8 now available

    Script->>Common: Write-JsonFileUtf8 -Value $obj -Path $path -Depth N
    Common->>Common: ConvertTo-Json -Depth N
    Common->>Common: new UTF8Encoding($false)
    Common->>Common: GetFullPath($Path)
    Common->>FS: File::WriteAllText(path, json + NewLine, utf8NoBom)

    participant App as Flutter App
    participant Ctrl as WindowsDesktopUpdateController
    participant Updater as DesktopUpdater
    participant Reporter as AppErrorReporter

    App->>Ctrl: checkVersion()
    Ctrl->>Updater: versionCheck(appArchiveUrl)
    alt "versionResponse == null"
        Updater-->>Ctrl: null
        Ctrl->>Reporter: "reportInfo(No desktop update detected., {appArchiveUrl})"
        Ctrl-->>App: return
    else update available
        Updater-->>Ctrl: ItemModel
        Ctrl->>Reporter: "reportInfo(Desktop update detected., {version, ...})"
        Ctrl-->>App: notifyListeners()
    end
    Note over Ctrl: catch (error, stackTrace)
    Ctrl->>Reporter: "reportInfo(Desktop update check failed., {appArchiveUrl, error, stackTrace})"
Loading

Reviews (1): Last reviewed commit: "Remove trademark symbol from online stat..." | Re-trigger Greptile

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.

2 participants