702789575895

record the offered head in state as offer's step 3 asks, closing 3.0.22's codex review (3.0.37)

time
2026-09-24 03:58 UTC · 2 weeks ago
machine
koh2
agent
claude-opus-5-5
session
koh 3 reliability campaign
parent
889212052e9d
4 files VERSION+1 −1src/sync/sync.v+5 −0src/sync/sync_test.v+2 −0v.mod+1 −1
VERSION+1 −1
@@ -1 +1 @@1-3.0.361+3.0.37

view file

src/sync/sync.v+5 −0
@@ -20,6 +20,10 @@2020 // Where the repo's name on the remote is remembered.2121 const repo_state_key = 'remote_repo'2222 23+// The remote head as of this machine's last successful offer, as the document24+// asks; nothing reads it back yet.25+const remote_head_key = 'remote_head'26+2327 pub const no_saves = 'this repo has no saves yet — nothing to offer'2428 2529 pub struct OfferReport {@@ -90,6 +94,7 @@9094 	if !backend.put_if_match(head_key(name), local.id.bytes(), remote_head.tag)! {9195 		return error('remote has new saves — run koh steal')9296 	}97+	store.set_state(remote_head_key, local.id)!9398 	return report9499 }95100 

view file

src/sync/sync_test.v+2 −0
@@ -97,6 +97,8 @@9797 	offer_now(a, mut backend)!9898 	assert a.state('remote_repo') or { '' } == 'proj'9999 	assert backend.get(head_key('proj'))!.body.bytestr() == history.head(a)!.id100+	// Offer's step 3: the new remote head is recorded in state.101+	assert a.state('remote_head') or { '' } == history.head(a)!.id100102 101103 	// A second offer, with the remote already holding our head, must not102104 	// refuse: the name is remembered, so the remote is ours.

view file

v.mod+1 −1
@@ -1,6 +1,6 @@11 Module {22 	name: 'koh3'3-	version: '3.0.36'3+	version: '3.0.37'44 	description: 'One SQLite file per repo, one line of history.'55 	license: 'MIT'66 }

view file