refactor/pool: split the orchestrator's update, status, rollback and cache-address flows into helpers #96

Merged
pti merged 1 commit from refactor/complexity-pool-orchestrator into main 2026-10-19 22:33:59 +02:00
Owner

Part of #71, the pool orchestrator slice, the last of seven. UpdateHarnessLocked was at Sonar cognitive complexity 35, StatusHarness 36, RollbackHarnessLocked 32 and persistCacheAddresses 28. The update flow now runs through an updateRun struct whose methods cover the realize-and-record step that used to appear three times, the existing-generation repair, resolve plus lock plus fetch plus realize, the node note, lock persistence and the allow_young audit, with node selection and recipe revision moved verbatim into selectUpdateNode and the manifest load into loadUpdateManifest. persistCacheAddresses merges archive, runtime and npm addresses through one generic helper, no release loop because a release sha256 is fixed at resolve time. Rollback and status each gained small helpers. Order of lock write, allow_young audit and realize is unchanged, the scratch-dir cleanup still covers realize, the deferred node error still surfaces only on a fresh resolve. Reviewer pass ran nine mutations with eight caught by existing tests, including the integration tests which all ran here. The survivor was a pre-existing gap, so one test was added asserting no allow_young audit event is written when the lock write fails. 🤖 Generated with Claude Code

Part of #71, the pool orchestrator slice, the last of seven. UpdateHarnessLocked was at Sonar cognitive complexity 35, StatusHarness 36, RollbackHarnessLocked 32 and persistCacheAddresses 28. The update flow now runs through an updateRun struct whose methods cover the realize-and-record step that used to appear three times, the existing-generation repair, resolve plus lock plus fetch plus realize, the node note, lock persistence and the allow_young audit, with node selection and recipe revision moved verbatim into selectUpdateNode and the manifest load into loadUpdateManifest. persistCacheAddresses merges archive, runtime and npm addresses through one generic helper, no release loop because a release sha256 is fixed at resolve time. Rollback and status each gained small helpers. Order of lock write, allow_young audit and realize is unchanged, the scratch-dir cleanup still covers realize, the deferred node error still surfaces only on a fresh resolve. Reviewer pass ran nine mutations with eight caught by existing tests, including the integration tests which all ran here. The survivor was a pre-existing gap, so one test was added asserting no allow_young audit event is written when the lock write fails. 🤖 Generated with Claude Code
refactor(pool): split the orchestrator's update, status, rollback and cache-address flows into helpers
All checks were successful
Lint / lint (pull_request) Successful in 1m4s
Lint / sonarqube (pull_request) Has been skipped
fdfddce6c9
Sonar go:S3776 flagged UpdateHarnessLocked, persistCacheAddresses,
RollbackHarnessLocked and StatusHarness (issue #71). Extract named helpers
using the spec's vocabulary: the update flow now separates manifest loading,
node-runtime selection, the recorded-generation facts, and the
resolve/fetch/lock/audit/realize effects (the realize-and-record step that
appeared three times is one method). Cache-address merging uses one generic
per-artifact-kind helper, rollback target selection and status candidate
scanning are their own functions.

Behaviour-neutral: error messages, audit events and the order of side
effects (lock write, then allow_young audit, then realize) are unchanged,
and validation of persisted state is read at the same points, so the
self-heal-via-Decide property is preserved.

Also pin a pre-existing gap: a new test asserts the allow_young audit event
is appended only after the lock write succeeded (an unwritable lock
directory leaves no audit record).

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
pti merged commit 8d04ddfa2c into main 2026-10-19 22:33:59 +02:00
pti deleted branch refactor/complexity-pool-orchestrator 2026-10-19 22:33:59 +02:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
pti/wraptool!96
No description provided.