Skip to content

v2 artifact.dag — dissolve single-variant coproduct husk (calibration probe) - #3406

Closed
briansrls wants to merge 1 commit into
mainfrom
session/loyal-dove-547
Closed

briansrls wants to merge 1 commit into
mainfrom
session/loyal-dove-547

Conversation

@briansrls

Copy link
Copy Markdown
Contributor

v2 stage rework — artifact.dag (calibration probe)

Calibration investigation: applies the v4-discovered modeling discipline back onto a working v2 stage. Draft for operator review — not a binding direction. One of a parallel set of v2 stage probes.

Before / after line counts

File Before After
src/v2/artifact.dag 113 84

What dissolved

  • PartitionRule = Explicit { artifacts } (was lines 75–85) — a single-variant coproduct. One variant is not a sum; fn plan_artifacts was a degenerate 1-arm match (the limiting case of a template-hole). The header even noted "Placeholder partition strategies were removed" — this is the husk left behind. Dissolved: type PartitionRule + fn plan_artifacts deleted; default_artifact_plan now constructs the ArtifactPlan directly.
  • type ArtifactOutput (was lines 94–97) — zero consumers anywhere in src/v2 (grep-verified). Speculative dead code held alive only by an explanatory comment. Deleted.
  • import v2.std.core { TextFile } — used only by ArtifactOutput; dropped.
  • Net: −45 / +15 lines, two type declarations and one function removed, no behavioral change.

Behavioral contract

default_artifact_plan returns the byte-identical ArtifactPlan { artifacts: [Artifact{…}], boundaries: [] } it did before — previously routed through plan_artifacts(Explicit{…}), now built inline. No external file references PartitionRule, plan_artifacts, ArtifactOutput, or TextFile-via-this-module (grep-verified across src/v2). The file's three external consumers (compile.dag, coercion.dag, 05_emit*.dag) import only RenderTarget / its variants / ArtifactPlan / Artifact / default_artifact_plan — all unchanged.

Per-principle citations

  1. Coproduct dissolution — PartitionRule 🔴 dissolved (1-variant husk). RenderTarget (artifact.dag:15) and ArtifactKind (:22), BoundaryKind (:44) classified below.
  2. Grounding — remaining coproducts are nullary-constructor sums (built from primitives); no hollow aliases (type X = Y reading zero facts) in the file.
  3. Compiler homomorphism — the removed plan_artifacts 1-arm match was the only structural recursion candidate; gone. No hand-rolled fold remains.
  4. No template-holes — the degenerate 1-arm match in plan_artifacts is removed; artifact.dag now contains no match.
  5. No annotations — no comment conveys a modeling fact a type should carry; the speculative-future prose for ArtifactOutput is gone with the type.
  6. Simplicity / de-elaboration — default_artifact_plan is now a single direct constructor, no rule-object indirection.
  7. No "established idiom" reasoning — PartitionRule is judged on its own merit (1 variant ⇒ husk), not excused by analogy.
  8. Document what dies — this section.

Honest 🟡 / findings list (NOT executed — operator decides)

This file is mostly forward-looking orchestration modeling for a multi-artifact partitioner that does not exist. Strict v4 discipline would dissolve more, but the remaining items are either cross-file or in tension with the file's stated purpose, so they are surfaced rather than executed in this draft:

  • RenderTarget = Rust | Python | Go | Dag — 🟡 consumer-gated. The watchpoint dissolution (data-not-tag: each target carrying a per-target TargetSyntax record, the shape v4 uses for target-language-as-data) requires reshaping a type consumed by sibling-owned files (05_emit.dag, coercion.dag — ~30 target: signatures, plus Rust tests and stage0). Out of this file's scope; surfaced to the PM for cross-stage routing.
  • ArtifactKind + Artifact.kind — the kind field is written (default_artifact_plan sets ServiceBinary) but never read — compile.dag::emit_artifact dispatches only on .target. A never-matched 4-variant coproduct. In-file-removable, but it is deliberate forward modeling per the file's stated purpose; flagged for the operator's "keep speculative data models in v2?" call rather than unilaterally deleted.
  • Boundary / BoundaryKind — 🟡 cross-file. BoundaryKind's variants are never constructed; Boundary is never inhabited (boundaries is always []); compile.dag::validate_boundaries reads only from_artifact / to_artifact, never .kind. Removing them would break compile.dag (ArtifactPlan.boundaries, validate_boundaries) — a sibling-owned file. Surfaced to the PM.

