Skip to content

Normalize imported hashes to lower case and default their null fields [patch] - #199

Merged
matt-edmondson merged 1 commit into
mainfrom
fix/import-normalize-hash-and-nulls
Oct 8, 2026
Merged

matt-edmondson merged 1 commit into
mainfrom
fix/import-normalize-hash-and-nulls

Conversation

@matt-edmondson

Copy link
Copy Markdown
Contributor

Summary

Import.MergeEntries now:

  • lower-cases every imported hash before validating and storing it, so an entry from a tool that writes upper-case SHA-256 (e.g. PowerShell Get-FileHash) is stored under the key Scan looks up, and the same hash imported in both cases merges into one entry;
  • defaults a null KnownPaths, Description, SuggestedFileName or Model (new RepairNullFields), so a JSON import with nulls can no longer make Search, Stats, Export or Scan throw on every later run. Partially filled entries still merge, as the triage note suggested.

Tests

Two new tests in SearchTests:

  • MergeEntriesStoresAnUpperCaseHashAsTheLowerCaseHashScanLooksUp: upper- then lower-case import of one hash gives one lower-case key holding both paths
  • MergeEntriesRepairsNullFieldsSoSearchStatsAndExportStillRun: imports an all-null entry, then runs Search, Stats and Export.BuildCsv

Both fail on main and pass with the fix. Full suite: 87 passed, 1 skipped (that test skips when run as root), 0 warnings.

Fixes #163

🤖 Generated with Claude Code

https://claude.ai/code/session_015PVg1hwPKWXb1nLDuTQgYR


Generated by Claude Code

… [patch]

An imported entry with an upper-case hash was stored under a key Scan never
looks up, and a JSON null in Description, KnownPaths, SuggestedFileName or
Model made Search, Stats, Export and Scan throw on every later run.

Fixes #163

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015PVg1hwPKWXb1nLDuTQgYR
@sonarqubecloud

sonarqubecloud Bot commented Oct 7, 2026

Copy link
Copy Markdown

@matt-edmondson
matt-edmondson merged commit 51e0b0f into main Oct 8, 2026
14 checks passed
@matt-edmondson
matt-edmondson deleted the fix/import-normalize-hash-and-nulls branch October 8, 2026 04:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants