fix(desktop): keep the Gauzy Cloud API address in the main process (egress audit)

Merged
EV
14d ago
+103-37

Refs #9517

Summary

The egress audit (node --test tools/egress-audit/static-hostnames.test.mjs) failed on integration/issue-triage-2026-10-31. The cause was packages/desktop-ui-lib/src/lib/time-tracker/web-portal/web-portal-url.ts from #11576, which named Gauzy Cloud's API host once and its web app host twice. Neither is in the baseline. The baseline may only shrink, so the file now names no Ever host, comments included.

What changed

  • packages/desktop-lib/src/lib/desktop-store.ts:
    • New exported constant GAUZY_CLOUD_API_URL replaces the two literals.
    • That file's baseline count drops from 2 to 1, which the audit allows. The baseline file itself is unchanged.
  • packages/desktop-lib/src/lib/desktop-ipc.ts:
    • New GET_GAUZY_CLOUD_API_URL handler next to GET_LOCAL_WEB_APP_URL.
    • The channel is added to the matching removeHandler list.
  • web-portal.service.ts:
    • Reads both addresses from the main process, with the same fallback as before.
    • A main process that cannot answer (no channel) gives null, so no link comes from that address.
    • The cloud API address is passed on as cloudApiUrl.
  • web-portal-url.ts:
    • The GAUZY_CLOUD_API_URL constant and its default are removed.
    • cloudApiUrl is optional with no default. Without it, no server counts as Gauzy Cloud.
    • The comments name no host.

Behavior is unchanged in the app:

  • The main process answers Gauzy Cloud's API address.
  • The link still opens GAUZY_CLOUD_APP for Gauzy Cloud, or the web UI the app serves on this computer.
  • Custom servers still get no link.

Tests

npx jest -c packages/desktop-ui-lib/jest.config.ts --rootDir packages/desktop-ui-lib src/lib/time-tracker/web-portal src/lib/time-tracker/time-tracker.component
# Test Suites: 3 passed, 3 total; Tests: 21 passed, 21 total
  • web-portal-url.spec.ts:
    • Passes cloudApiUrl in each case.
    • New case: no server counts as Gauzy Cloud without the address, including null and a value that is not a URL.
  • web-portal.service.spec.ts:
    • Each channel gets its own answer.
    • New case: a main process without the cloud channel gives no Gauzy Cloud link, and still gives the local web UI link.
  • npx tsc -p packages/desktop-lib/tsconfig.lib.json --noEmit: clean.
  • npx tsc -p packages/desktop-ui-lib/tsconfig.lib.json --noEmit: only the existing google errors.
  • ESLint: no findings on changed lines.
  • node --test tools/egress-audit/static-hostnames.test.mjs:
    • Neither this branch's files nor web-portal-url.ts is reported any more.
    • It still reports git-ignored local packages/ui-config/src/lib/environments/environment*.ts copies, which CI does not have.
    • It also still reports three tracked files this PR does not touch, changed by other commits on the integration branch:
    • Those are left to their own branches.

Rollback

Revert this commit. That restores the address literal in web-portal-url.ts, and the egress audit then fails again.

cc @evereq

šŸ¤– Generated with Claude Code


Summary by cubic

Fixes the egress audit failure on the integration branch by keeping Gauzy Cloud's API address in the main process instead of a hardcoded literal in web-portal code. User-visible behavior is unchanged: Gauzy Cloud still opens its web app, the web UI still opens when the app serves one, and custom servers still get no link.

  • desktop-store.ts now holds the address once as the exported GAUZY_CLOUD_API_URL, replacing two literals.
  • The main process answers it on a new GET_GAUZY_CLOUD_API_URL IPC channel.
  • WebPortalService reads it alongside the local web UI channel; without an answer, no server counts as Gauzy Cloud.