← Back to Pull requests

[AUTOMATED] Add per-run ledger for globals retyped as a whole (#1246) #1616

Open
unknown opened this pull request with 650 lines diff across 8 files
View on GitHub
unknown unknown commented on Nov 29, 2026 04:58 UTC
Author

User description


[AUTOMATED] Refs #1246. Adds the per-run ledger for globals retyped as a whole.

What changed


  • crates/unlace-bandb-core/src/p5_types/globalretype.rs: RetypedGlobals<T>, keyed by (address-space index, first offset). A later record for the same start keeps the larger object. covering() answers for every byte of a recorded object. Ledger = RetypedGlobals<Rc<Datatype>> is an ArchTables entry, so it is per-run and not persisted.

  • crates/unlace-bandb-core/src/p5_types/mod.rs: registers the module.
  • Not in this PR


  • No pass records into the ledger and no reader consults it, so there is no behavior change and no option or spec change.

  • Still open for #1246: access collection that feeds the ledger, and the global symbol-type readers that would consult it behind a default-off option. The datatests (675/675) need a measurement run after those land.
  • Verification


  • Written blind. Unit tests in the module (covers_every_byte_of_a_recorded_object, other_spaces_are_not_covered, smaller_record_does_not_narrow_the_object, larger_record_replaces_the_object, empty_ledger_covers_nothing) were run through the run lane on this branch (request queued; result recorded below).
  • Model: claude-haiku-5-5

    <!-- This is an auto-generated description by cubic. -->
    ---

    Summary by cubic


    Adds the per-run ledger for globals retyped as a whole (refs #1246).

    RetypedGlobals<T> records global objects keyed by (address-space index, first offset); a later record for the same start keeps the larger object, and covering() answers for every byte of a recorded object. Ledger = RetypedGlobals<Rc<Datatype>> is an ArchTables entry, so it lives per run and is not persisted.

    No behavior change yet: nothing records into the ledger and no reader consults it. Access collection and the global symbol-type readers remain open in #1246.

    <sup>Written for commit 9bf3950899019d901089c5738f580b32dc500015. Summary will update on new commits.</sup>

    <a href="https://cubic.dev/pr/coleleavitt/unlace/pull/1616?utm_source=github" target="_blank" rel="noopener noreferrer" data-no-image-dialog="true"><picture><source media="(prefers-color-scheme: dark)" srcset="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://www.cubic.dev/buttons/review-in-cubic-light.svg"><img alt="View guided diff" src="https://www.cubic.dev/buttons/review-in-cubic-light.svg"></picture></a> <a href="https://www.cubic.dev/action/auto-fix/pr/coleleavitt/unlace/1616?returnTo=https%3A%2F%2Fgithub.com%2Fcoleleavitt%2Funlace%2Fpull%2F1616&source=description" target="_blank" rel="noopener noreferrer" data-no-image-dialog="true"><picture><source media="(prefers-color-scheme: dark)" srcset="https://www.cubic.dev/buttons/turn-on-auto-fix-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://www.cubic.dev/buttons/turn-on-auto-fix-light.svg"><img alt="Turn on auto-fix" src="https://www.cubic.dev/buttons/turn-on-auto-fix-light.svg"></picture></a>

    <!-- End of auto-generated description by cubic. -->

    ___

    CodeAnt-AI Description


    Track whole-object global retyping decisions for the duration of one run

    What Changed


  • Records each retyped global object by address space and starting offset, and can find its type from any byte within the object

  • Keeps the wider object when a later record at the same start covers fewer bytes

  • Records exist only for the current run; this change does not yet affect decompilation output
  • Impact


    ✅ Preserves wider global-object records
    ✅ Finds recorded types from any byte within an object
    ✅ Starts each run without records from earlier runs
    <details><summary><strong>💡 Usage Guide</strong></summary>

    Checking Your Pull Request


    Every time you make a pull request, our system automatically looks through it. We check for security issues, mistakes in how you're setting up your infrastructure, and common code problems. We do this to make sure your changes are solid and won't cause any trouble later.

    Talking to CodeAnt AI


    Got a question or need a hand with something in your pull request? You can easily get in touch with CodeAnt AI right here. Just type the following in a comment on your pull request, and replace "Your question here" with whatever you want to ask:
    <pre>
    <code>@codeant-ai ask: Your question here</code>
    </pre>
    This lets you have a chat with CodeAnt AI about your pull request, making it easier to understand and improve your code.

    Example


    <pre>
    <code>@codeant-ai ask: Can you suggest a safer alternative to storing this secret?</code>
    </pre>

    Preserve Org Learnings with CodeAnt


    You can record team preferences so CodeAnt AI applies them in future reviews. Reply directly to the specific CodeAnt AI suggestion (in the same thread) and replace "Your feedback here" with your input:
    <pre>
    <code>@codeant-ai: Your feedback here</code>
    </pre>
    This helps CodeAnt AI learn and adapt to your team's coding style and standards.

    Example


    <pre>
    <code>@codeant-ai: Do not flag unused imports.</code>
    </pre>

    Retrigger review


    Ask CodeAnt AI to review the PR again, by typing:
    <pre>
    <code>@codeant-ai: review</code>
    </pre>

    Check Your Repository Health


    To analyze the health of your code repository, visit our dashboard at https://app.codeant.ai. This tool helps you identify potential issues and areas for improvement in your codebase, ensuring your repository maintains high standards of code health.

    </details>

    <!-- This is an auto-generated comment: release notes by coderabbit.ai -->

    <!-- coderabbit-ai-generated:v1 -->

    Summary by CodeRabbit

    New Features
    Added tracking for global objects that have been retyped, with lookups by address and address space.
    Lookups return the matching type and the queried address’s offset within the object.
    Re-recording an object with an equal or larger size updates its entry; a smaller size does not replace the existing record.
    * Added checks for object boundaries, address-space separation, and empty tracking results.

    <!-- end of auto-generated comment: release notes by coderabbit.ai -->

    Diff: 650 lines (+487 / -163) across 8 files Reviewer: coderabbitai[bot] Review duration: 7m
    All Vouch review confidence checks passed
    Residual risk 0.39 = Change Risk (0.52) × (1 − Review Confidence (0.25)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.52 · 650 lines diff across 8 files
    0.52
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.02 · 1 substantive comment(s)
    0.02
    Model 3 · Review Timing & Attention
    Session adequacy: 46% · Reviewer familiarity: 35%
    25%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.388
    Shallow Review Depth shallow_review_depth
    0.344
    Real PR Conversation Timeline
    1 comments
    "Review active on #1616"
    general weight: 0.35
    Assignees
    Unassigned
    Labels
    risk: medium confidence: 25.1% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 52% (MEDIUM) · Higher = larger blast radius
    52%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 25.1% · Lower = rushed or shallow review
    25.1%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 39.0% · Moderate risk
    39.0%