Skip to content

Hash stash: merge an external pre-categorized hash set - #307

Merged
charpy4n6 merged 1 commit into
mainfrom
feat/stash-precategorized
Oct 21, 2026
Merged

charpy4n6 merged 1 commit into
mainfrom
feat/stash-precategorized

Conversation

@charpy4n6

@charpy4n6 charpy4n6 commented Oct 21, 2026 •

Copy link
Copy Markdown
Collaborator

What it adds

There's a new button in the Hash stash dialog, next to "Merge external hash stash…": Merge external pre-categorized hash set…. The same thing on the command line is gleapp stash --merge-precategorized FILE.

It folds in MD5s that another tool has already categorized. The input is a JSON file of records, each carrying an MD5 and a numeric Category. The records may sit at the top level or under value.

  • What's kept: categories 1–3, the same rule as every stash entry. When a hash is already in the stash, the more severe code wins, as with the existing merge.
  • Source: each row records pre-categorized: <file name>.
  • Reporting: the result says how many records were added, how many fell outside 1–3, and how many had no MD5.
  • No silent zero: a file with no record carrying both fields is refused with a reason, instead of reporting a merge that added nothing.

Why a separate action

"Merge external hash stash" is for another examiner's GLEAPP stash (.hstash or md5,category CSV). A pre-categorized hash set from another tool is a different input, so it gets its own clearly named entry.

It reads JSON with a numeric Category, not CSV. A CSV export that names its categories in words, with the category in a later column, silently added 0 rows through the existing CSV merge. A numeric code doesn't depend on any tool's wording.

Testing

  • tests/test_stash_precategorized.py, all synthetic, covers:
    • categories 1–3 merged, while category 4 and a record without an MD5 are counted and skipped;
    • MD5 normalized to lower case, and the recorded source;
    • a bare top-level list is read;
    • a file without MD5 and Category is refused, and so is a non-JSON file.
  • Tried on a test hash set (not case data) in a throwaway stash: 35,742 records, +35,736 added (13,719 / 13,433 / 8,584 in codes 1 / 2 / 3), 6 skipped as category 4. A second merge added 0, and a CSV file was refused as not JSON.
  • Full suite: 1,082 passed locally on Windows, excluding one test that needs symlink privileges this machine lacks.
  • Lint: no new warnings. Line endings: LF.

Docs: MANUAL (Hash stash sharing table and command examples) and the in-app help.

🤖 Generated with Claude Code

"Merge external pre-categorized hash set..." in the Hash stash dialog (and
gleapp stash --merge-precategorized) folds in MD5s another tool has already
categorized: JSON records each carrying an MD5 and a numeric Category.
Categories 1-3 are kept, the records outside them or without an MD5 are
counted and reported, and a file with no such records is refused instead
of reporting a merge that added nothing.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@charpy4n6
charpy4n6 force-pushed the feat/stash-precategorized branch from 5262939 to 30f64c9 Compare October 21, 2026 20:13
@charpy4n6
charpy4n6 merged commit ae7171b into main Oct 21, 2026
8 checks passed
@charpy4n6
charpy4n6 deleted the feat/stash-precategorized branch October 21, 2026 21:44
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