Repository navigation
Conversation
Adding or removing a prep step now rebuilds the alias's corrected table from the new prep output by replaying the correction log, but only when a corrected table already exists. The import refresh shares the same check through CorrectionProcessor.refresh_existing_corrected_data. Both prep handlers end in a rerun, which wiped any warning rendered straight away, so prep and correction reapply failures are now queued in session state and shown on the next run of the Prep page. Closes #297 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Act on review of the corrected-data refresh: - Add queue_notice/show_queued_notices to ui_utils so success, warning and error messages raised before st.rerun() are shown on the next run. The Prep page uses it for step added/removed messages and reapply failures, replacing its private tuple queue. - Catch and report a failed corrected-data rebuild on the Prep page (UI boundary) instead of crashing after the prep change was saved. - Applying a project bundle now also rebuilds an existing corrected table for aliases whose prep steps it re-seeds without corrections. - Extract format_reapply_failures, cut the extra delegation in refresh_existing_corrected_data, use "refresh" naming in prep_view, and share mock setup in the prep view tests. Refs #297 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Zero-row prep results can bypass queued notices and cause check pages to fall back to stale raw data.
Review effort: Balanced
Findings: 1
Open (2)
What changed in this PR
Rebuilds corrected datasets after prep changes to prevent stale check results.
Changes:
- Adds conditional correction replay after prep changes, imports, and bundle application.
- Queues Streamlit notices across reruns.
- Adds regression tests and documentation.
| File | Description |
|---|---|
src/datasure/processing/corrections.py |
Adds conditional corrected-data refresh. |
src/datasure/views/prep_view.py |
Refreshes corrections after prep changes. |
src/datasure/views/import_view.py |
Reuses conditional refresh after imports. |
src/datasure/utils/project_config.py |
Refreshes corrected data during bundle application. |
src/datasure/utils/ui_utils.py |
Adds rerun-safe notice queueing. |
src/datasure/utils/reapply_utils.py |
Extracts failure-message formatting. |
tests/processing/test_corrections.py |
Tests conditional correction refresh. |
tests/views/test_prep_view.py |
Tests prep refresh and notices. |
tests/views/test_import_view.py |
Tests import-triggered replay. |
tests/utils/test_project_config.py |
Tests bundle-triggered replay. |
tests/utils/test_ui_utils.py |
Tests queued notices. |
tests/utils/test_reapply_utils.py |
Tests failure formatting. |
docs/ARCHITECTURE.md |
Documents corrected-data rebuilding. |
CONTRIBUTING.md |
Documents rerun-safe notices. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
A step that removes every row sends the Prep tab down its "No data available" path, which skipped show_queued_notices, so the step's success, reapply warnings and rebuild errors were never shown and resurfaced later. Render them before the empty check. Also import prep_view once in its tests (as pv) instead of mixing module and from-imports, per GitHub Code Quality. Refs #297 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
4 tasks
|
Contributor
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
The implementation consistently refreshes existing corrected data, reports failures, and includes targeted coverage for all introduced paths.
Review effort: Balanced
Findings: None
Resolved since last review (2)
6 of 7 tasks
This branch has not been deployed
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.





Pull Request Summary 🚀
What does this PR do? 📝
Closes #297. When a dataset's prep data changes, its corrected table is now rebuilt from the new prep output by replaying the correction log. This only happens if the dataset already has a corrected table.
The rebuild runs after:
Replay failures, and errors from the rebuild itself, are shown on the Prep page.
Why is this change needed? 🤔
Check pages read
corrected.duckdbbeforeprep. Until now, changing a prep step never touchedcorrected. After you dropped a column in Prep, check pages kept showing the old corrected table.How was this implemented? 🛠️
CorrectionProcessor.refresh_existing_corrected_data(processing/corrections.py): replays the correction log only when a corrected table exists. The Prep page, the import refresh and bundle application all use it. Replay still goes through_apply_correction_row, soacceptrows are skipped and acceptances whose values changed become inactive (from Corrections: add source and accept to the log, extract a shared correction form #296).queue_notice/show_queued_notices(utils/ui_utils.py): both prep handlers end inst.rerun(), which cleared messages rendered just before it. Messages are now queued in session state and shown once on the next run, under "Apply Changes". This also fixes an existing bug where the prep-step failure warning on removal never appeared. CONTRIBUTING.md now documents the helper.utils/project_config.py):_apply_correctionsseeds and replays bundled corrections as before. It also refreshes existing corrected tables for re-prepped datasets that the bundle has no corrections for.Merge danger
Door: two-way. No schemas, stored formats or migrations change. The only new session-state key is
st_queued_notices.Blast radius: corrected data. After this merges, corrected tables are rebuilt more often, and a correction that no longer applies to the new prep output is marked
Failedin the correction log instead of silently serving stale data.How to test or reproduce ? 🧪
Failed.Tests:
refactor/310-action-strenum: the new tests fail.refresh_existing_corrected_data,queue_noticeandformat_reapply_failuresdon't exist, and no rebuild runs after a prep change.just testgives 3364 passed and 6 skipped. New coverage:TestRefreshExistingCorrectedData: no-op without a corrected table, rebuild from new prep, failures reported.TestPrepChangeRefreshesCorrectedData: add and remove trigger the rebuild, a rejected step doesn't, and success, warning and error messages appear after the rerun.TestQueuedNotices: messages show in order, once, per scope.Screenshots (if applicable) 📷
Checklist ✅
just pre-commit-runpasses.docs/ARCHITECTURE.mddata flow and theCONTRIBUTING.mdview UI rules.Reviewer Emoji Legend
:code::smiley::+1::100:...and I want the author to know it! This is a way to highlight positive parts of a code review.
:star: :star: :star:And I am providing reasons why it needs to be addressed as well as suggested improvements.
:star: :star:And I am providing suggestions where it could be improved either in this PR or later.
:star:...and consider this a suggestion, not a requirement.
:question:This should be a fully formed question with sufficient information and context that requires a response.
:memo::pick:This does not require any changes and is often better left unsaid. This may include stylistic, formatting, or organization suggestions and should likely be prevented/enforced by linting if they really matter
:recycle:Should include enough context to be actionable and not be considered a nitpick.
🤖 Generated with Claude Code