nx_compliance_verdict.nx source
↩ module page · 69 lines · 3324 B
1// nx_compliance_verdict.nx -- sealed regulatory-compliance verdict.
2//
3// license_tier: PUBLIC_NISHI_SUBSTRATE
4// genealogy_id: federal_seed_act_1939 + state_seed_law_50_state_matrix
5// + usda_aphis_phyto_2024 + nishi_pillar_2_state_law_2026
6//
7// The verdict every shippable order receives from
8// nx_state_seed_law_router.nx (and similar regulatory routers --
9// sales tax, AML, phyto, etc.).
10//
11// Per Pillar 2: substrate-level enforcement that no order progresses
12// past PENDING_COMPLIANCE without router approval. Per Cardinal 13
13// (additive-only), the ComplianceTrace is permanent; per Cardinal 20
14// (fail fast), startup verifies the router data is current.
15//
16// ===== The verdicts ===============================================
17
18const NX_COMP_OK: i64 = 1 // ship as-is
19const NX_COMP_LABEL_REQUIRED: i64 = 2 // Federal Seed Act label triggered
20const NX_COMP_REGISTRATION_REQUIRED: i64 = 3 // state requires registered seller
21const NX_COMP_RESTRICTED_SPECIES: i64 = 4 // species disallowed at destination (noxious weed, invasive quarantine)
22const NX_COMP_PHYTO_REQUIRED: i64 = 5 // USDA-APHIS phytocertificate required
23const NX_COMP_AGE_VERIFICATION: i64 = 6 // 18+ verification required (some species/states)
24const NX_COMP_BLOCKED: i64 = 7 // cannot legally ship
25const NX_COMP_UNKNOWN_JURISDICTION: i64 = 8 // router has no data for ship-to (fail-safe BLOCK)
26
27func nx_comp_verdict_name(v: i64) -> *u8 {
28 if v == NX_COMP_OK { return "OK" }
29 if v == NX_COMP_LABEL_REQUIRED { return "LABEL_REQUIRED" }
30 if v == NX_COMP_REGISTRATION_REQUIRED { return "REGISTRATION_REQUIRED" }
31 if v == NX_COMP_RESTRICTED_SPECIES { return "RESTRICTED_SPECIES" }
32 if v == NX_COMP_PHYTO_REQUIRED { return "PHYTO_REQUIRED" }
33 if v == NX_COMP_AGE_VERIFICATION { return "AGE_VERIFICATION" }
34 if v == NX_COMP_BLOCKED { return "BLOCKED" }
35 if v == NX_COMP_UNKNOWN_JURISDICTION { return "UNKNOWN_JURISDICTION" }
36 return "UNKNOWN"
37}
38
39// Can the order proceed at all given this verdict?
40func nx_comp_can_ship(v: i64) -> i64 {
41 if v == NX_COMP_RESTRICTED_SPECIES { return 0 }
42 if v == NX_COMP_BLOCKED { return 0 }
43 if v == NX_COMP_UNKNOWN_JURISDICTION { return 0 }
44 return 1
45}
46
47// Does this verdict require additional action before ship?
48func nx_comp_requires_action(v: i64) -> i64 {
49 if v == NX_COMP_LABEL_REQUIRED { return 1 }
50 if v == NX_COMP_REGISTRATION_REQUIRED { return 1 }
51 if v == NX_COMP_PHYTO_REQUIRED { return 1 }
52 if v == NX_COMP_AGE_VERIFICATION { return 1 }
53 return 0
54}
55
56// === Compliance-data-currency verdict =============================
57// Annual cron checks state-law-effective-date registry against
58// last-router-update per Pillar 2.
59
60const NX_COMP_DRIFT_CURRENT: i64 = 1 // data <30 days old
61const NX_COMP_DRIFT_STALE_30D: i64 = 2 // 30-90 days old
62const NX_COMP_DRIFT_STALE_90D: i64 = 3 // >90 days old (escalate to attorney review)
63
64func nx_comp_drift_name(v: i64) -> *u8 {
65 if v == NX_COMP_DRIFT_CURRENT { return "CURRENT" }
66 if v == NX_COMP_DRIFT_STALE_30D { return "STALE_<30D" }
67 if v == NX_COMP_DRIFT_STALE_90D { return "STALE_>90D" }
68 return "UNKNOWN"
69}