Skip to content

feat(desktop): launch a project's desktop app only from its approval - #61

Merged
winlp4ever merged 7 commits into
epic/electron-targetsfrom
feat/electron-launch
Oct 10, 2026
Merged

winlp4ever merged 7 commits into
epic/electron-targetsfrom
feat/electron-launch

Conversation

@winlp4ever

Copy link
Copy Markdown
Contributor

PR 4a of the Electron targets epic (#55): the main side of "Kif works in desktop apps". The studio's side (grounding, checks, recordings) is 4b. The design was reviewed, and decisions were taken with the user (2026-10-09 and 2026-10-10).

Launching from the approval (apps/desktop/src/main/desktop-launch.ts)

DesktopLauncher.launch(name, signal) launches the project's app only from the copy approved for this project folder and for what the project opens with it. The app is inspected once, by its status.

  • ready: launched with the copy's executable and bundle, the project's files/ when it has one, and its args, origins and viewport. The approval and the project are read again just before the spawn: if the app was removed, or the project switched, while it was being looked at, it is never launched. The approved build must also be the one being started.
  • updated (the same developer's new build; user decision): the launch tries it confined, quietly. It's stopped by the launch's own stop, or by the launcher's (stopAll: a project switch, a quit; said in words). Then:
    • the build is approved compare-and-set (the same copy, developer and opens, in the launch's own project);
    • the status is asked again, so an update, move or replacement during the trial is refused, never launched untried.
  • Anything else is a DesktopRefused (needsUser) for the user to settle in the Apps panel. The agent says so and never retries. A quiet trial that didn't work says why (a site, a quit, a failure).

Takes

A desktop app's take keeps its build: appBuild holds its version (bounded) and what it opened. It's shown, never part of the take's key, and never a reason to record again (user decision). Its meta is strict, so an older Kiframe can't read such a take; OBJECT-MODEL says so.

Also

  • Kif starting ends an "Add desktop app…" check in progress. Picked cards are kept, and the check says so in words.
  • A folder in files/ that disappears mid-copy is said as a change.
  • The slow-copy tests budget the app's start on the slower of two starts.
  • BACKLOG: feat(desktop): add a desktop app to a project from the apps panel #60's CI flakes, and what an approval doesn't cover (what's inside files/).

Not yet

Nothing creates the launcher until 4b, which wires it into the studio, with stopAll on a project switch and on quit. The quick wiring check from "Kif starting ends a check" is covered by 4b's end-to-end test.

Tests

  • The launcher, with fakes: every status, the quiet trial (worked, refused, stopped, its own or the launcher's), and changes during the inspect or the trial (removed, closed, another project opened, another approval).
  • Each fix's test fails with its bug put back.
  • A desktop take's appBuild, read back from its meta.

The launch main gives the agent (PR 4a, design reviewed): the app's copy
approved for this project and what it opens, inspected once by its status.
An update by the same developer is tried confined first, quietly (one
trial per app and project), and that build approved compare-and-set (the
same copy, developer and opens, the project still open). Anything else is
refused for the user to settle in the Apps panel, never for the agent to
retry.

- a take of a desktop app keeps its build and what it opened (appBuild:
  shown, never in its key, never a reason to record again)
- Kif starting ends an "Add desktop app…" check in progress
- BACKLOG: #60's CI flakes; what an approval doesn't cover (files/)
…proved

- a launch re-reads the approval and the project after looking at the app:
  one removed or switched meanwhile is never launched
- one quiet trial per build: an update landing during a trial is never
  launched untried; a stopped launch stops only its own wait
- a quiet trial that didn't work says why (a site, a quit, a failure); an
  approval that can't be written is refused for the user
- Kif starting ends checks in progress only (picked cards kept); a
  launch's stop reaches its look at the app; the take's build shape from
  its schema; status tests assert the app they return
…s asked again

- one quiet trial per app and project (launches meanwhile wait); after it
  a launch asks the app's status again and must find the build just
  approved (an update, a move, a replacement meanwhile: refused)
- the quiet trial ends with the launcher (stopAll: a project switch, a
  quit), never with one launch's stop; a launch already stopped starts none
- the trial approves against the launch's own project; a launch checks the
  approved build is the one it starts
- an add's check ended by Kif starting or a switch is said in words
Simplified after a third review round on the shared quiet trial: each
launch of an updated app tries it itself (stopped by its own stop, or by
the launcher's as it was when the launch began: a project switch, a quit
refused in words), then approves compare-and-set (two launches that both
tried it approve the same build). No trial shared, kept, or joined.

- an add's check ended (Kif started, given up) always said in words
- a folder in files/ gone mid-copy said as a change; the slow-copy tests
  budget the app's start on the slower of two
… met it

On a busy CI runner the page loads slower than the late dialog's 300 ms,
so the dialog is up as the steps begin and is handled before "wait"
instead of "go" (seen twice). Handled once, off camera, before the click
it would block, either way: the click works.
The previous commit's edit dropped the test's closing brace (lint and format failed in CI).
Since #59 the electron project holds two files and they ran in parallel:
Electron launched while the other file cloned and re-signed it (spawn
ETXTBSY on Linux for the first tests, a splash slower than its wait on
macOS, both in #61's CI). The suite was meant to run alone: its files now
do too.
@codecov

codecov Bot commented Oct 10, 2026

Copy link
Copy Markdown

@winlp4ever
winlp4ever merged commit 0dcb640 into epic/electron-targets Oct 10, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant