Skip to content

The agent that grows with you

test(update): shared update-marker identity corpus (A7 rule 7)

Teknium9b1c31c1bea3
diff --git a/tests/fixtures/update_marker_corpus.json b/tests/fixtures/update_marker_corpus.json
new file mode 100644
index 00000000000..31be0a68acb
--- /dev/null
+++ b/tests/fixtures/update_marker_corpus.json
@@ -0,0 +1,668 @@
+{
+ "schema": 1,
+ "contract": {
+ "doc": "Shared update-marker identity corpus (ROUND5 A7 rule 7). Every marker reader runs the 'judge' cases and every releaser the 'release' cases.",
+ "format": [
+ "line 1: owner pid, ASCII digits, fits u32 (else MALFORMED)",
+ "line 2: started_at unix seconds, ASCII digits (else MALFORMED)",
+ "line 3: ct:<digits[.digits]> owner creation time; anything else makes the marker v1",
+ "lines 4+: tagged; 'delegate:<pid> ct:<ct>' (exactly one space; first well-formed one wins) and 'run:<[A-Za-z0-9._-]{1,128}>' (first wins); unknown/malformed tagged lines are ignored. Writers put the delegate on line 4.",
+ "per line: drop one leading BOM (line 1), one trailing CR, surrounding spaces/tabs"
+ ],
+ "liveness": [
+ "an identity is (pid, ct); dead if the pid is not a live process (pid 0 never is)",
+ "our own pid: ours only if |ct - our_ct| <= own_ct_epsilon; a no-ct claim naming our pid is a previous incarnation (dead)",
+ "any other pid: live if |ct - actual| <= ct_tolerance; no recorded ct (v1) or unreadable actual ct: live only while now - started_at <= v1_max_age",
+ "verdict: malformed | dead | ours (a live identity is our incarnation) | live; owner = the owner identity if live, else the delegate if live, else null"
+ ],
+ "release": [
+ "releaser owns line 1-3 identity (exact incarnation): delete, unless a delegate that is live and not the releaser exists -> rewrite with that delegate as owner (started_at and run lines kept)",
+ "releaser is the delegate: owner live -> rewrite without the delegate line; owner dead -> delete",
+ "anything else: keep. Every release runs under the <marker>.lock kernel lock (A7 rule 1)"
+ ],
+ "live_table": "pid -> creation time of a live process; null = alive but creation time unreadable; absent = no such process. The case's own process (our_pid/our_ct, else the top-level defaults; releaser_pid/releaser_ct in release cases) is always alive with that ct.",
+ "rewrite_text": "rewritten markers are canonical: '<pid>\\n<started_at>\\nct:<ct as written>\\n' then the kept run lines, each '\\n'-terminated"
+ },
+ "now": 1791079400,
+ "own_ct_epsilon": 0.005,
+ "ct_tolerance": 2.0,
+ "v1_max_age": 1200,
+ "our_pid": 4242,
+ "our_ct": 1791079000.2504,
+ "judge": [
+ {
+ "name": "v2_live_foreign_owner",
+ "text": "6080\n1791079348\nct:1791079348.328\n",
+ "live": {
+ "6080": 1791079348.328
+ },
+ "expect": {
+ "verdict": "live",
+ "owner": 6080,
+ "run": null
+ }
+ },
+ {
+ "name": "v2_dead_owner",
+ "text": "6080\n1791079348\nct:1791079348.328\n",
+ "live": {},
+ "expect": {
+ "verdict": "dead",
+ "owner": null,
+ "run": null
+ }
+ },
+ {
+ "name": "v2_recycled_pid_ct_mismatch",
+ "text": "6080\n1791079348\nct:1791079348.328\n",
+ "live": {
+ "6080": 1791079390.0
+ },
+ "expect": {
+ "verdict": "dead",
+ "owner": null,
+ "run": null
+ }
+ },
+ {
+ "name": "v2_foreign_ct_inside_2s_tolerance",
+ "text": "6080\n1791079348\nct:1791079348.328\n",
+ "live": {
+ "6080": 1791079349.9
+ },
+ "expect": {
+ "verdict": "live",
+ "owner": 6080,
+ "run": null
+ }
+ },
+ {
+ "name": "v2_foreign_ct_outside_2s_tolerance",
+ "text": "6080\n1791079348\nct:1791079348.328\n",
+ "live": {
+ "6080": 1791079350.4
+ },
+ "expect": {
+ "verdict": "dead",
+ "owner": null,
+ "run": null
+ }
+ },
+ {
+ "name": "self_exact_incarnation",
+ "text": "4242\n1791079001\nct:1791079000.250\n",
+ "live": {},
+ "expect": {
+ "verdict": "ours",
+ "owner": 4242,
+ "run": null
+ },
+ "note": "recorded ct is our ct rounded to 3 decimals"
+ },
+ {
+ "name": "self_pid_reuse_inside_2s",
+ "text": "4242\n1791078999\nct:1791078999.300\n",
+ "live": {},
+ "expect": {
+ "verdict": "dead",
+ "owner": null,
+ "run": null
+ },
+ "note": "our own pid, 0.95 s earlier creation: a previous incarnation (fresh pid namespace)"
+ },
+ {
+ "name": "self_pid_reuse_6ms",
+ "text": "4242\n1791079001\nct:1791079000.244\n",
+ "live": {},
+ "expect": {
+ "verdict": "dead",
+ "owner": null,
+ "run": null
+ },
+ "note": "our own pid is ours only within 5 ms of our creation time"
+ },
+ {
+ "name": "self_pid_v1_young",
+ "text": "4242\n1791079390\n",
+ "live": {},
+ "expect": {
+ "verdict": "dead",
+ "owner": null,
+ "run": null
+ },
+ "note": "a v1/no-ct claim naming our own pid is a previous incarnation, never live"
+ },
+ {
+ "name": "self_pid_bad_ct_line_is_v1",
+ "text": "4242\n1791079390\nct:soon\n",
+ "live": {},
+ "expect": {
+ "verdict": "dead",
+ "owner": null,
+ "run": null
+ }
+ },
+ {
+ "name": "v1_foreign_young",
+ "text": "6080\n1791079390\n",
+ "live": {
+ "6080": 1791079348.328
+ },
+ "expect": {
+ "verdict": "live",
+ "owner": 6080,
+ "run": null
+ }
+ },
+ {
+ "name": "v1_foreign_past_ceiling",
+ "text": "6080\n1791078000\n",
+ "live": {
+ "6080": 1791079348.328
+ },
+ "expect": {
+ "verdict": "dead",
+ "owner": null,
+ "run": null
+ },
+ "note": "v1 age 1400 s > 1200 s ceiling"
+ },
+ {
+ "name": "v1_foreign_dead",
+ "text": "6080\n1791079390\n",
+ "live": {},
+ "expect": {
+ "verdict": "dead",
+ "owner": null,
+ "run": null
+ }
+ },
+ {
+ "name": "v2_ct_inaccessible_young",
+ "text": "6080\n1791079348\nct:1791079348.328\n",
+ "live": {
+ "6080": null
+ },
+ "expect": {
+ "verdict": "live",
+ "owner": 6080,
+ "run": null
+ },
+ "note": "alive but creation time unreadable (Windows other-user/elevated): v1 age ceiling"
+ },
+ {
+ "name": "v2_ct_inaccessible_past_ceiling",
+ "text": "6080\n1791078100\nct:1791078100.000\n",
+ "live": {
+ "6080": null
+ },
+ "expect": {
+ "verdict": "dead",
+ "owner": null,
+ "run": null
+ }
+ },
+ {
+ "name": "bad_ct_line_is_v1",
+ "text": "6080\n1791079390\nct:1.2.3\n",
+ "live": {
+ "6080": 1791079348.328
+ },
+ "expect": {
+ "verdict": "live",
+ "owner": 6080,
+ "run": null
+ }
+ },
+ {
+ "name": "ct_line_trailing_garbage_is_v1",
+ "text": "6080\n1791078000\nct:1791079348.328 x\n",
+ "live": {
+ "6080": 1791079348.328
+ },
+ "expect": {
+ "verdict": "dead",
+ "owner": null,
+ "run": null
+ },
+ "note": "v1 past the ceiling"
+ },
+ {
+ "name": "crash12db_owner_and_delegate_dead",
+ "text": "6080\n1791079348\nct:1791079348.328\ndelegate:13368 ct:1791079350.794\n",
+ "live": {},
+ "expect": {
+ "verdict": "dead",
+ "owner": null,
+ "run": null
+ },
+ "note": "exact bytes of the native Windows orphaned_update artifact"
+ },
+ {
+ "name": "delegate_live_owner_dead",
+ "text": "6080\n1791079348\nct:1791079348.328\ndelegate:13368 ct:1791079350.794\n",
+ "live": {
+ "13368": 1791079350.794
+ },
+ "expect": {
+ "verdict": "live",
+ "owner": 13368,
+ "run": null
+ }
+ },
+ {
+ "name": "owner_and_delegate_live",
+ "text": "6080\n1791079348\nct:1791079348.328\ndelegate:13368 ct:1791079350.794\n",
+ "live": {
+ "6080": 1791079348.328,
+ "13368": 1791079350.794
+ },
+ "expect": {
+ "verdict": "live",
+ "owner": 6080,
+ "run": null
+ }
+ },
+ {
+ "name": "delegate_recycled",
+ "text": "6080\n1791079348\nct:1791079348.328\ndelegate:13368 ct:1791079350.794\n",
+ "live": {
+ "13368": 1791079399.0
+ },
+ "expect": {
+ "verdict": "dead",
+ "owner": null,
+ "run": null
+ }
+ },
+ {
+ "name": "delegate_is_us_owner_dead",
+ "text": "6080\n1791079348\nct:1791079348.328\ndelegate:13368 ct:1791079350.794\n",
+ "live": {
+ "13368": 1791079350.7941
+ },
+ "our_pid": 13368,
+ "our_ct": 1791079350.7941,
+ "expect": {
+ "verdict": "ours",
+ "owner": 13368,
+ "run": null
+ }
+ },
+ {
+ "name": "delegate_is_us_owner_live",
+ "text": "6080\n1791079348\nct:1791079348.328\ndelegate:13368 ct:1791079350.794\n",
+ "live": {
+ "6080": 1791079348.328,
+ "13368": 1791079350.7941
+ },
+ "our_pid": 13368,
+ "our_ct": 1791079350.7941,
+ "expect": {
+ "verdict": "ours",
+ "owner": 6080,
+ "run": null
+ }
+ },
+ {
+ "name": "delegate_names_our_pid_previous_incarnation",
+ "text": "6080\n1791079348\nct:1791079348.328\ndelegate:13368 ct:1791079350.794\n",
+ "live": {
+ "13368": 1791079351.5
+ },
+ "our_pid": 13368,
+ "our_ct": 1791079351.5,
+ "expect": {
+ "verdict": "dead",
+ "owner": null,
+ "run": null
+ },
+ "note": "0.7 s off: a previous incarnation of our pid"
+ },
+ {
+ "name": "owner_ours_delegate_live",
+ "text": "4242\n1791079001\nct:1791079000.250\ndelegate:13368 ct:1791079350.794\n",
+ "live": {
+ "13368": 1791079350.794
+ },
+ "expect": {
+ "verdict": "ours",
+ "owner": 4242,
+ "run": null
+ }
+ },
+ {
+ "name": "padded_lines",
+ "text": " 6080 \t\n\t1791079348 \nct:1791079348.328\t\n delegate:13368 ct:1791079350.794 \n",
+ "live": {
+ "13368": 1791079350.794
+ },
+ "expect": {
+ "verdict": "live",
+ "owner": 13368,
+ "run": null
+ },
+ "note": "spaces/tabs around every line are trimmed"
+ },
+ {
+ "name": "crlf_and_bom",
+ "text": "\ufeff6080\r\n1791079348\r\nct:1791079348.328\r\n",
+ "live": {
+ "6080": 1791079348.328
+ },
+ "expect": {
+ "verdict": "live",
+ "owner": 6080,
+ "run": null
+ }
+ },
+ {
+ "name": "no_trailing_newline",
+ "text": "6080\n1791079348\nct:1791079348.328",
+ "live": {
+ "6080": 1791079348.328
+ },
+ "expect": {
+ "verdict": "live",
+ "owner": 6080,
+ "run": null
+ }
+ },
+ {
+ "name": "interior_whitespace_pid",
+ "text": "60 80\n1791079348\nct:1791079348.328\n",
+ "live": {
+ "6080": 1791079348.328,
+ "60": 1791079348.328,
+ "80": 1791079348.328
+ },
+ "expect": {
+ "verdict": "malformed",
+ "owner": null,
+ "run": null
+ }
+ },
+ {
+ "name": "interior_whitespace_delegate",
+ "text": "6080\n1791079348\nct:1791079348.328\ndelegate:13368 ct:1791079350.794\n",
+ "live": {
+ "13368": 1791079350.794
+ },
+ "expect": {
+ "verdict": "dead",
+ "owner": null,
+ "run": null
+ },
+ "note": "exactly one space inside a delegate line"
+ },
+ {
+ "name": "delegate_without_ct_ignored",
+ "text": "6080\n1791079348\nct:1791079348.328\ndelegate:13368\n",
+ "live": {
+ "13368": 1791079350.794
+ },
+ "expect": {
+ "verdict": "dead",
+ "owner": null,
+ "run": null
+ }
+ },
+ {
+ "name": "malformed_started_at",
+ "text": "6080\nyesterday\nct:1791079348.328\n",
+ "live": {
+ "6080": 1791079348.328
+ },
+ "expect": {
+ "verdict": "malformed",
+ "owner": null,
+ "run": null
+ }
+ },
+ {
+ "name": "malformed_pid",
+ "text": "pid\n1791079348\n",
+ "live": {},
+ "expect": {
+ "verdict": "malformed",
+ "owner": null,
+ "run": null
+ }
+ },
+ {
+ "name": "negative_pid",
+ "text": "-6080\n1791079348\nct:1791079348.328\n",
+ "live": {},
+ "expect": {
+ "verdict": "malformed",
+ "owner": null,
+ "run": null
+ }
+ },
+ {
+ "name": "pid_beyond_u32",
+ "text": "4294967296\n1791079348\nct:1791079348.328\n",
+ "live": {
+ "4294967296": 1791079348.328
+ },
+ "expect": {
+ "verdict": "malformed",
+ "owner": null,
+ "run": null
+ }
+ },
+ {
+ "name": "single_line",
+ "text": "6080\n",
+ "live": {
+ "6080": 1791079348.328
+ },
+ "expect": {
+ "verdict": "malformed",
+ "owner": null,
+ "run": null
+ }
+ },
+ {
+ "name": "pid_zero",
+ "text": "0\n1791079390\nct:1791079390.000\n",
+ "live": {},
+ "expect": {
+ "verdict": "dead",
+ "owner": null,
+ "run": null
+ },
+ "note": "pid 0 is never a process"
+ },
+ {
+ "name": "run_line",
+ "text": "6080\n1791079348\nct:1791079348.328\nrun:desk-7f3a.1\n",
+ "live": {
+ "6080": 1791079348.328
+ },
+ "expect": {
+ "verdict": "live",
+ "owner": 6080,
+ "run": "desk-7f3a.1"
+ }
+ },
+ {
+ "name": "run_after_delegate",
+ "text": "6080\n1791079348\nct:1791079348.328\ndelegate:13368 ct:1791079350.794\nrun:desk-7f3a.1\n",
+ "live": {
+ "13368": 1791079350.794
+ },
+ "expect": {
+ "verdict": "live",
+ "owner": 13368,
+ "run": "desk-7f3a.1"
+ }
+ },
+ {
+ "name": "delegate_after_run",
+ "text": "6080\n1791079348\nct:1791079348.328\nrun:desk-7f3a.1\ndelegate:13368 ct:1791079350.794\n",
+ "live": {
+ "13368": 1791079350.794
+ },
+ "expect": {
+ "verdict": "live",
+ "owner": 13368,
+ "run": "desk-7f3a.1"
+ },
+ "note": "writers put the delegate on line 4; readers accept it on any line after line 3"
+ },
+ {
+ "name": "run_line_dead_claim",
+ "text": "6080\n1791079348\nct:1791079348.328\nrun:desk-7f3a.1\n",
+ "live": {},
+ "expect": {
+ "verdict": "dead",
+ "owner": null,
+ "run": "desk-7f3a.1"
+ }
+ },
+ {
+ "name": "malformed_run_ignored",
+ "text": "6080\n1791079348\nct:1791079348.328\nrun:has space\n",
+ "live": {
+ "6080": 1791079348.328
+ },
+ "expect": {
+ "verdict": "live",
+ "owner": 6080,
+ "run": null
+ }
+ },
+ {
+ "name": "first_of_two_run_lines",
+ "text": "6080\n1791079348\nct:1791079348.328\nrun:first\nrun:second\n",
+ "live": {
+ "6080": 1791079348.328
+ },
+ "expect": {
+ "verdict": "live",
+ "owner": 6080,
+ "run": "first"
+ }
+ }
+ ],
+ "release": [
+ {
+ "name": "owner_alone_deletes",
+ "text": "6080\n1791079348\nct:1791079348.328\n",
+ "releaser_pid": 6080,
+ "releaser_ct": 1791079348.3283,
+ "live": {
+ "6080": 1791079348.3283
+ },
+ "expect": {
+ "action": "delete"
+ }
+ },
+ {
+ "name": "owner_with_dead_delegate_deletes",
+ "text": "6080\n1791079348\nct:1791079348.328\ndelegate:13368 ct:1791079350.794\n",
+ "releaser_pid": 6080,
+ "releaser_ct": 1791079348.3283,
+ "live": {
+ "6080": 1791079348.3283
+ },
+ "expect": {
+ "action": "delete"
+ }
+ },
+ {
+ "name": "owner_with_live_delegate_hands_over",
+ "text": "6080\n1791079348\nct:1791079348.328\ndelegate:13368 ct:1791079350.794\nrun:desk-7f3a.1\n",
+ "releaser_pid": 6080,
+ "releaser_ct": 1791079348.3283,
+ "live": {
+ "6080": 1791079348.3283,
+ "13368": 1791079350.794
+ },
+ "expect": {
+ "action": "rewrite",
+ "text": "13368\n1791079348\nct:1791079350.794\nrun:desk-7f3a.1\n"
+ },
+ "note": "A7 rule 5: the live delegate becomes the owner; started_at and run lines are kept"
+ },
+ {
+ "name": "delegate_with_dead_owner_deletes",
+ "text": "6080\n1791079348\nct:1791079348.328\ndelegate:13368 ct:1791079350.794\n",
+ "releaser_pid": 13368,
+ "releaser_ct": 1791079350.7942,
+ "live": {
+ "13368": 1791079350.7942
+ },
+ "expect": {
+ "action": "delete"
+ },
+ "note": "the crash-12db cause: the script owner was killed; its delegate must remove the marker"
+ },
+ {
+ "name": "delegate_with_live_owner_drops_its_line",
+ "text": "6080\n1791079348\nct:1791079348.328\ndelegate:13368 ct:1791079350.794\nrun:desk-7f3a.1\n",
+ "releaser_pid": 13368,
+ "releaser_ct": 1791079350.7942,
+ "live": {
+ "6080": 1791079348.328,
+ "13368": 1791079350.7942
+ },
+ "expect": {
+ "action": "rewrite",
+ "text": "6080\n1791079348\nct:1791079348.328\nrun:desk-7f3a.1\n"
+ }
+ },
+ {
+ "name": "foreign_claim_kept",
+ "text": "7000\n1791079348\nct:1791079348.111\n",
+ "releaser_pid": 6080,
+ "releaser_ct": 1791079348.3283,
+ "live": {
+ "6080": 1791079348.3283,
+ "7000": 1791079348.111
+ },
+ "expect": {
+ "action": "keep"
+ }
+ },
+ {
+ "name": "same_pid_other_incarnation_kept",
+ "text": "6080\n1791079348\nct:1791079347.000\n",
+ "releaser_pid": 6080,
+ "releaser_ct": 1791079348.3283,
+ "live": {
+ "6080": 1791079348.3283
+ },
+ "expect": {
+ "action": "keep"
+ },
+ "note": "our pid, 1.3 s off: not our claim"
+ },
+ {
+ "name": "v1_naming_our_pid_kept",
+ "text": "6080\n1791079348\n",
+ "releaser_pid": 6080,
+ "releaser_ct": 1791079348.3283,
+ "live": {
+ "6080": 1791079348.3283
+ },
+ "expect": {
+ "action": "keep"
+ },
+ "note": "no-ct claim: a previous incarnation's; release leaves it to a reclaiming reader"
+ },
+ {
+ "name": "malformed_kept",
+ "text": "6080\nnope\n",
+ "releaser_pid": 6080,
+ "releaser_ct": 1791079348.3283,
+ "live": {
+ "6080": 1791079348.3283
+ },
+ "expect": {
+ "action": "keep"
+ }
+ }
+ ]
+}