Skip to content

Beautiful, AI-native markdown IDE and LLM wiki

fix(ok): upload bug reports from dev builds, not just packaged (#2973)

tim-inkeepa8b1425b436c
diff --git a/packages/desktop/src/main/index.ts b/packages/desktop/src/main/index.ts
index 04deb547a..03c0bdf12 100644
--- a/packages/desktop/src/main/index.ts
+++ b/packages/desktop/src/main/index.ts
@@ -4774,11 +4774,10 @@ function registerIpcHandlers() {
if (request.kind === 'send') {
return handleBugReportSend(
{
- // Packaged builds default to the production intake so a shipped app
- // uploads; `OK_BUG_REPORT_INTAKE_URL` overrides, dev stays on email.
+ // Every build defaults to the production intake so Send uploads (dev
+ // included); `OK_BUG_REPORT_INTAKE_URL` overrides.
intakeBaseUrl: resolveBugReportIntakeUrl({
envUrl: process.env.OK_BUG_REPORT_INTAKE_URL,
- packaged: app.isPackaged,
}),
appVersion: app.getVersion(),
platform: `${process.platform} ${osRelease()}`,
diff --git a/packages/desktop/src/main/ipc/bug-report.test.ts b/packages/desktop/src/main/ipc/bug-report.test.ts
index 9a282cdd0..950c7ae68 100644
--- a/packages/desktop/src/main/ipc/bug-report.test.ts
+++ b/packages/desktop/src/main/ipc/bug-report.test.ts
@@ -454,33 +454,22 @@ function makeSendRig(intakeBaseUrl: string | undefined): {
}
describe('resolveBugReportIntakeUrl', () => {
- test('an explicit env URL always wins, packaged or not', () => {
+ test('an explicit env URL always wins', () => {
const envUrl = 'https://intake.example.test';
- expect(resolveBugReportIntakeUrl({ envUrl, packaged: true })).toBe(envUrl);
- expect(resolveBugReportIntakeUrl({ envUrl, packaged: false })).toBe(envUrl);
+ expect(resolveBugReportIntakeUrl({ envUrl })).toBe(envUrl);
});
- test('a packaged build with no env falls back to the production intake', () => {
- expect(resolveBugReportIntakeUrl({ envUrl: undefined, packaged: true })).toBe(
- DEFAULT_BUG_REPORT_INTAKE_URL,
- );
- });
-
- test('an unpackaged build with no env stays undefined (email fallback, no accidental upload)', () => {
- expect(resolveBugReportIntakeUrl({ envUrl: undefined, packaged: false })).toBeUndefined();
+ test('no env falls back to the production intake (dev included — PRD-7611)', () => {
+ expect(resolveBugReportIntakeUrl({ envUrl: undefined })).toBe(DEFAULT_BUG_REPORT_INTAKE_URL);
});
test('an empty or whitespace env value is treated as unset', () => {
- expect(resolveBugReportIntakeUrl({ envUrl: '', packaged: true })).toBe(
- DEFAULT_BUG_REPORT_INTAKE_URL,
- );
- expect(resolveBugReportIntakeUrl({ envUrl: ' ', packaged: false })).toBeUndefined();
+ expect(resolveBugReportIntakeUrl({ envUrl: '' })).toBe(DEFAULT_BUG_REPORT_INTAKE_URL);
+ expect(resolveBugReportIntakeUrl({ envUrl: ' ' })).toBe(DEFAULT_BUG_REPORT_INTAKE_URL);
});
test('a surrounding-whitespace env value is trimmed', () => {
- expect(resolveBugReportIntakeUrl({ envUrl: ' https://x.test ', packaged: true })).toBe(
- 'https://x.test',
- );
+ expect(resolveBugReportIntakeUrl({ envUrl: ' https://x.test ' })).toBe('https://x.test');
});
});
diff --git a/packages/desktop/src/main/ipc/bug-report.ts b/packages/desktop/src/main/ipc/bug-report.ts
index dc26280ca..b9912b47d 100644
--- a/packages/desktop/src/main/ipc/bug-report.ts
+++ b/packages/desktop/src/main/ipc/bug-report.ts
@@ -376,40 +376,39 @@ export async function handleBugReportCaptureScreenshot(
const SUPPORT_EMAIL = '[email protected]';
/**
- * Production intake origin baked into packaged builds — the apex routes
- * `/api/bug-report` to the private intake (see the desktop README's bug-report
- * table). Mirrors how the auto-updater (`proxyFeed.base`) and share-handoff
- * (`PROD_BASE`) hardcode `openknowledge.ai` as the shipped default rather than
- * relying on a runtime env var a GUI-launched app never receives.
+ * Production intake origin used by every build when `OK_BUG_REPORT_INTAKE_URL`
+ * is unset — the apex routes `/api/bug-report` to the private intake (see the
+ * desktop README's bug-report table). Mirrors how the auto-updater
+ * (`proxyFeed.base`) and share-handoff (`PROD_BASE`) hardcode `openknowledge.ai`
+ * as the shipped default rather than relying on a runtime env var a
+ * GUI-launched app never receives.
*/
export const DEFAULT_BUG_REPORT_INTAKE_URL = 'https://openknowledge.ai';
/**
* Resolve the intake base URL for the `send` wiring. An explicit
- * `OK_BUG_REPORT_INTAKE_URL` always wins; otherwise a packaged build falls back
- * to the production origin so a shipped app actually uploads instead of silently
- * dropping every Send to the email draft. Unpackaged builds (dev / test /
- * Playwright) resolve to `undefined` and keep the email fallback, so a dev run
- * never uploads to the production intake by accident. An empty / whitespace env
- * value is treated as unset.
+ * `OK_BUG_REPORT_INTAKE_URL` always wins; otherwise EVERY build — packaged or an
+ * unpackaged dev run — falls back to the production origin, so a report filed
+ * from a dev build uploads rather than stranding its bundle on disk. Send is
+ * always an explicit user action, and automated tests exercise the handler with
+ * an explicit `intakeBaseUrl` (or a stub env), so nothing uploads to production
+ * without a person clicking Send. An empty / whitespace env value is treated as
+ * unset. To keep a dev machine off the production intake, point the env at a
+ * local stub.
*/
-export function resolveBugReportIntakeUrl(args: {
- envUrl: string | undefined;
- packaged: boolean;
-}): string | undefined {
+export function resolveBugReportIntakeUrl(args: { envUrl: string | undefined }): string {
const trimmed = args.envUrl?.trim();
- if (trimmed !== undefined && trimmed !== '') return trimmed;
- return args.packaged ? DEFAULT_BUG_REPORT_INTAKE_URL : undefined;
+ return trimmed !== undefined && trimmed !== '' ? trimmed : DEFAULT_BUG_REPORT_INTAKE_URL;
}
export interface BugReportSendDeps {
/**
* Intake endpoint origin (e.g. `https://openknowledge.ai`). Wired from
- * `resolveBugReportIntakeUrl`: an explicit `OK_BUG_REPORT_INTAKE_URL`, else the
- * packaged production default, else `undefined`. Absent (unpackaged with no
- * override) means send makes no network attempt and resolves to the email
- * fallback with `reason: 'email-draft'`, which the dialog renders as the email
- * flow rather than a failure.
+ * `resolveBugReportIntakeUrl`, which always yields the env override or the
+ * production default — so in production this is never absent. It stays
+ * optional because the handler's email-draft path (`reason: 'email-draft'`, no
+ * network attempted) is still reachable by a direct caller/test passing
+ * `undefined`; the dialog renders that as the email flow, not a failure.
*/
intakeBaseUrl: string | undefined;
/** App version (`app.getVersion()`), stamped into the report metadata by main. */