From c40990445357cbc6da71a4284d4eca5c72ccf8ad Mon Sep 17 00:00:00 2001 From: Neil <4138956+nwparker@users.noreply.github.com> Date: Sat, 18 Apr 2026 20:20:37 -0700 Subject: [PATCH] fix(feedback): include app version + OS metadata in submissions (#812) --- src/main/ipc/feedback.ts | 30 +++++++++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/src/main/ipc/feedback.ts b/src/main/ipc/feedback.ts index 775fb0e1c..82f61bd39 100644 --- a/src/main/ipc/feedback.ts +++ b/src/main/ipc/feedback.ts @@ -1,4 +1,5 @@ -import { ipcMain, net } from 'electron' +import os from 'node:os' +import { app, ipcMain, net } from 'electron' // Why: the production Mac build loads the renderer from a file:// origin, so a // cross-origin POST from fetch() triggers a CORS preflight that the feedback @@ -14,11 +15,33 @@ export type FeedbackSubmitArgs = { githubEmail: string | null } +type FeedbackSubmitBody = FeedbackSubmitArgs & { + appVersion: string + platform: NodeJS.Platform + osRelease: string + arch: string +} + export type FeedbackSubmitResult = | { ok: true } | { ok: false; status: number | null; error: string } -async function postFeedback(url: string, body: FeedbackSubmitArgs): Promise { +// Why: the Slack notification and any follow-up investigation need to know +// which Orca build and which OS the feedback came from. The main process is +// the only place with trusted access to these values (app.getVersion and the +// node os module), so we enrich the payload here rather than trusting the +// renderer. +function buildSubmitBody(args: FeedbackSubmitArgs): FeedbackSubmitBody { + return { + ...args, + appVersion: app.getVersion(), + platform: process.platform, + osRelease: os.release(), + arch: process.arch + } +} + +async function postFeedback(url: string, body: FeedbackSubmitBody): Promise { return net.fetch(url, { method: 'POST', headers: { 'Content-Type': 'application/json' }, @@ -26,7 +49,8 @@ async function postFeedback(url: string, body: FeedbackSubmitArgs): Promise { +export async function submitFeedback(args: FeedbackSubmitArgs): Promise { + const body = buildSubmitBody(args) try { const res = await postFeedback(FEEDBACK_API_URL, body) if (res.ok) {