Skip to content

refactor(entitlements): drop retired daily counter table - #1135

Merged
kody-bot merged 54 commits into
mainfrom
cursor/meter-do-38c8
Aug 1, 2026
Merged

kody-bot merged 54 commits into
mainfrom
cursor/meter-do-38c8

Conversation

@kentcdodds

@kentcdodds kentcdodds commented Aug 1, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • migration 0126 drops retired entitlement_daily_counters table/index
  • removes completed pending-drop/retention exemptions
  • keeps post-retirement admin parity presence-gated

Validation

System recap — contracts retired D1 mirror schema (medium risk)

Mode: recap · Base: main @ cd3686bf · Head: 65b28281

Migration-only final stage after deployed mirror-stop and inventory-detach Workers.

Conductor report

Open in Web Open in Cursor 

Summary by CodeRabbit

  • Data Management

    • Retired legacy daily entitlement counter storage.
    • Daily counters are now maintained solely by the user metering system.
    • Updated export and retention handling to reflect the retired storage and finalized data lifecycle.
  • Documentation

    • Updated architecture and entitlement documentation to describe the finalized storage model and reporting behavior.
  • Tests

    • Added migration coverage and updated schema, export, and retention validation tests to confirm the new behavior.

cursoragent and others added 30 commits July 31, 2026 22:46
Co-authored-by: Kent C. Dodds <me+github@kentcdodds.com>
Co-authored-by: Kent C. Dodds <me+github@kentcdodds.com>
Co-authored-by: Kent C. Dodds <me+github@kentcdodds.com>
Co-authored-by: Kent C. Dodds <me+github@kentcdodds.com>
Co-authored-by: Kent C. Dodds <me+github@kentcdodds.com>
Co-authored-by: Kent C. Dodds <me+github@kentcdodds.com>
Co-authored-by: Kent C. Dodds <me+github@kentcdodds.com>
Co-authored-by: Kent C. Dodds <me+github@kentcdodds.com>
Co-authored-by: Kent C. Dodds <me+github@kentcdodds.com>
# Conflicts:
#	packages/worker/src/email/inbound.ts
#	packages/worker/src/email/outbound.ts
#	packages/worker/worker-configuration.d.ts

Co-authored-by: Kent C. Dodds <me+github@kentcdodds.com>
Co-authored-by: Kent C. Dodds <me+github@kentcdodds.com>
Co-authored-by: Kent C. Dodds <me+github@kentcdodds.com>
# Conflicts:
#	docs/contributing/architecture/data-storage.md
#	packages/worker/src/account/export.node.test.ts
#	packages/worker/src/account/export.ts

Co-authored-by: Kent C. Dodds <me+github@kentcdodds.com>
Co-authored-by: Kent C. Dodds <me+github@kentcdodds.com>
Co-authored-by: Kent C. Dodds <me+github@kentcdodds.com>
Co-authored-by: Kent C. Dodds <me+github@kentcdodds.com>
Co-authored-by: Kent C. Dodds <me+github@kentcdodds.com>
Co-authored-by: Kent C. Dodds <me+github@kentcdodds.com>
Co-authored-by: Kent C. Dodds <me+github@kentcdodds.com>
Co-authored-by: Kent C. Dodds <me+github@kentcdodds.com>
Co-authored-by: Kent C. Dodds <me+github@kentcdodds.com>
Co-authored-by: Kent C. Dodds <me+github@kentcdodds.com>
Co-authored-by: Kent C. Dodds <me+github@kentcdodds.com>
# Conflicts:
#	docs/contributing/architecture/data-storage.md

Co-authored-by: Kent C. Dodds <me+github@kentcdodds.com>
Co-authored-by: Kent C. Dodds <me+github@kentcdodds.com>
# Conflicts:
#	docs/contributing/architecture/data-storage.md

Co-authored-by: Kent C. Dodds <me+github@kentcdodds.com>
Co-authored-by: Kent C. Dodds <me+github@kentcdodds.com>
Co-authored-by: Kent C. Dodds <me+github@kentcdodds.com>
Co-authored-by: Kent C. Dodds <me+github@kentcdodds.com>
Co-authored-by: Kent C. Dodds <me+github@kentcdodds.com>
cursoragent and others added 19 commits August 1, 2026 10:56
Co-authored-by: Kent C. Dodds <me+github@kentcdodds.com>
Co-authored-by: Kent C. Dodds <me+github@kentcdodds.com>
Co-authored-by: Kent C. Dodds <me+github@kentcdodds.com>
Co-authored-by: Kent C. Dodds <me+github@kentcdodds.com>
Co-authored-by: Kent C. Dodds <me+github@kentcdodds.com>
Co-authored-by: Kent C. Dodds <me+github@kentcdodds.com>
Co-authored-by: Kent C. Dodds <me+github@kentcdodds.com>
Co-authored-by: Kent C. Dodds <me+github@kentcdodds.com>
Co-authored-by: Kent C. Dodds <me+github@kentcdodds.com>
Co-authored-by: Kent C. Dodds <me+github@kentcdodds.com>
Co-authored-by: Kent C. Dodds <me+github@kentcdodds.com>
Co-authored-by: Kent C. Dodds <me+github@kentcdodds.com>
Co-authored-by: Kent C. Dodds <me+github@kentcdodds.com>
Co-authored-by: Kent C. Dodds <me+github@kentcdodds.com>
Co-authored-by: Kent C. Dodds <me+github@kentcdodds.com>
Co-authored-by: Kent C. Dodds <me+github@kentcdodds.com>
Co-authored-by: Kent C. Dodds <me+github@kentcdodds.com>
Co-authored-by: Kent C. Dodds <me+github@kentcdodds.com>
Co-authored-by: Kent C. Dodds <me+github@kentcdodds.com>
@coderabbitai

