Skip to content

increment 3: realization materialization arm — reconcile→Share collapse (KeySource-keyed) - #5168

Merged
briansrls merged 16 commits into
mainfrom
session/merry-owl-830
Jun 18, 2026
Merged

briansrls merged 16 commits into
mainfrom
session/merry-owl-830

Conversation

@gunbai-bot

@gunbai-bot gunbai-bot Bot commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

Increment 3 of the realization sequence (the materialization arm), following the increment-1 CreateEffect idempotency vocabulary already on main.

What this does

Re-introduces the trimmed materialization vocab in std.realization and adds the reconcile → Share collapse:

  • type Placement = LocalInProcess | LocalFilesystem | RemoteNetwork
  • type Materialization = Recompute | Memoize | Share
  • type RealizedStep { shape, placement, materialization, cost }
  • fn reconcile(steps) — collapses two same-KeySource CreateIfAbsent steps into ONE step with materialization: Share; distinct identities (or non-create effects) stay separate.

The collapse decision is std.effects.create_double_init_collapsible (the single KeySource-keyed authority). reconcile only consumes it — it never re-derives KeySource equality (§3 single authority).

Not Route-C / content-hash gated

The collapse keys on KeySource (create_double_init_collapsible → key_source_eq, pure structural over the closed KeySource coproduct), never on a content hash. The step carries its source EffectShape so the collapse can key on identity now. RealizedStep's intent/licensed_by ContentHash fields return in increment 4 with cross-tree content-hashing (trim marker kept in the header).

Proven by execution

dsl/test/claim/realization_reconcile_witness_test.dag → reconcile_share_collapse_witnesses is green by execution, with a discriminating +/- design:

  • GREEN same-KeySource → exactly ONE step, exactly ONE Share.
  • RED-if-wrong different-KeySource → TWO steps, ZERO Share (a collapse-on-anything-but-KeySource bug flips this red).
  • Fail-closed PostAlways create-always → never collapses (TWO steps, ZERO Share).

Whole-tree dsl compile-clean passes (281 modules, 302 files, 0 diagnostics); existing realization_witnesses (independence arm) still green (no regression).

Latent bug fixed (pre-existing, not new scope)

create_double_init_collapsible called key_source_eq(a:, b:), but the dsl key_source_eq is defined (left:, right:). Latent because nothing in the dsl tree consumed create_double_init_collapsible until now — reconcile is the first consumer, so the whole-tree compile-clean gate would have broken without the fix.

Deferred to later increments

  • Increment 4 — generalize realize() + re-introduce RealizeIntent { target: ContentHash } (needs cross-tree Node content-hashing).
  • Increment 5 — executor honors Share (the seed change): wire Materialization::Share through the executor / resolved_graph_cache so the CI floor resolves shared closures once.

🤖 Generated with Claude Code

briansrls and others added 16 commits June 17, 2026 21:10
A scannable in-flight task index for gunbc (the compiler/language). Explicitly
NOT a second authority — DESIGN.md remains the source of truth for the why and
each task's real state is its branch/PR + the marks on the substrate (§3). Product
/ ctrl features are tracked elsewhere.

Records the confirmed root-cause of the cost-lens blind spot: the lens rates
subject-program complexity, not the compiler's own pass cost — a self-hosting gap
(§7), which is why the ~500x resolve blowup is invisible to it.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…exity violation, not a new lens

The cost-lens 'blind spot' is not a new issue: complexity_lens is general and the
budget roster is designed to enroll compiler-stage bodies (waves 2+). Fix is the
planned enrollment, not a scaffold. Drops the interim step-count ratchet idea.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
… landed claim (review #5129)

cursor/composer-2.5 REQUEST_CHANGES: CiFloorSpec does not exist on main and
dsl/extdeps/github/ci.dag still records ci.yml as hand-edited, so the 'Recently
landed' line overstated. Now claims only the verifiable #5101 consolidation;
ci.yml generation stays honestly under Next.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Per operator: each task one line for quick scanning; details go to indented
sub-bullets. Promotes the lens-universalization + host-language-ban lane to Now
(being dispatched).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…oved to scope-a PR body)

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…se (KeySource-keyed)

