Rename a session with e - #16
Merged
Merged
Conversation
projects.go is registration: the explorer, the path resolution, and the record that comes out of them. Renaming is the second name a row gets, and it is about to have a session counterpart, so it moves out whole before that lands rather than after.
A session's title was set once on the new-session form and never again, so a session that turned into different work kept the wrong label on its card and told every sibling the wrong thing about itself. e now reads the focused column the way x and c do: the sessions list renames the session, the projects list renames the project. The form carries one required field, because the title is the only name a session has that nothing is built on — Name and Branch are in the worktree path and in git, and editing them here would rename neither. The coordinator keeps its own copy of a live session, taken when the agent started, so it is told separately. Title is the only field that can change after Register, so Retitle closes that gap rather than patching one case of it. TestMain arrives with it. The rename tests call store.Save, and with XDG_STATE_HOME unset that writes the real ~/.local/state/deck/state.json — a passing suite replaced a developer's registered projects with a fixture. Per-test t.Setenv protects the test that remembers; this protects the one that does not.
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.
A session's title was set once on the new-session form and never again. A
session that turned into different work kept the wrong label on its card, and
told every sibling the wrong thing about itself.
enow reads the focused column the wayxandcdo: the sessions listrenames the session, the projects list renames the project, and a focused but
empty sessions list falls back to the project. The form carries one required
field, because the title is the only name a session has that nothing is built
on —
NameandBranchare in the worktree path and in git, and editing themhere would rename neither.
The coordinator keeps its own copy of a live session, taken when the agent
started, so it is told separately.
Titleis the only field that can changeafter
Register, soRetitlecloses that gap rather than patching one case ofit. A session whose agent is not running takes the new title from the store
when
Registernext announces it.The first commit moves the project rename out of
projects.goon its own, sothe second is only the new behaviour.
TestMain came with it
The rename tests call
store.Save, and withXDG_STATE_HOMEunset that writesthe real
~/.local/state/deck/state.json.go test ./internal/uireplaced adeveloper's registered projects with a two-project fixture, and the suite
passed while doing it.
TestMainininternal/uiandinternal/storepointsthe state directory at a temporary one for every test in the package, which
protects the test that forgets
t.Setenvrather than the one that remembers.Checked
go test -count=1 ./...andmake race, both green.Retitlecall in turn, and confirmed the twotests that cover them fail without the code.