Skip to content

Reference data: show an unfinished import as importing or incomplete, not 0 - #269

Merged
charpy4n6 merged 1 commit into
mainfrom
fix/refdata-incomplete-count
Oct 8, 2026
Merged

charpy4n6 merged 1 commit into
mainfrom
fix/refdata-incomplete-count

Conversation

@charpy4n6

Copy link
Copy Markdown
Collaborator

Problem

A user who imported NSRL RDS sets saw some of them listed as 0 in the Reference data dialog while the hashes were visibly in the store.

The number in that list is hashsets.count, which is written only once an import finishes (hashstore._finalize). The hashes are committed in batches of 100,000 as the import runs. So any set whose import has not reached the end reads 0:

  • still importing: the count appears when the import finishes
  • stopped part-way: GLEAPP closed or crashed mid-import, or the import raised near the end. A failure in the unguarded checkpoint/ANALYZE tail of _bulk_end skipped _finalize even after every entry was stored. The set keeps what was stored and is still matched against cases.

Reproduced on a scratch store by ending an import after 200,000 hashes: count=0, 200,000 MD5 rows stored.

Change

  • _create_set leaves count NULL until _finalize writes it. hashstore.sets() adds a status:
    • complete
    • importing: this process is importing the set
    • incomplete: count is NULL, or 0 with entries, which is how an earlier version left an unfinished set. A 0 with nothing stored stays a real 0.
  • Reference data and Project VIC lists: show importing… or incomplete — add it again (warning color, with the reason in a tooltip) instead of 0.
    • The Reference data dialog reloads its list when opened.
    • Both lists reload after a failed import as well as a successful one.
  • gleapp hashset --list: prints the same instead of failing on a NULL count.
  • _bulk_end: no longer repeats the checkpoint and ANALYZE outside the try, so a failure there can't cost the count once every entry is stored.
  • Docs: docs/MANUAL.md and help.html describe the two states.

Limitation: a set being imported by another GLEAPP process (a second window, the command line) reads incomplete in this one until that import finishes. The tooltip and the manual say so.

Testing

  • tests/test_reference_set_status.py, 6 tests: an interrupted import reads as incomplete, keeps its entries, and re-adding it replaces it; importing during an import; a failed list import leaves nothing behind; the old 0-with-entries case; a failing ANALYZE no longer costs the count; and the CLI --list output. All 6 fail on main.
  • Full suite locally (Windows, Python 3.12): 940 passed, 6 skipped.
  • tools/lint_changed.py: no new warnings. check_line_endings.sh: all LF.
  • In the browser, on a scratch store with its own config folder: an interrupted set showed incomplete — add it again. A 5,000,000-row import showed importing… while it ran and its count when it finished, with the dialog open. Re-adding the incomplete set replaced it with its full count.

🤖 Generated with Claude Code

… not 0

A shared-store set's count was written only when its import finished
(_finalize), while its hashes are committed in batches as it runs. So a set
still being imported, or one whose import stopped part-way (GLEAPP closed,
an error), listed as 0 beside the hashes it holds.

- _create_set leaves count NULL until _finalize writes it; sets() reports a
  status: complete, importing (this process is importing it) or incomplete
  (count NULL, or 0 with entries, as an earlier version left it)
- the Reference data and Project VIC lists show "importing..." or
  "incomplete - add it again" with the reason in a tooltip; the Reference
  data dialog reloads its list when opened, and both lists reload after a
  failed import too
- gleapp hashset --list prints the same instead of failing on a NULL count
- _bulk_end no longer repeats the checkpoint and ANALYZE outside the guard,
  so a failure there cannot cost the count once every entry is stored
- MANUAL.md and help.html describe the two states

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@charpy4n6
charpy4n6 merged commit e95eb54 into main Oct 8, 2026
8 checks passed
@charpy4n6
charpy4n6 deleted the fix/refdata-incomplete-count branch October 21, 2026 00:11
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