Repository navigation
fix(cli): self install replaces the record, retiring what it no longer owns - #934
Merged
David-Noble-at-work merged 4 commits intoSep 23, 2026
Merged
Conversation
added 4 commits
September 23, 2026 17:39
Lane 17 of noblefactor-ops#217, ahead of #228 -- a serious bug, corrected while the analysis is fresh. Ruled 2026-09-23: the manifest is a record of what the tool owns, self install implicitly uninstalls a prior install, and that holds for every app. All four products build through cli.NewRootCmd, so it is one function. Ruled the same day, B over A: install, then retire what the prior record owned and this one does not -- rather than retire first and install into the gap. Both reach the same state. B does not remove a running executable, which Windows refuses, and does not leave the tool absent if the install then fails. Nothing here is transactional. Ruled the same day on vocabulary: writ's verb is reused to describe the function, and its model is not. "We get a manifest, not a trace." A trace has receipts that fold, lifetimes to prune, and a replayable graph behind its reconciliation; a manifest is paths and hashes written at the end of one operation. The plan records the distinction so a later reader does not reach for readback.Fold here. One open question carries a proposal rather than an answer: a file whose hash has changed cannot be deleted and cannot be trusted, and that does not change. But the forgetting can -- the new record could retain it as a modified entry instead of dropping it, which is this issue reproduced one file at a time. Not in the phases; a requirement of its own if wanted.
…r owns runSelfInstall never read the prior manifest. It wrote files, then overwrote the record with a list built from scratch -- so a file at a path this install no longer writes was left on disk and disowned in the same operation, and self uninstall, which reads only the record, could never reach it again. star's extensions moved under devlore/ in #918 and stranded 24 files exactly that way. They were removed by hand on 2026-09-23. Ruled that day: the manifest is a record of what the tool owns, self install implicitly uninstalls a prior install, and it holds for every app. lore, star, writ and devlore-test all build through cli.NewRootCmd, so this one function satisfies it for all four. Ruled B over A: install, then retire what the prior record owned and this one does not -- rather than retire first and install into the gap. Both reach the same state. B does not remove the running executable, which Windows refuses, and does not leave the tool absent when the install that was to replace it fails partway. Nothing here is transactional. The removal loop is now removeRecordedFiles, shared with self uninstall, hash guard included: a file whose content no longer matches what was recorded may be the operator's edit, so it is left and reported. That does not change -- there is no safe way to delete it and no way to trust it. runSelfUninstall loses its nolint:gocognit; extracting the loop took it back under the threshold, verified by golangci-lint. Five tests, and the two that prove the fix were made to fail with the retirement disabled. The other three still pass without it, correctly: they guard against over-deletion, not under-deletion.
10-command-line-interface.md section 3 is where #913 defines the four lifecycle operations by what each does to the record. self install has a record too -- share/<tool>/manifest.json -- and now replaces it rather than overwriting it, so the note belongs beside them, with the reason the verb is the same. It also says what is deliberately not shared. A trace carries receipts that fold, lifetimes to prune, and a reconciliation that can restore a system because the graph behind it is replayable. A manifest is paths and hashes written at the end of one operation. It answers "is this the file I wrote" and cannot answer "what would it take to get back here". Ruled 2026-09-23: reuse the vocabulary to describe the function, not the infrastructure behind it. self install's own Long listed five steps and the retirement made it six. That correction belonged in the commit that made it stale -- rule 12, missed, and caught here rather than left. docs/cli needs no commit: gitignored in this repository, generated by make build and published by docs-publish.yaml. The behaviour reaches it through the Long above.
The last commit of the pull request closes the plan, per #199. Every other box is ticked: vet, lint and test clean, gofmt clean, and the live path exercised with the built binary -- a superseded completion retired and reported, and a file edited after install left and reported. Two findings recorded in the plan because they will recur. misspell enforces US spelling in Go source even though this repository's prose is British, which cost the first lint run. And `gofmt -l` with no file operands reads standard input, so the pre-flight added to the PR script is guarded on there being changed Go files -- unguarded it would hang on a branch that touches no Go. The CI box states the arrangement rather than the outcome, which arrives after this commit; the merge gate enforces it.
David-Noble-at-work
deleted the
fix/933-self-install-never-reconciles
branch
September 23, 2026 16:08
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
Lane 17 of NobleFactor/noblefactor-engprod#217.
runSelfInstallnever read the prior manifest: it wrote files, thenoverwrote the record with a list built from scratch. A file at a path this install no longer writes was therefore
left on disk and disowned in the same operation -- and
self uninstall, which reads only the record, couldnever reach it again.
star's extensions moved under
devlore/in #918 and stranded 24 files exactly that way. They were removed by handon 2026-09-23.
Ruled that day: the manifest is a record of what the tool owns;
self installimplicitly uninstalls a priorinstall; and it holds for every app.
lore,star,writanddevlore-testall build throughcli.NewRootCmd,so this is one function for all four.
It is not only path moves. Any install whose file set shrinks or is renamed strands the difference: an
extension dropped from the source tree, a man page no longer generated, a completion for a shell not selected
this time.
Retire after installing, not before (ruled). Both orders reach the same state. This one does not remove the
running executable, which Windows refuses, and does not leave the tool absent when the install that was to
replace it fails partway. Nothing here is transactional.
The hash guard does not change. A file whose content no longer matches the record may be the operator's own
edit, so it is left and reported rather than deleted. There is no safe way to delete it and no way to trust it.
It takes
deploy's verb and not its model (ruled).docs/architecture/10-command-line-interface.mdsection 3is where #913 defines the four lifecycle operations by their effect on the record, so the note belongs beside
them -- along with what is deliberately not shared: a trace carries receipts that fold, lifetimes to prune and a
replayable graph; this is a list of paths and hashes written at the end of one operation. We get a manifest, not
a trace.
docs/plans/fix/933-self-install-never-reconciles.mdretireSupersededFilesas step 7; the removal loop extracted asremoveRecordedFiles, shared with uninstall; five testsself install'sLong, which listed five steps and now lists sixcomplete-- the last commit closes the plan, per #199Test plan
make vet,make lintandmake testpassgofmt -lclean over every changed fileRetiresWhatItNoLongerOwnsandManifestMatchesTheTree. The other three still pass without it, correctly --they guard against over-deletion, not under-deletion
ManifestMatchesTheTreecompares record and disk in both directions after a changing re-install: apath on disk and in no record can never be uninstalled, and a path in the record and not on disk is how an
uninstall reports success over files it never touched
--shell bash, then--shell zsh. It printedRetired 1 file(s) a previous install placed and this one does notand named thebash completion, which is gone. Before this change that file stayed forever
Left 1 modified file(s) a previous install placedand the operator's line survivedPlan: docs/plans/fix/933-self-install-never-reconciles.md
Resolves #933
Time
Computed by the algorithm of noblefactor-ops#188 at merge.