Skip to content

fix: enforce release state invariants and macro hygiene - #342

Merged
acgetchell merged 1 commit into
mainfrom
fix/333-release-state-invariants
Nov 9, 2026
Merged

acgetchell merged 1 commit into
mainfrom
fix/333-release-state-invariants

Conversation

@acgetchell

@acgetchell acgetchell commented Nov 9, 2026 •

Copy link
Copy Markdown
Owner

Matrix dispatch macros could fail to compile when a downstream caller defined its own Err. Release candidate handoffs also represented draft and publication selections through optional asset roles, leaving stage-specific requirements to later checks.

  • Qualify exported macro error arms and cover caller-name shadowing.
  • Represent scaled products with explicit empty, nonzero, zero, and non-finite states while preserving arithmetic order.
  • Parse release transfers and handoffs into distinct draft/publication variants. Validate asset identities and owner digests before effects, retain immutable approval bytes, and use fixed local transport paths.
  • Consolidate Rust imports and simplify repeated paths across source, tests, and benchmarks.

The public library signatures and schema-1 transfer format are preserved.

Validation

  • just check and just clippy-all-targets passed.
  • Final just ci passed outside the sandbox on macOS: 1,143 Rust tests and 447 Python tests, default/exact doctests, documentation, examples, benchmark compilation, and the exact benchmark smoke tests.
  • Whole-repository Rust API, parse-don't-validate, style, and trait-bound reviews plus Python parse-don't-validate and portability review informed these changes.

No timing campaign was run or performance improvement claimed; numerical arithmetic order and benchmark workloads are unchanged. Hosted checks and review still gate merge.

Refs #333. Published research-repo-tools v0.2.7 adoption and final release validation remain separate work under the release tracker.

Summary by CodeRabbit

  • New Features
    • Release handoffs now distinguish draft transfers from publication transfers, including attached archive details.
    • Draft and publication assets are checked against release records during staging, sealing, dispatch, and receipt.
  • Bug Fixes
    • Invalid transfer data, including malformed digests, duplicate asset identifiers, and non-finite JSON values, is rejected before verification, downloads, or output creation.
    • Draft receipt no longer triggers publication downloads.

- Represent scaled determinant products with explicit empty, nonzero,
  zero, and non-finite states while preserving arithmetic order.
- Parse release handoffs into draft and publication variants with
  validated asset identities and fixed local transport paths.
- Reject mismatched handoffs and malformed owner digests before effects.
- Keep matrix dispatch error arms independent of caller-defined names.
- Consolidate Rust imports and shorten repeated implementation paths.

Refs #333
@acgetchell
acgetchell enabled auto-merge (squash) November 9, 2026 14:47
@coderabbitai

coderabbitai Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The release tooling now distinguishes draft and publication transfers and validates their handoff paths. The Rust changes restructure ScaledProduct magnitude tracking and update dispatch error construction, imports, and call sites.

Changes: Release transfer and handoff validation

Layer / File(s) Summary
Typed transfer parsing and serialization
tooling/release_candidate.py, tests/tooling/test_candidate_transfer.py
Typed asset assertions and draft/publication transfer records validate asset metadata and retain the schema-1 wire format. Tests cover invalid values, duplicate JSON keys, and transfer round trips.
Staging, sealing, and dispatch
tooling/release_candidate.py, tests/tooling/test_candidate_transfer.py, tests/tooling/test_release_context.py
Staging validates owner digests and prepared assets. Sealing creates a publication transfer. Record and dispatch handling check transfer type and release identity.
Draft and publication receipt
tooling/release_candidate.py, tests/tooling/test_candidate_transfer.py
Receipt handling selects a handoff type based on its source. Draft receipt verifies and copies transport files; publication receipt downloads asserted assets and rechecks release identity.

Rust numerical and call-site updates

