Skip to content

proof: bridge mappingPackedWord source reads (parallel/experimental)#2127

Open
Th0rgal wants to merge 117 commits into
paloma/issue-2080-whole-contract-retarget-phase30from
paloma/parallel-claude-fragment-2081
Open

proof: bridge mappingPackedWord source reads (parallel/experimental)#2127
Th0rgal wants to merge 117 commits into
paloma/issue-2080-whole-contract-retarget-phase30from
paloma/parallel-claude-fragment-2081

Conversation

@Th0rgal

@Th0rgal Th0rgal commented Jul 9, 2026

Copy link
Copy Markdown
Member

Parallel / experimental fragment slice

Do not merge into the #2080 review stack gate. This is an independent, parallel proof-fragment expansion opened off the current stack tip (paloma/issue-2080-whole-contract-retarget-phase30, currently under review as #2126). It is intended to advance the proven fragment without blocking or reordering the #2122#2124#2126 drain.

Summary

Widens the native-safe source-expression read grammar (BridgedSourceExpr) to cover packed mapping-word reads (Expr.mappingPackedWord). These lower to and(shr(lit offset, mappingSlotRead), lit mask) — the exact bridged shape already proven for packed struct-member reads (structMember) and packed storage reads.

  • New constructor BridgedSourceExpr.mappingPackedWord.
  • New case in compileExpr_bridgedSource, discharged with the pre-existing compileMappingSlotRead_bridged and bridgedExpr_packed_read lemmas (no new supporting lemmas needed).
  • New case in compileRequireFailCond_bridgedSource via the default (non-comparison) path.
  • Doc sync in the module header and inductive docstring (mappingPackedWord moved from out-of-scope to in-scope).

What this is NOT

This does not flip the state-surface gate: mappingPackedWord remains marked unsupported in exprTouchesUnsupportedStateSurface. This PR only widens the read-bridge grammar — a building block toward later removing mappingPackedWord from that gate. No existing theorem is weakened; no check is disabled.

Validation (lean-slot / DGX Spark offload)

  • lake build Compiler.Proofs.YulGeneration.Backends.EvmYulLeanSourceExprClosure → green (exit 0).
  • lake build PrintAxioms → green (exit 0), full elaboration, sorryAx count 0.
  • #print axioms compileExpr_bridgedSource[propext, Quot.sound]
  • #print axioms compileRequireFailCond_bridgedSource[propext, Quot.sound]

No new sorry / admit / axiom / native_decide. Diff is +36 / -4, single file.


Note

Low Risk
Single-file Lean proof extension reusing established packed-read lemmas; no compiler behavior, auth, or gate changes.

Overview
Extends the BridgedSourceExpr read grammar so Expr.mappingPackedWord is in scope, with module docs updated to list it alongside other mappingSlot bridges instead of treating packed mapping reads as unsupported in this fragment.

compileExpr_bridgedSource gains a case that follows the packed structMember pattern: compile the key, run compileMappingSlotRead, then wrap the slot word with bridgedExpr_packed_read using existing compileMappingSlotRead_bridged lemmas (no new helper theorems). compileRequireFailCond_bridgedSource adds the matching constructor and routes it through the default iszero(cond) path.

This is proof-only widening of the bridged compile closure; it does not change exprTouchesUnsupportedStateSurface or relax runtime/state-surface gates.

Reviewed by Cursor Bugbot for commit abbf8d5. Bugbot is set up for automated code reviews on this repo. Configure here.

@vercel

vercel Bot commented Jul 9, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
verity Ready Ready Preview, Comment Jul 18, 2026 11:01pm

Request Review

@cursor

cursor Bot commented Jul 9, 2026

Copy link
Copy Markdown

Bugbot couldn't run - usage limit reached

Bugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit.

A user or team admin can review and increase usage limits in the Cursor dashboard.

(requestId: serverGenReqId_6b58932e-f287-4bea-8866-68ac2ae26ea2)

@github-actions

github-actions Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor
\n### CI Failure Hints\n\nFailed jobs: `checks`\n\nCopy-paste local triage:\n```bash\nmake check\nlake build\nFOUNDRY_PROFILE=difftest forge test -vv\n```

