fix(cli, rfd)!: Stop the workspace picker recording a selection - #1143
Open
JeanMertz wants to merge 2 commits into
Open
fix(cli, rfd)!: Stop the workspace picker recording a selection#1143JeanMertz wants to merge 2 commits into
JeanMertz wants to merge 2 commits into
Conversation
Answering the workspace picker recorded the choice as the session's active workspace, so a command run from outside every workspace asked once and then silently reused that answer. Standing in `~/scratch`, `jp c ls` prompted, and the next `jp c ls` did not: a listing had acquired durable user-global state on the way past, and nothing said so on later runs, because the foreign-root notice stays quiet when the launch cwd has no workspace of its own to compete. RFD 087 never said the picker records, and says the opposite everywhere else. The cwd-vs-active prompt separates `c` (use it now) from `C` (use it and make it session-active), which is a distinction the picker was quietly deciding on the user's behalf. `jp w use` is described as the command that mutates session state. And the whole surface is meant to mirror `jp conversation`, where the picker leaves the session mapping alone and only `use`, `fork`, and `q` write it. The picker now resolves the run and nothing more, so a session that never ran `jp w use` is asked again, exactly like a conversation that was never `use`d. Resolution may still repair a recorded selection whose checkout is gone, but it never creates one: `picker` takes no session at all, so the invariant holds by construction rather than by review. The bootstrap requirement declaration was not driving anything. `run_inner` returned early for `jp w` before reading it, leaving `WorkspaceCommand::workspace_requirement` unreachable and its `Resolve` variant dead behind that unreachable call. The declaration also described the wrong relationship: `jp w show <id>` reports *on* a workspace rather than running inside one, and `jp w use <id>` records a selection for later runs, so both resolve their own target against the pre-workspace `TargetEnv` and want no root selected for them. That is now a `Subject` requirement, and the startup dispatch matches on the requirement instead of on the command, so each arm performs exactly the pre-workspace work its commands asked for. `Resolve` had no client left once `jp w use` became `Subject`, and is dropped rather than kept for a hypothetical caller. The targeting keyword for global recency becomes `recent` / `r`. `jp conversation` already spells this concept `recent` and reserves `newest` for the distinct one, so `latest` was a third word for something the grammar it borrows from names twice. RFD 087 was corrected to `recent` while this implementation was in flight, and merged without picking the change up. BREAKING CHANGE: The `l` / `latest` workspace target is now `r` / `recent` Spell `jp -w latest` as `jp -w recent`, and `jp w use l` as `jp w use r`. The old spellings are no longer keywords and fall through to fuzzy matching, so they will report no matching workspace rather than resolving. `jp w use help` lists the current grammar. Signed-off-by: Jean Mertz <git@jeanmertz.com>
Signed-off-by: Jean Mertz <git@jeanmertz.com>
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.
Answering the workspace picker recorded the choice as the session's active workspace, so a command run from outside every workspace asked once and then silently reused that answer. Standing in
~/scratch,jp c lsprompted, and the nextjp c lsdid not: a listing had acquired durable user-global state on the way past, and nothing said so on later runs, because the foreign-root notice stays quiet when the launch cwd has no workspace of its own to compete.RFD 087 never said the picker records, and says the opposite everywhere else. The cwd-vs-active prompt separates
c(use it now) fromC(use it and make it session-active), which is a distinction the picker was quietly deciding on the user's behalf.jp w useis described as the command that mutates session state. And the whole surface is meant to mirrorjp conversation, where the picker leaves the session mapping alone and onlyuse,fork, andqwrite it. The picker now resolves the run and nothing more, so a session that never ranjp w useis asked again, exactly like a conversation that was neverused. Resolution may still repair a recorded selection whose checkout is gone, but it never creates one:pickertakes no session at all, so the invariant holds by construction rather than by review.The bootstrap requirement declaration was not driving anything.
run_innerreturned early forjp wbefore reading it, leavingWorkspaceCommand::workspace_requirementunreachable and itsResolvevariant dead behind that unreachable call. The declaration also described the wrong relationship:jp w show <id>reports on a workspace rather than running inside one, andjp w use <id>records a selection for later runs, so both resolve their own target against the pre-workspaceTargetEnvand want no root selected for them. That is now aSubjectrequirement, and the startup dispatch matches on the requirement instead of on the command, so each arm performs exactly the pre-workspace work its commands asked for.Resolvehad no client left oncejp w usebecameSubject, and is dropped rather than kept for a hypothetical caller.The targeting keyword for global recency becomes
recent/r.jp conversationalready spells this conceptrecentand reservesnewestfor the distinct one, solatestwas a third word for something the grammar it borrows from names twice. RFD 087 was corrected torecentwhile this implementation was in flight, and merged without picking the change up.BREAKING CHANGE: The
l/latestworkspace target is nowr/recentSpell
jp -w latestasjp -w recent, andjp w use lasjp w use r. The old spellings are no longer keywords and fall through to fuzzy matching, so they will report no matching workspace rather than resolving.jp w use helplists the current grammar.