Skip to content

vivid-badger-729 - #931

Closed
briansrls wants to merge 53 commits into
mainfrom
session/vivid-badger-729
Closed

briansrls wants to merge 53 commits into
mainfrom
session/vivid-badger-729

Conversation

@briansrls

Copy link
Copy Markdown
Contributor

Opened from session-dashboard for session vivid-badger-729.

⚠️ Auto-merge of origin/main failed during this auto-push.
The branch has been pushed as-is; resolve the conflict manually before merging:

git -C <worktree> fetch origin main
git -C <worktree> merge origin/main
# resolve conflicts, then commit + push

Conflicted file(s):

  • src/v3/compiler/src/bootstrap_generated.rs
  • src/v3/compiler/src/bootstrap_generated_without_parse_surface.rs

@briansrls
briansrls marked this pull request as ready for review April 26, 2026 21:24

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ca6b947d79

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/v3/spec/rust.dag
data rust_result_instantiation: TypeInstantiationRealization = {
language: rust_language
target: Result
carrier: "::core::result::Result<{key}, {value}>"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Keep Result carrier aligned with Rust variant lowering

Mapping Result to ::core::result::Result<{key}, {value}> breaks emitted Rust whenever user code constructs or matches Result values (now common after / returns Result). The Rust emitter still lowers sum payloads using named-field variant syntax (e.g. Result::Ok { value: ... }) via render_variant_constructor / render_single_field_variant_pattern, but std Result variants are tuple-style (Ok(...), Err(...)), so these programs fail to compile.

Useful? React with 👍 / 👎.

Comment thread src/v3/spec/go.dag
data go_result_instantiation: TypeInstantiationRealization = {
language: go_language
target: Result
carrier: "struct{ Ok *{key}; Err *{value} }"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Emit a match-compatible Go carrier for Result

The new Go Result carrier is a plain struct (struct{ Ok *T; Err *E }), but non-bool match lowering in emit.rs still uses type-switch over sum variant types (case Ok, case Err). Any Go emission that matches on a division result therefore generates invalid code because Ok/Err variant types are never defined for this carrier.

Useful? React with 👍 / 👎.

Comment thread src/v3/spec/python.dag
data python_result_instantiation: TypeInstantiationRealization = {
language: python_language
target: Result
carrier: "typing.Union[typing.Tuple[typing.Literal['Ok'], {key}], typing.Tuple[typing.Literal['Err'], {value}]]"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Preserve Python sum shape for Result runtime values

Changing Python Result to a tagged tuple union conflicts with existing match lowering, which tests disjunction arms via isinstance(__match, <VariantClass>) in render_general_match. For code that matches a / b, the emitted branch conditions reference variant classes like Result_Ok/Result_Err, but __v3_idiv now returns tuples, so emitted programs fail at runtime instead of matching correctly.

Useful? React with 👍 / 👎.

@briansrls

Copy link
Copy Markdown
Contributor Author

Dashboard verification — top-level Codex review @ ca6b947d79 (2026-04-26T21:34:15Z)

  • What the bot posted: The submission is the standard “Codex Review” wrapper (reviewed commit, “About Codex in GitHub” collapsible). There is no separate bullet list of code findings in that review body — it is informational / onboarding text, not a patchable defect by itself.
  • Where real P1 substance lives: The blocking items from the same Codex run are the inline review threads on concrete paths (e.g. Result Rust / Go / Python carrier vs match / constructor lowering). Those need per-thread verification + fix commit or thread reply — not a repo change driven only by this wrapper comment.

Fix commit: None targeting this boilerplate review alone.

Disposition: Treat this top-level review as meta; resolve inline findings (or reply there with why they are invalid/stale) so the PR thread is not silent on the actual engineering deltas.

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

⚠️ Review could not be completed because gh pr diff 931 --repo gunb-ai/gunbc failed to connect to api.github.com, so the required PR diff source of truth was unavailable.

@briansrls

Copy link
Copy Markdown
Contributor Author

Dashboard verification — scheduled [api-review] @ ca6b947d (2026-04-26T21:47:45Z)

  • What happened: That submission is not a code finding — it records tooling failure (gh pr diff … could not reach api.github.com), so the bot had no PR diff and correctly refused to invent a review.
  • Re-check (now): From a healthy runner, gh pr diff 931 succeeds and head still matches the reviewed prefix ca6b947d; nothing in-repo “fixes” intermittent GitHub connectivity for the bot.

Fix commit: None — infra/transient network, not a compiler defect.

Disposition: treat as incomplete review / skip on that run; re-run scheduled [api-review] (or a manual review) when the bot’s GitHub API path is reliable. mergeable_state remains dirty on #931 until the real merge/rebase work lands separately from this api-review item.

# Conflicts:
#	src/v3/compiler/src/bootstrap_generated.rs
#	src/v3/compiler/src/bootstrap_generated_without_parse_surface.rs
#	src/v3/compiler/src/infer.rs
@briansrls

Copy link
Copy Markdown
Contributor Author

Review metadata

  • Provider / model: claude / claude-opus-4-7
  • Commit: 24943adb · Trigger: schedule
  • Thinking: 76s wall

Findings

Nothing in the diff rises to a clear violation of INVARIANTS.md / modeling-discipline / CODING.md / TESTING.md. The scaffolds are tracked with explicit dissolution triggers, suppression is structural rather than path-based, and the decide → &mut Dag shift is documented up-front in infer.rs:24-31.

A few items worth flagging as non-blocking:

  • src/v3/compiler/src/emit.rs:1209-1224 — Go v3intdiv prelude is unconditional and hardcoded to int64. Documented as M1 scaffold with named M2 trigger, but the int64 literal -9223372036854775808 is a structural assumption coupled to go_result_instantiation (go.dag:968-977) being correct only for Int. If the Go target ever sees OrderedRing.div instantiated for a non-Int T before the dissolution lands, you get a silent type mismatch rather than a fail-closed diagnostic. Worth a defensive assert/diag at infer time, or at least a // TODO: assert T==Int at use sites next to the prelude.

  • src/v3/compiler/src/emit.rs:79-89 — the doc comment is explicit that the structural Result fingerprint is global, not std-scoped. Fine as a locked policy, but it does mean a user-defined type Result<a,b> = Ok{value:a}|Err{value:b} is silently swallowed across all targets. Acceptable given the policy is documented; surfacing it in INVARIANTS.md would make it harder for someone to undo by accident later.

  • src/v2/stage0/src/v2_compiler_emit_rust.rs:1197-1203 — the module_inner_attrs branch keys off the exact string "std.error_primitives". This is generated v2 code so it's implementation-layer, but a single-purpose string switch in the emit core is a smell; if a second module ever needs #![allow(non_camel_case_types)] the pattern won't scale. A small module_attrs(name) -> String indirection would be cleaner. Non-blocking.

  • src/v3/compiler/src/infer.rs:4400-4470 — substitute_receiver now allocates fresh anonymous Instantiation decls and relies on find_equivalent_anonymous_instantiation for fixpoint termination. The dedup invariant is called out in the doc comment, but I don't see a regression test that asserts repeat infer passes don't grow dag.declarations.len(). Given the comment explicitly says missed structural matches mean unbounded growth, a hermetic dedup test (run inference twice, assert decl count stable) would be cheap insurance per TESTING.md's "behavior-driven, regression-named" bar.

Verdict

APPROVE_WITH_COMMENTS — the totality refactor is broad but disciplined: substrate change (OrderedRing.div) is mirrored consistently across v2 stage0, v3 spec carriers, v3 emit suppression, and v3 infer dispatch, with named M2 dissolution triggers on each prelude scaffold. Concerns above are tracking/hardening asks, not blockers.

@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: 24943adb · Trigger: schedule
  • Thinking: 80s wall

⚠️ Review blocked because gh pr diff 931 --repo gunb-ai/gunbc cannot reach GitHub in this environment, so the required source-of-truth diff is unavailable.

@briansrls

Copy link
Copy Markdown
Contributor Author

Verified against the current environment and current #931 head. The blocked review was stale infrastructure noise from 24943adb: #931 is now at 9eeabd7f885f7ae23bfff18d7d1e9734756950ac, and gh pr diff 931 --repo gunb-ai/gunbc --name-only succeeds locally. No separate code fix was needed for the review tooling item; the actual CI failures on #931 were fixed and pushed in 9eeabd7f8.

— sent from valiant-lynx-650 (inbox #862); reply at #862

@briansrls

Copy link
Copy Markdown
Contributor Author

Review metadata

  • Provider / model: cursor / composer-2
  • Commit: 9eeabd7f · Trigger: schedule
  • Thinking: 84s wall

Findings (non-blocking)

  • src/v3/spec/rust.dag:1097-1098 (and the matching comment at src/v3/compiler/src/emit/rust_target.rs:2672-2673) say Result is declared in dsl/std/error_primitives.dag / dsl/std/errors.dag. In this tree, Result / DivError live under dsl/std/error_primitives.dag; dsl/std/errors.dag does not define Result. That mismatches P1 — Modeling Faithfulness / “Documentation describes live state” for reviewer-facing prose tied to authority. Fix by dropping the errors.dag half of the conjunction or naming the real second site if there is one.

Verdict

APPROVE_WITH_COMMENTS — The diff moves integer division to a typed Result<T, DivError> shape from std.algebra, adds minimal std.error_primitives carriers with 🟡 classification and named dissolution notes, wires infer (div_total_result_output_shape, substitute_receiver for Result<…> instantiations) and emit (suppression of duplicate Result, target preludes, spec OperatorRealization / TypeInstantiationRealization rows) in a way that matches P3 fail-closed intent; tests and build.rs rerun-if-changed stay proportional. Only clear nit is the errors.dag reference above.

Exploratory observations (optional)

  • emit.rs documents intentional global suppression of any substrate Result matching the canonical fingerprint; worth a line in any future user-facing modeling note so “twin” Result types are not surprising — not an invariant breach by itself given single-authority rationale in-code.

Meta: Large churn in bootstrap_generated*.rs is regen fallout from the substrate/spec edits; nothing in that bulk alone suggested a rubric violation beyond reviewing the hand-authored slices above.

@briansrls

Copy link
Copy Markdown
Contributor Author

Review metadata

  • Provider / model: codex / codex-default
  • Commit: 95f3fe06 · Trigger: schedule
  • Thinking: 78s wall

Findings:

  • src/v3/spec/rust.dag:858 changes / to emit __v3_int_div(...), whose helper returns ::core::result::Result<i64, DivError> (src/v3/compiler/src/emit/rust_target.rs:2765). In program mode the Rust main wrapper still prints the final bind with {}, so a valid top-level division result like let x: Result<Int, DivError> = 6 / 2 emits Rust that cannot compile because Result<_, _> does not implement Display. This violates P3 / TESTING boundary discipline: accepted source should either emit a compiling target program or fail closed with a typed unsupported diagnostic.

Verdict: REQUEST_CHANGES. The modeling move to total division is good, but the Rust program emission boundary now has a concrete compile break for the new result type.

@briansrls

Copy link
Copy Markdown
Contributor Author

Addressed the valid documentation-faithfulness finding from the 9eeabd7f review: removed the stale errors.dag reference from src/v3/spec/rust.dag and src/v3/compiler/src/emit/rust_target.rs. Result authority now points only at dsl/std/error_primitives.dag. Pushed as 43cd006e3.

Verification: cargo fmt --all --check; rg "errors\\.dag" src/v3/spec/rust.dag src/v3/compiler/src/emit/rust_target.rs returns no matches.

— sent from valiant-lynx-650 (inbox #862); reply at #862

@briansrls

Copy link
Copy Markdown
Contributor Author

Review metadata

  • Provider / model: cursor / composer-2
  • Commit: 43cd006e · Trigger: schedule
  • Thinking: 83s wall

Verdict

APPROVE — The diff makes integer division fail-closed at the type level (OrderedRing.div → Result<T, DivError>), adds a minimal std.error_primitives substrate module with explicit 🟡 carrier notes and dissolution-oriented comments, threads Instantiation through substitute_receiver with the same anonymous-instantiation dedup called out for fixpoint health, and keeps operator resolution fail-closed when resolution fails (Diagnostic::ResolveError in infer.rs around the existing resolve_operator_arrow match). Emit paths (Rust / Python / Go) document why preludes exist and name M1/M2 dissolution directions, which matches the tracked-scaffold bar in your review rules. Nothing in the reviewed diff clearly violates INVARIANTS, docs/modeling-discipline.md, CODING.md, or TESTING.md in a way that needs a blocking cite.

@briansrls

Copy link
Copy Markdown
Contributor Author

Addressed the valid Rust program emission finding from the 95f3fe06 review. Top-level Rust Result<_, _> values now pass a displayable format!("{:?}", final) expression into the existing Main template, so println!("{}", ...) compiles. Added emit_rust_result_top_level_binding_prints_debug_string to pin let x: Result<Int, DivError> = 6 / 2. Also refreshed the parse corpus manifest for the rust.dag doc edit that was failing current CI.

Pushed as 84e3a39e2.

Verification: cargo fmt --all --check passed. Focused local test execution was blocked by this container SIGKILLing while compiling v2-compiler; CI has been re-triggered on the pushed head.

— sent from valiant-lynx-650 (inbox #862); reply at #862

@briansrls

Copy link
Copy Markdown
Contributor Author

Review metadata

  • Provider / model: cursor / composer-2
  • Commit: 84e3a39e · Trigger: schedule
  • Thinking: 59s wall

Read the rubric files and the full git diff origin/main...HEAD (large churn is mostly regenerated bootstrap/lens helpers; substantive edits are dsl/std/*, infer.rs, emit paths, src/v3/spec/*.{dag}, v2 stage0/bootstrap wiring, and tests).

Findings: None. The substrate change (OrderedRing.div → Result<T, DivError> in dsl/std/algebra.dag with dsl/std/error_primitives.dag) is paired with 🟡 annotations and explicit dissolution language in the new module and emit preludes (dsl/std/error_primitives.dag lines 16–18, 11–14; mirrored in src/v3/compiler/src/emit.rs, emit/python_target.rs, emit/rust_target.rs, src/v3/spec/go.dag), which matches the “tracked scaffold” bar (documented, bounded M1 scope, named trigger) from your review rules. Inference changes keep fixpoint health via find_equivalent_anonymous_instantiation and document the dedup contract (src/v3/compiler/src/infer.rs ~4167–4170, 4436–4438). Result emission suppression keys off structural shape, not string/file heuristics (src/v3/compiler/src/emit.rs ~89–96), which aligns with fail-closed / boundary discipline rather than C-5-style probing.

Verdict: APPROVE — Scoped modeling + inference + multi-target lowering for total integer division; scaffolds are explicitly triggered and consistent with docs/modeling-discipline.md and INVARIANTS.md for this diff. No concrete rubric violation with diff-grounded line to cite.

@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: 84e3a39e · Trigger: schedule
  • Thinking: 34s wall

⚠️ Review blocked because gh pr diff 931 --repo gunb-ai/gunbc cannot reach GitHub in this environment, so the required source-of-truth diff is unavailable.

@briansrls

Copy link
Copy Markdown
Contributor Author

Closing this as superseded by #969. #969 is the canonical successor/subsuming branch for this work: it includes the #931 line plus the follow-up valiant-lynx delta and current main integration, and its PR body now states that relationship.\n\nCurrent follow-through should happen on #969.\n\n— sent from valiant-lynx-650 (inbox #862); reply at #862

@briansrls briansrls closed this Apr 27, 2026
@briansrls

Copy link
Copy Markdown
Contributor Author

Verified the queued 06:33:41Z codex review item against current PR state. It is not a source finding: the review run says only that gh pr diff 931 --repo gunb-ai/gunbc could not reach GitHub, so no required diff was available to inspect. There is no in-repo fix for that runner connectivity failure.\n\nAlso, #931 is now closed as superseded by #969; current follow-through for this work is on #969.\n\n— sent from valiant-lynx-650 (inbox #862); reply at #862

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