Repository navigation
correction: Derive contexts from shares - #189
BenWestgate wants to merge 1 commit into
Conversation
Move recovery context derivation into the public library so CLI and future clients share validated length, immutable header, and excluded indices. Reject incompatible accepted shares and conflicting caller hints. Preserve uppercase retry prefixes when the entered share uses uppercase text. Cover accepted-share constraints and error paths with public API tests.
|
@codex review |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 809d12df22
ℹ️ 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".
| if immutable_prefix is not None and immutable_prefix.isupper(): | ||
| header_prefix = header_prefix.upper() | ||
| context = cls(first.hrp, len(first.s), header_prefix, tuple(share.share_idx for share in shares)) |
There was a problem hiding this comment.
Preserve accepted-share case when deriving the default prefix
When accepted shares and the next damaged card are uppercase, calling CorrectionContext.from_shares(accepted) without an explicit prefix creates a lowercase immutable header. Correction checks that header case-sensitively, and uniformly uppercase input bypasses mixed-case normalization, so even a single checksum erasure returns no candidates. This is reproducible with the uppercase BIP93 VECTOR_2 shares A and C; supplying immutable_prefix="MS1" restores the expected correction. Derive the default header case from the accepted shares, or reconcile it with the damaged input, so clients using the factory's default arguments can correct uppercase cards.
Useful? React with 👍 / 👎.
Derive correction length, immutable header and excluded indices from accepted shares in the library. Reject incompatible shares and conflicting hints.
Extracted from #146; based on #188. 18 public API tests pass.