@Th0rgal

Th0rgal commented Jul 9, 2026

Copy link
Copy Markdown
Member Author

Review status: merge blocked only on still-running CI (runner queue)

Reviewed the diff (single commit 5c7d97d, EvmYulLeanSourceExprClosure.lean +36/−4): widens BridgedSourceExpr with mappingPackedWord plus matching cases in compileExpr_bridgedSource and compileRequireFailCond_bridgedSource. Stack relationship verified: base = paloma/issue-2080-whole-contract-retarget-phase30 (head of #2126), no unrelated stack changes. No new sorry/admit/axiom/native_decide. No unresolved review threads (Bugbot skipped: usage limit).

Local validation (warm cache, at PR head 5c7d97d):

  • lake build Compiler.Proofs.YulGeneration.Backends.EvmYulLeanSourceExprClosure
  • python3 scripts/lean_lint.py --only lean_hygiene ✅ (0 sorry / 0 native_decide)
  • python3 scripts/check_compiler_boundaries.py

CI: original checks failure was an infra SIGTERM (exit 143) mid-make check; re-run passed. In run 29003411005, 15/17 jobs are green (incl. checks, builds, compiler-audits/regressions, foundry-patched/multi-seed/gas-calibration) and probe (EVMYulLean fork conformance) is green. Remaining blocker: foundry (2) and foundry (3) are still queued awaiting runner capacity.

Will merge once those two shards complete green under the standing merge policy.

Th0rgal and others added 5 commits July 9, 2026 11:50
Add the missing legacy-compatibility analog of the proven disjoint
composition:
- compileStmtList_legacyCompatible_of_interface: lift the per-statement
  StmtListCompiledLegacyCompatible interface to a whole-list
  LegacyCompatibleExternalStmtList witness for the emitted Yul body.
- compileFunctionSpec_body_legacyCompatible_of_interface: per-function
  bridge composing genParamLoads_scalar_legacy with the body lemma.

These lift the remaining per-statement #2080 legacy obligations toward the
whole-contract LegacyCompatibleExternalBodies target.
Widen the native-safe source-expression read grammar to cover packed
mapping-word reads (`Expr.mappingPackedWord`). These lower to
`and(shr(lit offset, mappingSlotRead), lit mask)`, exactly the shape
already discharged for packed struct-member and packed storage reads.

- Add `BridgedSourceExpr.mappingPackedWord` constructor.
- Prove the corresponding case in `compileExpr_bridgedSource` using the
  existing `compileMappingSlotRead_bridged` and `bridgedExpr_packed_read`
  lemmas.
- Handle the constructor in `compileRequireFailCond_bridgedSource` via the
  default (non-comparison) path.
- Sync module/inductive docs (mappingPackedWord now in scope).

No gate flip: `mappingPackedWord` remains on the state-surface gate; this
is a building block toward removing it. Both theorems depend only on
[propext, Quot.sound]; no new sorry/admit/axiom.
@Th0rgal
Th0rgal force-pushed the paloma/parallel-claude-fragment-2081 branch from 5c7d97d to abbf8d5 Compare July 9, 2026 09:50
@cursor

cursor Bot commented Jul 9, 2026

Copy link
Copy Markdown

Bugbot couldn't run - usage limit reached

Bugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit.

A user or team admin can review and increase usage limits in the Cursor dashboard.

(requestId: serverGenReqId_03ef24dc-6530-484e-82b2-27cbbe097e59)

@Th0rgal

Th0rgal commented Jul 9, 2026

Copy link
Copy Markdown
Member Author

/ocr review

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

OpenCodeReview first-pass review

Status: skipped · 0 finding(s) · files unknown · 0 tool calls

No supported files changed.

Pilot mode: advisory only. Codex Review remains the merge gate.

Th0rgal added 2 commits July 9, 2026 11:06
Includes Verity-specific file types in OCR rules and avoids cancelling OCR runs on unrelated comments.
Tightens Verity-specific OCR rules and versions OCR dedupe by trusted rules hash so changed rules can re-review unchanged PR heads.
@Th0rgal

Th0rgal commented Jul 9, 2026

Copy link
Copy Markdown
Member Author

/ocr review

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

OpenCodeReview first-pass review

Status: success · 0 finding(s) · 1 files · 191243 tokens · 15 tool calls

No comments generated. Looks good to me.

Pilot mode: advisory only. Codex Review remains the merge gate.

Th0rgal and others added 2 commits July 9, 2026 15:57
Bounds OCR prompt context, extends job timeout, strips generated review tails, and keeps partial OCR outputs retryable without dropping completed findings.
@Th0rgal

Th0rgal commented Jul 9, 2026

Copy link
Copy Markdown
Member Author

/ocr review

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

OpenCodeReview first-pass review

Status: success · 0 finding(s) · 1 files · 239521 tokens · 16 tool calls

No comments generated. Looks good to me.

Pilot mode: advisory only. Codex Review remains the merge gate.

Th0rgal and others added 2 commits July 9, 2026 20:45
Add trusted OCR routing, metrics, and bounded large-Lean hotspot coverage.
@Th0rgal

Th0rgal commented Jul 9, 2026

Copy link
Copy Markdown
Member Author

/ocr review

@github-actions

github-actions Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

⚠️ OpenCodeReview failed to produce valid JSON.

No stderr captured.

Fix the OCR router base fetch on self-hosted runners and avoid posting invalid legacy OCR output when routing fails.
@Th0rgal

Th0rgal commented Jul 9, 2026

Copy link
Copy Markdown
Member Author

/ocr review

Th0rgal and others added 27 commits July 14, 2026 17:49
* ci: bootstrap OCR Lean toolchain client per run

* test: isolate Lean LSP GitHub path harness

* ci: preserve router-only OCR summaries

* test: cover Lean LSP elan bootstrap

* fix: isolate OCR elan bootstrap per run
Import IRInterpreter so the exact helper-dispatch lookup field
(irInternalFunctionDefOfStmt?) resolves in SupportedSpec, tolerate
termination goals already closed by simp in the surface decreasing_by,
and newline-separate the packaged-dispatch witness struct fields so the
anonymous-constructor literals parse in GenericInduction/Calls.
…dge-slice

proof: package direct helper statement context bridge
…storageword-bridge

# Conflicts:
#	PrintAxioms.lean
…dmap

docs: queue Lean 4.30 migration last
…eword-bridge

proof: bridge setStorageWord statement preservation
…ofile

Add external param binding witnesses
…y-offset-bridge

Bridge dynamic ABI array member offsets to core model
Single conflict: the auto-generated theorem tally comment in
PrintAxioms.lean (both sides bumped it). Kept main's line; the derived
artifact refresh will regenerate the exact merged count.
The pilot's output buried the review under pipeline internals:

- sanitizeCommentText backslash-escaped every markdown character, so
  findings rendered as 'ErrorRevert\.lean' / 'source\-level', flattened
  the model's paragraphs, and hard-sliced at 700 chars mid-word. Keep
  the injection protections (mention zero-width, <> entities, control
  chars) but stop escaping markdown, preserve paragraph breaks, and
  truncate at a word boundary with an explicit '… (truncated)' marker.
- Added-line samples now render as inline code spans (new
  renderCodeSample) so Lean/Yul operators are not parsed as markdown.
- renderPacketFinding leads with the finding, then the reviewer
  question, then the router's selection rationale — instead of burying
  the substance behind 'Large Lean packet selected…' boilerplate.
- The summary comment now opens with a one-line human verdict with a
  severity rollup (e.g. '🟡 Scout triage only — 8 finding(s) (2 high /
  4 medium / 2 low)…') instead of 'Status: scout_triage · Mode:
  large-lean-hotspots · 0 tokens · 0 tool calls'. Retryable runs say so
  in plain text; errored runs are explicit that the PR is unreviewed.
- Ops telemetry (pilot metrics + packet coverage) folds into <details>;
  the duplicated scout-coverage warning is deduped; router mode names
  are dropped from inline badges (severity and semantic categories stay).

node test-ocr-routing.js passes (300 asserts).
- renderCodeSample: substitute backticks with a prime mark and always
  render inside one code span, instead of an unescaped prose fallback
- severityRollup: hasOwnProperty guard so inherited property names
  ('constructor', '__proto__') from model severities can't corrupt counts
- verdictLine: 'no-supported' runs now say OCR did not run instead of
  claiming a clean first pass
Support constructorArg in core proof surface
scoutTimeoutMs was 45s; GLM-5.2 and MiniMax-M3 are thinking models that
reason at length on the 18k-char dossier before emitting the JSON
verdict, so every scout call aborted ('This operation was aborted') and
all large-Lean reviews silently ran fallback_deterministic — the LLM
scout has effectively never fired in production. Raise to 240s; the
scout runs once per review inside a 45-minute job budget.

node test-ocr-routing.js passes.
fix(ocr): give the scout model time to think
Single-scout review converged serially — a real PR needed 3 review cycles
because each pass surfaced one new defect class (checksum-manifest scoping
→ verification-replay independence → shallow-clone verification contract).

Multi-lens: fan out one scout call per lens (provenance,
verification-independence, environment-determinism, proof-soundness) in
parallel and union/de-dup findings, so one repair cycle addresses all
classes. Per-lens failures are caught so one broken lens cannot lose the
others; all-lenses-fail keeps the existing fallback_deterministic surface.
Wall-clock stays one scoutTimeoutMs (concurrent). ROUTER_VERSION v9->v10
so the richer review is not suppressed by a prior single-lens dedup tag.

Accumulating rubric (.github/ocr/rubric.json) seeded with the three known
defect classes, injected into every scout dossier; appendRubricItem() is
the documented growth hook. Lenses subsettable via OCR_SCOUT_LENSES.

node test-ocr-routing.js passes (8 new tests). Input sanitization intact.
feat(ocr): multi-lens scout review + accumulating rubric
@cursor

cursor Bot commented Jul 18, 2026

Copy link
Copy Markdown

Bugbot couldn't run - usage limit reached

Bugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit.

A user or team admin can review and increase usage limits in the Cursor dashboard.

(requestId: serverGenReqId_ef3880bd-0e35-494c-a834-d68ee0597a02)

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

OpenCodeReview first-pass review

🟡 Scout triage only — not a full review. no findings; a human or Codex must still cover the unflagged hunks and proof obligations.

Lean packet budget exceeded: 60 Lean file(s), 11131 changed supported line(s).

Warnings

  • routing : Diff exceeded bounded packet review capability; full OCR not attempted.
OCR pilot metrics & packet coverage

OCR pilot metrics

  • Routing: large-lean-hotspots (router-v10)
  • Changed files: 95 supported / 99 total; Lean 60, trust docs 2, workflow/scripts 30, contracts 0, docs 3
  • Changed lines: 11131 supported; thresholds large Lean >=3 files or >800 lines
  • OCR: status large-lean-hotspots; comments 0; files 0; tokens 0; tool calls 0; warnings 1; duration 1s
  • Largest changed files: .github/scripts/test-ocr-routing.js (+2113/-0), .github/scripts/ocr-router.js (+1576/-0), Compiler/Proofs/IRGeneration/Function.lean (+1039/-45), Compiler/Proofs/IRGeneration/GenericInduction/StorageWord.lean (+607/-0), Compiler/Proofs/IRGeneration/HelperSummaryEvidence.lean (+513/-0)

Packet coverage

  • Packet review: not used; selected 0/8 packet(s)
  • Scout: configured; status skipped_no_packets; model builtin/assistant
  • Scout lenses: provenance, verification-independence, environment-determinism, proof-soundness; rubric items checked 3
  • Strong review: required; status blocked_packet_input
  • Residual risk: Diff exceeded packet budget; use top changed files and deterministic signals as required Codex/human review checklist.
  • Strong packet-review blocker: OpenCodeReview 1.7.9 supports --from/--to full diff ranges, but this workflow does not have a safe packet/window input bridge for Lean hunks yet.

Pilot mode: advisory only. Codex Review remains the merge gate.

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