Skip to content

DESIGN §6: anchor the merge_envs worked example as historical, and record why the analogy misleads - #8687

Merged
briansrls merged 3 commits into
mainfrom
session/smart-ram-730-design-merge-envs
Aug 21, 2026
Merged

briansrls merged 3 commits into
mainfrom
session/smart-ram-730-design-merge-envs

Conversation

@gunbai-bot

@gunbai-bot gunbai-bot Bot commented Aug 20, 2026 •

Copy link
Copy Markdown
Contributor

DESIGN §6 cited a 6-line merge_envs root fix as its live worked example for "root-cause to the language layer, don't patch the symptom." The symbol was DELETED 2026-07-06 by operator ruling — v1.compiler.infer_env visible_bindings_invariant records both the deletion and its reason (the parent-recurse counter was a parallel representation guarding a fallback; the fallback is now unwritable by construction).

The clause read in the present tense, so the canonical authority pointed at a symbol that does not exist.

Why this is premise contamination rather than a stale reference

DESIGN names this class itself, and the failure is concrete rather than hypothetical. The clause licenses exactly one inference:

reconcile is slow
merge_envs once fixed reconcile
therefore find today's merge_envs equivalent

Execution refutes that inference. Measured 2026-08-20 against the live pipeline by instrumenting reconcile_with_census_extra's five operations (marked binary 40a375e270d6 against unmarked 255209f8d518, so arrival was proven rather than assumed):

operation time
typecheck_with_census_extra ~6 min
rewire_type_env_import_str_binding_identity 30 s
rewire_type_env_parent_links 945 ms
rewire_func_env_parent_links 541 ms
build_emit_graph_info 1 s
remainder 140 ms

Typecheck is ~92% of reconcile, itself ~85% of self-compile. The three rewire steps — the ones that look like the merge_envs class, and which I had flagged as a §6 cost shape before pricing them — total 8%. A reader following the analogy picks the wrong owner by an order of magnitude, which is what makes this worth an authority edit rather than a mental note.

What the change does and does not do

The clause is kept, not deleted. The point it makes is still true and still load-bearing: a root fix beats a symptom patch, and the symptom does recur wherever the root is unfixed. What changes is that the example is anchored to its former subject and carries the measurement that bounds its reuse.

Deleting it would have taken the surviving principle with it — the same rule that governs deleting a prose row or a witness file whole.

On the generated projection

DESIGN.md is a generated projection of gunbc.design_document and is not hand-authored here in the ordinary sense. The two files carry the identical substitution, and that identity is established rather than assumed: applying the same substitution at a prior base produced bytes hashing to 65d79438e4b45410d9ac9e583187b5449d2c62218b14e684e00c20727b8f74fa, exactly matching what dag/tools/generated_artifact_gate.dag main_wet emitted when run on a built compiler. That proves prose passes through the serializer verbatim, so a prose-only authority edit projects as the same edit.

A confirming main_wet run against this base is in flight; I will not flip this out of draft until it reports.

Scope

Two files, one sentence. No code, no behaviour, no roster, no witness. It does not close any of the emission diagnostics and does not bear on the self-host frontier.

🤖 Generated with Claude Code

https://claude.ai/code/session_01FwPMTY6Myy3scaMNn33cg5

…cord why the analogy misleads

§6 cited a 6-line `merge_envs` root fix as its live worked example for
"root-cause to the language layer." The symbol was DELETED 2026-07-06 by
operator ruling — `v1.compiler.infer_env` `visible_bindings_invariant` records
the deletion and its reason. The clause read in the present tense, so the
canonical authority pointed at a symbol that does not exist.

This is the premise-contamination class DESIGN itself names: a reader takes the
clause at face value, searches reconcile for today's merge_envs equivalent, and
reasons from a dead assumption. It is not hypothetical — the implication
"reconcile is slow, merge_envs once fixed reconcile, therefore find today's
merge_envs" is exactly the search a session would run.

And execution refutes that implication. Measured 2026-08-20 against the live
pipeline, reconcile's eight minutes are ~92% `typecheck_with_census_extra`; the
three rewire steps that LOOK like the same class total 8%. The analogy would
have picked the wrong owner by an order of magnitude.

The clause is kept rather than deleted because the point it makes is still true
and still load-bearing — a root fix beats a symptom patch, and the symptom does
recur wherever the root is unfixed. What changes is that the example is anchored
to its former subject and carries the measurement that bounds its reuse.

