Skip to content

The settings layout tests expect General's new Appearance section - #281

Merged
Mpdreamz merged 1 commit into
mainfrom
fix/settings-layout-tests
Nov 16, 2026
Merged

Mpdreamz merged 1 commit into
mainfrom
fix/settings-layout-tests

Conversation

@Mpdreamz

Copy link
Copy Markdown
Contributor

The appearance PR added a section to General; two layout tests still expected Sessions first. Test-only.

🤖 Generated with Claude Code

@Mpdreamz
Mpdreamz merged commit 2f4fc21 into main Nov 16, 2026
3 checks passed
@Mpdreamz
Mpdreamz deleted the fix/settings-layout-tests branch November 16, 2026 17:12
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]>
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