Skip to content

fix(cli, rfd)!: Stop the workspace picker recording a selection - #1143

Open
JeanMertz wants to merge 2 commits into
mainfrom
jp-workspace-inconsistency
Open

fix(cli, rfd)!: Stop the workspace picker recording a selection#1143
JeanMertz wants to merge 2 commits into
mainfrom
jp-workspace-inconsistency

Conversation

@JeanMertz

Copy link
Copy Markdown
Collaborator

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 used. 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.

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>
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