interplane.Get Omega
Read in your language

omnet

aien-dev/omnet

Brought by drakestapleton

GitHub aien-dev/omnet#18 (code only)

closed derived a63c96dec9a958ca #18

Imported from GitHub aien-dev/omnet#18 (code only)

GitHub's metadata for this pull request is unavailable: its state is DERIVED from the commits (merged: the head is reachable from this project's main; open: GitHub kept a merge ref; else closed).

Base 18abb3970699657cc4b24208a818ae403663a7f6 · Head 01379783be86898a222461f5b55c496b7baad3f9

Apply it

git checkout -b patch-a63c96dec9a958ca 18abb3970699657cc4b24208a818ae403663a7f6
curl -fsSL https://interplane.io/drakestapleton/omnet/patches/a63c96dec9a958ca.patch | git am

Raw patch (mbox) · Diff

Provenance

This proposal is imported from GitHub; it is not signed by its author. Its import statement and source record:

github-import 1
aien-dev/omnet
18
01379783be86898a222461f5b55c496b7baad3f9
{"kind":"github-import","owner":"aien-dev","repo":"omnet","number":18,"url":"https://github.com/aien-dev/omnet/pull/18","export_sha256":"967c79e26a893657b5cdaa45efd442be5dbd2ecfe68e25f9a8c1b5da4d60d452","imported_utc":"2026-11-18T16:40:43Z","metadata":"unavailable","state_derived":true}

Changes

diff --git a/cmd/tkad/rpc.om b/cmd/tkad/rpc.om
index 08111c4..318deda 100644
--- a/cmd/tkad/rpc.om
+++ b/cmd/tkad/rpc.om
@@ -340,6 +340,9 @@ end
 if ne tkabegin 0
 ret 500
 end
+note Retained nodes before staging: a replay of an AUM we already have stages
+note nothing, and must not be published as a durable change below.
+rb = tkacget 0
 b = new uchar 65536 0
 if eq dskind t r 2
 j = add r 1
@@ -361,7 +364,11 @@ end
 p = dslit out 0 10
 p = dsputhead out p
 put ds_ctl 6 dslit out p 5
+note Publish only when the commit appended a node. A retained or empty AUM
+note replay leaves the head, revision and stored bytes unchanged.
+if gt tkacget 0 rb
 put ds_ctl 5 1
+end
 ret 200
 end
 fn dsdisable t view ulong 32768 d view uchar 65536 out edit uchar 65536 to int
diff --git a/cmd/tkad/test/smoke.py b/cmd/tkad/test/smoke.py
index eb3f2ee..4d2f76f 100755
--- a/cmd/tkad/test/smoke.py
+++ b/cmd/tkad/test/smoke.py
@@ -178,6 +178,24 @@ with tempfile.TemporaryDirectory(prefix="omnet-tkad-") as top:
         affected = d.rpc(8, d.req(KeyID=FIX["keyID"]))
         check(affected["Signatures"] == FIX["signatures"], "affected raw signature array")
         d.rpc(5, d.req(Head=FIX["updatedHead"], MissingAUMs=[FIX["emptyMeta"]], Interactive=True))
+        # A replay of an already-retained AUM appends nothing, so it must not
+        # persist: the snapshot bytes and Revision stay identical. The daemon
+        # rewrote the snapshot here with Revision+1 before this was pinned.
+        # File layout: 16-byte store magic, 40-byte record frame, then the
+        # 16-word daemon header (word 6 Revision, word 15 the complete marker).
+        def snapshot_state():
+            raw = (state / "snapshot").read_bytes()
+            check(raw[:16] == b"OMNETSNAP0000001", "snapshot store magic")
+            header = struct.unpack_from("<16Q", raw, 56)
+            check(header[15] == 1, "snapshot complete marker")
+            return header[6], raw
+        head_after = d.map()["TKAInfo"]["Head"]
+        revision, before_bytes = snapshot_state()
+        replay = d.rpc(5, d.req(Head=head_after, MissingAUMs=[FIX["emptyMeta"]], Interactive=True))
+        after_revision, after_bytes = snapshot_state()
+        check(replay == {"Head": head_after}, f"retained replay reply: {replay}")
+        check(after_revision == revision, f"retained replay must not advance Revision: {revision} -> {after_revision}")
+        check(after_bytes == before_bytes, "retained replay must not rewrite the snapshot")
         snapshot_map = d.map()
         d.stop(); d = Daemon(state)
         check(d.map() == snapshot_map, "typed empty metadata replay and signatures")