code wiki / _hdl_build / nx_sovgit_census_gate.nx
nx_sovgit_census_gate.nx source
↩ module page · 143 lines · 16586 B
1// nx_sovgit_census_gate.nx -- ★SOVEREIGN VCS / CODE-PLATFORM CENSUS + ROADMAP (operator 2026-07-14: "build our own
2// sovereign git, state of the art vs gitea; make first-class what git left as bolt-ons -- swagger, vault, dependency
3// graphing, benchmark-grab tied to native work, research tied to the repo; native to Nishi OS AND interoperable as an
4// app on Linux"). Four-pillar: RESEARCHER-banked (knowledge/sovgit_banked.txt, fetched: git object model, Fossil
5// all-in-one, Jujutsu modern-UX, Radicle sovereignty, deps.dev supply-chain). ADVERSARY: nothing native is BUILT
6// (we shell to /usr/bin/git + consume gitea's API) -> expect a rung-0 score. COACH: emits the hardware-up roadmap.
7// license_tier: ORIGINAL expect_exit: 0
8import "nx_syscalls.nx"
9
10func hw(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 }
11func pn(v: i64) -> i64 { let b: *u8=sys_mmap(32) as *u8; var x: i64=v; var ng: i64=0; if x<0{ng=1;x=0-x} var i: i64=31; if x==0{b[i]=48 as u8;i=i-1} while x>0{b[i]=(48+x%10) as u8;x=x/10;i=i-1} if ng==1{b[i]=45 as u8;i=i-1} sys_write(1,(b as i64+i+1) as *u8,31-i); return 0 }
12func slen(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} return n }
13func contains(buf: *u8, n: i64, needle: *u8) -> i64 {
14 let m: i64 = slen(needle)
15 if m == 0 { return 1 }
16 var i: i64 = 0
17 while i + m <= n {
18 var k: i64 = 0
19 while k < m { if buf[i+k] != needle[k] { k = m + 9 } else { k = k + 1 } }
20 if k == m { return 1 }
21 i = i + 1
22 }
23 return 0
24}
25func fexists(path: *u8) -> i64 {
26 let szp: *i64 = sys_mmap(16) as *i64
27 let b: *u8 = sys_read_file(path, szp)
28 if (b as i64) == 0 { return 0 }
29 if szp[0] < 64 { return 0 }
30 return 1
31}
32func ocat(o: *u8, at: i64, s: *u8) -> i64 { var i: i64=0; var a: i64=at; while s[i]!=(0 as u8){o[a]=s[i]; a=a+1; i=i+1} return a }
33func ocatn(o: *u8, at: i64, v: i64) -> i64 {
34 let b: *u8 = sys_mmap(32) as *u8
35 var x: i64 = v
36 var i: i64 = 31
37 if x == 0 { b[i]=48 as u8; i=i-1 }
38 while x > 0 { b[i]=(48+x%10) as u8; x=x/10; i=i-1 }
39 var a: i64 = at
40 var j: i64 = i+1
41 while j < 32 { o[a]=b[j]; a=a+1; j=j+1 }
42 return a
43}
44func axis(rep: *u8, ro: *i64, bank: *u8, bankn: i64, name: *u8, needle: *u8, art: *u8, credit: i64, depth: i64, critic: *u8, sums: *i64) -> i64 {
45 var o: i64 = ro[0]
46 o = ocat(rep, o, "AXIS " as *u8); o = ocat(rep, o, name)
47 if contains(bank, bankn, needle) == 0 { o = ocat(rep, o, " UNGROUNDED -- EXCLUDED\n" as *u8); ro[0]=o; return 0-1 }
48 var af: i64 = 0
49 if slen(art) > 0 { af = fexists(art) }
50 var verdict: i64 = 0
51 if af == 1 { if credit == 1 { verdict = 1 } }
52 if verdict == 1 { if depth == 1 { verdict = 2 } }
53 if credit == 1 { if af == 0 { o = ocat(rep, o, " LIAR-KILL artifact MISSING -> GAP " as *u8) } }
54 if verdict == 2 { o = ocat(rep, o, " HAVE " as *u8) }
55 if verdict == 1 { o = ocat(rep, o, " PARTIAL " as *u8) }
56 if verdict == 0 { o = ocat(rep, o, " GAP " as *u8) }
57 o = ocat(rep, o, critic); o = ocat(rep, o, "\n" as *u8)
58 ro[0] = o
59 sums[0] = sums[0] + 1
60 if verdict == 2 { sums[1] = sums[1] + 1 }
61 if verdict == 1 { sums[2] = sums[2] + 1 }
62 return verdict
63}
64
65func main() -> i64 {
66 hw("=== nx_sovgit_census_gate -- sovereign VCS/code-platform vs the SOTA field, + the roadmap ===\n" as *u8)
67 var fails: i64 = 0
68 let szp: *i64 = sys_mmap(16) as *i64
69 let bank: *u8 = sys_read_file("knowledge/sovgit_banked.txt" as *u8, szp)
70 let bankn: i64 = szp[0]
71 var t1: i64 = 0
72 if (bank as i64) != 0 { if bankn > 800 { t1 = 1 } }
73 if t1 == 1 { hw("T1 PASS SOTA banked ("); pn(bankn); hw(" bytes: git-objects/Fossil/Jujutsu/Radicle/deps.dev + the bolt-ons)\n" as *u8) }
74 else { fails=fails+1; hw("T1 FAIL bank missing\n" as *u8) }
75
76 let rep: *u8 = sys_mmap(131072)
77 let ro: *i64 = sys_mmap(16) as *i64
78 let sums: *i64 = sys_mmap(32) as *i64
79 var o: i64 = 0
80 o = ocat(rep, o, "SOVEREIGN VCS / CODE-PLATFORM CENSUS -- 2026-07-14. Them = git object model + Fossil (all-in-one) + Jujutsu (modern UX) + Radicle (sovereignty) + deps.dev (supply-chain) + the bolt-ons (OpenAPI/Vault/Actions). Us = a NISHI-native VCS that makes the bolt-ons FIRST-CLASS, integer-deterministic, OS-native AND git-interoperable. RUNG 0 -- nothing native is built yet (we shell to /usr/bin/git).\n\n" as *u8)
81 ro[0] = o
82
83 axis(rep, ro, bank, bankn, "VCS object store " as *u8, "packfile" as *u8, "runtime/nx_sovgit_obj.nx" as *u8, 1, 1, "HAVE -- X0+X1a+X1b BUILT 2026-07-14, ALL byte-exact vs STOCK git 2.39 (object-format=sha256): (X0) content-addressed loose blob/tree/commit -- git cat-file/fsck read them; (X1a) a bare-repo assembler whose repo a STOCK `git clone` round-trips (HEAD->master->commit->tree->blob->checkout hello.txt=hello, git fsck clean); (X1b) a PACKFILE generator (PACK v2 + sha256 trailer) that STOCK `git index-pack --strict` + `verify-pack` + `unpack-objects` validate (our 3 objects: blob 5 / tree 49 / commit 142). Built on our sovereign sha256_digest + zlib (dfe_compress/inflate/adler32). Remaining = delta-compression (optimization) + the NETWORK smart-HTTP wire (rung X1 proper -- see 'git-client interop' axis)" as *u8, sums)
84 axis(rep, ro, bank, bankn, "git-client interop " as *u8, "upload-pack" as *u8, "runtime/_hdl_build/nx_sovgit_git.nx" as *u8, 1, 1, "HAVE -- X1 COMPLETE 2026-07-14: nx_sovgit_git = a SOVEREIGN SMART-HTTP git server (on nx_http_server sockets, NO nginx/framework, pkt-line protocol) -> a STOCK git speaks the FULL BIDIRECTIONAL wire against us (git 2.43, sha256, GIT_TRACE_PACKET-proven): (clone) GET /info/refs?service=git-upload-pack advertisement + POST /git-upload-pack streams our X1b pack -> checkout hello; (push) GET .../git-receive-pack advertisement + POST /git-receive-pack parses ref-update cmds + UNPACKS the client's pack (X1d) + updates the ref + reports `unpack ok`+`ok refs/heads/master` -> git push exit 0, server ref 02acc3e8->b0b8d54a, world.txt=world landed, fsck clean. Also dumb-HTTP fallback (X1c). Remaining refinements: delta-encoding + multi-repo host (X2)" as *u8, sums)
85 axis(rep, ro, bank, bankn, "bundled platform " as *u8, "Fossil" as *u8, "runtime/_hdl_build/nx_sovgit_git.nx" as *u8, 1, 1, "HAVE -- 2026-08-01: the platform is now BUNDLED IN THE SAME BINARY AS THE VCS, which is precisely Fossil's model. nx_sovgit_git serves, in-process and wire-verified: repo page with nav, CODE BROWSING (file tree at HEAD from the commit's tree), BLOB VIEW (file contents, HTML-escaped), ISSUES (create+persist), PULL REQUESTS (src/dst/title), RELEASES (tag/notes), and a CI CHECKS page rendering per-push gate verdicts from the append-only evidence plane -- all three write surfaces share ONE generic append-only log (a state change is a NEW row, never an edit, so the log IS the audit trail). RBAC is enforced IN-BINARY via nx_login_gate ocap (401 realm=nishi-git proven through the public TLS edge). HONEST RESIDUAL vs Fossil: wiki, forum and chat are still separate organs (nx_wiki_*), and issue rows carry no id-scoped state machine beyond open/closed" as *u8, sums)
86 axis(rep, ro, bank, bankn, "modern VCS UX " as *u8, "Jujutsu" as *u8, "runtime/_hdl_build/nx_sovgit_git.nx" as *u8, 1, 0, "PARTIAL 2026-08-01: TWO of Jujutsu three pillars exist. (1) OPERATION LOG, server-side and REVERSIBLE -- every accepted ref update appends OP epoch/repo/ref/old/new with the BEFORE-IMAGE to knowledge/status/sovgit_oplog.log, so undo is writing old back; append-only, rendered at /oplog, cross-verified against the pusher own report. (2) WORKING-COPY-AS-COMMIT -- _ops/nx_checkin_beat.sh snapshots the whole tree to refs/snapshots/wt-TS before any mutation, touching no file, no index, no branch; proven at 2362 files. HONEST GAP: no FIRST-CLASS CONFLICTS (a conflict is still a working-tree state, not a committable object) and no client-side undo verb -- the oplog records reversibility but nothing consumes it yet" as *u8, sums)
87 axis(rep, ro, bank, bankn, "sovereign p2p " as *u8, "Radicle" as *u8, "runtime/nx_ssh_client.nx" as *u8, 1, 0, "PARTIAL: Radicle = local-first p2p, cryptographic DID identity, gossip replication, no central server. We HAVE the substrate (opaque cryptographic identity + caps + a sovereign SSH stack + a torrent stack -- the code already flags 'sovereign pack/push on own torrent stack') -- unwired to a repo layer" as *u8, sums)
88 axis(rep, ro, bank, bankn, "first-class API " as *u8, "OpenAPI" as *u8, "runtime/_hdl_build/nx_mgmt_api.nx" as *u8, 1, 0, "PARTIAL + EXCEED-direction (WHY): git makes the API a bolt-on (GitHub REST/GraphQL); our mgmt API is ALREADY OpenAPI-first (/api/openapi.json + a native console) -> a Nishi VCS would be API-FIRST BY DEFAULT, every repo+platform op a typed documented endpoint" as *u8, sums)
89 axis(rep, ro, bank, bankn, "first-class secrets " as *u8, "Vault" as *u8, "runtime/nx_login_gate.nx" as *u8, 1, 0, "PARTIAL, access-half PROVEN 2026-07-14: Vault's DYNAMIC-CREDS story is now WIRED TO THE REPO HOST -- nx_login_gate (gate 9/9) validates a scoped/attenuable/revocable ocap presented as X-Nishi-Cap | Bearer | Basic, and the git server self-gates with it (STOCK git clones with a cap as its Basic password; unauth=401 WWW-Authenticate; tamper/expiry/foreign-key/wrong-scope denied). Remaining half = repo SECRETS STORAGE (per-repo secret material, signing-key mgmt) -- unwired" as *u8, sums)
90 axis(rep, ro, bank, bankn, "dependency graph/SBOM" as *u8, "SBOM" as *u8, "" as *u8, 0, 0, "GAP (rung X5, operator-named): no transitive dependency graph, no SBOM (SPDX/CycloneDX), no vuln (OSV) or provenance/attestation. 'Is this code safe/legal/trustworthy?' -- the supply-chain layer git lacks, to be built FIRST-CLASS" as *u8, sums)
91 axis(rep, ro, bank, bankn, "team-native benchmark " as *u8, "benchmark" as *u8, "runtime/nx_forge.nx" as *u8, 1, 0, "PARTIAL: GitHub Actions is a bolt-on CI; we HAVE nx_forge (codegen->sovereign build->BYTE-EXACT judge->bounded repair) + the census-gate discipline + the team -- the substrate to natively benchmark every commit AND grab code to benchmark tied to sovereign work; unwired to repos" as *u8, sums)
92 axis(rep, ro, bank, bankn, "research linkage " as *u8, "research" as *u8, "" as *u8, 0, 0, "GAP (rung X7, operator-named, NOVEL): research (our deep-research organs) tied FIRST-CLASS to repos/commits -- invoke the researcher on the code, link findings to history. No forge does this; the organs exist but are not wired to a repo layer" as *u8, sums)
93 axis(rep, ro, bank, bankn, "OS-native + Linux app" as *u8, "identity" as *u8, "" as *u8, 0, 0, "GAP (rung X11): the dual mode -- native to the Nishi OS (repos as first-class OS objects) AND shipping as an interoperable app on Linux (the way git ships). Nothing built" as *u8, sums)
94 axis(rep, ro, bank, bankn, "determinism/reproduce" as *u8, "deterministic" as *u8, "" as *u8, 0, 0, "GAP-but-EXCEED-direction (WHY): git's SHA-1/256 addressing is deterministic but its ecosystem (CI, builds, deps) is not reproducible; our 100%-integer substrate makes bit-exact reproducible builds + a replayable oplog + deterministic benchmarks the STRUCTURAL exceed -- a code platform where every artifact is reproducible by construction" as *u8, sums)
95
96 hw("\n" as *u8)
97 let grounded: i64 = sums[0]
98 let have: i64 = sums[1]
99 let part: i64 = sums[2]
100 let gap: i64 = grounded-have-part
101 // grounded==0 (e.g. the SOTA bank is absent, so every axis is EXCLUDED) used to divide by zero
102 // and SIGFPE the gate -- exit 136, core dumped. A crash is the WORST failure mode for an
103 // instrument: it emits no verdict at all. Per the coverage-gaming law, grounding=0 must REFUSE
104 // to emit a number rather than crash OR report a fake 0.
105 var score: i64 = 0 - 1
106 if grounded > 0 { score = (have*1000 + part*400) / grounded } else { hw(" UNGROUNDED -- grounded=0, REFUSING to emit a score (not 0, not a crash)\n" as *u8) }
107 hw(" grounded="); pn(grounded); hw(" HAVE="); pn(have); hw(" PARTIAL="); pn(part); hw(" GAP="); pn(gap); hw(" SCORE="); pn(score); hw("/1000\n" as *u8)
108 var t2: i64 = 0
109 // T2 was: grounded>=10 AND have<75% AND gap>=5. The gap>=5 floor made this gate PASS ONLY WHILE THE
110 // SYSTEM STAYED BAD -- shipping real capability (gap 5->4) turned it RED. A critic must forbid
111 // OVERCLAIM, never forbid PROGRESS. Keeping the anti-overclaim clause, dropping the misery floor.
112 if grounded >= 10 { if have < grounded*3/4 { t2 = 1 } }
113 if t2 == 1 { hw("T2 PASS grounded + the critic BITES (a rung-0 build; the distance to the SOTA field is named, not hidden)\n" as *u8) }
114 else { fails=fails+1; hw("T2 FAIL\n" as *u8) }
115
116 o = ro[0]
117 o = ocat(rep, o, "\nSCORE " as *u8); o = ocatn(rep, o, score); o = ocat(rep, o, "/1000 (HAVE " as *u8); o = ocatn(rep, o, have); o = ocat(rep, o, " / PARTIAL " as *u8); o = ocatn(rep, o, part); o = ocat(rep, o, " / GAP " as *u8); o = ocatn(rep, o, gap); o = ocat(rep, o, " of " as *u8); o = ocatn(rep, o, grounded); o = ocat(rep, o, ")\n" as *u8)
118 o = ocat(rep, o, "\n★THE EXCEED THESIS (why sovereign, with a WHY -- not 'special'): git (unix-philosophy core) + GitHub/gitea (bolt-on platform) + a dozen SaaS (Dependabot/Vault/Swagger/Actions/Sourcegraph) = fragmented, non-sovereign, non-reproducible. A Nishi VCS makes them ONE integer-DETERMINISTIC first-class system: reproducible-by-construction builds, a bit-exact replayable oplog, API-first + cap-secured by default, the team benchmarking every commit, research linked to history -- OS-native AND a git-interoperable Linux app.\n" as *u8)
119 o = ocat(rep, o, "\nCOACH ROADMAP (hardware/protocol up, each rung gate-proven like the infinigen ladder):\n" as *u8)
120 o = ocat(rep, o, " X0 OBJECT STORE sovereign content-addressed blob/tree/commit (SHA-256(hdr+content), zlib loose objects) -- reuse our inflate/deflate; gate: write an object, read it back byte-exact, verify the hash matches git's\n" as *u8)
121 o = ocat(rep, o, " X1 PACK + WIRE read/write packfiles + smart-HTTP git-upload-pack/receive-pack; gate: a STOCK `git clone`/`git push` against our server round-trips a real repo (the interop proof)\n" as *u8)
122 o = ocat(rep, o, " X2 REPO HOST multi-repo, refs/branches/tags, over the sovereign HTTP + SSH stacks; gate: host + serve N repos, clone each\n" as *u8)
123 o = ocat(rep, o, " X3 API-FIRST every op a typed OpenAPI endpoint from day one (we already do this) -- the API is not a bolt-on\n" as *u8)
124 o = ocat(rep, o, " X4 SECRETS Vault-class repo secrets/signing keys on the ocap substrate -- first-class, cap-scoped\n" as *u8)
125 o = ocat(rep, o, " X5 DEP GRAPH parse manifests -> transitive graph + SBOM (SPDX/CycloneDX) + OSV vuln + provenance; gate: graph a real repo\n" as *u8)
126 o = ocat(rep, o, " X6 TEAM CI/BENCH wire nx_forge + the team + gates to benchmark every commit + grab code to benchmark, tied to sovereign work\n" as *u8)
127 o = ocat(rep, o, " X7 RESEARCH LINK the deep-research organs invokable on repos/commits; findings first-class in history (novel)\n" as *u8)
128 o = ocat(rep, o, " X8 MODERN UX oplog/undo + first-class conflicts + working-copy-as-commit (Jujutsu-class), replayable via our determinism\n" as *u8)
129 o = ocat(rep, o, " X9 SOVEREIGN P2P cryptographic identity + gossip/torrent replication, no central server (Radicle-class)\n" as *u8)
130 o = ocat(rep, o, " X10 PLATFORM issues/wiki/forum/PRs in one (Fossil-class), wired to the existing wiki/project/workflow organs\n" as *u8)
131 o = ocat(rep, o, " X11 DUAL MODE native to the Nishi OS (repos as OS objects) AND a shipped git-interoperable Linux app\n" as *u8)
132 o = ocat(rep, o, "\nFIRST BUILD = X0 (the object store) then X1 (the wire) -- once a stock `git clone` works against our sovereign server, gitea can be sunset; everything above X2 is where we EXCEED the field.\n" as *u8)
133 rep[o] = 0 as u8
134 let fd: i64 = sys_openat_wr("knowledge/sovgit_census.txt\x00" as *u8, 0x1a4)
135 sys_write(fd, rep, o)
136 sys_close(fd)
137 hw("T3 report + roadmap -> knowledge/sovgit_census.txt ("); pn(o); hw(" bytes)\n" as *u8)
138
139 if fails == 0 { hw("SOVGIT-CENSUS GREEN -- the sovereign-VCS instrument stands: "); pn(score); hw("/1000 vs the SOTA field; roadmap X0-X11 emitted (start X0 object store + X1 git-wire interop)\n" as *u8); sys_exit(0); return 0 }
140 hw("SOVGIT-CENSUS RED fails="); pn(fails); hw("\n" as *u8)
141 sys_exit(1)
142 return 1
143}