code wiki / (root) / nx_asset_policy_seed.nx

nx_asset_policy_seed.nx source

↩ module page · 21 lines · 1259 B

1// nx_asset_policy_seed.nx -- seed the asset VISIBILITY POLICY into the native seg_store (no TSV). 2// 3// The migration step: writes the source->visibility rules (authored in nx_asset_visibility's vis_seed) 4// into the content-addressed policy store knowledge/store/asset-vispolicy-, so nx_asset_visibility reads 5// the policy from the nishi-native store instead of a flat .tsv. Idempotent in effect (re-seeding 6// appends a new segment that shadows the old rows; ADDITIVE #13). Run this once (or after editing the 7// rules in vis_seed) to (re)publish the policy. No hardware writes (#26). license_tier: ORIGINAL 8import "nx_syscalls.nx" 9import "nx_asset_visibility.nx" 10 11func sp_w(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } sys_write(1, s, n); return 0 } 12 13func main() -> i64 { 14 sp_w("=== ASSET POLICY SEED: write visibility policy -> native seg_store (no TSV) ===\n\x00" as *u8) 15 sp_w(" store=\x00" as *u8); sp_w(vis_policy_prefix()); sp_w("\n\x00" as *u8) 16 let rc: i64 = vis_seed(vis_policy_prefix()) 17 if rc != 0 { sp_w(" SEED FAILED\n\x00" as *u8); sys_exit(1); return 1 } 18 sp_w(" seeded 6 rules under tag 'vis' (committed). policy now lives in the native store.\n\x00" as *u8) 19 sys_exit(0) 20 return 0 21}