fix(kiloclaw): log instance-scoped billing mutations#2582
Open
jeanduplessis wants to merge 1 commit intojdp/kiloclaw-spec-compliance-pr1-specsfrom
Open
Conversation
Contributor
Code Review SummaryStatus: No Issues Found | Recommendation: Merge Files Reviewed (2 files)
Reviewed by gpt-5.4-20260305 · 520,113 tokens |
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
Adds in-transaction audit logging to instance-scoped KiloClaw billing mutations.
Why this change is needed
Legacy personal billing mutations already wrote subscription changelog entries, but newer instance-scoped procedures mutated same subscription fields without writing matching audit records. That left support and reconciliation with incomplete history for cancel, conversion, reactivation, and plan-switch flows when users acted from instance-scoped screens.
How this is addressed
Verification
pnpm test -- apps/web/src/routers/kiloclaw-billing-router.test.tspnpm typecheckpnpm formatVisual Changes
N/A
Reviewer Notes
Human Reviewer
schedule_changedentry before new schedule creation. Reviewers should confirm that treating this cleanup as first-class audit history matches expected operator semantics.Code Reviewer Agent
Code Reviewer Notes
mutateUserSubscriptionWithChangeLoginapps/web/src/routers/kiloclaw-router.ts, which wrapsbeforeread, mutation, and changelog insert in one DB transaction.cancelKiloclawSubscriptionForRow,acceptKiloclawConversionForRow,reactivateKiloclawSubscriptionForRow,switchKiloclawPlanForRow,cancelKiloclawPlanSwitchForRow). Legacy top-level procedures already had changelog coverage and were left functionally unchanged.switchKiloclawPlanForRownow takesuserIdso schedule mutations can log actor context. Conflict handling and Stripe cleanup behavior stay same.