feat(myopencre): improve UI messaging for no-op CSV imports #684
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.
Please review this PR after the above PR is merged.
NOTE FOR REVIEWERS
This PR intentionally limits its scope to the following files only:
Any additional file diffs shown by GitHub are inherited from branch history or stacked branches and are not part of this change.
Summary
This PR improves the MyOpenCRE CSV import user experience by clearly distinguishing successful no-op imports from imports that actually create new data.
A no-op import occurs when:
Previously, these cases appeared ambiguous or misleading in the UI.
This change ensures users receive accurate, intention-revealing feedback while keeping all existing backend behavior unchanged.
What this PR does
✅ Explicit no-op import feedback (frontend)
new_cres.length === 0new_standards === 0✅ Empty CSV handling
✅ Preserves existing success behavior
✅ UI consistency improvements
Backend note (non-behavioral)
This PR does not introduce any new backend import logic, idempotency rules, or duplicate detection.
Duplicate-safe and idempotent behavior already exists in the backend and remains unchanged, including:
cre_main.register_cre(...), which detects existing CREs and avoids re-creationcre_main.register_standard(...), which safely reuses existing standards and mappingsnew_cres = []new_standards = 0This PR does not attempt to reimplement or infer idempotency in the frontend.
Instead, the frontend strictly trusts and reflects backend outcomes.
A small, non-behavioral refinement was made in
web_main.pyto make these already-existing outcomes explicit in the API response (e.g. classifying a successful import ascreatedvsnoop).This refinement does not change how imports are processed — it only makes the backend response more intention-revealing and predictable for frontend consumption.
In short:
Screenshots
1. Successful import (data created)

2. Empty CSV (no-op import)

Note on duplicate (idempotent) imports
Duplicate no-op imports (re-uploading the same CSV) cannot be reliably demonstrated in the local development environment because the database is ephemeral.
The UI behavior for this case is implemented based on backend response semantics and can be verified in an environment with a persisted database.
What is intentionally out of scope
Backend import logic or idempotency rules
Existing backend behavior already handles duplicates safely, including:
cre_main.register_cre(...)avoiding CRE re-creationcre_main.register_standard(...)reusing existing standards and mappingsnew_cres = []new_standards = 0Database-level duplicate handling
No schema, constraints, or persistence mechanisms were modified.
This PR only improves how already-existing backend outcomes are communicated to users.
Why this matters
Feedback welcome
If maintainers prefer different wording or severity (info vs success), I’m happy to iterate.