Re-introduce the trimmed Placement / Materialization (Recompute|Memoize|Share) / RealizedStep
vocab in std.realization and add reconcile(steps), which collapses same-KeySource CreateIfAbsent
steps into one Share via std.effects.create_double_init_collapsible (the single KeySource-keyed
authority — reconcile consumes it, never re-derives KeySource equality). Not Route-C/content-hash
gated; the step carries its source EffectShape so the collapse keys on KeySource identity (the
ContentHash intent + licensed_by return in increment 4 with cross-tree content-hashing).

Discriminating witness (reconcile_share_collapse_witnesses, green by execution): same-KeySource ->
one Share; different-KeySource -> two un-Shared; PostAlways never collapses (fail-closed).

Fix latent effects.dag arg-name mismatch: create_double_init_collapsible called key_source_eq(a:,b:)
but the dsl def is (left:,right:). Latent until now (no dsl consumer); realization.dag is the first.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…h DESIGN.md CI section

Two follow-ups on the increment-3 branch:

(1) review #5168 (cursor/composer-2.5 REQUEST_CHANGES): std.realization's `is_share`
was an undispositioned `is_*` predicate over the Materialization coproduct. reconcile
sets `materialization: Share` directly and nothing in std/ reads it back, so its only
consumer is the reconcile witness. Per the predicate-dissolution rule + §6 model-just-
in-time, a predicate with zero std/ consumers does not belong in std/. Disposition =
the reviewer's first option: delete from std/, move the Share match into the witness as
a test-local fn. std.realization keeps only the fold-bearing reconcile arm.

(2) DESIGN.md CI section refresh: the "two composed passes / claim_batch / ci_gates.dag"
paragraph was stale. Replaced with the actual floor — one claim_executor plan pass
(ci_floor_plan.gunbc_ci_floor_batches) with marker-driven tree-wide witness discovery
(every *_test.dag test fn under both src/v2 and dsl, fail-closed filename hygiene) and a
whole-tree dsl compile-clean gate.

Verified by execution: dsl compile-clean (281 modules, 0 diagnostics) +
reconcile_share_collapse_witnesses => true.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@briansrls
briansrls force-pushed the session/merry-owl-830 branch from a2ad073 to 504bbcc Compare June 18, 2026 17:58
@gunbai-bot

gunbai-bot Bot commented Jun 18, 2026

Copy link
Copy Markdown
Contributor Author

Addressed in 504bbcc. Took the first option from the review: deleted is_share from std.realization and moved the Share discriminator into the witness as a test-local fn. Rationale — reconcile sets materialization: Share directly and nothing in std/ reads it back, so the predicate had zero std/ consumers; per §6 model-just-in-time it does not belong in std/, and a future increment-5 executor that honors Share will add its own dispositioned detection rather than us pre-staging it now. std.realization keeps only the fold-bearing reconcile arm. Verified by execution: dsl compile-clean (281 modules, 0 diagnostics) and reconcile_share_collapse_witnesses => true on the new head. — sent from merry-owl-830

@gunbai-bot

gunbai-bot Bot commented Jun 18, 2026

Copy link
Copy Markdown
Contributor Author

Thanks — approval noted. The has_collapsible_peer nit is correct (peers |> length > 0 reads cleaner than !((peers |> length) == 0)). Holding it deliberately rather than pushing now: it is a pure-cosmetic non-blocker, and a one-line touch to realization.dag would re-stale the approval just landed + restart CI while the second review is still queued and cursor’#39;s (now-stale) REQUEST_CHANGES re-review is pending on this head. I’#39;ll fold the cleanup into the increment-4 PR, which revisits realization.dag to generalize realize() anyway — keeping this PR's head stable so the converging approvals stick. — sent from merry-owl-830

@briansrls
briansrls merged commit 1c34208 into main Jun 18, 2026
1 check passed
@briansrls
briansrls deleted the session/merry-owl-830 branch June 18, 2026 18:55
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