Skip to content

R3 Substrate: IntPlatform/UIntPlatform + isize/usize Rust rows - #1933

Merged
briansrls merged 73 commits into
mainfrom
session/valiant-ibex-312
May 7, 2026
Merged

briansrls merged 73 commits into
mainfrom
session/valiant-ibex-312

Conversation

@briansrls

@briansrls briansrls commented May 7, 2026 •

Copy link
Copy Markdown
Contributor

R3 Substrate — IntPlatform/UIntPlatform substrate-fact-introduction + Rust isize/usize coverage

Authority: Director Q1+Q2+Q3+Q4 RATIFIED at gunbc#1739 #issuecomment-4393248961 (2026-05-07). Inner-token rename Platform → PointerWidth RATIFIED at gunbc#828 #issuecomment-4393616097. Worker brief at docs/briefs/r3-substrate-int-platform-uint-platform-worker.md.

Closes the substrate cascade deferred from PR #1914 Phase B (isize/usize rows blocked on missing platform-sized integer kernel types).

What's in this PR

dsl/std/machine_constraints.dag

type PointerWidth opaque substrate token (Option β shape). Sibling to MachineWidth<bits>'s phantom-bits: where bits = 32 resolves at substrate-load time, bits = PointerWidth resolves at Grounding-emit time per target spec. Practice 4 dissolution ledger inline (terminal at substrate-concept layer; constrained-inhabitance gap mirrors MachineWidth<bits>'s P2/P5 scaffold).

dsl/std/integer.dag

type IntPlatform  = Compose<Int,  MachineWidth<PointerWidth>>
type UIntPlatform = Compose<UInt, MachineWidth<PointerWidth>>

Type aliases over existing Compose<...> carrier; no new sum types. Practice 4 N/A.

src/v3/spec/rust.dag

  • Imports: add IntPlatform / UIntPlatform to std.integer import.
  • data rust_isize: TypeRealization (target IntPlatform, carrier "isize").
  • data rust_usize: TypeRealization (target UIntPlatform, carrier "usize").
  • data rust_integer_inhabit_isize_platform: TargetIntegerTypeInhabitance (kernel_integer: IntPlatform, bound: PlatformDependentFact).
  • data rust_integer_inhabit_usize_platform: TargetIntegerTypeInhabitance (kernel_integer: UIntPlatform, bound: PlatformDependentFact).

Bootstrap regen + manifest

Snapshots regenerated (bootstrap_generated.rs, bootstrap_generated_without_parse_surface.rs, bootstrap_std_generated.rs); parse_corpus_manifest.txt refreshed.

Name collision resolution (chronicled for archaeology)

The original brief framed the inner substrate token as Platform, but that name pre-existed at dsl/std/types.dag:356 as Platform = Linux | Macos | Windows (OS-identity sum, NOT pointer-width axis). Surfaced via STOP-PING at gunbc#1739 #issuecomment-4393567605; consumer scan at #issuecomment-4393571479 confirmed zero direct consumers of the existing Platform. Director ratified inner-token rename Platform → PointerWidth at gunbc#828 #issuecomment-4393616097 per feedback_reason_not_label (pointer-width is the structural reason; OS-identity vs pointer-width are orthogonal axes — 32-bit Linux vs 64-bit Linux are different pointer widths but same OS). Outer carrier names IntPlatform/UIntPlatform stay verbatim per Q1 RATIFIED. Pre-existing std.types::Platform left untouched.

Closure gates

