Repository navigation
The settings layout tests expect General's new Appearance section - #281
Merged
Merged
Conversation
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Mpdreamz
added a commit
that referenced
this pull request
Nov 16, 2026
…TestRun, coalesced GitHub syncs (#283) Part 1 of fix/explicit-states (code-health plan, PR 12): explicit states for fetches and tests. Merges on its own. - **`Load<T>`** (HeedCore/Domain/Load.swift): `idle`, `loading(token, stale:)`, `loaded`, `failed(why, stale:)`. `finish`, `fail` and `abandon` act only when the token is the current load's, so a replaced fetch finishing late changes nothing. - **Diff overlay:** one `diffLoad: Load<DiffContent>` replaces `diffFiles`, `diffCommits` and `diffLoading`, which are now computed from it. Before, a cancelled load's `defer { diffLoading = false }` cleared "loading" while the next load was still running. With no worktree, a running load is now cancelled instead of landing afterwards. - **Threads:** `threads: [key: Load<ThreadConversation>]` replaces `conversations`, `conversationErrors` and `conversationsLoading`. A retry now shows "Loading the thread…" instead of the previous error. `currentConversation` (summaries) awaits the reader's fetch while it runs, kept in `threadFetches`. It used to poll every 200 ms, up to 150 times. Eviction (40 kept) is unchanged. - **`TestRun<Answer>`** (`running`, `passed`, `failed`) with `AgentTestAnswer` and `DecisionTestAnswer` replaces the app's `LLMTest` and `DecisionTest` structs. A running test with an answer can no longer be represented. `testLLM` and `testInference` share one function, `runAgentTest`. Only the Model calls test writes `setupTests.inference`, as before. - **`SyncQueue`:** `syncGitHub` dropped any ask made while a sync ran (`guard !syncing`), including gr and `:github.sync`. An ask made during a sync is now kept, merged with any others (named parts united, schedule if either asked, force if either was), and runs when that sync ends. A single ask fetches what it fetched before, and teams are refreshed only by a forced scheduled sync, as before. ## Verification - `mise run fmt` and `mise run lint` are clean. - `mise run test`: 2577 tests. The only failures were 5 issues in `SettingsLayoutTests`, which this PR does not touch; #281 on main has since fixed that test. - New tests in `Tests/HeedCoreTests/LoadTests.swift`: a stale finish, failure or give-up is ignored; a retry forgets the error but keeps the value; a test cannot start over a running one; a forced ask during a sync runs after it; asks merge. - Mutations, applied and then reverted, each fail the suite: the token check in `Load` replaced by `isLoading` fails 4 tests; `SyncQueue.ask` dropping the ask fails 2; `TestRun.canStart` always true fails 1. ## Not tested - The app-layer wiring: the diff overlay, the readers' thread loading and the Settings Test buttons were not clicked through in a running app. They compile and the shots set the new values. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 5.5 <[email protected]>
Mpdreamz
added a commit
that referenced
this pull request
Nov 16, 2026
…, and Attention is worked out once per change (#288) Part (a) of the code-health performance round (plan PR 11): the hook path, the sidebar, Attention. Screen reading, startup, GitHub sync and telemetry, and Audit/ExternalText/OriginKeeper come in their own PRs. Every working-state hook commits its session. Each commit rebuilt the sidebar once per domain part it wrote (sessions, GitHub, PR details, feedback, pilot log), each rebuild O(sessions² × PRs). What the user sees does not change; each step is now cheaper or done once. - **One rebuild per commit.** The didSets of `sessions`, `github`, `pullDetails`, `feedback` and `pilotLog` ask a `Coalesced` rebuild (HeedCore). Outside a commit it runs at once, as before. `commit` and `replace(with:)` write every part in a batch and rebuild once at the end, then update the Dock and menu bar and note state changes, in the same order as before. - **The next tool of a working turn.** `Session.changedOnlyActivity(from:)` detects a commit that changed only what an agent is doing (the activity line, lastActivity, the reason of an unchanged state). Such a commit skips the five notices that read only other fields and so cannot fire on it: ledger, naming, turn ends, audit of new sessions, goal attach. The time-based notices (session panel, goal PRs) still run. Every reader of `sessions` still sees the new values. - **Run hooks.** A run's hook rebuilds the list only when the run's state changed. - **PRs by ref.** `GitHubState.pull(_:)` reads an index kept with `pulls` and still returns the first match. The index takes no part in equality, hashing or the cache. - **Pilot state once per rebuild.** Whether a PR has a session is now a lookup in a set kept with `sessions`. Within one rebuild, each PR's and each session's pilot state is worked out once and reused. - **Rows by id.** `SessionList.index(of:)` and `pinIndex(of:)` replace `firstIndex(of:)`, which compared whole `Session` values, in the sidebar and the rail. The size sort asks each session's size once, and done sessions are dropped by id. - **Attention.** Entries and listing are kept (`Derived`, HeedApp) until something they read changes (`withObservationTracking`), or for at most one second because they read the clock. The badge, counts, coverage line and list share one computation. A per-value observed counter makes readers of the kept value redraw as before. `[attention] rules` are parsed when they change. - **Presence.** A hook writes `agentPresence` only when it changes which panes run an agent. ### Deliberate deviations from the audit's suggestions - Activity is **not** moved out of `Session` into a separate store. `lastActivity` and `activity` have about 57 readers (sweep, ledger staleness, permission asks, away summary, control socket, swarm stuck), and a store that lags would change what they see. Instead, an activity-only commit stays exact and skips the work that cannot apply to it. - Row values are **not** precomputed in `rebuildList`. Several of them (watch labels, close readiness, pilot status) depend on runs, helpers and the clock, which do not trigger a rebuild, so precomputed values would go stale. The rows instead call helpers that are now cheap: O(1) index lookups and the PR index. - Timing nuance: a run's hook no longer triggers a rebuild on every tool call. Before, those calls incidentally re-checked time-based pilot states such as stalled. The other rebuild triggers still do. ### Verification - `swift build`. Targeted tests pass: `HookPathTests` (new, 14 tests), DomainMirror, SessionsView, GitHub, QuietHours, ResumeBanner, AttentionListing, SettingsLayout (96 tests). `mise run fmt` and `mise run lint` are clean. - Mutation checks: making `Coalesced.request` run immediately, dropping the `pulls` index didSet, dropping the rules didSet, dropping the state comparison in `changedOnlyActivity`, and making `AgentPresence.changes` always true each made the matching tests fail. The size-memo mutation ran in the same batch, but its result line was cut from the output, so it is unconfirmed. - `DomainMirrorTests` now reads `replaceParts(with:)` and `write(_:over:changed:)`, where the parts are written now. ### Not done / untested - Full suite: not run after the last rebase (the coordinator validates on main). A run before the rebase failed only the then-broken SettingsLayout tests (fixed on main by #281) and DomainMirror (fixed here). - Bench numbers: `Tests/HeedCoreTests/Bench/SidebarBench.swift` is added (200 sessions sorted by size; 600 PR lookups among 2,000), but the release builds did not finish on a machine at load average about 200, so there are no before/after numbers yet. Run `mise run bench` (filter `SidebarBench`, and CoreBench's `sessionList`) on main and on this branch. - `mise run tutor-check` and the app itself: not run. `Derived`'s observation-driven invalidation is untested at runtime: there is no HeedApp test target. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 5.5 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The appearance PR added a section to General; two layout tests still expected Sessions first. Test-only.
🤖 Generated with Claude Code