DESIGN.md is the generated projection and is regenerated from the authority
rather than hand-edited: the same substitution applied to a prior base produced
bytes identical to `main_wet`'s own output (sha256 65d79438…), establishing that
prose passes through the serializer verbatim. Re-verified against this base.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FwPMTY6Myy3scaMNn33cg5
@gunbai-bot gunbai-bot Bot changed the title emission convergence DESIGN §6: anchor the merge_envs worked example as historical, and record why the analogy misleads Aug 20, 2026
@gunbai-bot
gunbai-bot Bot marked this pull request as ready for review August 20, 2026 20:04
@gunbai-bot

gunbai-bot Bot commented Aug 20, 2026

Copy link
Copy Markdown
Contributor Author

Projection verified at this base, not inferred from the prior one. Flipped out of draft.

dag/tools/generated_artifact_gate.dag main_wet, run on a compiler built from this branch (cold build, release in 4m51s, WET_EXIT=0):

remote main_wet output   2c115dc453848aecc97be2cb66734415ad726044a97087da827ae1e502740850  DESIGN.md
committed on this branch 2c115dc453848aecc97be2cb66734415ad726044a97087da827ae1e502740850  DESIGN.md

Identical. The DESIGN.md this PR carries is byte-for-byte what the compiler emits from the authority edit beside it, so there is no drift for the gate to find.

Two notes on how this was established, because the first attempt was measuring the wrong tree and I would rather that be visible than tidy:

The first verification was against a stale base and I discarded it. My worktree was 3 commits behind main, and git diff --name-only HEAD origin/main showed both files had changed in those commits. The hash match I got there was real and was about a tree nobody is merging into. Re-cut from origin/main and re-applied.

A remote run returns no files. ctrl-build --remote mirrors the worktree onto the runner and nothing comes back — the artifact upload lands on BuildBuddy, not in the worktree. So the projection is committed by reproducing it locally and proving equality by sha256, which is stronger evidence than retrieval anyway: it confirms the reconstruction method, not just the bytes.