coderabbitai Bot commented Aug 1, 2026 •

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Migration 0126 removes entitlement_daily_counters and its index. Runtime data-target and retention registries no longer reference the table. Tests validate the final schema and inventories. Architecture documentation records UserMeter as the daily-counter authority.

Changes

Daily counter retirement

Layer / File(s) Summary
Schema retirement and migration validation
packages/worker/migrations/0126-drop-entitlement-daily-counters.sql, tools/migration-ledger.json, packages/worker/src/entitlements/drop-entitlement-daily-counters-migration.node.test.ts
Migration 0126 drops the table and index. The migration ledger records its checksum. Tests validate creation by earlier migrations and removal by 0126 and the full migration sequence.
Runtime inventory and retention alignment
packages/worker/src/account/data-targets.ts, packages/worker/src/account/data-targets.node.test.ts, packages/worker/src/account/export.node.test.ts, packages/worker/src/app/account-retention-dispositions.ts, packages/worker/src/app/account-retention-dispositions.node.test.ts
Pending-drop and retention registrations no longer include the table. Tests verify its absence from runtime targets, schema coverage, user-column coverage, and retention dispositions.
Retirement documentation
docs/contributing/architecture/data-storage.md, docs/contributing/architecture/entitlements.md
Documentation records the completed drop, finalized parity semantics, UserMeter-only daily-counter retention, and Analytics Engine reporting.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Possibly related PRs

  • kentcdodds/kody#1064: Retires a different obsolete D1 table through related migration, inventory, retention, test, and documentation updates.
  • kentcdodds/kody#1133: Initiates the retirement completed by this PR.
  • kentcdodds/kody#1134: Begins the pending-drop, retention, export, and schema-coverage removal completed by this PR.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: dropping the retired entitlement daily counter table.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch cursor/meter-do-38c8

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@kody-bot
kody-bot marked this pull request as ready for review August 1, 2026 17:22
@cursor

cursor Bot commented Aug 1, 2026

Copy link
Copy Markdown
Contributor

@coderabbitai review

@github-actions

github-actions Bot commented Aug 1, 2026 •

Copy link
Copy Markdown
Contributor

🔎 Preview deployed: https://kody-pr-1135.kody-a99.workers.dev

Worker: kody-pr-1135
D1: kody-pr-1135-db
KV: kody-pr-1135-oauth-kv

Mocks:

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@docs/contributing/architecture/data-storage.md`:
- Line 650: Prevent Markdownlint violations by keeping issue references from
starting a line: in docs/contributing/architecture/data-storage.md lines
650-650, move `#1133` / `#1134` onto the preceding Workers prose; make the same
adjustment for `#1133` in docs/contributing/architecture/entitlements.md lines
158-158 and 364-364, keeping each reference attached to its preceding Worker
text.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 1d40718b-5602-40bf-9e25-7b418027bf83

📥 Commits

Reviewing files that changed from the base of the PR and between cd3686b and 659033c.

📒 Files selected for processing (10)
  • docs/contributing/architecture/data-storage.md
  • docs/contributing/architecture/entitlements.md
  • packages/worker/migrations/0126-drop-entitlement-daily-counters.sql
  • packages/worker/src/account/data-targets.node.test.ts
  • packages/worker/src/account/data-targets.ts
  • packages/worker/src/account/export.node.test.ts
  • packages/worker/src/app/account-retention-dispositions.node.test.ts
  • packages/worker/src/app/account-retention-dispositions.ts
  • packages/worker/src/entitlements/drop-entitlement-daily-counters-migration.node.test.ts
  • tools/migration-ledger.json
💤 Files with no reviewable changes (1)
  • packages/worker/src/app/account-retention-dispositions.ts

Comment thread docs/contributing/architecture/data-storage.md Outdated
Co-authored-by: Kent C. Dodds <me+github@kentcdodds.com>
@kody-bot
kody-bot merged commit a9c01a6 into main Aug 1, 2026
10 checks passed
@kody-bot
kody-bot deleted the cursor/meter-do-38c8 branch August 1, 2026 17:36
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.

3 participants