code wiki / _hdl_build / nx_doc_annotate_gate.nx
nx_doc_annotate_gate.nx
buildroot/runtime/_hdl_build/nx_doc_annotate_gate.nx
about
nx_doc_annotate_gate.nx -- GATE for LEGAL D4 (nx_doc_annotate).
Drives the annotation/markup overlay composing D1 (vault versions) + D2
(envelope completion -> the freeze) + D5 (real Ed25519 seal to complete it)
and asserts every overlay invariant WITH a negative control:
T1 ADD + COUNT + TYPE : notes/comments/highlights/redlines/checks/sigfields
land on a doc version; per-type counts are exact.
T2 REDLINE LIFECYCLE : a redline accepts (resolver recorded); another
rejects and is RETAINED (additive, count unchanged).
T3 THREADED COMMENTS : a comment + 2 replies -> thread_replies = 2.
T4 CHECKLIST GATES SEND : 3 required checklist items, 2 done -> complete=0
(a portal withholds nx_env_send); all done ->
complete=1 and nx_env_send = OK (compose w/ D2).
T5 IMMUTABLE-AFTER-COMPLETE (the crux) : (a) frozen=1 -> add/resolve REFUSED;
(b) a REAL envelope driven to COMPLETED yields
frozen := (status==COMPLETED) and a subsequent add
is REFUSED; control: a still-SENT envelope frozen=0
-> add succeeds. A signed agreement can't be re-marked.
T6 PER-VERSION ANCHORING : an annotation on v1 is not counted for v2 after a
vault version bump (it stays pinned to v1).
T7 HISTORY READABLE UNDER FREEZE : a completed doc's prior annotations remain
fully readable + counted; only NEW writes are refused.
NOTE (honest): uses the single RFC 8032 KAT keypair for determinism (per-signer
keys = a PKI rung). What is proven is the overlay lifecycle + the freeze/additive
invariants and their composition with the real envelope + vault.
Evidence -> knowledge/status/doc_annotate.log
license_tier: ORIGINAL
dependencies 6 imports · 0 importers
imports: nx_doc_annotate.nxnx_doc_envelope.nxnx_doc_seal.nxnx_doc_vault.nxnx_legal_compliance.nxnx_syscalls.nx
imported by: nobody (leaf or entry point)
call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown
structs
| none |
consts
| 38 | const DA_LOG: *u8 = "knowledge/status/doc_annotate.log" |
functions
| 40 | func ew(fd: i64, s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } sys_write(fd, s, n); return 0 } |
| 41 | func ewn(fd: i64, v: i64) -> i64 |
| 50 | func slen(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n } called by 1: mk_seal |
| 52 | func mk_seal(s: *NxSeal, dt: i64, ewills: i64, signer: *u8, ts: i64, |
| 69 | func main() -> i64 |