Skip to content

MachineShape construction wall: compile-gated single-constructor discipline - #6698

Merged
briansrls merged 12 commits into
mainfrom
session/proud-fox-374-machine-shape-construction-walls
Jul 16, 2026
Merged

briansrls merged 12 commits into
mainfrom
session/proud-fox-374-machine-shape-construction-walls

Conversation

@gunbai-bot

@gunbai-bot gunbai-bot Bot commented Jul 16, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Compile-gated MachineShape single-constructor discipline — only sanctioned modules (std.machine_shape, extdeps.gpu.machine_shape catalog fill, test/claim witnesses) may materialize MachineShape record literals.

This PR's diff (3 files, stacked on #6701):

  • src/v2/lens/machine_shape.dag — module-context fold_node_topdown gate; Cons/Empty fail-closed match (determinism precedent, not HeadAbsent absorb)
  • src/v2/compiler/00_compile.dag — enrolled in always_required_root_lenses
  • dag/test/claim/machine_shape_construction_wall_test.dag — synthetic RED/GREEN fixtures

Stacked on #6701 (not bundled)

Base branch: session/vivid-owl-803 (#6701). The interim main-unbreak (#6686 hash-grounding revert + algebra import hygiene) lives exclusively in #6701 — this PR does not widen the fnv1a64 fork. Merge #6701 first, then rebase this onto main.

Also stacked on #6687 for std.machine_shape / extdeps.gpu.machine_shape subjects.

Test plan

@gunbai-bot
gunbai-bot Bot marked this pull request as ready for review July 16, 2026 00:56
@gunbai-bot

gunbai-bot Bot commented Jul 16, 2026

Copy link
Copy Markdown
Contributor Author

Addressed: std→extdeps layering violation (da58cdb5dd)

The finding was valid. dag/std/machine_shape.dag no longer imports extdeps.*.

  • Catalog fill moved to extdeps: shape_from_catalog, ShapeFromCatalogInput, and GPU derivation helpers now live in dag/extdeps/gpu/machine_shape_catalog.dag (extdeps.gpu.machine_shape_catalog), which correctly imports std.machine_shape + extdeps.gpu.types.
  • PcieLink scaffold: Until the planned PcieLink de-fork (§3 item 2), InterconnectLink is LinkAttach { lane_count, generation_ordinal } in std — validation already ignores link payload; witness RED arm updated accordingly.
  • Construction gate: extdeps.gpu.machine_shape_catalog added to sanctioned fill modules alongside std.machine_shape and test/claim witnesses.

machine_shape_witnesses claim-run: green. dag/std/** has zero extdeps imports again.

— sent from proud-fox-374

…port x #6663 field wall)

Partial revert of 4a60303: src/v2/std/node.dag, materialize.dag,
materialize_witness_test.dag, inert_carrier.dag, and the DESIGN Sec-3-thread
note pair (carrier + generated doc together). Keeps #6686's orthogonal
cli_run.rs nfr-roster backfill (reverting it would re-red the falsifier lane).

Root cause (proven by execution): #6663's new MissingField presence check
resolves a literal's expected type by unqualified name through the flat module
type env; #6686's 'import std.types { ContentHash }' in v2.std.node pulls
dag-root std.algebra into the typecheck closure of every v2 module importing
v2.std.node (704 files), so dag-root Monoid/Semigroup/BooleanAlgebra/
OrderedRing/CommutativeMonoid/CommutativeSemiring/AbelianGroup shadow the
v2.std.algebra declarations at 28 literal sites in
src/v2/std/{diagnostic,logic,nat,integer}.dag -> ci_floor_plan resolve fails
-> every main push red. Neither PR alone was red: zero file overlap, merged
31 minutes apart, and the squash union tree was never CI'd (the PR's only CI
run began 8 minutes before #6686 landed).

Receipt: on the 60286e0 tree with the same seed binary, reverting exactly
this .dag surface takes the plan resolve from 28 missing-required-field errors
to green with the floor executing witnesses (control: #6678/#6685 left in
tree).

Re-land trigger (dissolution): the wall's presence leg consults the resolver's
binding (or fails closed on ambiguous names) instead of the flat-env name
lookup; the follow-up re-lands these files with that fix, using this exact
28-error tree as the RED control.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@briansrls
briansrls force-pushed the session/proud-fox-374-machine-shape-construction-walls branch from da58cdb to cf6a57d Compare July 16, 2026 01:07
…poisoning surface)

The floor's inert_carrier_no_unrostered_or_stale witness reds without it:
the LocalAlias fixture it rosters landed in #6641, not #6686 — the roster
line was a bundled orthogonal fix (same class as the kept cli_run.rs
backfill), not part of the hash-grounding surface. Receipt: local floor on
the revert tree, 300 PASS / 1 FAIL (this witness), FAIL clears with the
line restored.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@briansrls
briansrls force-pushed the session/proud-fox-374-machine-shape-construction-walls branch 2 times, most recently from cf6a57d to 5d99afc Compare July 16, 2026 01:29
@gunbai-bot

gunbai-bot Bot commented Jul 16, 2026

Copy link
Copy Markdown
Contributor Author

CI fix pushed (5d99afcac6) — dashboard 623e382 was stale (auto-commit had stripped compile enrollment); branch restored earlier to cf6a57d, now rebased.

Root cause: pre-existing main-red from #6663 field wall × #6686 ContentHash cross-root import (not construction-wall diff). Fix: cherry-picked coordinated interim unbreak from vivid-owl-803 (76563774e3, 7fc39a33ad — reverts #6686 hash-grounding surface that poisoned v2 typecheck closure) + our 3-file construction-wall deliverable on current origin/main.

Floor job is running (resolve phase no longer failing at ~2m like prior runs). Proper wall fix (scope-correct binding lookup) remains operator-coordinated for main re-land.

— sent from proud-fox-374

@gunbai-bot

gunbai-bot Bot commented Jul 16, 2026

Copy link
Copy Markdown
Contributor Author

Review artifact /api/reviews/38585 (composer-2.5 APPROVE): verified — no action required.

Checked at 5d99afcac6:

  • machine_shape_compile_gate uses module-context fold_node_topdown + callee Atom ^MachineShape recognition (determinism precedent)
  • Enrolled in always_required_root_lenses via 00_compile.dag
  • construction_justification: WallAfterGrounding present in src/v2/lens/machine_shape.dag
  • RED/GREEN synthetic fixtures in dag/test/claim/machine_shape_construction_wall_test.dag
  • #6686 revert commits are intentional interim unbreak (documented dissolution trigger); LocalAlias roster line orthogonal

No code changes from this review.

— sent from proud-fox-374

@briansrls
briansrls force-pushed the session/proud-fox-374-machine-shape-construction-walls branch from 5d99afc to 3f29af2 Compare July 16, 2026 01:46
@gunbai-bot gunbai-bot Bot changed the title Machine-shape construction walls: compile-gated lens pair enforcing (1) MachineShape single-constructor discipline - the type may only be constructed by the sanctioned shape_from_catalog derivation (module-context fold_node_topdown, construction recognized by Atom identity, precedent symbol_index_fi MachineShape construction wall: compile-gated single-constructor discipline Jul 16, 2026
@gunbai-bot

gunbai-bot Bot commented Jul 16, 2026

Copy link
Copy Markdown
Contributor Author

Addressed /api/reviews/38588 (opus REQUEST_CHANGES) — 3f29af2f1d

All three findings were valid. The #6686 revert commits (d82d7b52, 7fc39a33a) were smuggled scope from the interim main-unbreak lane and have been removed from this branch.

Finding Resolution
§3 Hash/content_hash regression + DESIGN revert in MachineShape PR Fixed — branch is again 3 files only vs origin/main; v2/std/node.dag, materialize.dag, DESIGN.md untouched
Deleted node_content_hash_is_realization_plan_target witness Fixed by removal — that deletion lived in the reverted commits, not in the construction-wall deliverable
PR scope / commit-message honesty Fixed — title/body updated; diff is exclusively lens + compile enrollment + claim witnesses

The interim main-unbreak belongs on a separate PR (operator/vivid-owl-803 coordination), not piggybacked here. Floor CI may re-red until that lands — acceptable per scope discipline.

— sent from proud-fox-374

@gunbai-bot
gunbai-bot Bot changed the base branch from main to session/vivid-owl-803 July 16, 2026 01:58
@briansrls
briansrls force-pushed the session/proud-fox-374-machine-shape-construction-walls branch from 3f29af2 to 6bca004 Compare July 16, 2026 01:58
@gunbai-bot
gunbai-bot Bot changed the base branch from session/vivid-owl-803 to main July 16, 2026 02:01
Brian Searls and others added 3 commits July 16, 2026 02:01
…immune (rustfmt::skip)

Batch-4 generated_artifact_drift_gate_passes red on this PR is the first run
of that gate since main broke at 60286e0 -- #6677 landed its derived
crate-layout artifact during the red window, so no tree ever executed batch 4
against it. Two writers disagreed on one artifact: the wet leg
(stage0_crate_layout_emit.dag) emits plain multi-line arrays, while the
committed bytes were rustfmt'd (trailing comma, collapsed one-liner). Committed
bytes: fmt-clean, drift-red; emitter bytes: drift-clean, fmt-red -- no tree
could satisfy both gates.

Fix: the emitter stamps #[rustfmt::skip] on both consts, so its output is the
fixed point of cargo fmt; artifact regenerated via main_wet. Receipts: wet
regen leaves the tree clean, cargo fmt --check -p v1-compiler green,
regen_stage0 --verify divergence 0.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@briansrls
briansrls force-pushed the session/proud-fox-374-machine-shape-construction-walls branch from 867545b to 002a20b Compare July 16, 2026 02:21
@gunbai-bot
gunbai-bot Bot changed the base branch from main to session/vivid-owl-803 July 16, 2026 02:21
@gunbai-bot

gunbai-bot Bot commented Jul 16, 2026

Copy link
Copy Markdown
Contributor Author

Addressed /api/reviews/38607 (opus REQUEST_CHANGES) — 002a20b5c8

Finding Verdict Action
§3 Hash/ContentHash regression bundled with MachineShape wall Valid Split: PR base is now session/vivid-owl-803 (#6701). Diff vs base is 3 files only — no node.dag, materialize.dag, DESIGN.md, or witness changes in this PR. Hash ungrounding lands exclusively via #6701 with explicit bootstrap justification on that carrier.
HeadAbsent => outcome_accepted absorbing fallback in machine_shape_compile_gate Valid Fixed in 002a20b5c8: replaced is_empty + list_head/HeadAbsent with Cons/Empty match + Rejected { NonEmptyDiagnostics }, matching determinism_compile_gate precedent — no silent accept arm on invariant violation.

Merge order: #6701 → rebase this onto main → merge #6698.

— sent from proud-fox-374

Brian Searls and others added 3 commits July 16, 2026 02:22
Rebuilt from origin/main per operator recovery: three-file scope only
(lens, compile enrollment, claim witnesses). Stacked on #6687 for
std.machine_shape / extdeps.gpu.machine_shape subjects — no Phase 1
content copied. Removed unused std.algebra import that poisoned CI resolve.

Co-authored-by: Cursor <cursoragent@cursor.com>
Replace is_empty + list_head/HeadAbsent absorb arm with Cons/Empty fold
match — HeadAbsent silently accepted on invariant violation (§5).

Co-authored-by: Cursor <cursoragent@cursor.com>
@gunbai-bot

gunbai-bot Bot commented Jul 16, 2026

Copy link
Copy Markdown
Contributor Author

Review artifact 38618 (composer-2.5 APPROVE): verified — no code changes.

Checked at 49e1b5d64d (rebased onto latest session/vivid-owl-803 / #6696 algebra fix):

  • Rooted fold_node_topdown gate + ^MachineShape callee recognition
  • Cons/Empty fail-closed match (no HeadAbsent absorb arm)
  • Enrolled in always_required_root_lenses
  • ConstructionJustification { WallAfterGrounding { dissolves_to: SingleAuthority } }
  • RED/GREEN witnesses in machine_shape_construction_wall_test.dag
  • Diff vs base remains 3 files; ContentHash grounding preserved on base (not reverted in this PR)

— sent from proud-fox-374

@gunbai-bot

gunbai-bot Bot commented Jul 16, 2026

Copy link
Copy Markdown
Contributor Author

Review artifact 38619 (opus APPROVE): verified — no code changes.

Checked at 49e1b5d64d:

  • Construction wall, compile enrollment, and synthetic witnesses match the approval read
  • Cons/Empty gate (prior REQUEST_CHANGES item) already landed in 002a20b5 / carried through rebase
  • Minor observation on machine_shape_walk_step propagating child_r.module_qn upward: acknowledged — findings aggregate via concat(acc.findings, child_r.findings) and child contexts derive from ctx in child_context, not acc; no correctness impact. Will clean up if this walker pattern is copied elsewhere.

— sent from proud-fox-374

@briansrls
briansrls force-pushed the session/proud-fox-374-machine-shape-construction-walls branch from 002a20b to 49e1b5d Compare July 16, 2026 02:38
@gunbai-bot

gunbai-bot Bot commented Jul 16, 2026

Copy link
Copy Markdown
Contributor Author

Review artifact 38634 (composer-2.5 APPROVE): verified — no action required.

Checked at 49e1b5d64d:

  • Rooted fold_node_topdown + fail-closed Cons/Empty → Rejected { NonEmptyDiagnostics }
  • Enrolled in always_required_root_lenses (00_compile.dag)
  • ConstructionJustification { WallAfterGrounding { dissolves_to: SingleAuthority } }
  • RED/GREEN synthetic witnesses in machine_shape_construction_wall_test.dag
  • Diff vs session/vivid-owl-803 base: 3 files only; no hand-Rust, no absorbing fallbacks

— sent from proud-fox-374

@gunbai-bot

gunbai-bot Bot commented Jul 16, 2026

Copy link
Copy Markdown
Contributor Author

Review artifact 38636 (opus APPROVE): verified — observation acknowledged, no code change.

Checked at 49e1b5d64d:

  • Recognition at machine_shape.dag:117 is exactly Transform call + callee Atom ^MachineShape (synthetic fixture at machine_shape_construction_wall_test.dag:37-53 exercises this path)
  • std.machine_shape / extdeps.gpu.machine_shape not in tree yet — confirmed (git ls-files '*machine_shape*' → lens + test only); gate is WallAfterGrounding scaffolding stacked on std.machine_shape: allocation-as-contract Phase 1 landing #6687

On the non-blocking flag: agreed — when MachineShape lands (#6687), we must verify production construction sites surface as Transform/Atom-callee nodes (as machine_shape_construction_wall_note already documents) rather than bare TypeNode { Conj } record literals. If the inhabited type's literal form differs, recognition extends before WallAfterGrounding dissolves — tracked as part of #6687 landing, not a merge blocker for this scaffold.

— sent from proud-fox-374

Base automatically changed from session/vivid-owl-803 to main July 16, 2026 03:16
@briansrls
briansrls merged commit 45808d7 into main Jul 16, 2026
3 checks passed
@briansrls
briansrls deleted the session/proud-fox-374-machine-shape-construction-walls branch July 16, 2026 04:45
briansrls added a commit that referenced this pull request Jul 16, 2026
Main (#6698) added docs/plans/emitted-crate-partition-design.md without
an inbound link; doc_graph_has_no_orphan_docs reded after merge.

Co-authored-by: Cursor <cursoragent@cursor.com>
briansrls added a commit that referenced this pull request Jul 16, 2026
Main (#6698) added docs/plans/emitted-crate-partition-design.md without
an inbound link. Add open-thread row in design_document.dag authority
(not hand-edited DESIGN.md) so doc_graph and generated_artifact drift
gates both pass.

Co-authored-by: Cursor <cursoragent@cursor.com>
briansrls added a commit that referenced this pull request Jul 16, 2026
* Tier-2 homonym gate: split census ambiguity from reachability leg

Census ABSENT must refuse the ambiguity leg (§5), not collapse to
non-ambiguous; reachability invariants carry the gate until census
coverage widens on main.

Co-authored-by: Cursor <cursoragent@cursor.com>

* Tier-2 census refusal: emit counted diagnostics and assert ABSENT

RefusedAbsent arm now prints typed located refusals and reports
3/3 count; snapshot test asserts ABSENT as dissolve trigger when

Co-authored-by: Cursor <cursoragent@cursor.com>
#6640 widens census coverage.

* Fix CI: link emitted-crate-partition-design into doc graph

Main (#6698) added docs/plans/emitted-crate-partition-design.md without
an inbound link. Add open-thread row in design_document.dag authority
(not hand-edited DESIGN.md) so doc_graph and generated_artifact drift
gates both pass.

Co-authored-by: Cursor <cursoragent@cursor.com>

---------

Co-authored-by: Brian Searls <briansrls@gunb.ai>
Co-authored-by: Cursor <cursoragent@cursor.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant