Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
133 changes: 133 additions & 0 deletions docs/planning/v4-e0308-stratified-rca-worksheet-2026-06-03.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
# v4 E0308 Stratified RCA Worksheet — 2026-06-03

> **Status:** DRAFT RCA WORKSHEET — routes subfamilies; does not authorize one broad E0308 implementation.
> **Authority:** PR #4140 (`E0308` = 2,953); pair histogram from Jun1 M1 probe (regenerated `vivid-lynx-81` session matched #4140 exactly).
> **Mechanical rule:** each implementation lane needs its own single-authority fact and falsification probe. Do not dispatch "fix E0308".

---

## Pair Histogram

Top expected/found pairs from the regenerated M1 rustc log:

| Pair | Count | Route |
| --- | ---:| --- |
| `String => Symbol` | 1,344 | SG-1b `TargetFunctionSignatureRealization` |
| `Rc<Diagnostics> => Diagnostics` | 300 | SG-RC-LAYERING |
| `Outcome<_> => Rc<Outcome<_>>` | 184 | SG-RC-LAYERING + SG-2 residual |
| `Box<_> => Rc<Node>` | 134 | SG-RC-LAYERING |
| `Node => Rc<Node>` | 113 | SG-RC-LAYERING |
| unparsed E0308 blocks | 96 | classify after P0 routes; do not open new class yet |
| `TestClaim => Rc<TestClaim>` | 69 | SG-RC-LAYERING / TestClaim boundary slice |
| `Vec<Rc<Edge>> => FreeMonoid<_>` | 47 | SG-COLLECTION-PROJECTION (#4151) |
| `FreeMonoid<_> => Rc<FreeMonoid<_>>` | 38 | SG-RC-LAYERING around collection carrier |
| `Vec<Rc<PrimitiveFactBundle>> => FreeMonoid<_>` | 32 | SG-COLLECTION-PROJECTION |
| `Rc<Diagnostics> => Option<_>` | 32 | diagnostic result-shape boundary |
| `Vec<Rc<AlgebraInhabitanceDecl>> => FreeMonoid<_>` | 22 | SG-COLLECTION-PROJECTION |
| `Vec<Rc<Node>> => FreeMonoid<_>` | 16 | SG-COLLECTION-PROJECTION |
| `DecimalDigit => NonZeroDecimalDigit` | 15 | refinement / subset constructor proof |
| `Vec<Rc<FormalGrammarSymbol>> => FreeMonoid<_>` | 14 | SG-COLLECTION-PROJECTION |
| `Outcome<Rc<Vec<Rc<Edge>>>> => Rc<Outcome<_>>` | 14 | SG-RC-LAYERING + SG-2 residual |
| `Diagnostics => Option<_>` | 13 | diagnostic result-shape boundary |
| `Coverage<CoverageDefectAcceptanceKey> => CoverageDefectAcceptanceKey` | 13 | lens carrier/value boundary |

---

## P0 Subfamilies

### E0308-A: Function-boundary atom signature mismatch

```text
Representative:
pub fn foo_symbol() -> String { Symbol("foo".to_string()) }

Single-authority fact:
TargetFunctionSignatureRealization in v4.std.target_model, keyed by source_carrier and FunctionBoundarySite.

Existing worksheet:
v4-sg-1b-function-signature-realization-worksheet-2026-05-30.md (#4099)

Worker:
TargetAtom / Target Realization lane, not broad E0308.

Acceptance:
SG-1b falsification probes: signature and SG-1 value form stay coupled; fn-boundary atom spelling does not bypass the realization lookup.
```

### E0308-B: Per-use-site ownership layering

```text
Representative:
expected Rc<Diagnostics>, found Diagnostics
expected Node, found Rc<Node>
expected Box<_>, found Rc<Node>
expected TestClaim, found Rc<TestClaim>

Single-authority fact:
TargetUseSiteOwnershipRealization in v4.std.target_model, with TargetOwnershipUseSite and TargetReferenceLayer.

Existing worksheet:
v4-sg-rc-layering-worksheet-2026-05-31.md (#4116); manual receipt sg_rc_layering.dag

Worker:
Target Realization + Compiler Spine, with Runtime/TestClaim falsification.

Acceptance:
Type and value positions change together when a reference_layer row changes; no name-keyed Rc/Box wrapping.
```

### E0308-C: Collection boundary projection

```text
Representative:
expected Vec<Rc<Edge>>, found FreeMonoid<_>
expected Vec<Rc<PrimitiveFactBundle>>, found FreeMonoid<_>
expected Vec<Rc<FormalGrammarSymbol>>, found FreeMonoid<_>

Single-authority fact:
TargetCollectionRealization extension for FreeMonoid<T> → Vec<Rc<T>> at consumer boundary (SG-COLLECTION-PROJECTION).

Existing worksheet:
v4-sg-collection-projection-worksheet-2026-06-01.md (#4151); substrate gated on main; manual receipt sg_collection_projection.dag

Worker:
Target Realization — consume collection realization row at translate boundary; no per-site collect() patches.

Acceptance:
ProbeSeq<T> or FreeMonoid<Probe> projects to Rust boundary storage by row change only; no hardcoded FreeMonoid or Edge branch.
```

### E0308-D: Diagnostic/result shape boundaries

```text
Representative:
expected Rc<Diagnostics>, found Option<_>
expected Diagnostics, found Option<_>
expected Outcome<_>, found Rc<Outcome<_>>

Single-authority fact:
Split before dispatch:
- Rc/raw wrapping routes to SG-RC-LAYERING.
- Option vs Diagnostics routes to diagnostic result-shape modeling; likely Outcome/Diagnostic carrier construction, not ownership.

Dispatch:
Do not open until SG-RC and SG-2 land, then remeasure. The remaining Option/Diagnostics band may become a small diagnostic-constructor worksheet.
```

---

## Non-Goals

- Broad E0308 implementation.
- Per-function return-type patches.
- Hardcoded `Rc::new` / `Box::new` / `.into()` insertion tables.
- Folding collection projection into SG-RC without Modeling DFS approval.
- Using E0308 count reduction as acceptance.

---

## Manager Decision

P0 implementation fanout uses existing approved SG-1b, SG-RC, and SG-COLLECTION-PROJECTION
worksheets first. Diagnostic/result-shape work waits for a post-SG-RC/SG-2 remeasure unless
a worker proves an independent single-authority fact before then.
80 changes: 80 additions & 0 deletions docs/planning/v4-rust-rca-manager-worksheets-2026-06-03.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
# v4 Rust RCA Manager Worksheets — 2026-06-03

**Live state (P1):** M1 CI gate = `.github/ci-floor/v4-m1-rust-emit-probe.sh` (v2 emit +
receipt only; authority `src/v4/workflow/ci.dag:562`). The 7,724 rustc histogram is PR
#4140 audit only — recover via `git show 65e8db2ac0:docs/audit/…` §5 (extended probe with
`cargo check`, not the ci-floor script). There is no `scripts/v4-m1-rust-emit-probe.sh` on
`origin/main`.

