Skip to content

chore(desktop): #1645 follow-ups + isolate flaky server-dashboard test#1651

Merged
esengine merged 2 commits into
mainfrom
chore/desktop-1645-followup
May 24, 2026
Merged

chore(desktop): #1645 follow-ups + isolate flaky server-dashboard test#1651
esengine merged 2 commits into
mainfrom
chore/desktop-1645-followup

Conversation

@esengine

Copy link
Copy Markdown
Owner

What

Two unrelated chores, bundled because hitting the second was the only way to get the first past the local pre-push gate.

test(server-dashboard) — root-cause a flaky test (separate commit)

The `dashboard server: v0.13 panels` suite uses `mkdtempSync` for `cfgPath` + `usagePath` but the handlers it exercises (`/api/health`, `listSessions`) still call `homedir()` underneath. On a dev machine with ~20k session jsonl files in `~/.reasonix/sessions` the readdir + per-file `statSync` walk blows past the 5 s default test timeout, even though the same test finishes in milliseconds on a clean CI box.

Redirect `HOME` + `USERPROFILE` inside the suite's `beforeEach` so the walks land in the already-empty temp dir, restore in `afterEach`. No production-code change — the handlers' `homedir()` coupling is a separate cleanup that deserves its own PR.

Whole file now runs in 1.7 s (78 tests).

chore(desktop) — tidy three small things from #1645 (separate commit)

  • composer: extract `recordSendAndReset` so the history-push + browse-index reset is one helper, not duplicated between the Enter key path and the send-button `onClick`.
  • composer: drop the duplicate IME-quirk comment at the use site; the ref declaration block at the top of the component already documents the macOS Chinese IME ordering quirk.
  • App: hoist the inline `onEdit` arrow into a `useCallback` so `UserMsg`'s `memo` isn't busted by a fresh function identity on every render of the message list.

How to verify

  • `npm run verify` passes locally (pre-push gate)
  • `npx vitest run tests/server-dashboard.test.ts` — 78 tests in 1.7 s

Checklist

  • `npm run verify` passes locally
  • No `Co-Authored-By: Claude` trailer
  • Comments follow CONTRIBUTING.md
  • No edits to `CHANGELOG.md`

reasonix added 2 commits May 23, 2026 21:26
Three small cleanups landed alongside the desktop UX bundle:

- composer: extract `recordSendAndReset` so the history-push + browse-
  index reset logic is one helper, not duplicated between the Enter key
  path and the send-button onClick.
- composer: drop the duplicate IME-quirk comment at the use site; the
  ref declaration block at the top of the component already documents
  the macOS Chinese IME ordering quirk.
- App: hoist the inline `onEdit` arrow into a useCallback so UserMsg's
  memo isn't busted by a fresh function identity on every render of the
  message list.
The v0.13 panels suite uses mkdtempSync for cfgPath and usagePath but
the handlers it exercises (/api/health, listSessions) still call
homedir() under the hood. On a dev machine with thousands of session
jsonl files in ~/.reasonix/sessions the readdir + per-file statSync
walk blows past the 5 s default test timeout, even though the same
test runs in ms on a clean CI box.

Redirect HOME and USERPROFILE inside the suite's beforeEach so the
walks land in the suite's already-empty temp dir, and restore the
originals in afterEach. No production-code change — the handlers'
homedir() coupling is a separate cleanup.

Whole file now runs in 1.7 s.
@esengine esengine merged commit f78bede into main May 24, 2026
4 checks passed
@esengine esengine deleted the chore/desktop-1645-followup branch May 24, 2026 04:48
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