Skip to content

tests: BIP-39 mnemonic detector false-positive corpus #135

Open

Description

@Ishannaik

You will build a false-positive corpus that locks in the README's claim: English prose that uses wallet words never trips the mnemonic detector.

How it fits together

flowchart TD
    A["tests/test_mnemonic.py<br/>new FP corpus (near line 56)"] --> B["English sentences with 12+<br/>consecutive BIP-39 words"]
    F["bip39_words.py<br/>WORDS list"] --> B
    B --> C["scan_text() -> detect_mnemonics()<br/>(mnemonic.py line 58)"]
    C --> D["_bip39_checksum_ok() (line 35)<br/>rejects the window"]
    D --> E["assert no bip39-mnemonic finding"]
Loading

Wordlist membership alone would match prose, so detect_mnemonics() confirms a real BIP-39 checksum (or an Electrum HMAC tag) before it reports anything. These tests pin that guarantee from the false-positive side; the existing VALID_12 / VALID_24 cases already pin the true-positive side.

Steps

  1. In tests/test_mnemonic.py, build a small corpus of English sentences that contain 12 or more consecutive words drawn from the BIP-39 list (src/agentsweep/bip39_words.py, which is full of common words like "abandon", "expose", "actor") but do not form a valid checksummed mnemonic.
  2. Assert detect_mnemonics returns no bip39-mnemonic finding for every sentence. Drive it through scan_text, the way the other tests do.
  3. Place the corpus next to the existing positive cases so both directions of the claim stay covered.

Files

  • tests/test_mnemonic.py (extend near test_natural_english_not_detected, line 56)
  • Code under test: src/agentsweep/mnemonic.py (detect_mnemonics, line 58)

How to claim

Comment "I'll take this", fork the repo, branch from main, and open a PR that links this issue.

Activity

  1. added
    enhancementNew feature or request
    help wantedExtra attention needed — contributions welcome
    testingTests and test infrastructure
    on Jul 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requesthelp wantedExtra attention needed — contributions welcomepythonPython codetestingTests and test infrastructure

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions