Skip to content

correction: Derive contexts from shares - #189

Draft
BenWestgate wants to merge 1 commit into
codex/split146-prefixfrom
codex/split146-context
Draft

BenWestgate wants to merge 1 commit into
codex/split146-prefixfrom
codex/split146-context

Conversation

@BenWestgate

Copy link
Copy Markdown
Owner

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.

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.

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 24, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-24T04:42:06.217072Z 809d12d Manual request
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 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".

Comment thread src/codex32/correction.py
Comment on lines +116 to +118
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))

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge 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 👍 / 👎.

This branch has not been deployed

No deployments
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