Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix: properly emit update metadata for intel macs #446

Mergednmggithub(GitHub profile, opens in a new tab)merged 2 commits intomain fromrefs/pull/446/headmerged by t3dotgg(GitHub profile, opens in a new tab) View on GitHub

Should resolve #409. Update metadata for Intel Macs was being emitted to a file that our upstream updater package electron-updater doesn't actually use. This ensures we use the right filenames. Intel Mac users on versions prior to whatever update this lands in will likely have to manually update to the new version unless we backport the correct metadata format to previous releases.

Note: this was basically entirely agent-written with T3 Code itself. However, I do.jajs experience with electron-updater, so I'm fairly certain this is the correct approach.

Note

Merge macOS updater manifests in the release workflow to properly emit update metadata for Intel Macs and write a single latest-mac.yml

Add a pre-publish workflow step to run the scripts/merge-mac-update-manifests.ts CLI that merges arm64 and x64 manifests into latest-mac.yml, deletes latest-mac-x64.yml, and document the behavior; implement parser/merger/serializer with tests.

📍Where to Start

Start with the CLI entrypoint in merge-mac-update-manifests.ts, then review the workflow changes in .github/workflows/release.yml.

Macroscope summarized 5018cd7.
    1. coderabbitai[bot](GitHub profile, opens in a new tab)commented

      Important

      Review skipped

      Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

      ⚙️ Run configuration

      Configuration used: Repository UI

      Review profile: CHILL

      Plan: Pro

      Run ID: d9bc6487-946c-4349-9730-d2add4e328a8

      You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

      Use the checkbox below for a quick retry:

      • ✅ Review completed - (🔄 Check again to review again)
      ✨ Finishing Touches
      🧪 Generate unit tests (beta)
      • Create PR with unit tests
      • Post copyable unit tests in a comment

      Tip

      Try Coding Plans. Let us write the prompt for your AI agent so you can ship faster (with fewer bugs). Share your feedback on Discord.


      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 and usage tips.
    2. @@ -0,0 +45,21 @@
      45+ ) {
      46+ throw new Error(
      47+ `Invalid macOS update manifest at ${sourcePath}:${lineNumber}: incomplete file entry.`,
      48+ );
      49+ }
      50+ return {
      51+ url: currentFile.url,
      52+ sha512: currentFile.sha512,
      53+ size: currentFile.size,
      54+ };
      55+}
      56+
      57+function parseScalarValue(rawValue: string): MacUpdateScalar {
      58+ const value = stripSingleQuotes(rawValue.trim());
      59+ if (value === "true") return true;
      60+ if (value === "false") return false;
      61+ if (/^-?\d+(?:\.\d+)?$/.test(value)) {
      62+ return Number(value);
      63+ }
      64+ return value;
      65+}
      macroscopeapp[bot](GitHub profile, opens in a new tab)commented

      🟢 Low scripts/merge-mac-update-manifests.ts:57

      parseScalarValue strips single quotes before checking if the value looks like a boolean or number, so explicitly quoted strings like 'true' or '123' are coerced to boolean or number. For extras fields this silently changes the data type, breaking consumers expecting strings. For version (validated as string at line 135), a quoted numeric value like '1.0' throws version must be a string because it was coerced to number. Consider checking if rawValue is quoted before stripping — if quoted, return it as a string without type inference.

       function parseScalarValue(rawValue: string): MacUpdateScalar {
      -  const value = stripSingleQuotes(rawValue.trim());
      +  const trimmed = rawValue.trim();
      +  const isQuoted = trimmed.startsWith("'") && trimmed.endsWith("'") && trimmed.length >= 2;
      +  const value = isQuoted ? trimmed.slice(1, -1).replace(/''/g, "'") : trimmed;
      +  if (isQuoted) return value;
         if (value === "true") return true;
         if (value === "false") return false;
         if (/^-?\d+(?:\.\d+)?$/.test(value)) {
           return Number(value);
         }
         return value;
       }
      🚀 Reply "fix it for me" or copy this AI Prompt for your agent:
      In file scripts/merge-mac-update-manifests.ts around lines 57-65:
      
      `parseScalarValue` strips single quotes before checking if the value looks like a boolean or number, so explicitly quoted strings like `'true'` or `'123'` are coerced to `boolean` or `number`. For `extras` fields this silently changes the data type, breaking consumers expecting strings. For `version` (validated as string at line 135), a quoted numeric value like `'1.0'` throws `version must be a string` because it was coerced to number. Consider checking if `rawValue` is quoted *before* stripping — if quoted, return it as a string without type inference.
      
      Evidence trail:
      scripts/merge-mac-update-manifests.ts lines 26-31 (`stripSingleQuotes` function), lines 57-65 (`parseScalarValue` function), lines 134-139 (version validation). The function at line 58 calls `stripSingleQuotes(rawValue.trim())` before checking for boolean/number patterns at lines 59-63. Line 135 checks `typeof value !== "string"` and throws at lines 136-138 if version was coerced to number.
    3. Figured after three hours Macroscope wasn't likely to actually fix it for me, so I committed the fix manually with an extra test.

    4. Gonna trust you on this one

Sign in to join this conversation.