← Back to Pull requests

Judge a derived pin by its pattern's output at upstream's tip (issue btclib-org/btclib#3133) #210

Closed
unknown closed this pull request without merging on Nov 19, 2026 09:34 UTC
View on GitHub
unknown unknown commented on Nov 19, 2026 09:23 UTC
Author

This is base58-bech32's copy of the change ISS btclib-org/btclib#3133 asks for, which landed in btclib as e0b34057, in ecc as 88352b8e, in btclib-wallet as 3a399ed0, in bip32-descriptors as 328a1941 and in btclib-secp256k1 as b289e653. A ledger entry may now name its derivation in a pattern line, and .github/scripts/check_vendored_vectors.py judges such an entry, where its behind reads zero, by what that pattern derives at the tip of the entry's path, read through the API: it fetches upstream's tarball at that commit, holds each regular file under the path to its blob in the recursive tree, finds the matches as LC_ALL=C git grep -aohP does, sorts them bytewise and deduplicates them, and reports the entry where the result is not the file here, naming the lines only the derivation holds and those only the file holds, or where the file is not here at all. The value of the entry's commit decides nothing; an entry without a pattern line is judged by its commit, as before. This is the maintainer's option 1 on the issue: the change goes in the shared checker every tree's copy runs.

base58-bech32's ledger holds no entry with a pattern line, so this carries the capability, its tests and the ledger's paragraphs on what such a line means, as bip32-descriptors' copy does. This copy calls gh through subprocess.run at each call site and has no shared helper or retry, so _derived makes its two calls the same way: the tree as text, the tarball as bytes. The helper and its retry are ISS btclib-org/base58-bech32#209. This copy's exact match of the issue title is kept.

Prose corrected beyond the port: the header's copy paragraph no longer says this copy's code departs from bip39-slip39's in nothing, which was already false (bip39-slip39's retries a server error); and two sentences of tests/_data/README.md (on the weekly job, and on what the suite does not ask upstream) now say a pin that moved is reported unless its entry carries a pattern.

What this breaks: find_drift returns a third list, the derived entries found current with their tip; stdout prints "No checked pin has drifted from upstream's tip." where it printed "Every checked pin is still at upstream's tip."; the issue body's first line and the closing comment are reworded to match; a derived entry prints a DERIVED or a DIFFERS line.

Evidence

| Gate on 1e6ab285 | Command | Exit |
| --- | --- | --- |
| Suite, coverage lane | uv run --locked --no-default-groups --group test pytest -n 2: 1878 passed, 100.00% | 0 |
| Hooks | uv run --locked --only-group lint pre-commit run --all-files --show-diff-on-failure | 0 |
| Build and sdist lane | uv build, twine check --strict, check-wheel-contents, pyroma --min 10; the suite from the unpacked sdist on Python 3.15: 1726 passed, 100.00% | 0 |
| Docs | sphinx-build -n -W, the href grep and check_included_links.py | 0 |
| Sign-off | check_sign_off.py 8a18a44d..1e6ab285; control 463f194 exits 1 | 0 |

  • merge-tree --write-tree against main at 8a18a44d, the branch's parent, merges clean.

  • The script run on the real ledger prints, at base and at head alike, "Hashed 8 files and asked upstream for 8 blobs: 0 mismatches."; the two runs differ only in the all-clear line above.

  • Local review: the dedicated reviewer (Claude Code) and a second fresh-context Claude Code reviewer, standing in for the fresh Codex review by the maintainer's ruling of 2026-11-19 while the Codex workspace is out of credits, each cleared 1e6ab285 on their first verdict. The fresh reviewer fed _derived offline the real tree and tarball of bitcoin-core/secp256k1 at a0e2e23a and got btclib's tests/_data/secp256k1_symbols.txt byte for byte; the dedicated reviewer held _matches to git grep on 162 inputs, none differing. Their non-blocking findings are in the findings record; the two that apply to every copy are filed on ISS btclib-org/btclib#3155.

  • Sourcery: no issues on 1e6ab285. CodeRabbit CLI: one review before the push, two findings (a trailing slash in path; the copying in _line_matches), both already filed for every copy on ISS btclib-org/btclib#3155.

  • Not checked locally: the live API path, which no entry of this ledger reaches. The os-* sweeps and the dist job's other steps run in CI.

  • The other copies of the checker follow in their own pull requests; the issue stays open until the last of them lands.
  • (issue btclib-org/btclib#3133)

    🤖 Generated with Claude Code

    Diff: 562 lines (+421 / -141) across 7 files Reviewer: fametrano Review duration: 11m
    All Vouch review confidence checks passed
    Residual risk 0.22 = Change Risk (0.50) × (1 − Review Confidence (0.55)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.50 · 562 lines diff across 7 files
    0.50
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 79% · Reviewer familiarity: 35%
    55%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.379
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #210"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 55.5% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 49.7% (MEDIUM) · Higher = larger blast radius
    49.7%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 55.5% · Lower = rushed or shallow review
    55.5%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 22.1% · Safe to merge
    22.1%