Skip to content
This repository was archived by the owner on Jun 8, 2026. It is now read-only.

FEAT-66: Split relay and API origins, add settings migration - #19

Merged
shafty023 merged 2 commits into
mainfrom
FEAT-66
Mar 16, 2026
Merged

shafty023 merged 2 commits into
mainfrom
FEAT-66

Conversation

@shafty023

Copy link
Copy Markdown
Contributor

Rename apiOrigin → relayOrigin for the Socket.IO relay connection and add a dedicated apiOrigin for the REST API used by challenge-exchange auth verification. These are different servers (relay.closedloop.ai vs api.closedloop.ai) and sharing a single setting caused 404s on the auth verify endpoint.

  • Rename DesktopSettings.apiOrigin → relayOrigin; add new apiOrigin
  • Add settings migration handling 4 scenarios: fresh install, pre-auth, intermediate build (with authApiOrigin), and already-migrated
  • Remove electron-store defaults to prevent migration key contamination
  • Rename normalizeAndValidateApiOrigin → normalizeAndValidateOrigin
  • Make webAppOrigin live via optional getter (CORS updates per-request)
  • Split settings UI into responsive Cloud Relay / Local Gateway columns
  • Add migration tests with sentinel URLs, auth wiring test, CORS test

Rename apiOrigin → relayOrigin for the Socket.IO relay connection and
add a dedicated apiOrigin for the REST API used by challenge-exchange
auth verification. These are different servers (relay.closedloop.ai vs
api.closedloop.ai) and sharing a single setting caused 404s on the
auth verify endpoint.

- Rename DesktopSettings.apiOrigin → relayOrigin; add new apiOrigin
- Add settings migration handling 4 scenarios: fresh install, pre-auth,
  intermediate build (with authApiOrigin), and already-migrated
- Remove electron-store defaults to prevent migration key contamination
- Rename normalizeAndValidateApiOrigin → normalizeAndValidateOrigin
- Make webAppOrigin live via optional getter (CORS updates per-request)
- Split settings UI into responsive Cloud Relay / Local Gateway columns
- Add migration tests with sentinel URLs, auth wiring test, CORS test
Comment thread apps/desktop/src/main/app.ts Outdated
Comment thread apps/desktop/src/main/cloud-socket.ts
@closedloop-ai-stage

Copy link
Copy Markdown

Code Review Summary

Status: Needs Attention

Reviewers: Bug Hunter A, Bug Hunter B, Unified Auditor, Premise Reviewer, cloud-command-executor-specialist

Findings

Severity Count
Blocking 0
High 1
Medium 1

HIGH Issues (should fix)

  1. [P1] [apps/desktop/src/main/app.ts:811] Empty-string relayOrigin/apiOrigin in onboarding throws, blocking onboarding completion

MEDIUM Issues (consider)

  1. [P3] [apps/desktop/src/main/cloud-socket.ts:68] Private connect parameter still named apiOrigin after relay-origin rename

Validation Stats

  • Agent failures: 0 partitions skipped
  • Cross-file grouped: 0 findings consolidated

Recommendation: Address the HIGH issue — empty string inputs will block users from completing onboarding when relay/API origin fields are left blank.

…aram

- Add .trim() guard on relayOrigin/apiOrigin in onboarding handler so
  empty strings are treated as absent (keeps existing/default values)
- Rename connect() parameter from apiOrigin to relayOrigin for consistency
@shafty023
shafty023 merged commit 0ae0d41 into main Mar 16, 2026
1 check passed
@shafty023
shafty023 deleted the FEAT-66 branch March 16, 2026 19:37
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant