decisions AMENDED

126. A process holding two directory capabilities gets a real, single, moving cwd

Amended 2026-09-26 (UTC) by ยง234 (the prompt shows one tree, and other trees are mounted at names in it), provisional until the merge queue lands it. At the prompt, an absolute path no longer starts with a tree's label: the person sees one root, and other trees appear at mount names in it. The single moving cwd below stands.

calef, 2026-08-25, in conversation, closing one of milestone 154's own three "still open" items. Raised as a direct question: "Let's do a real cwd. Isn't that a better user experience?" Answered yes, with the boundary behavior settled below.

The question

Milestone 154 built grant_plan::nav::TwoRoots: a process holding two labeled directory capabilities can resolve /a/... against the first and /b/... against the second, and /a/../b is refused because there is nothing above a's own root to pop. That mechanism is deliberately stateless: every lookup is absolute and labeled, and a bare relative name (no leading /) is refused outright, because "a two-grant holder has two roots and no reason to prefer either" (TwoRoots::resolve's own doc comment) is exactly the shadowing question milestone 47's four open questions leave undecided.

The milestone's own text left "wiring a second grant into the real interactive boot" as calef's call, "a boot-time decision... policy rather than mechanism." Underneath that sits a sharper, narrower question, one that does not require deciding 47's harder open questions (unions, shadowing across many sources, enumeration, whether $PATH survives as a string) at all. It is this: does a two-grant shell have a real, single, moving current directory, the way a one-grant shell already does?

The decision: yes, a real cwd, refuse at either tree's own root

State: a pair (which: A | B, pos: Cwd) in place of the single Cwd a one-grant Holdings carries today. pos is the existing single-tree position type, unchanged.

Resolution:

The boundary: .. at either tree's own root refuses, the same Refused::AtYourRoot a one-grant Cwd::apply already gives at its own root, applied per-tree rather than newly invented. Two alternatives were priced before deciding this one:

Refuse, unchanged from the one-grant case, applied per-tree, wins. It is nife's own existing answer to the same question at smaller scope, and it is no more code than the alternatives. The capability-boundary reasoning that motivated the one-grant refusal in the first place applies identically to two.

Starting position: the first-listed grant's own root (which = A), matching the existing "slot 0 is always the first grant" precedent milestone 154 already established for cspace ordering. No new precedent needed.

What this does not decide

Milestone 47's four open questions (unions and shadowing across more than two labeled sources, enumeration, the compile-time-set-to-runtime-lookup gap, whether $PATH survives as a string) remain exactly as open as they were. This decision is narrower than any of them: two disjoint, individually-labeled trees, one position at a time, no name ever meaning two different things. grant_plan::Holdings's extension to carry this pair, and plan_stage/redirect_target's and caps's use of it, are implementation, not decided here.

What it unblocks

The (which, pos) design gives whoever builds the rest of milestone 154's "still open" list (extending caps's display, the shell-to-init spawn-protocol encoding) a real state shape to extend Holdings with, rather than an open question to re-raise.