code wiki / (root) / nx_trace_consent.nx

nx_trace_consent.nx

buildroot/runtime/nx_trace_consent.nx

7284 B207 linesdepth 2pulls 2 transitivereach 2 importersview sourcekind librarytopic trace
docsdependenciesstructsconstsfunctions

about

nx_trace_consent.nx -- per-call cross-device sharing consent gate. Per [[feedback-end-to-end-bit-traceability-architecture]] CARDINAL: "Local trace per call in ~/.nishi/trace/<call_id>.jsonl default-off cross-device; federated via Merkle-root + branch fetch with per-call mutual consent." THE 5TH AND FINAL bit-traceability primitive. Without this, traces stay local (default-off) and cannot be shared across devices. With it, traces can be shared but ONLY with explicit per-call consent from BOTH parties (sharer + recipient). Per [[feedback-privacy-by-default-no-tracking]]: consent is the substrate's default-deny posture for cross-device data movement. No automatic syncing. V1 ships: - sealed enum NxConsentDecision (PENDING/GRANTED/DENIED/EXPIRED/REVOKED) - struct NxConsentRequest with call_id + sharer + recipient + scope + ttl - struct NxConsentLedger of all decisions for audit - propose / accept / decline / revoke verbs - check predicate -- "is sharing call_id X to peer Y currently consented?"

dependencies 2 imports · 2 importers

nx_syscalls.nx nx_tier.nx nx_trace_consent.nx nx_substrate_closure_compose_test. nx_trace_consent_test.nx

imports: nx_syscalls.nxnx_tier.nx

imported by: nx_substrate_closure_compose_test.nxnx_trace_consent_test.nx

structs

51struct NxConsentRequest
63struct NxConsentLedger

consts

29const NX_CC_PENDING: nx_int = 0
30const NX_CC_GRANTED: nx_int = 1
31const NX_CC_DENIED: nx_int = 2
32const NX_CC_EXPIRED: nx_int = 3
33const NX_CC_REVOKED: nx_int = 4
34const NX_CC_N_STATES: nx_int = 5
38const NX_CS_FULL_TRACE: nx_int = 0 // share the whole chain
39const NX_CS_MERKLE_ROOT_ONLY: nx_int = 1 // share only the root hash
40const NX_CS_BRANCH_FETCH: nx_int = 2 // recipient may pull specific links
41const NX_CS_N_SCOPES: nx_int = 3
43const NX_TC_OK: nx_int = 0
44const NX_TC_ERR_BAD_DECISION: nx_int = 1
45const NX_TC_ERR_BAD_SCOPE: nx_int = 2
46const NX_TC_ERR_NOT_PENDING: nx_int = 3
47const NX_TC_ERR_NOT_FOUND: nx_int = 4
69const NX_TC_REQ_BYTES: nx_size = 72

functions

71func nx_cc_decision_is_valid(d: nx_int) -> nx_int
77func nx_cs_scope_is_valid(s: nx_int) -> nx_int
92func _tc_at(l: *NxConsentLedger, idx: nx_size) -> *NxConsentRequest
96func _tc_find(l: *NxConsentLedger, request_id: nx_int) -> nx_int
called by 1: nx_trace_consent_decide calls 1: _tc_at