Skip to content

feat(stripe): add early fraud warning persistence foundation#3552

Merged
RSO merged 1 commit into
mainfrom
balanced-leotard
May 28, 2026
Merged

feat(stripe): add early fraud warning persistence foundation#3552
RSO merged 1 commit into
mainfrom
balanced-leotard

Conversation

@RSO
Copy link
Copy Markdown
Contributor

@RSO RSO commented May 28, 2026

Summary

  • Define the Stripe Early Fraud Warning enforcement contract and align KiloClaw, Impact, and organization-billing policies around personal-only enforcement and review-only organization cases.
  • Add inert stripe_early_fraud_warning_cases and stripe_early_fraud_warning_actions persistence with a generated Drizzle migration for the later automated enforcement rollout.
  • Preserve retained enforcement audit history during user soft deletion while nulling direct user linkage, with regression coverage for the new state.

Verification

N/A - this PR intentionally introduces an inactive persistence and specification foundation with no user-facing or enforcement behavior to exercise manually.

Visual Changes

N/A

Reviewer Notes

  • This is PR 1 of the planned two-step delivery. It does not ingest EFWs or execute blocks, refunds, cancellations, notices, payout reversals, cron work, or admin UI behavior.
  • Review the generated migration and GDPR null-link behavior closely; PR 2 will depend on these table and lifecycle contracts after deployment.

@RSO RSO marked this pull request as ready for review May 28, 2026 10:06
Comment thread .specs/kiloclaw-datamodel.md
Comment thread .specs/stripe-early-fraud-warnings.md
@kilo-code-bot
Copy link
Copy Markdown
Contributor

kilo-code-bot Bot commented May 28, 2026

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Executive Summary

Well-structured persistence foundation for Stripe Early Fraud Warning enforcement: new tables, schema types, migration, GDPR lifecycle update, and spec changes are all consistent and correct.

Files Reviewed (11 files)
  • .specs/stripe-early-fraud-warnings.md — new spec, clean definitions and invariants
  • .specs/impact-affiliate-tracking.md — EFW reversal rules correctly integrated
  • .specs/impact-referrals.md — EFW adverse payment classification added
  • .specs/kiloclaw-billing.md — fraud-enforcement cancellation exception documented
  • .specs/kiloclaw-datamodel.md — fraud-enforcement mutation invariants added
  • .specs/team-enterprise-seat-billing.md — organization EFW review-only boundary defined
  • packages/db/src/schema.ts — two new tables with correct constraints, FK onDelete: 'restrict' on actions→cases prevents orphaned action records
  • packages/db/src/schema-types.ts — four new const/type pairs for all enum columns
  • packages/db/src/migrations/0145_awesome_wild_child.sql — generated migration is correct; all CREATE INDEX are on new empty tables so no CONCURRENTLY concern; FK add order is safe
  • apps/web/src/lib/user/index.tssoftDeleteUser correctly nulls kilo_user_id FK while retaining audit/fraud-correlation fields (consistent with how kilocode_users.stripe_customer_id is handled)
  • apps/web/src/lib/user/index.test.ts — GDPR regression test verifies case and action retention with user link nulled and confirms unaffected user is unchanged

Fix these issues in Kilo Cloud


Reviewed by claude-4.6-sonnet-20260217 · 2,136,257 tokens

Review guidance: REVIEW.md from base branch main

@RSO RSO merged commit d3b84f1 into main May 28, 2026
50 checks passed
@RSO RSO deleted the balanced-leotard branch May 28, 2026 10:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants