Repository navigation
docs: plan phase 3, charter step 54, append phase 7 - #417
Merged
Merged
Conversation
Planning phase 3 of the native-Windows-permissions campaign (#405) corrected two claims the earlier outline made, and turned up a blocker that has to land before any of it starts. CORRECTION 1 -- "pkg/signing first" is not executable. DefaultSigner derives its key path from configHome() and has exactly one production caller, internal/cli/store.go:197. Under the invariant signing must RECEIVE a root, so internal/cli must own a config root before signing can be handed one. The CLI plumbing comes first; signing is the first consumer of it, not the first change. CORRECTION 2 -- the windows failures do NOT clear in phase 3, and cannot. Ruling 5 already says why: Mode().Perm() reports 0666 on Windows whatever the DACL says, and every one of those tests asserts mode bits. Enforcement makes the file genuinely private without moving a single assertion. Enumerated from the leg: 7 tests, 8 assertions, six of which clear in phase 5 when IsRestricted and Observe's restricted fact give them something true to assert. The seventh, TestWrite_WithPermOverridesPermission, asserts 0644 -- which grants other, so ruling 4 leaves it inheriting the parent DACL by design. It has no enforcement state to observe and becomes a Unix-scoped assertion: the one case where scoping is right rather than evasive. So the windows leg stays at 28 through phases 3 and 4. An unmoved 28 after phase 3 is not a failed migration. BLOCKER, chartered as step 54: internal/cli/xdg.go resolves every anchor from os.Getenv("HOME"), which Windows does not define, so with XDG_* unset StateHome() yields the RELATIVE .local\state and state lands under the process's working directory. Phase 3.1 would anchor writable roots there -- authority over an arbitrary directory while presenting as scoped, strictly worse than the os.WriteFile it replaces. pkg/signing/configHome() already resolves correctly via os.UserHomeDir(), and its doc claims a parity with internal/cli that does not hold, so the same logical location resolves to two different places on Windows. CI cannot see it: the scenario tests set HOME and USERPROFILE, and 65 t.Setenv("XDG_*") sites skip the fallback branch. The charter leaves the fix open -- the failure mode when home cannot resolve, and whether Windows should use XDG paths at all, are questions it states rather than settles. Phase 7 appended, and ruled final: move internal/cli into cmd/internal/cli. Enumeration of its importers found 38 files across four commands plus exactly two non-command importers, neither a library use -- internal/model calls cli.Note/cli.Error for interactive narration and internal/config takes one path anchor and one warning. The move makes that layering violation a compile error, since cmd/internal is importable only from cmd/... . Accepted residual of going last: phases 3-5 plumb internal/cli's roots at the old path and the move rewrites those imports afterward. Assisted-by: Claude Signed-off-by: David Noble <[email protected]>
David-Noble-at-work
pushed a commit
that referenced
this pull request
Aug 15, 2026
The conflicts are a squash-merge artifact, not disagreeing work. This branch was cut from plan-phase-3, whose content reached develop as the DIFFERENT squashed commit ae85c1c (#417), so git sees two independent edits to the same lines and cannot tell they are the same text. Resolved by taking this branch's version of all three files, verified before resolving rather than assumed: every line present only on develop is text this branch deliberately rewrote -- the pre-ruling charter wording, the superseded open-questions list, and the old step-54 ledger row. Nothing unique to develop exists in these files, so ours is develop's content plus the ruling. The merge is guarded: it aborts if any path outside those three conflicts, since that would mean the verification no longer covers the resolution. Signed-off-by: David Noble <[email protected]>
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.
Summary
Plans phase 3 of
windows-native-permissions.md(#405). Planning it corrected two claims the
outline made and surfaced a blocker that must land first.
Correction 1 — "
pkg/signingfirst" is not executableDefaultSigner()derives its key path fromconfigHome()and has one production caller(
internal/cli/store.go:197). Under the invariant, signing must receive a root — sointernal/climust own a config root before signing can be handed one. The CLI plumbing comes first.
Correction 2 — the Windows failures do not clear in phase 3, and cannot
Ruling 5 already said why:
Mode().Perm()reports0666on Windows whatever the DACL says, andevery one of those tests asserts mode bits. Enforcement makes the file genuinely private without
moving a single assertion.
Enumerated from the leg — 7 tests, 8 assertions. Six clear in phase 5, when
IsRestrictedand
Observe'srestrictedfact give them something true to assert on both platforms. The seventh,TestWrite_WithPermOverridesPermission, asserts0644— which grants other, so ruling 4 leavesit inheriting the parent DACL by design. It has no enforcement state to observe and becomes a
Unix-scoped assertion: the one case where scoping is correct rather than evasive.
The windows leg therefore stays at 28 through phases 3 and 4. An unmoved 28 after phase 3 is not
a failed migration, and the plan now says so where someone will read it.
Blocker — step 54
internal/cli/xdg.goresolves every anchor fromos.Getenv("HOME"), which Windows does not define.With
XDG_*unset,StateHome()yields the relative.local\state, so state lands under theprocess's working directory. Phase 3.1 would anchor writable roots there — authority over an
arbitrary directory while presenting as scoped, strictly worse than the
os.WriteFileit replaces.pkg/signing/configHome()already resolves correctly viaos.UserHomeDir(), and its doc claims aparity with
internal/clithat does not hold — so on Windows the signing key and the CLI's configresolve to two different places. CI cannot see any of it: the scenario tests set
HOMEandUSERPROFILE, and 65t.Setenv("XDG_*")sites skip the fallback branch.The charter deliberately leaves the fix open — the failure mode when home cannot resolve, and
whether Windows should use XDG paths at all, are questions it states rather than settles.
Phase 7, appended and ruled final
Move
internal/cli→cmd/internal/cli. Its importers enumerate to 38 files across four commands,plus exactly two non-command importers, neither a library use:
internal/modelcallscli.Note/cli.Errorfor interactive narration, andinternal/configtakes one path anchor and onewarning. The move turns that layering violation into a compile error, since
cmd/internalisimportable only from within
cmd/….Documentation only.
Assisted-by: Claude