Repository navigation
docs(r3): post-#1488 follow-up — SizeVariable construction invariant + EnforceableLens uniqueness - #1500
Conversation
Director relayed two analyses against current main: - Exploratory (gpt-5-5-pro main@8cd5359): 9 findings against dsl/std/*.dag, src/v2/tests/src/*.rs, dsl/extdeps/, THESIS, INVARIANTS, MODELING, ROADMAP — 2 novel correctness bugs (SymbolicCost semiring violation, emitter expect() panic paths), 3 sharpened tracked items (SubValueRelation lattice-law contradiction, ?? / % syntax-parser drift, CollectionOps/StringOps/ MapOps duplicates), 4 already-tracked items - Reflective (gpt-5-5-pro main@6ea9812 → now): 5 cross-PR patterns + 6 highest-priority course corrections + verdict "advancing, scaffold-velocity dominates" PM ingestion folds into single ROADMAP debt section per Director's prior 2026-04-30 analyses ingestion pattern (PR #1319). Sections: - A: Exploratory novel correctness bugs (SymbolicCost product-zero bug, SubValueRelation BoundedLattice claim violation, emitter expect panic paths) - B: Exploratory sharpened tracked items (?? / % drift, CollectionOps/StringOps/MapOps duplicates) - C: Exploratory already-tracked confirmations (no new ROADMAP rows) - D: Reflective 5 cross-PR patterns (author-now/fire-later, test_ runner.rs second predicate language, typed-carrier-Rust-mirror accumulation, numeric philosophy mid-window shift validating T-Numeric-Construction reframe, bridge retirement tracked-not- retired) - E: Reflective 6 highest-priority course corrections with owner attribution + lane connection table - F: CI cost signal (e765c86 60min timeout) + velocity-tripwire calibration (64 docs / 16 feat / 9 fix ratio) - G: PM strategic synthesis: 3 cross-cutting meta-themes (algebraic-law-witness coverage gap; "make scaffolds executable" cluster; "tighten existing structural enforcement" cluster) Per-finding/correction owner attribution names R3 Substrate Mgr, R3 Verification Mgr, R3 Grounding Mgr, R3 PB Mgr per ownership boundaries. Lane connections cite T-V-L4-L7-Direct, T-Free- Consequences-Demonstration, T-Ground-Services parser-grammar slice, T-Numeric-Construction Slice 2 sequencing, etc. Highest-value novel: SymbolicCost product-zero bug (cost-lens reads incorrect facts; iterate(ConstantCost(0), ...) returns body cost instead of zero) + emitter expect() panics. Highest-value sharpened-tracked: SubValueRelation BoundedLattice false-claim. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…-roadmap-2026-05-01-analyses
…-roadmap-2026-05-01-analyses
…-roadmap-2026-05-01-analyses
…-roadmap-2026-05-01-analyses
…-roadmap-2026-05-01-analyses
…-roadmap-2026-05-01-analyses
…-roadmap-2026-05-01-analyses
…-roadmap-2026-05-01-analyses
…-roadmap-2026-05-01-analyses
…-roadmap-2026-05-01-analyses
…-roadmap-2026-05-01-analyses
…-roadmap-2026-05-01-analyses
…-roadmap-2026-05-01-analyses
…-roadmap-2026-05-01-analyses
…-roadmap-2026-05-01-analyses
…-roadmap-2026-05-01-analyses
…-roadmap-2026-05-01-analyses
…-roadmap-2026-05-01-analyses
…-roadmap-2026-05-01-analyses
…-roadmap-2026-05-01-analyses
…-roadmap-2026-05-01-analyses
…-roadmap-2026-05-01-analyses
…-roadmap-2026-05-01-analyses
…-roadmap-2026-05-01-analyses
…-roadmap-2026-05-01-analyses
…-roadmap-2026-05-01-analyses
…-roadmap-2026-05-01-analyses
…-roadmap-2026-05-01-analyses
…deep-wolf-155-roadmap-2026-05-01-analyses
…anonicalizes; copies cannot diverge Cursor BLOCKING on PR #1488 sha bef5781: SizeVariable equality on source_port only, while display_name was admitted as an independent field. SymbolicCost payloads (LinearCost(SizeVariable), etc.) store copies; if the construction site allowed two SizeVariables with the same source_port but different display_name values, the user-facing label would not be single-authority — consumers picking either copy would render different labels for the same logical port. Resolution: specify the parser-level CONSTRUCTION INVARIANT explicitly in §1.2: - SizeVariable is constructed EXCLUSIVELY by the parser at authoring sites, against a per-DAG `PortId → String?` name table populated at parse time. - Every SizeVariable instance referencing source_port `p` carries the canonical display_name for `p` (or None if no authored name). - Parser is the only construction site (no user-facing `SizeVariable { ... }` literal at authoring time — SizeVariables emerge from let-binding references during lowering). - SymbolicCost payloads carrying SizeVariable copies cannot have divergent labels for the same source_port — single-authority by construction. Equality on source_port only is correct under this invariant: same source_port always carries same display_name. The redundancy is explicit (display_name is canonical-per-source_port, derived at construction). Future hardening note: when v3 lands a substrate-level `port_id → name` query (currently unwired per algebra.dag:143), display_name can retire from the carrier entirely. For now the parser- canonicalized field is what v3 supports. This is a parser-level invariant, not a type-level guarantee, but the parser is the only construction site for SizeVariable — divergent labels are unrepresentable through the public construction path. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…riant per (lens, Budget) pair Cursor BLOCKING on PR #1488 sha bef5781: EnforceableLens<Output, Budget> is a constructible record, so user code could declare another type-compatible Lens<C> + LensEnforcement<C, B> pairing as a different EnforceableLens. Canonical enforcement remained convention rather than API-level enforcement. Resolution: specify the PARSER-LEVEL UNIQUENESS INVARIANT in §2: "at most ONE EnforceableLens<C, B> declaration per (Lens<C>, Budget B) pair in the program". User code that declares a second EnforceableLens referencing the same lens with a type-compatible Budget fails parse-time with a Diagnostic naming both declarations as the duplicate-canonical-enforcement violation. Same shape as v3's other single-authority parser invariants (one declaration per name; one BoundedLattice instance per type). EnforcedApplication.enforceable_lens references resolve unambiguously to the SOLE canonical EnforceableLens for that (lens, Budget) tuple. Why parser-level, not type-level: full type-level enforcement would require existentials or singleton inhabitance — substrate features v3 doesn't fully express today (per substrate.dag inhabitance support is sparse). The parser-level invariant achieves the same single- authority outcome (no two competing canonical enforcements for a lens/budget pair) at the only construction site v3 currently supports as a structural gate. Future substrate hardening (existentials / dependent inhabitance) would let this lift to type-level — recorded as future cleanup. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
Review metadata
APPROVE — Documentation-only changes that strengthen previously-asserted single-authority claims by spelling out the construction-site mechanism (parser canonicalization for Exploratory observations (optional):
|
briansrls
left a comment
There was a problem hiding this comment.
Review metadata
- Provider / model:
codex/unknown - Commit:
2c27a28f· Trigger:schedule - Thinking:
152s wall
✅ Docs-only follow-up; the added parser-level invariants are documented, bounded, and consistent with the thesis/invariants, with no blocking concerns.
…-r3-scope-expansion
|
Review metadata
FindingsNo blocking issues. The diff only updates two design markdown files. It states parser-level (not type-level) rules for Nothing in this diff touches VerdictAPPROVE — Narrow documentation follow-up: construction invariant for Exploratory observations (optional)The new cross-reference “currently unwired per |
Follow-up to PR #1488 (merged at c03fc60). Addresses 2 BLOCKING findings from cursor review wave (sha bef5781) that arrived AFTER PR #1488 merged. Both close subtle parallel-authority gaps in the substrate-design carriers landed there.
Commits (2)
PortId → String?name table canonicalizes display_name; SymbolicCost payload copies cannot diverge for same source_port. Closes the gap where SizeVariable equality on source_port only admitted divergent labels.EnforceableLens<C, B>declaration per (Lens, Budget B) pair. User code declaring a second one fails parse-time with duplicate-canonical-enforcement Diagnostic. Closes the gap where multiple EnforceableLens declarations could compete as canonical.Modeling-discipline class
Both fixes use parser-level uniqueness/canonicalization invariants as the strongest single-authority enforcement v3 currently supports. Type-level alternatives (existentials, singleton inhabitance, dependent types) would let these lift to type-level guarantees but require substrate hardening v3 doesn't ship today. Each fix documents the parser-level invariant explicitly + names the future hardening trigger.
Files modified
docs/design-cost-lens-sizevar-dimension-wiring.md— §1.2 construction invariant added (parser canonicalizes display_name).docs/design-lens-application-surface.md— §2 EnforceableLens parser-level uniqueness invariant.Test plan
cargo fmt --all --check(passes via pre-push hook)🤖 Generated with Claude Code