Scope: #4137 Section 11.8 Rust release-minimum / M1 rustc residual lane. These
worksheets cluster the live ratchet meter (PR #4140: **7,724** `error[E####]`
lines at post-Jun1-cascade) into routed subfamilies. Each subfamily names a
single-authority fact and a falsification probe before implementation dispatch.

**Live ratchet authority:** PR #4140 (`docs(audit): refresh Jun1 M1 rustc
residual catalog`). The committed audit tree was removed in #4192; recover the
7,724-error histogram via
`git show 65e8db2ac0:docs/audit/v4-rustc-error-catalog-2026-06-01-post-jun1-cascade.md`
(see that file's §5 repro — extended emit + `cargo check`, not the live CI gate).

**Live M1 CI gate:** `.github/ci-floor/v4-m1-rust-emit-probe.sh` (authority:
`src/v4/workflow/ci.dag`) — v2 `--target rust` emit with a
`compiled: N files emitted, 0 diagnostics` receipt only; **no `cargo check`**.

**Manager session:** `bright-crane-734` (`node://adhoc-65299e42-409`).

**Closed classes at #4140 probe:** SG-1 (`E0423 = 0`), SG-7 (v2 emit diagnostics
= 0). Count growth (+549 vs #4122) is residual-population expansion after
substrate landings, not class reopening.

## Dispatch Rule

The Rust lane advances by **routed subfamily**, not by error code:

1. No worker may land on "fix E0308" or "fix SG-2" without naming the
single-authority fact and forbidden-pattern greps.
2. Error-count reduction is secondary evidence only.
3. Cross-language facts land in `src/v4/std/target_model.dag` (or another
ratified canonical home) before `extdeps/languages/rust.dag` rows or translate
consumers change.
4. Name-keyed import tables, carrier arity shims, or per-error text patches
violate INVARIANTS P2/P5 and must be rejected.

## Routing Summary

| Route | Residual population (#4140) | Worksheet | Dispatch state |
| --- | ---:| --- | --- |
| SG-8 module graph / import / re-export | `E0425`+`E0432`+`E0433` = **1,224** (+420 vs #4122) | [SG-8 addendum](v4-sg8-rca-ratification-addendum-2026-06-03.md) | §8 **ratified** (#4143); ready for impl |
| E0308 stratified | **2,953** (dominant code, not dominant delta) | [E0308 stratified](v4-e0308-stratified-rca-worksheet-2026-06-03.md) | P0 slices route to SG-1b / SG-RC / SG-COLLECTION |
| SG-2 residual | `E0107`+`E0282` = **2,661** (+75 vs #4122) | [SG-2 residual](v4-sg2-residual-rca-worksheet-2026-06-03.md) | Consumer-coverage slice on approved SG-2 substrate |
| Stable bands | `E0277`, `E0573`, `E0369`, `E0560`, `E0121`, tail | [Stable bands](v4-stable-rustc-bands-rca-worksheet-2026-06-03.md) | Second-order; no broad SG-3 lane |

## Fanout Order

1. **SG-8** — highest delta driver; implement per #4127 worksheet after §8
ratification (#4143). Target: `emit_imports` defining-module authority +
parametric alias emission; F1–F4 falsification.
2. **SG-2 residual** — extend approved `TargetTypeExpressionProjection` consumer
coverage to aliases, cached statics, function signatures, closure annotations,
and constructor result types (`ProbePair<T,U>` five-site probe).
3. **E0308 P0** — parallel slices only through existing or ratified worksheets:
- String/Symbol → SG-1b function-signature realization (#4099)
- Rc/raw/Box mismatches → SG-RC-LAYERING (#4116 / manual `sg_rc_layering.dag`)
- FreeMonoid vs `Vec<Rc<T>>` → SG-COLLECTION-PROJECTION (#4151; substrate gated on main)
4. **Stable bands** — attach to primary routes (`E0573` → SG-8, collection `E0277`
→ SG-5); hold constructor-field-admission until post-P0 remeasure.

## Worksheet Index

- `docs/planning/v4-sg8-rca-ratification-addendum-2026-06-03.md`
- `docs/planning/v4-e0308-stratified-rca-worksheet-2026-06-03.md`
- `docs/planning/v4-sg2-residual-rca-worksheet-2026-06-03.md`
- `docs/planning/v4-stable-rustc-bands-rca-worksheet-2026-06-03.md`

## Related Artifacts

- `.github/ci-floor/v4-m1-rust-emit-probe.sh` — M1 full-tree v2 rust emit + compile-log receipt (no `cargo check`)
- `src/v4/test/claim/manual/sg_rc_layering.dag` — SG-RC falsification F1–F6
- `src/v4/test/claim/manual/sg_collection_projection.dag` — SG-COLLECTION receipt
- `src/v4/std/target_model.dag` — SG-RC / collection / type-expression authority
- `docs/planning/v4-go-rca-manager-worksheets-2026-06-03.md` — parallel §11.8 lane shape
106 changes: 106 additions & 0 deletions docs/planning/v4-sg2-residual-rca-worksheet-2026-06-03.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
# v4 SG-2 Residual RCA Worksheet — 2026-06-03

> **Status:** DRAFT RCA WORKSHEET — residual routing on top of approved SG-2 worksheet (#4124).
> **Authority:** PR #4140 (`E0107` = 1,654, `E0282` = 1,007).
> **Existing worksheet:** `v4-sg2-type-expression-projection-worksheet-2026-05-30.md` (#3962 substrate, #4124 closure).

---

## Residual Shape

`E0107` missing-generic carrier histogram:

| Carrier | Count | Readout |
| --- | ---:| --- |
| `Outcome` | 740 | aliases/cached statics/signatures erase payload `T` |
| `TestClaimRun` | 292 | emitted claim run caches erase `S, A` |
| `Witness` | 135 | witness carrier instantiations lose `C` |
| `TestClaimEvalSubject` | 88 | evaluator subject generic path not preserved |
| `Validation` | 77 | refinement/validation caches erase `B` |
| `FreeMonoid` | 71 | collection source carrier instantiation missing at cache/signature sites |
| `Verdict` | 48 | verdict surface generic payload erased |
| `ClassifiedDependencyView` | 40 | lens/dependency generic erased |
| `Optional` | 25 | optional generic erased |
| `Generator` | 14 | generator generic erased |

`E0282` is concentrated in constructor/cache/closure sites after those
instantiations are erased. Top files include `v4_compiler_translate` (183),
`v4_workflow_ci` (58), `v4_lens_coverage` (45), `v4_lens_testgen` (38), and
`v4_std_target_model` (36).

Higher-kinded shape (`Homomorphism<C, Source, Target>` with `C<Source>` fields)
maps to `E0109` — a true realization-model gap requiring type-constructor encoding,
not a name-keyed arity table.

---

## §10.0-Adapted Residual Worksheet

```text
SG class:
SG-2 residual — generic instantiation preservation across aliases, caches, statics, and signatures.

Representative emitted failure:
CACHED.with(|c: &Rc<Outcome>| c.clone())
CACHED.with(|c: &Rc<TestClaimRun>| c.clone())
// Rust requires Outcome<T> and TestClaimRun<S,A>.

Immediate local patch:
Add name-keyed emitter branches:
Outcome -> Outcome<T>
TestClaimRun -> TestClaimRun<S,A>
Witness -> Witness<C>

Why forbidden:
Duplicates generic-arity facts already present in substrate instantiation edges;
requires an emitter edit for every new generic carrier (INVARIANTS P2).

DFS path:
std authority:
- generic carrier declarations (Outcome<T>, Witness<C>, Validation<B>, FreeMonoid<T>)
- Instantiation connective with positional edges
target authority:
- TargetTypeExpressionProjection in v4.std.target_model
- Rust row in extdeps/languages/rust.dag
consumer:
- type emission for aliases, function signatures, cached statics, closure annotations, constructor result types

Deepest unsound boundary:
Approved SG-2 carrier describes target type-expression projection, but residual sites
still read raw carrier names from alias/cache/signature paths instead of carrying the
instantiated TargetTypeExpression to those sites.

Systemic fix:
Extend SG-2 implementation to require every emitted type site to receive a
TargetTypeExpression value, including cached statics and generated closure annotations.
Fallback to raw carrier name is allowed only as typed ProjectionAbsent diagnostic/shim
with explicit dissolve-on: aliases, cached statics, function signatures, constructor
result types, and closure annotations all consume TargetTypeExpression.

Non-goals:
- Name-keyed arity table for Outcome/TestClaimRun/Witness.
- Treating E0282 as a separate inference feature before E0107 residual is reduced.
- Patching emitted Rust files.

Falsification probe:
Add generic carrier ProbePair<T, U> and use it in:
(a) type alias,
(b) cached static,
(c) function parameter,
(d) function return,
(e) closure annotation.
Emitted Rust must preserve ProbePair<X, Y> in all five sites without an emitter branch for ProbePair.

Metric allowed only as secondary:
E0107/E0282 movement.
```

---

## Dispatch Decision

Do not create a new SG-2 substrate carrier. The residual is a **consumer coverage
slice** for the already-approved `TargetTypeExpressionProjection`: aliases, caches,
signatures, and closure annotations must all consume the same projected type
expression. Target Realization owns consumer coverage; Runtime/TestClaim owns the
falsification receipt.
77 changes: 77 additions & 0 deletions docs/planning/v4-sg8-rca-ratification-addendum-2026-06-03.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
# v4 SG-8 RCA Ratification Addendum — 2026-06-03

> **Status:** ADDENDUM — implementation dispatch **authorized** (Modeling DFS Arbiter §8 sign-off #4143).
> **Authority:** PR #4140 Jun1 M1 rustc catalog (recover:
> `git show 65e8db2ac0:docs/audit/v4-rustc-error-catalog-2026-06-01-post-jun1-cascade.md`).
> **SG-8 worksheet:** landed #4127; planning path removed in #4192 — recover F1–F4 and full
> packet via
> `git show 8c26800586:docs/planning/v4-sg8-module-graph-carrier-reexports-worksheet-2026-05-31.md`.
> **Does not supersede** that recovered worksheet; this addendum only raises priority post-#4140.

---

## What Changed Since The Worksheet

PR #4140 remeasured the full M1 Rust emitted tree after the Jun1 cascade. The
SG-8 code family is the largest delta driver:

| Code | #4140 count | #4122 baseline | Delta |
| --- | ---:| ---:| ---:|
| `E0425` | 538 | 485 | +53 |
| `E0432` | 415 | 238 | +177 |
| `E0433` | 271 | 81 | +190 |
| **SG-8 total** | **1,224** | **804** | **+420** |

This growth does not create a new worksheet class. It confirms the existing SG-8
readout: imported names, variant-parent expansion, generic aliases, and promoted
carrier homes are emitted without a single export/import authority.

---

## Ratification Status

| Check | Answer |
| --- | --- |
| Single authority | Defining module/export surface, not import-site spelling or shim re-export tables |
| Existing worksheet still valid | Yes: #4127 — `emit_imports` graph-type isolation + defining-module `pub use`; parametric alias emission |
| §8 ratification | **Closed** 2026-06-01 via #4143 (`proud-fox-405`) |
| New #4140 evidence changes dispatch? | No; raises priority only |
| Spot-fix forbidden | Hand-added `pub use` rows, CarrierKind/List/Char shim duplication, per-error unresolved import patches |
| Acceptance | F1–F4 table below (full #4127 worksheet: `git show 8c26800586:…` above), not SG-8 count reduction |

---

## F1–F4 falsification (inlined from #4127 §4)

| Probe | Intent | Receipt |
| --- | --- | --- |
| F1 | String type import cannot pull Go enum parent | `rg 'GoScalarKind' <emitted_fixture.rs>` empty |
| F2 | TargetSource import does not re-export CarrierKind from wrong module | `rg 'v4_compiler_target_carriers.*CarrierKind' <emitted_fixture.rs>` empty; `CarrierKind` from `v4_std_pipeline` allowed |
| F3 | List alias emitted in collection module | `rg 'pub type List' v4_std_collection.rs` present |
| F4 | New generic alias via generic path (no name-keyed branch) | Hermetic `.dag` fixture + structural `TestClaim` or `src/v2/tests`; `rg 'pub type Pair' <emitted_fixture.rs>` |

---

## Implementation Dispatch Packet

```text
Implement SG-8 per git show 8c26800586:docs/planning/v4-sg8-module-graph-carrier-reexports-worksheet-2026-05-31.md (#4127).

MUST:
- Fix v2 emit_imports so graph type names do not trigger enum-variant parent expansion.
- Resolve pub-use and variant paths from defining ItemInfo.module_name, not import-site module.
- Emit parametric type aliases (pub type Foo<T> = ...) through the generic alias path.
- Prove F1–F4 per table above; rustc residual remeasure per #4140 §5 repro (extended
probe in recovered audit catalog), not the live ci-floor M1 gate alone.

MUST NOT:
- Add name-keyed import patch tables.
- Re-export promoted carriers from old compiler-local modules.
- Claim acceptance from E0425/E0432/E0433 count reduction.
```

Representative failures from #4140 §4:

- `CarrierKind` imported from `v4_compiler_target_carriers` while authority moved to `std/pipeline` — module-authority projection gap.
- `NodeRef` imported from `v4_std_node` with no such item — concept-home decision required before broad consumer imports.
- `EdgeLabel` undeclared in generated claim modules — dependency-edge emission from type references in generated bodies.
Loading
Loading