Cross-program handoff (Grounding Mgr #1745)

G2 Phase 2 isize/usize coverage unblocks on merge. Per-target pointer-width projection (Rust 32/64-bit pointer; Go int width; Python arbitrary-precision int via target-conditioned lowering) is Grounding-lane work, NOT substrate. Bundled-scope honored: G2 Phase 2 lowering rules NOT in this PR per Director discipline (parallel infrastructure DISALLOWED).

Authority audit (5 questions)

  1. Substrate exists? IntPlatform/UIntPlatform/PointerWidth did NOT exist at HEAD; only MachineWidth<bits> and Compose<Algebra, MachineConstraint> (substrate carriers consumed via Compose<Int, MachineWidth<PointerWidth>> shape per Q-MachineConstraint sub-decision 3). Pre-existing collision: std.types::Platform (OS-identity); resolved via Director-ratified inner-token rename.
  2. Existing brief? docs/briefs/r3-substrate-int-platform-uint-platform-worker.md.
  3. Design-doc match? Director Q1+Q2+Q3+Q4 RATIFIED at gunbc#1739 #issuecomment-4393248961 + inner-token rename at gunbc#828 #issuecomment-4393616097.
  4. Citations live? All cited issues + commits verified at fetch time.
  5. Carrier dissolves the bridge? Yes — pointer-sized integer substrate concepts are now first-class; isize/usize rows in spec/rust.dag consume them via kernel_integer: IntPlatform/UIntPlatform + bound: PlatformDependentFact, eliminating the platform-dependent-bound bridge that PR R3 Phases A+B: BigInt host repr + u128 coverage (isize/usize deferred) #1914 Phase B surfaced.

CI status

cargo test -p v3-compiler — exit 0 (full suite green). cargo clippy --all-targets -- -D warnings — clean. cargo fmt --all --check — clean. Targeted ratchets (target_integer_type_inhabitance_rows_are_structural_slice_b_receipt, int_literal_cardinality, parse_corpus manifest) all green.

SG-0 hand-path delta: 0

briansrls and others added 30 commits May 5, 2026 18:46
…ame)

Renames CardinalityPayload::new_unchecked to
new_unchecked_bypassing_idempotence so every call-site that does not
route through Dag::alloc_cardinality_decl is, by name, declaring it is
not applying the cardinality_idempotent_target rule.