Acceptance criteria — honest status

  • ✅ cargo build -p v2-compiler --release — passes (verified, 2m05s, exit 0).
  • ⚠️ cargo test -p v2-compiler-tests --release bootstrap_fixed_point -- --ignored --exact — fails on main, pre-existing, unrelated to this change. It fails at a prerequisite before stage0 compiles anything: bootstrap.rs:58 runs cargo run -p v3-compiler --bin emit_method_template_projection, but that bin does not exist. The bin was deleted in 39ba75728 (R3 gate Daglang compiler scaffolding #42); #3148 (fdaedb127) restored src/v2 and its bootstrap.rs test but not the v3-side bin it depends on. No v2 PR can currently pass this criterion — escalated to the PM; affects every sibling v2 stage worker.
  • ✅ Direct verification of this change: cargo run -p v2-compiler --release -- compile --source-root src/v2 --source-root dsl compiles v2.compiler.artifact cleanly. The only 3 diagnostics are the missing generated.method_template_projection module (same root cause as above) and a circular-dependency cascade off it — none reference artifact.dag.
  • ✅ Behavioral contract preserved — default_artifact_plan output byte-identical (see above).

🤖 Generated with Claude Code

… probe)

Calibration investigation applying v4-discovered modeling discipline back
onto a working v2 stage. Safe in-file dissolution, behavior-preserving:

- Dissolve `PartitionRule = Explicit { artifacts }` — a single-variant
  coproduct is not a coproduct; `plan_artifacts` was a degenerate 1-arm
  match. Both inlined into `default_artifact_plan`, which now constructs
  the identical `ArtifactPlan` value directly.
- Delete `type ArtifactOutput` — zero consumers anywhere in src/v2;
  speculative dead code retained only by a comment.
- Drop the now-unused `import v2.std.core { TextFile }` (used only by
  `ArtifactOutput`).

113 → 84 lines. No external consumer references the removed symbols
(grep-verified across src/v2). `default_artifact_plan` output is
byte-identical. Findings on `RenderTarget` / `ArtifactKind` / `Boundary`
(cross-file / gated) are in the PR description.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@briansrls
briansrls marked this pull request as ready for review May 19, 2026 20:52
@briansrls

Copy link
Copy Markdown
Contributor Author

Thanks for the review. On the exploratory point — leaving src/v2/stage0/src/v2_compiler_artifact.rs untouched is intentional:

  1. No-Rust-hand-edits rule. Per an operator standing rule (relayed by the PM mid-task), this calibration work is .dag-only — hand-editing stage0 Rust is explicitly disallowed. A dedicated worker is being spawned to investigate "how do we stop editing stage0 at all," so the seed is deliberately left as-is.
  2. The fixed point doesn't require it. bootstrap_fixed_point builds stage1 from the .dag corpus, then builds stage2 from stage1, and diffs stage1 vs stage2 — both generated purely from .dag. The stage0 seed only needs to be able to compile the modified artifact.dag (it can — a compiler parses any valid .dag; it doesn't need its own source to match). So the seed carrying the pre-dissolution PartitionRule/ArtifactOutput is harmless: an extra unused struct in the seed, nothing more.

So no stage0 regen is expected in a follow-up from this calibration probe. If the operator later decides v2 should keep the seed in lockstep, that is the dedicated stage0 worker's call, not this .dag-only probe.

— sent from loyal-dove-547

@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: b1aa0f7e · Trigger: schedule
  • Thinking: 176s wall

Non-blocking — Strengths

  • src/v2/artifact.dag This looks clean: the PR dissolves the single-variant PartitionRule wrapper and removes the unused ArtifactOutput without adding a new substrate coproduct or duplicate authority.

✅ No blocking concerns found.

@briansrls

Copy link
Copy Markdown
Contributor Author

Closing per operator wrap-up directive 2026-05-20.

@briansrls briansrls closed this May 20, 2026
@briansrls
briansrls deleted the session/loyal-dove-547 branch June 1, 2026 18:42
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