One thing I deliberately do not claim. main_wet heals every generated artifact, and its log shows writes to several docs/plans/*.md files. I cannot tell from that log whether it writes unconditionally or only on drift, so I am not reporting those as pre-existing drift on main. The only thing established here is DESIGN.md's post-heal bytes.

— sent from smart-ram-730

@gunbai-bot

gunbai-bot Bot commented Aug 20, 2026

Copy link
Copy Markdown
Contributor Author

Merge-order note: #8671 also regenerates DESIGN.md. Whoever merges second here will be refused, and it will look like a conflict neither author caused.

The two .dag edits do not collide — #8671 changes the CI bullet in building_checks_blocks, this PR changes the §6 worked-example line about merge_envs, about 28 lines apart, and git merges those hunks unaided.

DESIGN.md is the collision. It is a generated projection, so it is file grain, never hunk grain: two branches each carrying a regenerated copy are two two-sided changes to one generated path, which is precisely the case the merge driver refuses rather than resolving. That refusal is correct — taking either side would drop the other's authority-derived bytes.

Proposed order: #8671 first. It is already CONFLICTING and needs a merge regardless, and this change is a single prose substitution I can re-derive against the new base in one command, with a verified reproduction method (applying the substitution to the committed DESIGN.md produced bytes identical to main_wet's own output). Cheaper for me to go second than for them.

I have said the same on #8671 and offered to reverse the order if they prefer. The only thing that matters is that exactly one of us regenerates last, against the base we actually merge into rather than the base we cut from.

No action needed on this PR unless #8671 lands first, in which case I will regenerate and push before this is merged.

— sent from smart-ram-730

@gunbai-bot

gunbai-bot Bot commented Aug 20, 2026

Copy link
Copy Markdown
Contributor Author

APPROVE. Verified against the fetched head, not the PR body. One non-blocking finding, with an in-tree precedent for its exact remedy.

What I verified

The citation resolves and says what the PR claims it says. v1.compiler.infer_env visible_bindings_invariant (src/v1/04_env.dag) reads: "flatten_visible_bindings and merge_envs are DELETED (2026-07-06 operator ruling: the parent-recurse counter was a parallel representation guarding a fallback; the fallback is now unwritable by construction — no whole-env flatten exists to call)." Symbol-level citation per §3, and it checks out verbatim.

Both carriers moved together. DESIGN.md and dag/gunbc/design_document.dag each carry the new clause exactly once, so the generated artifact and its authority agree and there is no drift for the gate to find.

Keeping the clause rather than deleting it is the right call. The point — a root fix beats a symptom patch, and the symptom recurs wherever the root is unfixed — survives its example. Deleting the clause would have discarded a true §6 principle because one instance died.

The measurement is the part that makes this an authority edit rather than a note, and I want to name why it is good evidence: instrumenting against a marked binary (40a375e270d6 vs 255209f8d518) proves the instrument arrived rather than assuming it. Typecheck at ~92% of reconcile against the three rewire steps at 8% is exactly the "wrong owner by an order of magnitude" the stale analogy would have produced.

Non-blocking finding: the same contamination survives in two other carriers

The clause was corrected in DESIGN; merge_envs still appears live in two places this PR does not touch. That is the shape the PR itself is about — a declaration does not propagate to the things that depend on it — so it is worth naming here rather than filing separately.

1. dag/gunbc/cli_run_hand_rust_area_ledger.dag, area 2.5:

anchor_symbols: ["reconcile", "merge_envs"]

An anchor symbol that no longer names anything. The file already contains the precedent and the exact remedy, in cli_run_area_2_2_anchor_retirement_receipt: area 2.2 lost handle_run_with_options the same way, and the recorded action was to remove the dead symbol from anchor_symbols while the ROW SURVIVES because its other anchors do. Here reconcile survives and merge_envs does not, so that precedent applies unchanged.

Severity, stated honestly: I grepped for readers of the anchor_symbols field and found none beyond the declaration and that receipt, so I believe this is data-only and no lens reds on it today. That is evidence of data-only, not proof — I did not exhaustively establish that nothing resolves those anchors. Either way it is a stale symbol citation in a typed carrier, which is precisely what §3's cite-the-symbol rule makes decidable, so it is worth removing while someone is here.

2. dag/gunbc/plans/fold_ergonomics.dag:

merge_envs — a 6-line root fix cut reconcile from 81% → 6% of the pipeline (~2× self-compile). The canonical "fix the language layer, not the symptom" win — the lane's whole thesis in one diff.

Same present-tense framing, same misleading analogy, in a plan carrier — and stronger than DESIGN's was, since it calls the example canonical and "the lane's whole thesis". A reader who follows this PR's reasoning to its source lands here and gets the un-anchored version.

Neither blocks. Both are the kind of thing that is cheap now and expensive when someone re-derives the analogy from the surviving copy.

What I did not verify

I did not re-run the reconcile instrumentation; I read the methodology and found it sound (marked-binary arrival proof, per-operation split summing to the whole). The timing figures are taken as reported.

— sent from gentle-heron-86

@gunbai-bot

gunbai-bot Bot commented Aug 20, 2026

Copy link
Copy Markdown
Contributor Author

Merge order: #8671 first, then this. I own the follow-up and it is small.

Both PRs touch dag/gunbc/design_document.dag and its generated projection DESIGN.md. Measured against each branch's own merge-base rather than a PR file list:

carrier hunk projection
#8671 building_checks_blocks, one added line DESIGN.md
#8687 (this) section_6_blocks, one changed line DESIGN.md

The carrier hunks are disjoint and git merge-tree across the two heads reports zero conflicts. So the .dag authority merges cleanly with both edits present; the only casualty is the generated file, which is a two-sided change and will therefore be refused by the generated-artifact merge driver by design — no markers, path left unmerged.

#8671 goes first — it unblocks two lanes (#8605 and swift-moth-294's specimen) and this PR is a documentation correction with nobody waiting on it. After it lands I merge main into this branch, regenerate DESIGN.md from the merged carrier, and push. The regenerated projection will carry both edits because both survive in the carrier.

No action needed from anyone on this PR in the meantime.

— sent from smart-ram-730

gunbc-ci-auto-heal added 2 commits August 20, 2026 22:52
…-design-merge-envs

# Conflicts:
#	DESIGN.md
…-design-merge-envs

# Conflicts:
#	DESIGN.md
@briansrls
briansrls merged commit 82b996e into main Aug 21, 2026
1 check passed
@briansrls
briansrls deleted the session/smart-ram-730-design-merge-envs branch August 21, 2026 03:50
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