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

Commit 49d9935

Browse files
authored
Merge pull request #130 from closedloop-ai/PLN-324
PLN-324: Add managed onboarding
2 parents 457a02f + c0e8e64 commit 49d9935

21 files changed

Lines changed: 1475 additions & 26 deletions

AGENTS.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,14 @@ Tests run with `tsx --test` (Node test runner) via `just desktop-test`.
4141
- Add or update tests with behavior changes, especially gateway auth, process spawning, and telemetry flows.
4242
- Before opening a PR, run: `just desktop-lint && just desktop-typecheck && just desktop-test`.
4343

44+
## Breaking Changes
45+
Migration requirements apply only to contracts consumed by separate repositories or external clients that ship and upgrade independently of the desktop app:
46+
HTTP gateway routes, cloud relay messages, and persisted store schemas read across downgrade/rollback boundaries.
47+
48+
- Breaking those external contracts requires legacy migration logic at the boundary and a ClosedLoop ticket to track removing the migration path later.
49+
- Internal contracts that ship as one Electron bundle do not need migration logic: main/renderer IPC bridge messages, internal module interfaces, and types consumed only inside `apps/desktop/`.
50+
- When reviewing a compatibility issue, first identify whether the caller is independently shipped. If both producer and consumer update atomically in the same desktop build, treat it as an internal refactor unless persisted data or an external client is involved.
51+
4452
## Commit & Pull Request Guidelines
4553
Commit format follows `.gitmessage` and recent history:
4654

CLAUDE.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,13 @@ Run `just` to see all available recipes. Key ones:
1717

1818
## Breaking Changes
1919

20-
Any breaking change to APIs, contracts, or interfaces (HTTP gateway routes, cloud relay messages, IPC bridge, persisted store schemas, etc.) requires both of the following before merging:
20+
This rule applies ONLY to contracts consumed by separate repositories or external clients that ship and upgrade independently of the desktop app: HTTP gateway routes (consumed by the web app, CLI, or third-party tools), cloud relay messages (consumed by the cloud control plane), persisted store schemas on disk (read by older app versions during downgrade/rollback). Any breaking change to those contracts requires both of the following before merging:
2121

22-
1. **Legacy migration logic** so existing users are not broken on upgrade. Detect the old shape and translate it to the new shape at the boundary; do not assume users have already migrated.
22+
1. **Legacy migration logic** so existing external consumers are not broken on upgrade. Detect the old shape and translate it to the new shape at the boundary; do not assume external consumers have already migrated.
2323
2. **A ClosedLoop ticket** created via the ClosedLoop MCP (`mcp__closedloop__create-feature`) to track removing the legacy migration code at a later date. Reference the ticket ID in a comment next to the migration logic so it can be found and deleted when the ticket is worked.
2424

25+
This rule does NOT apply to internal contracts that ship as a single unit with the app: IPC bridge messages between main and renderer, internal module interfaces, type definitions consumed only within `apps/desktop/`. Both sides of an IPC channel are bundled into the same Electron build, so a breaking change updates the producer and consumer atomically — no migration is needed.
26+
2527
## Gateway Operations (`apps/desktop/src/server/operations/`)
2628

2729
- **Shared helpers live in dedicated modules.** Before adding a local helper function to an operation file, check if it already exists in a shared module (e.g., `response-utils.ts` for `json()`, `symphony-utils.ts` for `expandHome()`). If a helper is used by more than one operation, extract it into a shared module.

apps/desktop/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "desktop",
3-
"version": "0.13.20",
3+
"version": "0.13.21",
44
"description": "ClosedLoop Desktop",
55
"author": "ClosedLoop AI <support@closedloop.ai>",
66
"private": true,
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
/**
2+
* Handles Electron lifecycle callbacks that dispatch async Desktop work.
3+
*
4+
* Electron does not await event listener promises. Keeping the catch inside the
5+
* lifecycle helper prevents expected activation-time failures from becoming
6+
* process-level unhandled rejections.
7+
*/
8+
export async function handleActivateEvent(deps: {
9+
handleActivate: () => Promise<void>;
10+
log: (message: string) => void;
11+
}): Promise<void> {
12+
try {
13+
await deps.handleActivate();
14+
} catch (error) {
15+
const message =
16+
error instanceof Error
17+
? `${error.message}${error.stack ? `\n${error.stack}` : ""}`
18+
: String(error);
19+
deps.log(`activate handling failed: ${message}`);
20+
}
21+
}

0 commit comments

Comments
 (0)