docs,save: correct a stale TODO claim and rename encodeSnapshot (closes #27)
Four cleanups recorded as advisories during the PR #26 review and deliberately kept out of it. No behaviour change. The 2026-08-09 sig-leave (closes #12) TODO entry still argued in the present tense that declining to save on SIGINT/SIGQUIT was also the safe choice, "because AutoSave gob-encodes live state that the main goroutine is still mutating, after removing the old file". Both halves stopped being true with #24: the encode runs on the game goroutine and saveFile is CreateTemp/Sync/Chmod/Rename with no Remove. The paragraph is now in the past tense and marked superseded, pointing at the fix/autosave-race entry, and says the split stands on C and on semantics alone — which is what the current savesOnSignal comment says. The false claim was in the #12 entry, not the #24 one; the latter's account of the old remove-then-write is correctly historical and is untouched, as is the err113 mention in the 2026-07-06 entry. encodeSnapshot becomes writeSnapshotFile: it encodes, fsyncs, chmods 0400 and closes, and the old name claimed only the first of those. Its doc comment now names all four and why the fsync is there. TestAutoSaveOnSignalWhileInShellEscape used t.Error for a precondition, so a save that was never taken fell through into assertRestorable, which can then only report a second, derived failure. t.Fatal, matching the identical assertion in the blocked-on-input test. serviceAutoSaveRequest's doc comment carried a 24-column stub line ("The result is still a") left by an earlier edit. gofmt does not rewrap comments, so fmt-check was legitimately green and nothing would have caught it; the paragraph is rewrapped to the block's width. Next Step deliberately not rotated: out-of-band issue work.
This commit is contained in:
@@ -152,7 +152,7 @@ func TestAutoSaveOnSignalWhileInShellEscape(t *testing.T) {
|
||||
<-st.entered
|
||||
|
||||
if !g.AutoSaveOnSignal(autoSaveWait) {
|
||||
t.Error("the save was not taken while the game was in the shell escape")
|
||||
t.Fatal("the save was not taken while the game was in the shell escape")
|
||||
}
|
||||
|
||||
assertRestorable(t, g.FileName)
|
||||
|
||||
Reference in New Issue
Block a user