The routine card remembers which project Run now targets (#1647) - #1652
Merged
Conversation
The card's "Run in" pick was component state, so it was forgotten whenever the card unmounted — open a run, come back — and the picker read the first registered project again: the user's real repo. The next click fired a triage there and pushed an empty triage branch to its origin. The pick is now a preference, `autoPmProject`, beside the opt-outs and the concurrency it sits with on the card: written when the picker changes, read back on every render, so it holds across navigations, reloads and tabs. The card still validates it against the projects it shows, so a remembered project that is no longer registered falls back to the first.
Contributor
Author
|
🤖 automated Checked on the real dashboard, 2026-08-23 ~03:45 IDT, from a throwaway build of The issue's repro, step by step:
Then set it back to |
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.
🤖 automated
Fixes #1647.
What changed
The Routine work card's
Run inpick was component state, so the card forgot it whenever it unmounted — open a run from the sidebar, come back — and the picker read the first registered project again: the user's real repo. The next click fired a triage there and pushed an emptytf-triage-quickto its origin.The pick is now a preference,
autoPmProject(a project id), besideautoPmOptOutandautoPmConcurrency— the two settings it already sits with on the card:src/registry.ts: the field onPreferences, sanitized like the opt-out names — a bounded free-form string, not checked against the project list, since the card validates it against the projects it shows and a project removed since should fall back there rather than be erased on read. Empty is dropped.dashboard/components/RoutineWork.tsx: nopickedstate; the picker writesupdatePreferences({ autoPmProject })and the card readspreferences.autoPmProjectback on every render (the store is optimistic, so the<select>follows the click at once). The existing validation stays: a remembered id that names no registered project falls back to the first.So the pick holds across navigations, reloads (the hard-refresh after every daemon restart included) and tabs, the way the boxes beside it do.
Why a preference rather than session storage
The issue offered both. The pick decides which repo spends quota and gets branches pushed; a reload is exactly the moment it used to snap back to the real repo, and the dashboard keeps the user's settings in the daemon's file with no browser storage by design (
registry.SPEC.md). One field in the existing shape, no second store. "Default to the project whose page the user came from" is not done — it is a different feature, and with the pick remembered the open-run-and-return case no longer needs it.Spec changes
RoutineWork.SPEC.md— a new flow sentence: the project a Run now targets is picked once and kept as a setting, so leaving the Overview and coming back, or reloading, does not put the first project back; a remembered project no longer registered falls back to the first.FEATURES-SPEC.md— "Run now" on a routine, in a picked project the card remembers across navigations and reloads.RoutineWork.test.SPEC.mdupdated for the new tests.Verified
registry.test.ts— the preference round-trips trimmed, and an empty or non-string value is dropped.RoutineWork.test.tsx— a saved pick is what the picker shows and a change writes the setting; a remembered project that is gone falls back to the first. Two existing picker tests now set the preference instead of firing a change on the select (the mock store cannot re-render on a write; the write itself is asserted in the new test).pnpm typecheckexit 0;pnpm testwith the bundle built: node 1548/1548, dashboard 799/799.