Repository navigation
writ reads neither writ.segments nor writ.scopes, so both extensible sets are unreachable #765
Description
Feature: #762 — The writ lifecycle surface: reconcile, scopes, and the vocabulary settlement
writ cannot resolve a segment or a scope from configuration, so both extensible sets are unreachable and
every operation runs against the builtins alone.
Blocked on this
--scope (#762) has nothing to select until scopes
can be introduced. Custom segments have been documented since the schema was written and have never worked
(#746).
The shape, settled 2026-08-31
One key per concept, holding both the names and their values. A key introduces the name; its value sets it.
writ:
segments:
ROLE: desktop # introduced and set
SITE: # introduced; set by WRIT_SEGMENT_SITE or --segment
scopes:
Staging: ~/staging/root # a custom scope
Home: ~/staging/home # a BUILTIN's root, overridden
vars:
USER_NAME: "Your Name" # what templates interpolate, and nothing elseSpecified in docs/architecture/10-command-line-interface.md §11.
This changes writ.segments from an array to a map. Cheap now, because nothing reads it; expensive the
moment something does. Both keys' readers land in the same change that documents them, so scopes do not
repeat #746.
Work
-
writ.segmentsis read: names introduced, values taken, and a key with no value left unset for the
environment or a flag to fill.DetectSegmentsWithNamesexists for this and has no production caller. -
writ.scopesis read the same way, with a builtin's key overriding its default root. -
varsstops carrying segment values; it holds template variables alone. - Introducing a builtin scope's name is an error on a platform where it does not resolve, and permitted
as an override where it does. Segment builtins resolve everywhere, so segments need no such rule. - An undeclared
--segmentor--scopeerrors, naming what is accepted.SetValuesalready does this
for segments and has no production caller either.
Verification
writ.scopes: {Staging: ~/staging}plus--scope=Stagingdeploys beneath~/staging.writ.scopes: {Home: ~/staging/home}redirects the builtin.writ.scopes: {ProgramFiles: /opt/pf}errors on Unix and is accepted on Windows.writ.segments: {ROLE: desktop}selects<project>.desktopdirectories.writ.segments: {ROLE:}leaves ROLE unset, so no.desktopdirectory matches until
WRIT_SEGMENT_ROLEor--segmentsupplies one.- A
varsentry no longer sets a segment.
Related
#746 (segments unwired — superseded in scope by this), #762 (the lifecycle and scope design), #763 (the
doubled environment prefix, which WRIT_SEGMENT_<NAME> sidesteps by reading os.Getenv directly).
Activity
doc(writ): place the lifecycle and scope rulings (#762, #765, #766)
Plan: the writ lifecycle surface — reconcile, scopes, and the vocabul…
David-Noble-at-work commentedon Sep 30, 2026
#944's PR, #992, merged 2026-09-30 as
e440151aand delivers this issue's segments half. The scopes half stays here. #970, the segmentswrit upgradeandwrit reconciledidn't see, closed with it.The segments shape is not the one settled here on 2026-08-31.
writ.segmentsis an ordered list, not a map, because a directory name carries the extra segments in the order they're declared (ruled 2026-09-30). Each entry is aname, thevaluesit may take, and optionally this machine'svalue(cmd/internal/config/writ.go:11-29,schema/devlore-config.json:241).docs/architecture/10-command-line-interface.md§11 (:895-930) now shows the list for segments and keeps the map for scopes.At
e440151a:writ.segmentsis read byresolveSegments(cmd/writ/writ/config.go:284-306) forwrit deploy,writ upgrade,writ reconcileandwrit adopt(config.go:94,:144,:180,:246). All four take--segment(cmd/writ/writ/commands.go:58,:196,:261;cmd/writ/writ/adopt_cmd.go:83).--segment NAME=value, elseWRIT_SEGMENT_<NAME>, elsevaluein configuration (cmd/writ/writ/segment/detect.go:49-84). A segment with no value matches no directory name.detect.go:100-115). OS, DISTRO and ARCH take either without a declaration.pkg/selector/selector.go:253-295,ValidateSegments):valuethat isn't one of its segment'svaluesvarsholds template variables alone (cmd/internal/config/writ.go:13,schema/devlore-config.json:302).DetectSegmentsWithNamesandSetValues, which the work list names, are deleted (the plan's Q14).segment.Resolvedoes their job.Still this issue's: nothing reads
writ.scopes.WritConfighas no field for it (cmd/internal/config/writ.go:8-16). It exists only inschema/devlore-config.json:227-240and, commented out, inschema/defaults/writ.yaml:29.--scopeis not registered ondeploy,upgrade,reconcileordecommission. The work list's scope items and the three scope checks under Verification are unchanged.#746, which this issue superseded, is still open, although its complaint that
writ.segmentshas no reader no longer holds.docs/plans/feature/944-one-selector-api-writ-and-lore.md, Requirement 3 and Q26