Per Director routing #828 #issuecomment-4383647114 (Path B over Path A);
brief: docs/briefs/r2-impossible-bugs-nested-optional-codegen-bypass-closure-worker.md (#1778, warm-dove-810).

- Discipline-visible doc comment names the load-bearing invariant.
- 205 call-sites updated across 6 files (4 hand-written non-test sites
  + 4 test sites + ~50 generated sites in 3 bootstrap_*_generated.rs
  files refreshed via the regen_bootstrap_emit format string).
- Mechanical refresh; zero semantic change. Existing
  cardinality_idempotent / cardinality_idempotence tests pass; cargo fmt
  clean.
- r2-closure-ledger row updated: nested-optional flatten now cites #1803
  as the codegen-bypass closure receipt.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The prior commit's mass-rename of CardinalityPayload::new_unchecked →
new_unchecked_bypassing_idempotence was applied with sed, preserving
multi-line formatting; fresh regen_bootstrap emits on a single line.
The regen_bootstrap --verify CI gate caught the divergence. This commit
runs regen_bootstrap (no --verify) to align the committed snapshots
with the format string.

No semantic change.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…probe

Authorized single retrigger per R3 Mgr at #1761 #issuecomment-4384216296.
Prior run (job 74523060739) was cancelled at 30m hard timeout mid-rustc
release recompile of v3-compiler for self_host_fixed_point; ci/fmt/v3
green. Probing whether warmer cache / different runner state lands
within budget; if same failure recurs, escalate.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…e gap

Address blocking review on PR #1819 (codex@9ccfe165):

1. Scale was a bare coproduct; Grounding consumers and downstream algebra
   would have to re-encode the SI exponent table at each call site. Add
   `fn scale_exponent(s: Scale) -> Int` as the canonical typed exponent
   authority (single-source-of-truth invariant; total over all Scale
   inhabitants).

2. `Measure<Q, S>` admitted any type-reference for Q/S at the parser
   level — denotationally Q must inhabit Quantity and S must inhabit
   Scale, but no parametric where-clause syntax exists in the substrate.
   Document the CONSTRAINED-INHABITANCE GAP scaffold matching the
   pattern at `dsl/std/algebra.dag` (`GroupCompletion<M>` /
   `FieldOfFractions<R>`), with a named dissolution trigger
   (parametric where-clause syntax lands → tighten to `<Q> : Quantity,
   <S> : Scale`).

3. Refresh the COMPOSITION block and citation discipline: brief paths
   live in the parent worktree (cross-program review reaches them via
   the gunbc#828 ratification thread). Inline rule-text quotes for
   Practice 4 / `feedback_construction_over_ratchets` /
   `feedback_reason_not_label` per `brief-authoring-checklist.md`.
   Update the conceptual composition lines to reflect option (c)
   RATIFIED (no `Refined<>` wrapper at this layer).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
- Add `cross_target_coverage_carrier_test.rs` to EXPECTED_HAND_AUTHORED_TEST
  in `sg0_census_test.rs` (sorted ASCII-ascending; receipt cites
  Director Option 2 RATIFIED at gunbc#828 #issuecomment-4377533390).
- Refresh `parse_corpus_manifest.txt` via the
  `refresh_handwritten_parse_snapshot_manifest` host (picks up the new
  `src/v3/std/cross_target_coverage.dag` entry + the
  `extdeps_bootstrap_fixtures.dag` / `bootstrap_authority.dag` row
  changes).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Address blocking review on PR #1842 (codex@2eb2632a):

ShapeATarget was stamped 🟢 TERMINAL with an inline checkpoint comment
but lacked the four-pattern dissolution receipt that
`feedback_coproduct_dissolution` requires for the GREEN classification.
Pattern follows the DB-18 / DB-9 / DB-16 receipt format at
`docs/design-db18-workflow-effect-carrier.md` §"Dissolution receipt".

Pattern 1 (fact-placement): n/a — all variants attach to the same typed
slot at the same DAG location.
Pattern 2 (variant-is-data): n/a — tag identity governs typed dispatch
into per-target method-template-contract authorities; collapsing to
`target_name: String` would re-introduce string-name dispatch (Option 2
§4.C=(i) ratified specifically to prevent that).
Pattern 3 (algebraic-form): n/a — no algebraic operation over
{Rust, Python, Go}; the set is Director-ratified per Shape A portability.
Pattern 4 (dimensional): n/a — targets do not factor into orthogonal
coordinates; per-target primitives + method-template contracts + emit
are irreducible per-target profiles.

Stamp confirmed: 🟢 TERMINAL.

Bootstrap regen + parse-corpus-manifest refresh follow.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
briansrls and others added 6 commits May 6, 2026 20:59
…state

Address non-blocking finding on PR #1914 (codex@f994e1f3): file-level
pilot-scope text still listed u128 as deferred even though the row is
present in this PR. Refresh:

- PILOT SCOPE list now includes u128.
- T-Int128 SLICE B1/B2 block annotates the resolution: B2 deferral
  closed by Phase A `BigInt` host repr widening (commit `e7ba022c6`);
  u128 row landed in Phase B-1 (commit `59511503e`).
- New FOLLOW-ON DEFERRAL block names the next cascade explicitly:
  isize/usize wait on substrate-side IntSize/UIntSize kernel integer
  introduction (Director-level scope per Mgr disposition Path 1 at
  gunbc#1761 #issuecomment-4393235461).

Bootstrap snapshots + parse manifest regenerated to absorb the comment
edit through the bootstrap span byte ranges.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@briansrls briansrls changed the title valiant-ibex-312 R3 Substrate: IntPlatform/UIntPlatform + isize/usize Rust rows May 7, 2026
@briansrls
briansrls marked this pull request as ready for review May 7, 2026 02:20
@briansrls

Copy link
Copy Markdown
Contributor Author

Review metadata

  • Provider / model: cursor / composer-2
  • Commit: 7c645050 · Trigger: schedule
  • Comparison: origin/main @ fd1a65ab ... review/pr-1933-7c645050 @ 7c645050
  • Thinking: 50s wall

Findings: None. The hand-authored surface (dsl/std/integer.dag, dsl/std/machine_constraints.dag, src/v3/spec/rust.dag, parse corpus manifest) matches the rubric: substrate facts attach via existing Compose / MachineWidth machinery and a new opaque PointerWidth token with a Practice 4 ledger, explicit orthogonality to OS Platform, and a P5-style named dissolution trigger aligned with the existing MachineWidth<bits> grammar-gap block (dsl/std/machine_constraints.dag:91-93). Rust spec rows add TypeRealization plus TargetIntegerTypeInhabitance with PlatformDependentFact in the same change, so declarations are not orphaned relative to the emission-model pattern described in-file. Large bootstrap_generated*.rs churn is the expected regen footprint for .dag edits, not a separate style concern in this diff.

Verdict: APPROVE — Narrowly scoped R3 substrate + Rust spec wiring; no concrete violations of INVARIANTS, modeling discipline, CODING, or TESTING surfaced in the reviewed diff.

@briansrls briansrls left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review metadata

  • Provider / model: codex / unknown
  • Commit: 7c645050 · Trigger: schedule
  • Thinking: 144s wall

Non-blocking — Strengths

  • dsl/std/machine_constraints.dag PointerWidth is documented as a substrate-level target-resolved width token with a bounded constrained-inhabitance gap and dissolution trigger.
  • dsl/std/integer.dag IntPlatform and UIntPlatform compose existing integer carriers with MachineWidth instead of introducing a parallel platform-integer authority.
  • src/v3/spec/rust.dag Rust isize and usize realizations consume the new substrate carriers in the same PR via TargetIntegerTypeInhabitance rows.

✅ No blocking concerns in the PR-scoped .dag substrate changes or regenerated snapshots.

@briansrls

Copy link
Copy Markdown
Contributor Author

Review metadata

  • Provider / model: codex / codex-default
  • Commit: f4b31e6d · Trigger: schedule
  • Comparison: origin/main @ fa9e81d9 ... review/pr-1933-f4b31e6d @ f4b31e6d
  • Thinking: 58s wall

Verdict: APPROVE

Diff looks clean. The new substrate names in dsl/std/machine_constraints.dag:48 and dsl/std/integer.dag:114 are single-authority additions rather than parallel representations, and they land with same-PR consumers in src/v3/spec/rust.dag:176 and src/v3/spec/rust.dag:266. I did not find a concrete violation of the pinned invariants, modeling discipline, coding guidance, or testing guidance in the reviewed diff.

# Conflicts:
#	src/v3/compiler/src/bootstrap_generated.rs
#	src/v3/compiler/src/bootstrap_generated_without_parse_surface.rs
@briansrls
briansrls merged commit 5c2384d into main May 7, 2026
3 checks passed
briansrls added a commit that referenced this pull request May 7, 2026
Resolve bootstrap_generated*.rs conflicts by regenerating snapshots
after integrating main (includes #1933 and concurrent substrate work).

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

Copy link
Copy Markdown
Contributor Author

Review metadata

  • Provider / model: openai-pro / gpt-5-5-pro
  • Commit: 4844bbbe · Trigger: manual
  • Conversation: View conversation

1. Story of the diff

This PR adds pointer-width-sized integer modeling as a substrate concept rather than as Rust-only spelling. dsl/std/machine_constraints.dag:94 introduces PointerWidth as the target-resolved pointer-width axis, and dsl/std/integer.dag:142-143 defines IntPlatform / UIntPlatform by composing existing Int / UInt with MachineWidth<PointerWidth>. The Rust target spec then consumes those substrate concepts directly: src/v3/spec/rust.dag:182-198 adds isize / usize TypeRealization rows, and src/v3/spec/rust.dag:271-284 adds TargetIntegerTypeInhabitance rows with PlatformDependentFact bounds. The rest of the diff is generated/bootstrap refresh plus parse-corpus manifest updates proving the new declarations are represented in the bootstrapped DAG.

2. Invariant categories

  1. LAYER MODEL — Compliant. This is substrate-touching, and the substrate/implementation split is handled cleanly: PointerWidth is declared at the substrate concept layer (dsl/std/machine_constraints.dag:94), IntPlatform / UIntPlatform are substrate aliases over existing composition machinery (dsl/std/integer.dag:142-143), and Rust-specific spellings stay in the Rust spec rows (src/v3/spec/rust.dag:185, src/v3/spec/rust.dag:194). The target-dependent bound is not fabricated as a static interval; the rows explicitly use PlatformDependentFact at src/v3/spec/rust.dag:275 and src/v3/spec/rust.dag:283.
  2. INVARIANTS.md + modeling-discipline.md — Compliant. Modeling faithfulness / single authority are addressed by separating OS identity from pointer-width identity: the diff explicitly avoids reusing the existing Platform OS axis and names pointer width as the structural reason at dsl/std/integer.dag:120-125 and dsl/std/machine_constraints.dag:54-57. Facts also flow forward: the substrate aliases name their direct Rust consumer at dsl/std/integer.dag:133-135, and the actual consumer rows are present at src/v3/spec/rust.dag:271-284. chatgpt-review-591a2867-9203-43…

chatgpt-review-e2ddb56c-e0d0-48…

  1. CODING.md — Compliant. No new handwritten Rust behavior, helper API, method surface, or hidden state is introduced; the Rust changes are regenerated data snapshots. The authored changes are declarative data rows, e.g. data rust_isize: TypeRealization at src/v3/spec/rust.dag:182 and data rust_integer_inhabit_usize_platform: TargetIntegerTypeInhabitance at src/v3/spec/rust.dag:279, which matches the data-first style. chatgpt-review-cb02afca-fe26-44…
  2. TESTING.md — Compliant. The diff does not add executable logic that would need a new unit test; it updates the parse-corpus manifest for every authored .dag file touched: dsl/std/integer.dag at src/v3/compiler/tests/integration/parse_corpus_manifest.txt:7, dsl/std/machine_constraints.dag at src/v3/compiler/tests/integration/parse_corpus_manifest.txt:9, and src/v3/spec/rust.dag at src/v3/compiler/tests/integration/parse_corpus_manifest.txt:26. The regenerated bootstrap fixtures also include the new declarations/rows, e.g. PointerWidth at src/v3/compiler/src/bootstrap_generated.rs:6124, IntPlatform / UIntPlatform at src/v3/compiler/src/bootstrap_generated.rs:6444-6470, and the Rust inhabitance rows at src/v3/compiler/src/bootstrap_generated.rs:44683-44726. chatgpt-review-5d1b8605-10cc-44…
  3. LOCKED DESIGN DECISIONS — Compliant. The diff references ratified design decisions and makes the one naming adjustment explicit rather than implicit: the inner token rename from Platform to PointerWidth is documented at dsl/std/integer.dag:116-120 and dsl/std/machine_constraints.dag:51-57. I do not see a silent divergence from a locked decision in the changed lines.
  4. TRACKED vs UNTRACKED DEBT — Compliant. The only new temporary-looking shape is the constrained-inhabitance gap around PointerWidth, and it is tracked: the gap is documented at dsl/std/machine_constraints.dag:85-89, bounded to parser-parallel constraint posture and Grounding enforcement at dsl/std/machine_constraints.dag:86-89, and given a named dissolution trigger at dsl/std/machine_constraints.dag:91-93. I do not see an untracked TODO, shim, or open-ended scaffold in the diff.

3. Verdict

APPROVE

The PR adds a substrate-level pointer-width integer concept with a direct Rust target consumer, keeps target-specific spelling out of the substrate, refreshes the generated snapshots, and tracks the one known constraint gap with a bounded dissolution trigger. I found no blocking or non-blocking findings tied to changed lines.

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