code wiki / _hdl_build / nx_seatresume_gate.nx
nx_seatresume_gate.nx source
↩ module page · 299 lines · 20543 B
1// nx_seatresume_gate.nx -- referee for nx_seat resume_map (DM2 crash-resume map, /compare/devmgmt).
2// Fixtures are ASSEMBLED AT RUNTIME under /tmp/nx_seatresume_gate/<epoch>/ (never the live population,
3// never a source-embedded pattern -- the detector-finds-its-own-fixture trap), unique per run so the
4// gate is idempotent by construction. It forks the DEPLOYED subject elf (argv override for staged or
5// local builds) and judges only the subject's OUTPUT -- the same evidence a coordinator would read.
6// Teeth carry their strength in their NAME (gate law E7); both refusal directions are covered: a
7// mapper that misses a planted in-flight write fails the detection teeth, and a mapper that flags
8// EVERYTHING fails the clean-session neg-control (the guard-that-refuses-everything trap).
9// license_tier: ORIGINAL No hw writes (Rule 26). expect_exit: 0
10import "nx_gate_verdict.nx"
11import "nx_tool_run.nx"
12import "nx_syscalls.nx"
13
14const GT_MODE_FILE: i64 = 0x1a4 // 0644, the estate's ST_MODE_RW spelling
15const GT_MODE_DIR: i64 = 0x1ed // 0755 for fixture dirs
16const GT_CAP: i64 = 262144 // capture buffer; the fixture report measures <20KB, tooth asserts TR_FIT so a silent cut cannot pass
17const GT_TIMEOUT_MS: i64 = 30000 // mirrors the subject's own ST_FORK_TIMEOUT_MS bounded-exec rationale
18const GT_WIN_HALF: i64 = 3600 // explicit fixture window half-width = the subject's ST_STALE_SEC/2; only needs to exceed the write-to-run gap
19const GT_OLD_OFFSET: i64 = 100000 // pushes old1 outside BOTH the explicit window and latest-mode span (ST_STALE_SEC=7200) by >10x
20const GT_NULPAD: i64 = 32 // NUL-fill length for the truncated-final-line fixture (real crashes measured 1700..26911B of garbage; any NUL run without a parseable type reproduces the class)
21const GT_PATH: i64 = 4096 // PATH_MAX
22const GT_ARGV: i64 = 96 // argv cell array: 12 slots x 8
23const GT_NUMBUF: i64 = 32 // one decimal epoch string
24
25const GT_JWIN: i64 = 60 // journal-leg test window width (s): narrow enough that the fixture's own span brackets it, so COVERS/PARTIAL are decided by the fixture, not by wall-clock drift
26const GT_JSEED: i64 = 3600 // how far back the fixture's span-min frame sits; only needs to precede the window start
27const GT_JBUF: i64 = 4096 // journal fixture build buffer; the fixtures below measure a few hundred bytes
28
29func gt_slen(s: *u8) -> i64 { var sl_n: i64 = 0; while s[sl_n] != (0 as u8) { sl_n = sl_n + 1 } return sl_n }
30
31// one actlog frame: <ts>\t<ws>\t<tool>\t<verb>\t<outcome>\t<note>\n -- the DM1 contract's shape, built
32// at runtime so the gate never carries a journal fixture as source bytes a scanner could find.
33func gt_frame(buf: *u8, off: i64, ts: i64, ws: *u8, tool: *u8, note: *u8) -> i64 {
34 var fr_o: i64 = gv_catn(buf, off, ts)
35 buf[fr_o] = 9 as u8
36 fr_o = gv_cat(buf, fr_o + 1, ws)
37 buf[fr_o] = 9 as u8
38 fr_o = gv_cat(buf, fr_o + 1, tool)
39 buf[fr_o] = 9 as u8
40 fr_o = gv_cat(buf, fr_o + 1, "use" as *u8)
41 buf[fr_o] = 9 as u8
42 fr_o = gv_cat(buf, fr_o + 1, "-" as *u8)
43 buf[fr_o] = 9 as u8
44 fr_o = gv_cat(buf, fr_o + 1, note)
45 buf[fr_o] = 10 as u8
46 buf[fr_o + 1] = 0 as u8
47 return fr_o + 1
48}
49
50func gt_wf(path: *u8, content: *u8) -> i64 {
51 let wf_fd: i64 = sys_openat_wr(path, GT_MODE_FILE)
52 if wf_fd < 0 { return 0 - 1 }
53 var wf_n: i64 = 0
54 while content[wf_n] != (0 as u8) { wf_n = wf_n + 1 }
55 sys_write(wf_fd, content, wf_n)
56 sys_close(wf_fd)
57 return 0
58}
59
60func gt_path2(dst: *u8, a: *u8, b: *u8) -> i64 {
61 var p2_o: i64 = gv_cat(dst, 0, a)
62 p2_o = gv_cat(dst, p2_o, b)
63 dst[p2_o] = 0 as u8
64 return p2_o
65}
66
67func main(argc: i64, argv: *i64) -> i64 {
68 let ctr: *i64 = gv_ctr()
69 gv_head("nx_seatresume_gate -- DM2 crash-resume map referee (runtime fixtures, forks the subject elf)" as *u8)
70 var subj: *u8 = "_offc/nx_seat.elf" as *u8
71 if argc > 1 { subj = argv[1] as *u8 }
72 let now: i64 = sys_now_realtime_sec()
73 // ---- fixture tree: /tmp/nx_seatresume_gate/<now>/{tr,troot/crash1/{scratchpad,tasks}} ----
74 sys_mkdir("/tmp/nx_seatresume_gate" as *u8, GT_MODE_DIR)
75 let base: *u8 = sys_mmap(GT_PATH)
76 var bo: i64 = gv_cat(base, 0, "/tmp/nx_seatresume_gate/" as *u8)
77 bo = gv_catn(base, bo, now)
78 base[bo] = 0 as u8
79 sys_mkdir(base, GT_MODE_DIR)
80 let tr: *u8 = sys_mmap(GT_PATH)
81 gt_path2(tr, base, "/tr" as *u8)
82 sys_mkdir(tr, GT_MODE_DIR)
83 let troot: *u8 = sys_mmap(GT_PATH)
84 gt_path2(troot, base, "/troot" as *u8)
85 sys_mkdir(troot, GT_MODE_DIR)
86 let td1: *u8 = sys_mmap(GT_PATH)
87 gt_path2(td1, troot, "/crash1" as *u8)
88 sys_mkdir(td1, GT_MODE_DIR)
89 let td2: *u8 = sys_mmap(GT_PATH)
90 gt_path2(td2, td1, "/scratchpad" as *u8)
91 sys_mkdir(td2, GT_MODE_DIR)
92 let td3: *u8 = sys_mmap(GT_PATH)
93 gt_path2(td3, td1, "/tasks" as *u8)
94 sys_mkdir(td3, GT_MODE_DIR)
95 let fp: *u8 = sys_mmap(GT_PATH)
96 // crash1.jsonl: paired FIXA, DANGLING FIXB, then a NUL-filled unterminated final line (the measured crash shape)
97 gt_path2(fp, tr, "/crash1.jsonl" as *u8)
98 let c1fd: i64 = sys_openat_wr(fp, GT_MODE_FILE)
99 if c1fd >= 0 {
100 let c1a: *u8 = "{\"type\":\"last-prompt\",\"lastPrompt\":\"fixture-lane-crash1\"}\n{\"type\":\"user\",\"message\":{\"role\":\"user\",\"content\":\"fixture-prompt crash1 lane work\"},\"timestamp\":\"2026-08-20T00:00:01.000Z\"}\n{\"type\":\"assistant\",\"message\":{\"role\":\"assistant\",\"content\":[{\"type\":\"text\",\"text\":\"fixture assistant text crash1\"}]},\"timestamp\":\"2026-08-20T00:00:02.000Z\"}\n" as *u8
101 sys_write(c1fd, c1a, gt_slen(c1a))
102 let c1b: *u8 = "{\"type\":\"assistant\",\"message\":{\"role\":\"assistant\",\"content\":[{\"type\":\"tool_use\",\"id\":\"toolu_FIXA\",\"name\":\"Bash\",\"input\":{\"command\":\"echo hi\"}}]},\"timestamp\":\"2026-08-20T00:00:03.000Z\"}\n{\"type\":\"user\",\"message\":{\"role\":\"user\",\"content\":[{\"type\":\"tool_result\",\"tool_use_id\":\"toolu_FIXA\",\"content\":\"ok\"}]},\"timestamp\":\"2026-08-20T00:00:04.000Z\"}\n{\"type\":\"ai-title\",\"aiTitle\":\"fixture crash1 title\"}\n" as *u8
103 sys_write(c1fd, c1b, gt_slen(c1b))
104 let c1c: *u8 = "{\"type\":\"assistant\",\"message\":{\"role\":\"assistant\",\"content\":[{\"type\":\"tool_use\",\"id\":\"toolu_FIXB\",\"name\":\"PowerShell\",\"input\":{\"command\":\"apply\"}}]},\"timestamp\":\"2026-08-20T00:00:05.000Z\"}\n" as *u8
105 sys_write(c1fd, c1c, gt_slen(c1c))
106 let nulb: *u8 = sys_mmap(GT_NULPAD)
107 var nz: i64 = 0
108 while nz < GT_NULPAD { nulb[nz] = 0 as u8; nz = nz + 1 }
109 sys_write(c1fd, nulb, GT_NULPAD)
110 sys_close(c1fd)
111 }
112 // clean1.jsonl: every use paired, turn ends in assistant text + system row (COMPLETED; the neg-control)
113 gt_path2(fp, tr, "/clean1.jsonl" as *u8)
114 gt_wf(fp, "{\"type\":\"last-prompt\",\"lastPrompt\":\"fixture-lane-clean1\"}\n{\"type\":\"user\",\"message\":{\"role\":\"user\",\"content\":\"fixture-prompt clean1\"},\"timestamp\":\"2026-08-20T00:00:01.000Z\"}\n{\"type\":\"assistant\",\"message\":{\"role\":\"assistant\",\"content\":[{\"type\":\"tool_use\",\"id\":\"toolu_FIXC\",\"name\":\"Bash\",\"input\":{\"command\":\"ls\"}}]},\"timestamp\":\"2026-08-20T00:00:02.000Z\"}\n{\"type\":\"user\",\"message\":{\"role\":\"user\",\"content\":[{\"type\":\"tool_result\",\"tool_use_id\":\"toolu_FIXC\",\"content\":\"ok\"}]},\"timestamp\":\"2026-08-20T00:00:03.000Z\"}\n{\"type\":\"assistant\",\"message\":{\"role\":\"assistant\",\"content\":[{\"type\":\"text\",\"text\":\"fixture clean1 done all banked\"}]},\"timestamp\":\"2026-08-20T00:00:04.000Z\"}\n{\"type\":\"system\",\"subtype\":\"hook\",\"timestamp\":\"2026-08-20T00:00:05.000Z\"}\n" as *u8)
115 // old1.jsonl: clean shape, mtime pushed out of every window
116 gt_path2(fp, tr, "/old1.jsonl" as *u8)
117 gt_wf(fp, "{\"type\":\"last-prompt\",\"lastPrompt\":\"fixture-lane-old1\"}\n{\"type\":\"assistant\",\"message\":{\"role\":\"assistant\",\"content\":[{\"type\":\"text\",\"text\":\"fixture old1 text\"}]},\"timestamp\":\"2026-08-19T00:00:01.000Z\"}\n" as *u8)
118 let tsp: *i64 = sys_mmap(GT_ARGV) as *i64
119 tsp[0] = now - GT_OLD_OFFSET
120 tsp[1] = 0
121 tsp[2] = now - GT_OLD_OFFSET
122 tsp[3] = 0
123 sys_utimensat(fp, tsp)
124 // novel1.jsonl: an UNKNOWN entry type must be censused, never crash, never misfile the seat
125 gt_path2(fp, tr, "/novel1.jsonl" as *u8)
126 gt_wf(fp, "{\"type\":\"zz-novel-type\",\"x\":\"y\"}\n{\"type\":\"assistant\",\"message\":{\"role\":\"assistant\",\"content\":[{\"type\":\"text\",\"text\":\"fixture novel1 text\"}]},\"timestamp\":\"2026-08-20T00:00:02.000Z\"}\n" as *u8)
127 // crash1's children: one agent JSONL output with a DANGLING use, one raw output, one scratch file
128 gt_path2(fp, td2, "/f1.txt" as *u8)
129 gt_wf(fp, "s\n" as *u8)
130 gt_path2(fp, td3, "/agent1.output" as *u8)
131 gt_wf(fp, "{\"parentUuid\":null,\"isSidechain\":true,\"agentId\":\"agent1\",\"type\":\"user\",\"message\":{\"role\":\"user\",\"content\":\"fixture-agent-lane sub work\"},\"timestamp\":\"2026-08-20T00:01:00.000Z\"}\n{\"type\":\"assistant\",\"message\":{\"role\":\"assistant\",\"content\":[{\"type\":\"tool_use\",\"id\":\"toolu_FIXD\",\"name\":\"Grep\",\"input\":{\"pattern\":\"x\"}}]},\"timestamp\":\"2026-08-20T00:01:01.000Z\"}\n" as *u8)
132 gt_path2(fp, td3, "/raw1.output" as *u8)
133 gt_wf(fp, "plain output line\nno json here\n" as *u8)
134 // journal fixtures: one present, one deliberately never created
135 let jyes: *u8 = sys_mmap(GT_PATH)
136 gt_path2(jyes, base, "/frames.jrnl" as *u8)
137 gt_wf(jyes, "f1\nf2\n" as *u8)
138 let jno: *u8 = sys_mmap(GT_PATH)
139 gt_path2(jno, base, "/absent.jrnl" as *u8)
140 // ---- DM1 leg fixtures (contract: chbeat_<YYYYMMDD>.jrnl, actlog frames, tszero its own file) ----
141 // jdir COVERS the journal-test window (a frame before it and one at its end bracket the span) and
142 // carries a crash1 frame whose tool MATCHES the transcript's last tool_use, so agreement is a real
143 // join and not a coincidence. clean1 is deliberately ABSENT from every journal -> UNCOVERED.
144 let jdir: *u8 = sys_mmap(GT_PATH)
145 gt_path2(jdir, base, "/jrnl" as *u8)
146 sys_mkdir(jdir, GT_MODE_DIR)
147 let jbuf: *u8 = sys_mmap(GT_JBUF)
148 var jo: i64 = gt_frame(jbuf, 0, now - GT_JSEED, "boundary" as *u8, "Seed" as *u8, "span-min" as *u8)
149 jo = gt_frame(jbuf, jo, now - GT_JWIN + 1, "crash1" as *u8, "PowerShell" as *u8, "delta" as *u8)
150 jo = gt_frame(jbuf, jo, now, "boundary" as *u8, "Seed" as *u8, "span-max" as *u8)
151 gt_path2(fp, jdir, "/chbeat_20260820.jrnl" as *u8)
152 gt_wf(fp, jbuf)
153 jo = gt_frame(jbuf, 0, 0, "crash1" as *u8, "Read" as *u8, "undated" as *u8)
154 jo = gt_frame(jbuf, jo, 0, "crash1" as *u8, "Read" as *u8, "undated" as *u8)
155 gt_path2(fp, jdir, "/chbeat_tszero.jrnl" as *u8)
156 gt_wf(fp, jbuf)
157 // jold sits ENTIRELY before the window -- the backfill-mid-drain case that must read PARTIAL
158 let jold: *u8 = sys_mmap(GT_PATH)
159 gt_path2(jold, base, "/jrnlold" as *u8)
160 sys_mkdir(jold, GT_MODE_DIR)
161 jo = gt_frame(jbuf, 0, now - GT_OLD_OFFSET, "crash1" as *u8, "Bash" as *u8, "old" as *u8)
162 gt_path2(fp, jold, "/chbeat_20260101.jrnl" as *u8)
163 gt_wf(fp, jbuf)
164 // an empty transcripts dir for estate-only mode (no .jsonl reachable, journal is the only source)
165 let notr: *u8 = sys_mmap(GT_PATH)
166 gt_path2(notr, base, "/notr" as *u8)
167 sys_mkdir(notr, GT_MODE_DIR)
168 let jwsb: *u8 = sys_mmap(GT_NUMBUF)
169 var jwo: i64 = gv_catn(jwsb, 0, now - GT_JWIN)
170 jwsb[jwo] = 0 as u8
171 let jweb: *u8 = sys_mmap(GT_NUMBUF)
172 jwo = gv_catn(jweb, 0, now)
173 jweb[jwo] = 0 as u8
174 // ---- window strings ----
175 let wsb: *u8 = sys_mmap(GT_NUMBUF)
176 var wo: i64 = gv_catn(wsb, 0, now - GT_WIN_HALF)
177 wsb[wo] = 0 as u8
178 let web: *u8 = sys_mmap(GT_NUMBUF)
179 wo = gv_catn(web, 0, now + GT_WIN_HALF)
180 web[wo] = 0 as u8
181 let one: *u8 = "1" as *u8
182 let two: *u8 = "2" as *u8
183 // ---- run A: explicit window, journal ABSENT ----
184 let out: *u8 = sys_mmap(GT_CAP)
185 let olen: *i64 = sys_mmap(16) as *i64
186 let trunc: *i64 = sys_mmap(16) as *i64
187 let av: *i64 = sys_mmap(GT_ARGV) as *i64
188 av[0] = subj as i64
189 av[1] = "resume_map" as i64
190 av[2] = tr as i64
191 av[3] = troot as i64
192 av[4] = wsb as i64
193 av[5] = web as i64
194 av[6] = jno as i64
195 av[7] = 0
196 let rcA: i64 = tr_run_capture_tr(subj, av, out, GT_CAP, olen, GT_TIMEOUT_MS, trunc)
197 let nA: i64 = olen[0]
198 gv_check("T1 crashed-fixture-state-CRASHED-MIDACTION" as *u8, tr_contains(out, nA, "resume> crash1 state=CRASHED-MIDACTION" as *u8), ctr)
199 gv_check("T2 dangling-tool-use-flagged-by-id" as *u8, tr_contains(out, nA, "INFLIGHT id=toolu_FIXB tool=PowerShell" as *u8), ctr)
200 var t3: i64 = 0
201 if tr_contains(out, nA, "INFLIGHT-SUSPECT final-line-unparseable" as *u8) == 1 { if tr_contains(out, nA, "nul=1" as *u8) == 1 { t3 = 1 } }
202 gv_check("T3 nul-truncated-final-line-flagged-inflight-suspect" as *u8, t3, ctr)
203 var t4: i64 = 0
204 if tr_contains(out, nA, "resume> clean1 state=COMPLETED" as *u8) == 1 { if tr_contains(out, nA, "INFLIGHT id=toolu_FIXC" as *u8) == 0 { t4 = 1 } }
205 gv_check("T4 neg-control-clean-session-must-not-be-flagged-inflight" as *u8, t4, ctr)
206 var t5: i64 = 0
207 if tr_contains(out, nA, "PARTITION scope=transcripts total_jsonl=4 in_window=3 out_of_window=1 sum=4 SUM-OK" as *u8) == 1 { if tr_contains(out, nA, "INWINDOW crashed_midaction=1 completed=2 idle=0 unknown=0 sum=3 SUM-OK" as *u8) == 1 { t5 = 1 } }
208 gv_check("T5 partition-parts-sum-with-denominators" as *u8, t5, ctr)
209 gv_check("T6 out-of-window-seat-counted-not-expanded" as *u8, 1 - tr_contains(out, nA, "SEAT id=old1" as *u8), ctr)
210 var t7: i64 = 0
211 if tr_contains(out, nA, "task_child name=agent1.output" as *u8) == 1 { if tr_contains(out, nA, "kind=agent" as *u8) == 1 { if tr_contains(out, nA, "INFLIGHT id=toolu_FIXD tool=Grep" as *u8) == 1 { t7 = 1 } } }
212 gv_check("T7 task-child-agent-parsed-lane-state-and-dangling" as *u8, t7, ctr)
213 var t8: i64 = 0
214 if tr_contains(out, nA, "zz-novel-type=1" as *u8) == 1 { if tr_contains(out, nA, "resume> novel1 state=COMPLETED" as *u8) == 1 { t8 = 1 } }
215 gv_check("T8 unknown-entry-type-censused-never-misfiled" as *u8, t8, ctr)
216 gv_check("T9 journal-absent-SKIP-UNOBSERVABLE-abstains" as *u8, tr_contains(out, nA, "SKIP UNOBSERVABLE reason=absent" as *u8), ctr)
217 var t13a: i64 = 0
218 if rcA == 0 { if trunc[0] == TR_FIT { if tr_contains(out, nA, "RESUME-MAP-END" as *u8) == 1 { t13a = 1 } } }
219 gv_check("T10 capture-complete-envelope-rc0-fit-and-end-marker" as *u8, t13a, ctr)
220 // ---- run B: a NON-actlog journal must be counted as malformed, never crash and never be believed.
221 // The transcript wire format is vendor-declared version-unstable and the journal is written by a
222 // sibling organ, so a shape the scanner does not recognise is EVIDENCE, not an exception.
223 av[6] = jyes as i64
224 let rcB: i64 = tr_run_capture_tr(subj, av, out, GT_CAP, olen, GT_TIMEOUT_MS, trunc)
225 let nB: i64 = olen[0]
226 var t10: i64 = 0
227 if rcB == 0 { if tr_contains(out, nB, "malformed=2" as *u8) == 1 { if tr_contains(out, nB, "verdict=SKIP" as *u8) == 1 { t10 = 1 } } }
228 gv_check("T11 unparseable-journal-counted-malformed-and-SKIPs-rather-than-being-believed" as *u8, t10, ctr)
229 // ---- run C: empty window (the empty set must carry its denominator, exit 0, zero seats) ----
230 av[4] = one as i64
231 av[5] = two as i64
232 av[6] = jno as i64
233 let rcC: i64 = tr_run_capture_tr(subj, av, out, GT_CAP, olen, GT_TIMEOUT_MS, trunc)
234 let nC: i64 = olen[0]
235 var t11: i64 = 0
236 if rcC == 0 { if tr_contains(out, nC, "in_window=0" as *u8) == 1 { if tr_contains(out, nC, "sum=4 SUM-OK" as *u8) == 1 { if tr_contains(out, nC, "RESUME-MAP-END seats=0" as *u8) == 1 { t11 = 1 } } } }
237 gv_check("T12 neg-control-empty-window-empty-set-carries-denominator" as *u8, t11, ctr)
238 // ---- run D: latest mode derives and PRINTS the window ----
239 av[4] = "latest" as i64
240 av[5] = jno as i64
241 av[6] = 0
242 let rcD: i64 = tr_run_capture_tr(subj, av, out, GT_CAP, olen, GT_TIMEOUT_MS, trunc)
243 let nD: i64 = olen[0]
244 var t12: i64 = 0
245 if rcD == 0 { if tr_contains(out, nD, "WINDOW mode=latest span_src=ST_STALE_SEC" as *u8) == 1 { if tr_contains(out, nD, "in_window=3" as *u8) == 1 { t12 = 1 } } }
246 gv_check("T13 latest-mode-window-derived-printed-and-excludes-stale" as *u8, t12, ctr)
247 // ---- runs E/F/G: the DM1 frames-journal leg (contract published 2026-08-20) ----
248 // E: journal COVERS the window -> per-seat join, agreement, tszero in its own bucket
249 av[2] = tr as i64
250 av[3] = troot as i64
251 av[4] = jwsb as i64
252 av[5] = jweb as i64
253 av[6] = jdir as i64
254 av[7] = 0
255 let rcE: i64 = tr_run_capture_tr(subj, av, out, GT_CAP, olen, GT_TIMEOUT_MS, trunc)
256 let nE: i64 = olen[0]
257 var t14: i64 = 0
258 if rcE == 0 { if tr_contains(out, nE, "verdict=COVERS" as *u8) == 1 { if tr_contains(out, nE, "COVERS: derived coverage spans the requested window" as *u8) == 1 { t14 = 1 } } }
259 gv_check("T14 journal-covering-window-reported-COVERS" as *u8, t14, ctr)
260 gv_check("T15 per-seat-join-agrees-with-transcript-last-action" as *u8, tr_contains(out, nE, "nas_last_tool=PowerShell laptop_last_tool=PowerShell agree=YES" as *u8), ctr)
261 gv_check("T16 neg-control-seat-absent-from-journal-reads-UNCOVERED-not-agree" as *u8, tr_contains(out, nE, "agree=UNCOVERED" as *u8), ctr)
262 gv_check("T17 tszero-frames-counted-in-their-own-bucket-never-folded" as *u8, tr_contains(out, nE, "tszero=2" as *u8), ctr)
263 var t18: i64 = 0
264 if tr_contains(out, nE, "seats_with_frames=1" as *u8) == 1 { if tr_contains(out, nE, "seats_uncovered=2" as *u8) == 1 { if tr_contains(out, nE, "residual=0" as *u8) == 1 { t18 = 1 } } }
265 gv_check("T18 journal-seat-partition-parts-sum" as *u8, t18, ctr)
266 // F: journal sits entirely BEFORE the window -> PARTIAL, and it must STATE the covered window
267 av[6] = jold as i64
268 let rcF: i64 = tr_run_capture_tr(subj, av, out, GT_CAP, olen, GT_TIMEOUT_MS, trunc)
269 let nF: i64 = olen[0]
270 var t19: i64 = 0
271 if rcF == 0 { if tr_contains(out, nF, "verdict=PARTIAL" as *u8) == 1 { if tr_contains(out, nF, "covered_window=" as *u8) == 1 { if tr_contains(out, nF, "does NOT span the requested window" as *u8) == 1 { t19 = 1 } } } }
272 gv_check("T19 backfill-mid-drain-journal-reported-PARTIAL-with-covered-window-stated" as *u8, t19, ctr)
273 gv_check("T20 neg-control-partial-journal-must-not-read-as-COVERS" as *u8, 1 - tr_contains(out, nF, "verdict=COVERS" as *u8), ctr)
274 // G: ESTATE-ONLY -- no transcripts reachable, the journal is the whole source (the NAS case)
275 av[2] = notr as i64
276 av[3] = "-" as i64
277 av[6] = jdir as i64
278 let rcG: i64 = tr_run_capture_tr(subj, av, out, GT_CAP, olen, GT_TIMEOUT_MS, trunc)
279 let nG: i64 = olen[0]
280 var t21: i64 = 0
281 if rcG == 0 { if tr_contains(out, nG, "SEAT id=crash1 source=journal-only" as *u8) == 1 { if tr_contains(out, nG, "source=estate-journal" as *u8) == 1 { t21 = 1 } } }
282 gv_check("T21 estate-only-mode-builds-the-map-from-frames-with-no-transcripts" as *u8, t21, ctr)
283 var t22: i64 = 0
284 if tr_contains(out, nG, "state=UNKNOWN reason=journal-only" as *u8) == 1 { if tr_contains(out, nG, "inflight=UNOBSERVABLE" as *u8) == 1 { t22 = 1 } }
285 gv_check("T22 neg-control-estate-only-abstains-on-in-flight-never-acquits" as *u8, t22, ctr)
286 gv_check("T23 non-session-journal-actor-not-counted-as-a-seat" as *u8, tr_contains(out, nG, "actor_kind=actor (a beat row, NOT a seat)" as *u8), ctr)
287 // H: the contract allows ONE chbeat_<YYYYMMDD>.jrnl day file in place of the convention directory
288 let jfile: *u8 = sys_mmap(GT_PATH)
289 gt_path2(jfile, jdir, "/chbeat_20260820.jrnl" as *u8)
290 av[2] = tr as i64
291 av[3] = troot as i64
292 av[6] = jfile as i64
293 let rcH: i64 = tr_run_capture_tr(subj, av, out, GT_CAP, olen, GT_TIMEOUT_MS, trunc)
294 let nH: i64 = olen[0]
295 var t24: i64 = 0
296 if rcH == 0 { if tr_contains(out, nH, "verdict=COVERS" as *u8) == 1 { if tr_contains(out, nH, "files=1" as *u8) == 1 { if tr_contains(out, nH, "agree=YES" as *u8) == 1 { t24 = 1 } } } }
297 gv_check("T24 single-day-file-journal-path-honoured-per-contract" as *u8, t24, ctr)
298 return gv_verdict("nx_seatresume_gate" as *u8, ctr, "judges the subject's emitted evidence over runtime fixtures" as *u8)
299}