fix: clean rebuild, stateless run guard#40
Merged
Conversation
1. Clean rebuild (create_mrp_item_entries) The full row set is now computed before the delete, then the table is deleted + committed before the bulk insert (also committed). The commit makes the clear durable so it can't be silently lost, turning the run back into a genuine rebuild instead of an ignore_duplicates append that left old generations (and headerless, invisible items) behind. Dropped ignore_duplicates so a dirty table fails loudly, and added a header/item-count invariant check. Commits are skipped under frappe.flags.in_test to preserve test isolation. 2. Stateless run guard (_finalise_in_progress) Replaced the un-filtered, silent _finalise_jobs_in_progress with a queue-derived check: only the most recent run's finalise batches count (age filter fixes the ancient-phantom deadlock), and jobs wedged past MRP_FINALISE_CEILING_MINUTES fail *open* (rebuild anyway + alert) rather than blocking forever. Skips are now visible. Uses now_datetime() for system-tz-consistent age math. trigger_mrp_run reuses the same helper.
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
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.
Description
fix: clean rebuild, stateless run guard
Fixes for internal refs:
Type of change
Tests
Checklist:
/patchesandpatches.txthave been updatedUser Experience:
N/A