Skip to content

fix(cli): self install replaces the record, retiring what it no longer owns - #934

Merged
David-Noble-at-work merged 4 commits into
developfrom
fix/933-self-install-never-reconciles
Sep 23, 2026
Merged

David-Noble-at-work merged 4 commits into
developfrom
fix/933-self-install-never-reconciles

Conversation

@David-Noble-at-work

@David-Noble-at-work David-Noble-at-work commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Lane 17 of NobleFactor/noblefactor-engprod#217. runSelfInstall never read the prior manifest: it wrote files, then
overwrote 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, 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 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.md section 3
is 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.

Commit What
plan docs/plans/fix/933-self-install-never-reconciles.md
fix retireSupersededFiles as step 7; the removal loop extracted as removeRecordedFiles, shared with uninstall; five tests
doc The model beside writ's in section 3, and self install's Long, which listed five steps and now lists six
plan #933 reads complete -- the last commit closes the plan, per #199

Test plan

  • make vet, make lint and make test pass
  • gofmt -l clean over every changed file
  • Five tests, and the two that prove the fix were made to fail with the retirement disabled:
    RetiresWhatItNoLongerOwns and ManifestMatchesTheTree. The other three still pass without it, correctly --
    they guard against over-deletion, not under-deletion
  • ManifestMatchesTheTree compares record and disk in both directions after a changing re-install: a
    path 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
  • The live path, with the built binary, twice into one prefix: installed --shell bash, then
    --shell zsh. It printed Retired 1 file(s) a previous install placed and this one does not and named the
    bash completion, which is gone. Before this change that file stayed forever
  • The hash guard, live: editing the zsh completion and re-installing printed
    Left 1 modified file(s) a previous install placed and the operator's line survived
  • CI on this PR

Plan: docs/plans/fix/933-self-install-never-reconciles.md

Resolves #933

Time

Marker UTC Elapsed
opened (first commit) 2026-09-23T15:39:58Z —
submitted (PR opened) 2026-09-23T15:58:20Z 0.3 h after opened
merged 2026-09-23T16:08:22Z 0.2 h after submitted; 0.5 h in all

Computed by the algorithm of noblefactor-ops#188 at merge.

David Noble 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
David-Noble-at-work merged commit d113cf5 into develop Sep 23, 2026
13 checks passed
@David-Noble-at-work
David-Noble-at-work deleted the fix/933-self-install-never-reconciles branch September 23, 2026 16:08
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.

self install never reconciles against the prior manifest: the record is a snapshot, not what the tool owns

1 participant