351a8a04769d
keep the folder remote's temp and lock files out of its listings (3.0.13)
- time
- 2026-09-23 22:06 UTC · 2 weeks ago
- machine
- koh2
- agent
- claude-opus-5-5
- session
- koh 3 review fixes
- parent
- 3e72c29a7ba3
↓ koh-351a8a04.tar.gzatlas at this save
files changed4 files
VERSION+1 −1src/remote/folder.v+7 −1src/remote/folder_test.v+8 −0v.mod+1 −1src/remote/folder.v+7 −1
@@ -52,7 +52,7 @@5252 child := if relative == '' { name } else { '${relative}/${name}' }5353 if os.is_dir(f.path_of(child)) {5454 walk << child55- } else {55+ } else if !is_scratch(name) {5656 keys << child5757 }5858 }@@ -124,6 +124,12 @@124124 }125125 os.link(fresh, path) or { return false }126126 return true127+}128+129+// is_scratch recognises the temp and lock files this backend writes beside a130+// key while publishing it. Keys themselves never contain a dot.131+fn is_scratch(name string) bool {132+ return name.contains('.tmp-') || name.contains('.lock')127133 }128134 129135 fn release_lock(path string) {src/remote/folder_test.v+8 −0
@@ -67,6 +67,14 @@6767 backend.put_if_absent('repo/objects/ccc', 'c'.bytes())!6868 assert backend.list('repo/saves')! == ['repo/saves/aaa', 'repo/saves/bbb']6969 assert backend.list('repo/nothing')!.len == 070+71+ // A writer mid-publish, or one that died, leaves its own files behind.72+ // They are not keys: a listing that returned them would send steal after73+ // events and saves that do not exist.74+ os.write_file(os.join_path(base, 'repo/saves/ddd.tmp-4242'), 'half')!75+ os.write_file(os.join_path(base, 'repo/saves/aaa.lock'), '4242')!76+ os.write_file(os.join_path(base, 'repo/saves/aaa.lock.4242.1790000000'), '4242')!77+ assert backend.list('repo/saves')! == ['repo/saves/aaa', 'repo/saves/bbb']7078 }7179 7280 fn test_delete_removes_the_key() {v.mod+1 −1
@@ -1,6 +1,6 @@11 Module {22 name: 'koh3'3- version: '3.0.12'3+ version: '3.0.13'44 description: 'One SQLite file per repo, one line of history.'55 license: 'MIT'66 }