Skip to content

bip93: Move the CLI's friendly share-set wording into the library - #161

Open
BenWestgate wants to merge 2 commits into
claude/project-thread-jhiarh-dup-messagesfrom
claude/project-thread-jhiarh-friendly-errors
Open

BenWestgate wants to merge 2 commits into
claude/project-thread-jhiarh-dup-messagesfrom
claude/project-thread-jhiarh-friendly-errors

Conversation

@BenWestgate

Copy link
Copy Markdown
Owner

Before: the CLI used its own _FRIENDLY_SET_ERRORS table to swap terse library messages ("share identifiers do not match", "invalid Long codex32 checksum") for friendly ones. The GUI branch has a third copy in pages.py _incompatible. When a user tried share with an unshared secret, the table showed the wrong message: "These strings require different numbers of shares."

After: the library exceptions use the friendly wording, so the CLI, a GUI and API callers all show the same text. The CLI table is gone. With an unshared secret, share now says "An unshared secret (threshold 0) was never split into shares." Mixing applications shows the library's "ms and bip39_12w cannot be combined" (Ben OK'd that).

How: I changed the messages in bip93.py and bech32.py, deleted the table and its imports in _cli_input.py, updated two pinned tests and added a test for the threshold-0 case. Installed logical lines go from 4,844 to 4,830. Exception types are unchanged.

Stacked on #157 (itself stacked on #155). Refs #156. It touches checksum and recovery error messages only, not their logic, but per project policy it still needs a security review before it is marked ready.

Checks run locally: python -m pytest and python -O -m pytest (909 passed), ruff, mypy, verify_correction_constants, differential_correction --verify.


Generated by Claude Code

The CLI kept its own table of friendlier messages for library
exceptions, and the GUI branch keeps a third copy. Put the wording in
the library exceptions so every frontend shows the same text, and
delete the CLI table.

This also fixes the threshold-0 case: the CLI mapped it to "These
strings require different numbers of shares." Mixed applications now
show the library's "ms and bip39_12w cannot be combined".

Refs #156.

Claude-Session: https://claude.ai/code/session_01Q1TNm1YeYW8K9W2eBvxmCD

@BenWestgate BenWestgate left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

AI-assisted current-head code/security review.

Code ACK f10a5c7 (static). The changes move user-facing error strings from the CLI mapping to the existing library exceptions without changing acceptance, checksum, or interpolation logic. Threshold-zero errors now describe the actual condition. Retest CLI and GUI together after merging stacked #155/#157; current head remains draft.

@BenWestgate
BenWestgate marked this pull request as ready for review October 22, 2026 11:02
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 22, 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-23T21:31:14.206435Z 10c8f9b 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.

@BenWestgate BenWestgate self-assigned this Oct 22, 2026
Comment thread src/codex32/bip93.py

Copy link
Copy Markdown
Owner Author

AI-assisted triage: the earlier feedback is on #158 (review threads from Oct 22, 11:22–11:33 UTC): whether to retain checksum.kind, use “shares” versus “strings” contextually, and avoid duplicate message logic. #161 is stacked on #158, so its clean code review does not resolve that discussion. Address or explain those points on #158 before calling this stack ready.

Say "shares" when every input is an ordinary share and "strings" when a
secret is among them, and word the threshold mismatch as "different
thresholds" so it reads well either way. recover_secret now reuses
_validate_recovery_prefix instead of repeating its secret check.

Addresses Ben's review of the duplicate #158.

Claude-Session: https://claude.ai/code/session_01Q1TNm1YeYW8K9W2eBvxmCD

Copy link
Copy Markdown
Owner Author

Correction to the triage above: #161 is stacked on #157, not on #158. Both #158 (Codex, codex/156-friendly-error-library) and #161 do the same move of _FRIENDLY_SET_ERRORS into the library for #156, so they are duplicates. 10c8f9b brings your #158 review into #161: the noun follows the set's contents, the recovery secret check is shared, and checksum.kind is dropped from the message (answered on each #158 thread). I suggest closing #158 as a duplicate of #161.


Generated by Claude Code

@BenWestgate
BenWestgate marked this pull request as draft October 22, 2026 15:45

@BenWestgate BenWestgate left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Focused code/security review — commit 10c8f9bbc9ab2acc59e78cc3b2aa440e255745ea.

No security findings in the PR diff or the additional 10c8f9b recovery refactor. recover_secret now calls _validate_recovery_prefix(..., require_exact=True); it still applies the same bounded validated-artifact checks, exact threshold count, compatibility and distinct-index checks, and SecretInRecoverySet rejection before interpolation. Error precedence is unchanged. The checksum checks and exception classes remain intact. New exceptions and CLI messages disclose no seed/share payload; the HRP mismatch reports only application prefixes.

Checked the repository security invariants, parser/CLI call sites, all six changed files, #158 feedback and its dispositions. The exact-head Python package CI workflow (run 39807698073) succeeded across its reported jobs. Local test execution against the PR checkout was unavailable because the local fetch failed DNS resolution for github.com; this is a static review backed by exact-head CI, not a claim that I reran the suite.

Security ACK for 10c8f9b. The stacked #155/#157 integration and combined CLI/GUI retest remain separate release gates.

@BenWestgate

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Hooray!

Reviewed commit: 10c8f9bbc9

ℹ️ 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".

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