State files are written by several helpers, and the atomic write has no stated contract #767
Labels
No labels
agent-ready
bug
contract
documentation
duplicate
enhancement
good first issue
help wanted
invalid
needs-human
needs-input
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
iterative-works/iw-cli#767
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Found during IW-707 (atomic card writes through
core/adapters/AtomicFile.scala). All writes of state files should go through one crash-atomic helper, and its contract should be stated and tested.dashboard/jvm/src/infrastructure/StateRepository.scalahas its own temp-and-rename write ofstate.json; it could share one atomic-write helper withcore/adapters/AtomicFile.scala.ServerConfigRepository.scala:45,ProcessManager.scala:19andConfigRepository.scala:17incore/adapterswrite withos.write.over, which is not crash-atomic; route them throughAtomicFile.write.ReviewStateMove.copyOut(.partialfile and move) andFakeCommandEnv.failWritesPartwaymodel a partial write that the liveFileSystem.writeno longer produces; remove the knob, the.partialstep and its test together.FileSystem.writeport doc does not state that a write resets the file mode and ownership and needs a writable directory, and no test pins that a symlink at the target is replaced, not followed —core/commands/CommandEnv.scala:107-111,core/test/AtomicFileTest.scala(IW-707 phase 1 review).ReviewStateAdapter.writeFileandLiveFileSystem.writespell the sameFailed to write $path: $ewrapper aroundAtomicFile.write, andAtomicFile.writegivesLeft(null)for an exception with no message —core/adapters/ReviewStateAdapter.scala:122,core/commands/LiveCommandEnv.scala:94,core/adapters/AtomicFile.scala:19.Intake: needs-input
1. May the IW-767 work delete the
.partialstep in the card move, its fake-disk knob and its test?When a tracked review-state card moves out of the tree, the code writes the copy to a
.partialfile and then moves it into place. Since IW-707, every live write is already all-or-nothing, so this step adds nothing. A test proves it with a fake disk that writes only half a file, and the real disk can no longer do that. Items 1, 2, 4 and 5 of this issue need no decision; only item 3 deletes working code, and that needs your approval.https://code.iterative.works/iterative-works/iw-cli/src/branch/main/core/commands/ReviewStateMove.scala#L39-L53
https://code.iterative.works/iterative-works/iw-cli/src/branch/main/core/test/ReviewStateMoveHarnessTest.scala#L109-L121
Recommended: a) — the step guards against a failure that the port contract now excludes, and the issue already plans to pin that contract with tests.
Answer in a comment on this issue, per number, for example "1: a", or in your own words; intake reads it on its next iteration.