W7.3 grammar-expansion (follow-up к #46) - #47
Merged
Conversation
added 3 commits
July 5, 2026 13:14
Carry-over from GLM peer-review of PR #46 @ 4a016d4 (RE-APPROVE with one non-blocking precision-nit tracked for expansion-PR). GLM finding: normalize_ast regex `line:\s*\d+,?` без word-boundary \b теоретически over-match'ит на любом `*line: N` AST-поле (например `inline: 5,` → strip до `in`), потенциально маскируя real structural diff или создавая false-match. Empirical verification на N=1000 baseline (main @ 3272583): дампы t27c parse не содержат ни одного `*line:` поля. Nit был latent, не active — 100/100/0 baseline валиден. Fix — defensive precision против future parser evolution (если в t27c AST добавят inline/pipeline/ baseline поля с numeric values). Change: `re.sub(r"line:\s*\d+,?", "", ast_text)` → `re.sub(r"\bline:\s*\d+,?", "", ast_text)` Regression check: N=50 subset of frozen baseline → 50/50/0 ok (parse_ok=1.0, invariance_ok=1.0). Fix не меняет observable behavior на текущем parser, только защищает от regression при parser evolution. phi^2 + phi^-2 = 3
Extends E1 generator to emit function parameters (0-4 per fn) with mixed
scalar and collection-typed params. Three T27-idiomatic collection forms
supported (elem T ∈ {u8, u16, u32, u64, usize}):
[]const T — const slice (Zig-style, most common in t27 codebase)
[]T — mutable slice
[N]T — fixed-size array (N ∈ {8, 16, 20, 32, 64, 128})
## Isolation constraint (per generalu review — isolate-variables discipline)
Collection-typed params are recorded in a new Ctx.coll_params vec, used
ONLY for signature emission. They are NOT pushed into Ctx.idents, which
is the scalar-eligible pool that feeds gen_expr's BinOp/Cast/return
branches. This prevents ill-typed expressions (e.g. vec + 1u8) that
t27c would reject and would confound the whitespace-invariance signal
with false parse_fail results.
Body use of collections (Index expressions arr[i]) is deferred to a
separate commit. This commit establishes parser-exercise of the param-
position (the W6.2 Class 2 defect surface); Index will drive body-
exercise of collection values. Landing them separately preserves
isolate-variables so any future invariance drop can be attributed.
## Empirical verification (this repo state)
Expanded baseline N=1000, seed range 0xC0FFEE..0xC0FFEE+999:
Parse-success 1000 / 1000 (100.0%)
Determinism 1000 / 1000 (100.0%)
Whitespace-invariance 1000 / 1000 (100.0%)
Parse errors: 0
Panics: 0
Non-determinism: 0
Elapsed: 10.77 sec (frozen subset was 9.9 sec)
Coverage delta vs frozen subset (PR #46 @ 3272583):
Fns emitted: 2014 (was ~1900)
Fns with ≥1 collection-param: 1201 / 2014 (59.6%)
Fns with 0 params: 422 / 2014 (20.9%)
Collection-param occurrences: 1988 (avg ~1 per fn)
Form distribution: []const T ~33%, []T ~34%, [N]T ~35%
t27c's parser accepts collection-typed parameters in all three forms
with identical 100% behavior. The frozen subset baseline remains the
reference citation-point; both numbers are reported side-by-side in
W7_3_FUZZ_BASELINE.md §Expanded baseline.
## Files touched
- tests/fuzz/grammar_v2/src/gen.rs:
+ Ctx.coll_params (new field), max_params_per_fn, coll_param_prob
+ Ctx.pick_coll_type (three-form emitter)
+ gen_params (mixes scalar → ctx.idents, collection → ctx.coll_params)
+ gen_fn wired to emit params
- docs/W7_3_FUZZ_BASELINE.md:
+ Expanded baseline section (side-by-side with frozen subset)
+ Coverage delta table
+ Interpretation with explicit IS / IS NOT scoping
+ Frozen citation-point preservation note
- docs/W7_3_FUZZ_BASELINE_PLAN.md:
+ Marked function-params TODO as [x] LANDED
+ Split Index into its own TODO (was bundled with Call)
+ Added fn-signature-registry note for Call TODO
## Reproducibility
cd tests/fuzz/grammar_v2 && cargo build --release
W73_OUT=/tmp/w73_expanded_1000 ./target/release/gen 1000 0xC0FFEE
cd ../../.. && python3 tests/fuzz/grammar_v2/roundtrip.py /tmp/w73_expanded_1000
Expected: ok=1000 parse_err=0 mut_fail=0 non_det=0
## Discipline
- Isolate-variables: only collection-params landed in this commit.
Call/If/Index deferred to separate commits. Any invariance drop in
future increments will be attributable to the specific increment.
- No pre-silicon claims (fuzz corpus is real t27c parse output).
- Frozen citation-point PR #46 @ 3272583 preserved as reference.
phi^2 + phi^-2 = 3
…corpus ground truth SHA-advance delta: 247427d → HEAD Blocking finding from GLM peer-review of 247427d: collection-params syntax mismatch with the actual audit corpus. 247427d emitted Zig-style forms: fn f(p: []const u8, q: [16]u32, r: []u16) This was chosen from a workspace-wide grep that included a parallel non-tri-net corpus at ../t27/specs/ (830 []const T occurrences there). Re-verification against the audit corpus at tri-net/specs on the PR #39 branch (feat/strategic-audit-2026-07-04, 68 files) confirmed 0 []const T occurrences. That corpus uses Rust-style [T; NAMED_CONST] exclusively — 159 total occurrences, 100% u32 element type, module-scope const-decls in the [2, 32] literal range. Revision applied (option a, drop Zig-forms + u32-only): - Rewrote gen.rs pick_coll_type to emit only [u32; NAMED_CONST]. - Added Ctx.declared_consts: Vec<(String, u32)> for per-module tracking. - Added gen_const_decls: emits 1–4 module-scope const NAME: u32 = <lit>; before fns, values in [2, 32], no repeats within a module. - Added NAMED_CONST_POOL: top-10 audit-corpus consts (MAX_NODES, MAX_PARAMS, MAX_METRICS, MAX_FLOWS, MAX_ENTRIES, MAX_MODULES, MAX_TASKS, MAX_FUNCTIONS, MAX_SAMPLES, MAX_RESULTS). - gen_module now emits const-decls before fn-decls. - gen_params guards: emit collection-param only if declared_consts non-empty, else fall back to scalar. - Isolation constraint preserved: collection-typed idents recorded in Ctx.coll_params, never pushed into Ctx.idents. - Grammar header comment updated. Re-baseline (N=1000, seed range 0xC0FFEE..0xC0FFEE+999): - ok=1000 parse_err=0 mut_fail=0 non_det=0 - 1951 fns emitted (1177 with ≥1 collection-param, 60.3%; 392 with 0 params, 20.1%) - 1924 [u32; NAMED_CONST] occurrences, distribution 166–224 per name - 2510 module-scope const-decls (avg 2.5 per module) BASELINE.md §Expanded baseline rewritten: - New §Corpus-mismatch resolution and syntax choice documents the scope error and its fix explicitly. - Results table replaced with [u32; NAMED_CONST] numbers. - Coverage delta rewritten with actual named-const distribution. - Interpretation notes updated; Zig-style absence documented as explicit non-coverage. Anchor recorded (Anchor #4): any claim verified against ground truth requires scoping the verification tool to the same corpus as the claim. Workspace-wide grep is not corpus-scoped grep. Discipline: honors SHA-advance rule (PR #45 → main @ be06148) — this commit is a delta from 247427d, delta bulletized in PR body. phi^2 + phi^-2 = 3
gHashTag
marked this pull request as ready for review
July 5, 2026 14:23
gHashTag
pushed a commit
that referenced
this pull request
Jul 23, 2026
…nnect Both platforms hold a sealed candidate offer (#45-47) but had no way to DELIVER it to the peer. Even serverless P2P needs a meeting point for the first exchange (WebRTC = signaling server, BitTorrent = tracker/DHT, tri-net = the mesh). Rendezvous.swift is the CLIENT: address the relay by roomHash = SHA256(passphrase) so it never sees the passphrase, publish your sealed offer, fetch the peer's. The relay is a BLIND pairing service — offers are sealed, so it cannot read or forge candidates; it only matches "someone else who hashed the same room" with you. Verified in smoke/harness/rendezvous.swift (12th verify.sh test, 15 checks, 5x for determinism, verify: 12 passed, 0 failed): pure layer — wire codec, roomHash blinding, mailbox pairing logic; LIVE layer — a reference UDP rendezvous server + two clients that gather -> seal -> publish -> fetch -> open -> Ice.connect and actually connect over loopback KNOWING ONLY A SHARED ROOM NAME. That is the whole serverless-connection chain end-to-end on one machine. Also fixed a verify.sh regression this exposed (NOT caused by rendezvous): the keychain harness began hanging because waves #46/#47 launched the real SIGNED app, which stored its device identity under the default keychain account; a fresh unsigned harness touching that signed item blocks on a GUI SecurityAgent prompt (the #41 watchdog caught it as a timeout). The app launch poisoned the shared keychain — identity before shared medium. Fix: export TRINET_KC_ACCOUNT=verify so the keychain harness uses an isolated, harness-owned account; the app's real identity item is left untouched. roomHash and the seal are independent defenses: the hash hides WHICH room from the relay, the seal hides WHAT candidates. Boundary: loopback proves discover + exchange + punch + connect over real UDP; a deployment needs the relay host (a tiny stateless service, or the mesh) and two separate NATs for real traversal. Rendezvous is client-only, harness-proven, Mac-only this wave; the iOS mirror and the CallManager integration are the last two steps. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
W7.3 grammar-expansion (продолжение PR #46)
Base:
main@3272583(PR #46 merged, E1+E2 baseline frozen — 100/100/0 subset)Head:
9bbc103Scope: grammar-expansion до E3 unblock (E3 timer-blocked до 2026-07-19 12:24 UTC per PR #44 backstop)
Commits (по SHA, chronological)
2080510—\b-fix normalize_ast (carry-over из GLM PR #46 review)Non-blocking precision-nit из GLM peer-review PR #46 @
4a016d4:line:\s*\d+,?без\bтеоретически over-match на*line: Nполях247427d— grammar-expansion target #1 (collection-typed params) — OBSOLETED by9bbc103Emitted Zig-style
[]const T/[]T/[N]Tcollection forms. GLM peer-review flagged blocking finding: syntax mismatch with the actual W6.2 audit corpus attri-net/specson PR #39 branch (that corpus uses Rust-style[T; NAMED_CONST]exclusively). Retained in history for traceability; replaced by9bbc103.9bbc103— collection-params rewrite to[u32; NAMED_CONST](audit-corpus-aligned)Corpus-mismatch resolution:
The audit corpus targeted by W6.2 lives at
tri-net/specson the PR #39 branch (feat/strategic-audit-2026-07-04, 68 spec files). Verification against that corpus:[]const Toccurrences (Zig-style is absent).[u32; NAMED_CONST]occurrences across the 68 files.u32element type.MAX_NODES(29),MAX_PARAMS(18),MAX_METRICS(12),MAX_FLOWS(11), and so on.const NAME: u32 = <literal>;at module scope, literals in[2, 32].247427dwas chosen from a workspace-widegrepthat also matched a parallel non-tri-net corpus at../t27/specs/(830[]const Toccurrences there). Corpus was not scoped to tri-net/specs. Anchor recorded (Anchor #4): any claim verified against ground truth requires scoping the verification tool to the same corpus as the claim.Revision applied (option a — drop Zig-forms + u32-only):
pick_coll_typerewritten to emit only[u32; NAMED_CONST].Ctx.declared_consts: Vec<(String, u32)>added for per-module tracking.gen_const_decls: 1–4 module-scopeconst NAME: u32 = <literal>;per module, values in[2, 32], no repeats within a module.NAMED_CONST_POOL= top-10 audit-corpus names (MAX_NODES,MAX_PARAMS,MAX_METRICS,MAX_FLOWS,MAX_ENTRIES,MAX_MODULES,MAX_TASKS,MAX_FUNCTIONS,MAX_SAMPLES,MAX_RESULTS).gen_moduleemits const-decls before fn-decls.gen_paramsguards: emits collection-param only ifdeclared_constsnon-empty, else falls back to scalar.Ctx.coll_params, never pushed intoCtx.idents.Re-baseline N=1000 (this HEAD
9bbc103):3272583)9bbc103)[u32; NAMED_CONST]occurrencesSample module snippet:
Планируемые следующие коммиты (tracked, не landed — separate PRs / commits per isolate-variables)
Priority по strategic value:
[u32; NAMED_CONST]— LANDED @9bbc103(superseded247427d)arr[i]) — next; makes collection-params live in body (actual W6.2 Class 2 defect-surface exercise). Isolate-variables: alone, re-baseline, then next.SHA-advance rule application
Per
docs/W7_COLLAB_OPTIONS.md§SHA-advance rule (merged via PR #45 → main @be06148):247427d(Zig-style, BLOCKING FINDING from GLM re-review — syntax mismatch with tri-net/specs corpus).247427d→9bbc103— delta:-Zig-stylepick_coll_type(three-form emitter for[]const T/[]T/[N]T)+Rust-stylepick_coll_type(one form:[u32; NAMED_CONST])+Ctx.declared_consts: Vec<(String, u32)>field+gen_const_decls— module-scope const-decl emitter (1–4 per module, [2,32] literals)+NAMED_CONST_POOL— 10 audit-corpus top consts+gen_moduleemits const-decls before fns+gen_paramsguarded ondeclared_constsnon-empty[u32; IDENT])~docs/W7_3_FUZZ_BASELINE.md§Expanded baseline rewritten (new §Corpus-mismatch resolution + new numbers table + new interpretation)roundtrip.pyReviewer: re-confirm against
9bbc103per rule (Re-reviewed at 9bbc103: delta <bullet-list>in review comment).External-dep window
Discipline compliance
3272583preserved as referencetri-net/specson PR docs: strategic audit 2026-07-04 (7 findings + 3 options) #39 branch (the actual W6.2 audit corpus), not workspace-wide grepphi^2 + phi^-2 = 3
Path-confirmation spot-check (GLM condition @ 9bbc103)
Peer-review of
9bbc103approved the code and doc, gated merge on one path-confirmation check: verify thatt27c gen-ruston a fuzz-generated spec producesVec<>in param position (the W6.2 Class 2 defect surface). Executed 2026-07-05, full 1000-spec sweep:t27c gen-rustsuccesst27c gen-rustfailed[u32; NAMED_CONST]in.t27inputVec<>in gen-rust Rust outputSample (spec
fuzz_00000_seed_0x00c0ffee.t27):Input (t27):
Output (
t27c gen-rust):Confirms: syntax match ↔ codegen path match. Every collection-param position in the fuzz corpus exercises the W6.2 Class 2 defect surface (
Vec<>param-position), not a divergent lowering path.Doc-nit correction (GLM cosmetic)
Prior body said "pick_coll_type rewritten". Precise wording: the standalone
pick_coll_typefunction from247427dwas removed; the equivalent collection-type emission is inlined intogen_paramsasformat!("[u32; {}]", const_name)at gen.rs line 229. Semantics identical, structure simplified. Not a behavior delta.phi^2 + phi^-2 = 3