feat(kiloclaw): add multi-row-all-destroyed collapse and bulk apply paths#2571
Open
jeanduplessis wants to merge 3 commits intomainfrom
Open
feat(kiloclaw): add multi-row-all-destroyed collapse and bulk apply paths#2571jeanduplessis wants to merge 3 commits intomainfrom
jeanduplessis wants to merge 3 commits intomainfrom
Conversation
…aths Adds a third remediation mode to the subscription alignment script for users whose personalCurrentSubscriptionWhere matches >1 rows AND none point at a live instance, which fails the resolver guard. The mode collapses the ambiguous rows into one tail row by chaining older rows to newer ones via transferred_to_subscription_id. Also introduces an opt-in --bulk flag on apply-missing-personal and apply-multi-row-all-destroyed for chunked bulk writes (250-row tx chunks with per-user fallback on chunk failure), batches the apply-changelog-baseline path into 500-row chunks, and adds progress logging to long-running apply paths.
Contributor
Code Review SummaryStatus: No Issues Found | Recommendation: Merge Files Reviewed (1 files)
Reviewed by gpt-5.4-20260305 · 299,454 tokens |
- Changelog baseline chunked backfill: return inserted counts from the transaction callback and accumulate after commit. Previous in-tx counter mutation could over-report on rollback when the second INSERT in the chunk threw after the first one ran. - Multi-row-all-destroyed collapse: detect users whose pre-existing partial chain blocks a full collapse (applying the planned pairs would still leave >1 ambiguous rows) and surface them as skipped_not_collapsible instead of writing a partial chain. A partial plan would replace one CurrentPersonalSubscriptionResolutionError shape with another and mask the broken state in the change log. - Extract shared pair planners (planMultiRowAllDestroyedPairsFromSourceRows, planMultiRowAllDestroyedPairsFromJoinedRows) used by preview, per-user apply, and chunk-bulk apply so the collapsibility invariant is checked uniformly. Preview now separately reports collapsible vs non-collapsible user counts and shows a sample of non-collapsible users.
Derive users_skipped_not_collapsible by filtering the skipped list instead of reading the preview-time candidate count. The bulk path and per-user path both surface in-tx re-plan races with reason skipped_not_collapsible, and those were previously excluded from the metric — users_skipped_total would go up while users_skipped_not_collapsible stayed flat, hiding how many users actually ended up requiring manual review.
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.
Summary
Retroactive PR for changes made to the script to update the database.