feat(curation): persist Dataset Curator panel state across sessions#285
Merged
lstein merged 1 commit intoMay 26, 2026
Conversation
Wire the five Dataset Curator inputs — target count, iterations, method (Diversity FPS vs Blocks K-Means), exclude-matches percent, and export path — into the shared per-device preferences mechanism so the panel reopens with the same values the user left. Backend (preferences.py): - Add curation_target_count (10..1000), curation_iterations (1..30), curation_method (Literal["fps","kmeans"]), curation_exclude_threshold (1..100). curation_export_path was already on the model. - Field ranges mirror the HTML input min/max attrs in curation.html so server validation defends against a stale tab posting an out-of-range value after a future HTML change tightens the bounds. Frontend: - state.js: register the five fields in PERSISTED_SETTINGS so they get the standard auto-restore + debounced-PATCH treatment. Existing users' curationExportPath localStorage values are migrated to the server on first boot via the existing reconciliation path. - curation.js: replace the manual localStorage reads/writes with state setters. Restore every input from `state.curation*` on panel setup; wire `oninput` / `onchange` on the slider, number, iterations, method radios, threshold, and export path to call the setters. Clamp before setting so out-of-range typed values don't trip server validation. Backend tests: - test_curation_fields_round_trip covers all five fields end-to-end. - test_curation_invalid_values_return_422 exercises every range bound and the Literal field. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stacked on top of #284 — base is
lstein/feature/server-side-preferences. GitHub will rebase the base tomasterautomatically when #284 merges.Summary
localStorage["curationExportPath"]values are picked up byrestoreFromLocalStorageand pushed to the server via the existing reconciliation path on first boot.What's new
Backend (
preferences.py)curation_target_count(int, 10..1000)curation_iterations(int, 1..30)curation_method(Literal["fps", "kmeans"])curation_exclude_threshold(int, 1..100)curation_export_pathwas already in the model from feat(preferences): per-device server-side UI preferences #284.Ranges mirror the HTML input min/max attrs in
curation.htmlso server validation defends against a stale tab posting an out-of-range value after a future HTML change tightens the bounds.Frontend
state.js: five new entries inPERSISTED_SETTINGS, five new setters exported, five new state defaults that mirror the HTML defaults.curation.js: replaced manuallocalStorage.getItem/setItem("curationExportPath")calls with state setters. Added a restore-from-state block at the top ofsetupEventListenersand wiredoninput/onchangehandlers on the slider, number, iterations, method radios, threshold, and export path. Each handler clamps before calling the setter so out-of-range typed values can't trip server validation.Test plan
pytest tests/backend/test_preferences.py— 12 tests, including two new ones (test_curation_fields_round_tripcovering all five fields end-to-end;test_curation_invalid_values_return_422exercising every range bound and the Literal field).npm test— full 334/334 suite still green.localStorage["curationExportPath"]set from before feat(preferences): per-device server-side UI preferences #284 → reload after both PRs land → path appears in the input.🤖 Generated with Claude Code