← Back to Pull requests

Switch dumps to use `CBOR` instead of `postcard` #913

Closed
unknown closed this pull request without merging on Sep 23, 2026 17:23 UTC
View on GitHub
unknown unknown commented on Sep 23, 2026 12:26 UTC
Author

Switch dumps to use cbor via minicbor so we can use serde default features and reorder fields without needing to bump the dump version and invalidate old dumps.

See this claude artifact for discussion.

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

Summary by cubic


Switches session dumps from postcard to CBOR via minicbor-serde, so derived structs serialize as maps keyed by field name and enums by variant name. Adding, removing, or reordering fields or variants no longer breaks loading of existing dumps, and byte arrays are written as CBOR byte strings (via serde_bytes) instead of one integer per byte. DUMP_VERSION now only bumps when the meaning of stored data changes (e.g. opcodes). postcard is dropped, and #[serde(default)] fallbacks that only served pre-13 dumps are removed since those dumps are rejected on load. Keys without a heap identity hash by stable name instead of enum discriminant (module functions by module-qualified name), since dict and set entries persist their hash in dumps; the fingerprint tests read serde variant names back from the encoding, and a fixture test pins dump compatibility.

Breaking Changes


  • DUMP_VERSION goes from 12 to 13, so dumps written before this PR are rejected; MIN_SUPPORTED_DUMP_VERSION now equals 13.

  • DumpError::Payload and dump()'s error wrap the codec's errors in new DumpDecodeError / DumpEncodeError types so the public API does not name the codec.
  • Migration


  • A checked-in fixture (dump_v13.bin) and crates/monty/tests/dump_compat.rs pin compatibility: a layout change at version 13 needs a #[serde(alias)] or #[serde(default)], or a bump plus UPDATE_DUMP_FIXTURE=1 to regenerate the fixture.
  • <sup>Written for commit 693112afbb117a25a7b86d57fb756f3ed224c94d. Summary will update on new commits.</sup>

    <a href="https://cubic.dev/pr/pydantic/monty/pull/913?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="Review in cubic" src="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"></picture></a>

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

    Diff: 302 lines (+226 / -76) across 3 files Reviewer: rewitt94 Review duration: 296m
    All Vouch review confidence checks passed
    Residual risk 0.18 = Change Risk (0.45) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.45 · 302 lines diff across 3 files
    0.45
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    60%
    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.342
    Shallow Review Depth shallow_review_depth
    0.289
    Ai Authored ai_authored
    0.050
    Real PR Conversation Timeline
    1 comments
    "Review active on #913"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% 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: 45.1% (MEDIUM) · Higher = larger blast radius
    45.1%
    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: 60.5% · Lower = rushed or shallow review
    60.5%
    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: 17.8% · Safe to merge
    17.8%
    Repository