Skip to content

Ask for the wallet record before the cards; show record values large - #221

Draft
BenWestgate wants to merge 8 commits into
claude/project-thread-p319g5from
claude/project-thread-ussx0k
Draft

BenWestgate wants to merge 8 commits into
claude/project-thread-p319g5from
claude/project-thread-ussx0k

Conversation

@BenWestgate

@BenWestgate BenWestgate commented Nov 10, 2026 •

Copy link
Copy Markdown
Owner

Requested by Ben · project thread

Ben asked for two things: ask for the master fingerprint before any card so it can inform error correction (he chose "order + correction hint"), and show the record values larger and darker.

1. Record values large and dark (1c7c5e3, kept through the merge of #223 in 5623394)

  • Values in _rows (identity, no-record and Finished pages) use the .card-group style: bold monospace in a tinted field. gui: Grow the window so no page needs scrolling #223 moved them into suffix labels, so the selector is .compact .suffixes > label, which adds 0 lines.
  • The GUI shows the fingerprint in uppercase, as the CLI prints it.

2. Wallet record before the cards (7860bd8, ddca9ab). This touches correction and needs Ben's security review.

  • Library: correction._record_match(recorded, accepted) asks whether a candidate is the recorded wallet once it completes a master seed: an ms secret, or the share that reaches the threshold together with the accepted shares. Within _best(..., recorded=), a match outranks the Hamming, CRC and identifier hints. A wrong seed matches 32 bits 1 time in 2³². With no match, the ranking is unchanged. Limit: both searches return only their lowest-capture-volume repairs, so the record settles ties among those and can't reach a costlier repair (Codex review). The suggestion is shown exactly as before, with no "matches your record" hint, so the operator still compares it with the whole card.
  • CLI ms32 wallet: asks "Type the master fingerprint from your wallet record (Enter if none)" before the cards. The record goes through read_artifacts → _suggestions → _best. After recovery, verify_identity still runs. On a mismatch the prompt asks again (or Enter for none) and adds "Check what you typed against the record." With no record, the cards come first and the same no-record warning follows.
  • GUI: Restore opens the record page (fingerprint + date) with Back, I have no wallet record and Continue. Then come the cards, where reading.repair gets the record. Then _check_record runs wallet_setup.verify, unchanged. "Stop" is gone. After a mismatch, Start again appears with "Check what you typed against the record. If it matches, these cards are from another wallet, or a card was misread: start again and re-enter the cards." The note before the check says "codex32 checks this before it restores your wallet in Bitcoin Core." Screenshots: wallet-record-display/restore-record-first.png and restore-mismatch.png in the project files.
  • Library mismatch message: "These cards do not make the master fingerprint from the wallet record. No wallet was created or restored."
  • Cost: each candidate checked costs one Core fingerprint (two bitcoin-cli calls), only when a record was typed.
  • Budgets: GUI 2,063 → 2,100 (Ben OK'd). Library 5,025 → 5,068 still needs Ben's OK.

Checked

  • python -m pytest: 1058 passed, 2 skipped. That includes the bip32-oracle modules, using bip32 from PyPI locally. ruff and mypy are clean.
  • New tests: a record match outranks the other rankings in _best, and a non-match changes nothing; a share is judged only when it completes the seed; ms32 wallet asks for the record before the cards; CLI suggestions use the record; GUI repair checks the last card against the record. Identity-path call-graph test updated.
  • Rendered the record-first and mismatch pages under Xvfb.

Stacked on #217. Draft until Ben's security review.

🤖 Generated with Claude Code

https://claude.ai/code/session_01N8jLK8HGLaWJq2AJGmxPVe

Bitcoin Core resolves an import timestamp of "now" to its tip's median
time. On an offline signer that never synced, that is the genesis block,
so every new wallet was born in 2009, and the watch-only copy Bails
exports from it asks the online node to rescan from genesis, which a
pruned node cannot do.

A new wallet now takes this computer's clock, a day early like a
recorded creation date, so a clock running up to a day fast cannot skip
its first payments. Restores keep the recorded date.

On a Core 32.1 regtest signer at genesis, the descriptors were dated
1296688602 (genesis) before and the clock less a day after; the signer
still found a payment from blocks it synced later.

Claude-Session: https://claude.ai/code/session_01N8jLK61uohaW6W7Y8AHnMb
The backup identifier and master fingerprint were small, dim row
subtitles, hard to copy onto the wallet record. Rows that show values
now use libadwaita's property style with the card-group text style,
and the fingerprint is uppercase, as the CLI prints it.

Claude-Session: https://claude.ai/code/session_01N8jLK8HGLaWJq2AJGmxPVe
@BenWestgate BenWestgate self-assigned this Nov 10, 2026
@BenWestgate
BenWestgate marked this pull request as ready for review November 10, 2026 22:20
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 10, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-17T21:08:57.062214Z 7860bd8 New commits
ℹ️ 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.

Every page now asks the window to grow, never past the screen's height,
whenever its content is taller than the space it has: on arrival, when a
section opens, and when a message gets longer. A window the operator
shrinks grows back to fit. The scroller stays as the last resort on a
screen too short for the page.

Name-and-value rows (wallet identity, wallet record, new card) are one
line each, value on the right, so the finished page fits the default
880x620 window and reads straight down against the paper record.

The GUI size budget rises by the 13 lines this takes.

Claude-Session: https://claude.ai/code/session_01N8jLK9eptxLjUcNnMk1VGr
#223 moved row values into suffix labels in a compact group. Keep that
layout and style those labels like card text instead of the subtitle.

Claude-Session: https://claude.ai/code/session_01N8jLK8HGLaWJq2AJGmxPVe
@BenWestgate
BenWestgate force-pushed the claude/project-thread-p319g5 branch from 6bcbfa0 to dfb6905 Compare November 17, 2026 20:54
Restore now takes the master fingerprint from the wallet record before
any card, in the CLI (`ms32 wallet`) and the GUI. While the cards are
entered, a correction whose recovered seed makes that fingerprint
outranks every other candidate and tie-breaker: a wrong seed matches 32
bits only 1 time in 2**32. Shares are judged only by the card that
completes the seed. The operator still compares every suggestion with
the whole card, and the library checks the fingerprint again after
recovery, before any wallet is touched.

"I have no wallet record" still works: it goes to the cards and then to
the same no-record warning as before.

GUI: the record page comes first and can go Back. "Stop" is gone; after
a mismatch, "Start again" appears with advice. Wording follows Ben:
"codex32 checks this before it restores your wallet in Bitcoin Core",
and the library mismatch now says no wallet was created or restored.

Budgets: library 5,025 -> 5,068, GUI 2,063 -> 2,100.

Claude-Session: https://claude.ai/code/session_01N8jLK8HGLaWJq2AJGmxPVe
@BenWestgate BenWestgate changed the title gui: Show wallet record values large and dark Ask for the wallet record before the cards; show record values large Nov 17, 2026
@BenWestgate
BenWestgate marked this pull request as draft November 17, 2026 21:06

@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: 7860bd86b8

ℹ️ 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 tests/test_cli.py
}

assert sum(counts.values()) < 5025, counts
assert sum(counts.values()) < 5068, counts

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Restore the mandated package review-line budget

The installed codex32 package now contains 5,067 logical review lines, exceeding the explicit limit of fewer than 5,025 in AGENTS.md. Raising this assertion to 5,068 hides the violation rather than preserving the required reviewability check. Reduce the production-code footprint and retain the original threshold.

AGENTS.md reference: AGENTS.md:L63-L64

Useful? React with 👍 / 👎.

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.

This raise is deliberate. The feature adds about 43 library lines: the record matcher, the plumbing through card input, and a CLI prompt split. The PR description lists the raise to 5,068 as needing the maintainer's OK. If the answer is no, the lines come out instead. Leaving this thread open until then.


Generated by Claude Code

Comment thread src/codex32/correction.py
Comment on lines +850 to +851
if recorded is not None and (matching := [item for item in candidates if recorded(item) is True]):
candidates = matching

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 Apply record-aware ranking before search pruning

When the repair matching the recorded fingerprint has a higher capture volume than another valid repair, this filter cannot select it: both upstream search paths have already discarded it. The CLI's _search_competitors prunes higher-volume layers and returns only _primary(...), and the GUI's correct() path through _search_many does the same. Consequently, the new promise that a record match outranks capture volume works only in the synthetic _best test, not in either actual recovery flow; users can still receive the wrong repair followed by an identity mismatch. Pass the record-aware ranking into discovery/pruning, rather than applying it only to the surviving primary candidates.

Useful? React with 👍 / 👎.

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.

Confirmed. _search_competitors and the non-competitor path of _search_many both return only _primary(...), so a record match can only choose among the lowest-capture-volume repairs. ddca9ab corrects the _best docstring and the test name so they don't claim more than that.

What the change still does: it settles ties among those repairs, beating the Hamming, CRC and identifier hints, which are what currently produce "More than one repair is possible". Searching costlier layers when no primary repair matches would change the search's budget and timing. It would also cost two bitcoin-cli calls per candidate. I'm leaving that call to the maintainer and not widening this PR.


Generated by Claude Code

Both search paths return only their lowest capture volume, so a record
match cannot reach a costlier repair (Codex review on #221).

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

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