feat(desktop): plumb WorkspaceApplyResult through frontend boundary (Phase 3e)

Surfaces the degraded-apply result from the backend all the way to the UI:

tauri.ts:
- Add WorkspaceApplyResult interface { applied: boolean; degraded: string[] }
- applyCommunity() now returns Promise<WorkspaceApplyResult> instead of
  Promise<void>; passes typed result through from apply_workspace command.

useCommunityInit.ts:
- Consumes applyResult from applyCommunity instead of discarding void.
- applied: false (drain-failed) → park on the loading gate so the user
  can retry via a workspace switch; the specific degradation messages are
  shown as the error.
- applied: true with degraded entries → console.warn (informational;
  workspace IS active; post-commit step failed gracefully).
- Existing catch block still handles genuine Tauri errors (poisoned lock,
  invalid nsec, etc.) unchanged.

Co-authored-by: Will Pfleger <pfleger.will@gmail.com>
Signed-off-by: Will Pfleger <pfleger.will@gmail.com>
This commit is contained in:
npub1mn7jgtj4w2pd0g0zeuhxsa6jy6p0rewxz4kujt98my82ahfmp72sxjexk7
2026-08-03 00:05:11 -04:00
parent 00a3381902
commit 91859ea806
2 changed files with 45 additions and 3 deletions

View File

@@ -1142,14 +1142,27 @@ export async function cancelPairing(): Promise<void> {
await invokeTauri("cancel_pairing");
}
/**
* Result from `apply_workspace` / `applyCommunity`.
*
* - `applied: true` — new scope committed; post-commit failures surface in
* `degraded` (informational — workspace IS active).
* - `applied: false` — drain failed; old scope still active; `degraded` names
* what could not be stopped or restored by compensation.
*/
export interface WorkspaceApplyResult {
applied: boolean;
degraded: string[];
}
export async function applyCommunity(
relayUrl: string,
nsec?: string,
token?: string,
reposDir?: string,
agentManagedProfiles?: boolean,
): Promise<void> {
await invokeTauri("apply_workspace", {
): Promise<WorkspaceApplyResult> {
return invokeTauri<WorkspaceApplyResult>("apply_workspace", {
relayUrl,
nsec: nsec ?? null,
token: token ?? null,