Skip to content

Fix main: GhosttyRuntime's appearance statics are main-actor state - #284

Merged
Mpdreamz merged 1 commit into
mainfrom
fix/ghostty-statics
Nov 16, 2026
Merged

Mpdreamz merged 1 commit into
mainfrom
fix/ghostty-statics

Conversation

@Mpdreamz

Copy link
Copy Markdown
Contributor

Main's lint fails: #279 added the no_unsafe_static_var rule and #273 (light theme) added two nonisolated(unsafe) static vars in GhosttyRuntime. The class is @mainactor and every use of isDark and started is on it, so the statics drop nonisolated(unsafe) and are main-actor isolated.

🤖 Generated with Claude Code

GhosttyRuntime is @mainactor and every read and write of isDark and started is on it, so they need no nonisolated(unsafe). The no_unsafe_static_var lint (#279) failed main after the light theme (#273) added them.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@Mpdreamz
Mpdreamz merged commit 6298865 into main Nov 16, 2026
2 of 3 checks passed
@Mpdreamz
Mpdreamz deleted the fix/ghostty-statics branch November 16, 2026 18:05
Mpdreamz added a commit that referenced this pull request Nov 16, 2026
…is one question (#285)

Part 2 of fix/explicit-states (code-health plan, PR 12). Merges on its
own; independent of #283.

- **`DialogStack<Kind, Dialog>`** (HeedCore/Keys): the dialogs open over
the window, oldest first, at most one of each kind. Setting a kind
changes it in place, nil closes only that kind.
- **`AppModel.dialogs`** holds one `Modal` per open dialog. It replaces
sixteen optionals: startWork, resume, firstRun, nudge, confirmation,
importPicker, taskPicker, hostsPicker, hostRootsChooser, linkPicker,
runReader, pilotExplain, awaySummary, repoSetup, pathImport and
addRepoDialog. Each keeps its accessor with the same access level, so
call sites and views did not change. `resume`'s and `startWork`'s
`didSet` behaviour moved into their setters.
- **It is a stack, not one slot.** The app layers dialogs on purpose:
the trust confirmation over Start work, the task and link pickers over
Start work. Which open dialog takes a key is still `handleKey`'s fixed
order, unchanged.
- **The click guards read one answer, `dialogOpen`** (any dialog, or the
tutor's picker). `clickedPane` only checked startWork, resume, firstRun
and nudge, so a click on a terminal under a y/n confirmation entered
INSERT. The same happened under any picker, the run reader or the pilot
explainer. `clicksReachLists` also missed taskPicker, hostsPicker,
hostRootsChooser, linkPicker, runReader and pilotExplain.
- **`StartWorkSession`** (HeedCore/StartWork): `form`, `presentation`
(window or standalone) and `phase` (`editing`, `awaitingTrust(id)`,
`launching`, `failed(why)`). It replaces `startWorkStandalone`,
`startingWork` and `startWorkError`, which are now computed from it. A
trust answer for a start that is no longer waiting starts nothing.
- **Stuck "Starting…" fixed.** `begin` set `startingWork = true` and
waited on the trust confirmation's answer. When another `ask` replaced
that confirmation, neither its action nor `onCancel` ran, and Start work
stayed on "Starting…" until relaunch. `ask` now counts a replaced
confirmation as cancelled and runs its `onCancel`. The other two
`onCancel`s (reopen a shell, drop an Attention draft) are clean-ups,
which also belong on replacement.
- **One small difference:** a new start now clears the previous start's
error, where before it stayed on screen during the next start.

Not folded in: `goals.form`, `sourceForm` and `swarmForm` stay on
`GoalsBrowser`, a separate observable. They are only open in Goals,
which has no terminals, and the goal page's own clicks check
`clicksReachLists`. `overlay` (help, diff, PR, approvals) stays its own
enum, because clicks in the diff overlay must reach it.

## Verification
- `mise run fmt` is clean. `mise run lint`: swiftformat is clean.
swiftlint's only errors were the two GhosttyRuntime statics, which main
fixed in #284 and which this branch is now rebased onto. It was rebuilt
after the rebase.
- `swift test`: 2577 tests passed. The rebase onto #284 changed only
GhosttyRuntime, so the suite was not rerun after it.
- `mise run tutor-check`, run as `scripts/bundle.sh debug` plus
`scripts/tutor-check.sh` because the release build would not finish in
reasonable time on this loaded machine, played every lesson with real
keys: `tutor-check: 0 problems`.
- New tests in `Tests/HeedCoreTests/DialogStateTests.swift`: one per
kind, closing one leaves the others; a trust answer for another start is
ignored; a failed start can try again; a second ⌘↩ while waiting does
nothing.
- Mutations, applied and then reverted, each fail the new tests:
`DialogStack.set` appending a duplicate instead of replacing fails 6
expectations; `trustAnswered` without the id check fails 2.

## Not tested
- The mouse guards were not clicked through in a running app.
`clickedPane` and `clicksReachLists` are one-liners over `dialogOpen`.
- The replaced-confirmation path to Start work was not driven end to
end.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Opus 5.5 <[email protected]>
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