Layer / File(s) Summary
Scaled-product magnitude state
src/scaled_product.rs
ScaledProduct now stores magnitude as explicit empty, nonzero, zero, or non-finite states. Multiplication and finalization use the prefix and pending factor in those states.
Dispatch error construction and shadowing test
src/lib.rs, tests/prelude_exports.rs
Dispatch fallbacks construct Result::Err explicitly. Tests cover a caller-local Err name and retain unsupported-dimension and callback assertions.
Imports and qualified call sites
benches/*, src/polynomial.rs, src/vector.rs, tests/*
Benchmarks, library code, and tests use imported helpers and reorganized imports. The described benchmark values and test behavior remain unchanged.

Estimated code review effort: 4 (Complex) | ~45 minutes

Change: Bug fix

Sequence Diagram(s)

sequenceDiagram
  participant Source
  participant receive
  participant parse_handoff
  participant ReleaseProvider
  Source->>receive: Transfer payload and source
  receive->>parse_handoff: Parse transfer for source
  parse_handoff-->>receive: DraftHandoff or PublicationHandoff
  alt DraftHandoff
    receive->>receive: Verify digests and copy transport files
  else PublicationHandoff
    receive->>ReleaseProvider: Download asserted assets
    ReleaseProvider-->>receive: Published assets
    receive->>receive: Recheck release identity and acceptance
  end
Loading

Possibly related issues

  • Issue 333 tracks release handoff and publication gates. This change addresses transfer and handoff validation, but does not cover all release gates noted in the issue.

Possibly related PRs

Suggested labels: rust, python, release, refactor

Merge Risk: Minimal · up to 60b9d

This change qualifies macro error arms, makes release-transfer state explicit, and validates handoffs earlier. No actionable merge-blocking risk was identified in the supplied evidence, and the author reports passing CI.

Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title "fix: enforce release state invariants and macro hygiene" matches the main themes of the PR objectives, which cover release transfer and handoff invariants, the explicit ScaledProduct magnit…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title "fix: enforce release state invariants and macro hygiene" matches the main themes of the PR objectives, which cover release transfer and handoff invariants, the explicit ScaledProduct magnitude states, and qualifying macro error arms so they work when callers define their own Err. The changeset includes the tooling/release_candidate.py rework and the src/lib.rs and tests/prelude_exports.rs macro changes. The title does not name the scaled-product refactor or the import consolidation, but it is not off-topic and does not need to cover every detail. It is specific enough that a reviewer scanning history can identify the primary change.

Finishing Touches

Generate docstrings

  • Commit to this branch
  • Create a new PR
Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 2c07c8e and 60b9d81.

Files selected for processing: 20

  • benches/common/angle.rs
  • benches/common/interval_solve.rs
  • benches/exact.rs
  • benches/interval.rs
  • benches/interval_solve.rs
  • benches/public_api.rs
  • benches/rational_solve.rs
  • benches/vs_linalg.rs
  • src/lib.rs
  • src/polynomial.rs
  • src/scaled_product.rs
  • src/vector.rs
  • tests/column_basis.rs
  • tests/interval_solve.rs
  • tests/prelude_exports.rs
  • tests/proptest_vector_angles.rs
  • tests/rational_allocations.rs
  • tests/tooling/test_candidate_transfer.py
  • tests/tooling/test_release_context.py
  • tooling/release_candidate.py

Included review availability: This review used your included allowance. 0 included reviews remain after this review. Your included PR review attempts over the past 7 days set your current allowance at 1 review per hour.

@codecov

codecov Bot commented Nov 9, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.35%. Comparing base (2c07c8e) to head (60b9d81).
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #342      +/-   ##
==========================================
+ Coverage   98.27%   98.35%   +0.07%     
==========================================
  Files          16       16              
  Lines        7609     7601       -8     
==========================================
- Hits         7478     7476       -2     
+ Misses        131      125       -6     
Flag Coverage Δ
unittests 98.35% <100.00%> (+0.07%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

@acgetchell
acgetchell merged commit 88d2d25 into main Nov 9, 2026
20 checks passed
@acgetchell
acgetchell deleted the fix/333-release-state-invariants branch November 9, 2026 15:31
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