Skip to content

feat(ENG-79): add dispersal validators, types, and extract reusable schema validators#136

Merged
Connorbelez merged 1 commit intomainfrom
ENG79
Mar 19, 2026
Merged

feat(ENG-79): add dispersal validators, types, and extract reusable schema validators#136
Connorbelez merged 1 commit intomainfrom
ENG79

Conversation

@Connorbelez
Copy link
Copy Markdown
Owner

@Connorbelez Connorbelez commented Mar 18, 2026

Create dispersal domain types and validators

Create convex/dispersal/validators.ts with dispersalStatusValidator and calculationDetailsValidator, and convex/dispersal/types.ts with CalculationDetails, DispersalEntry, and ServicingFeeEntry types for the dispersal accounting domain. Refactor schema.ts to import these validators instead of using inline definitions for dispersal entries.

Summary by CodeRabbit

  • Chores
    • Reorganized dispersal system infrastructure with dedicated type and validator modules for improved code maintainability and consistency.

…chema validators

Create convex/dispersal/validators.ts (dispersalStatusValidator,
calculationDetailsValidator) and convex/dispersal/types.ts
(CalculationDetails, DispersalEntry, ServicingFeeEntry) for the
dispersal accounting domain. Refactor schema.ts to import these
validators instead of inline definitions.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@linear
Copy link
Copy Markdown

linear bot commented Mar 18, 2026

Copy link
Copy Markdown

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Sorry @Connorbelez, you have reached your weekly rate limit of 500000 diff characters.

Please try again later or upgrade to continue using Sourcery

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Mar 18, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: a584eb9b-40cc-46a9-a23d-b670a154075d

📥 Commits

Reviewing files that changed from the base of the PR and between 49cd90f and b075a97.

📒 Files selected for processing (3)
  • convex/dispersal/types.ts
  • convex/dispersal/validators.ts
  • convex/schema.ts

📝 Walkthrough

Walkthrough

Three new files introduce type definitions and validators for a dispersal payment system. Two new TypeScript modules define core types for calculation details, dispersal entries, and servicing fees, along with corresponding Convex validators. The existing schema file is refactored to use these centralized validators instead of inline definitions.

Changes

Cohort / File(s) Summary
Dispersal Type Definitions
convex/dispersal/types.ts
Introduces three exported types: CalculationDetails capturing pro-rata calculation audit fields, DispersalEntry modeling per-lender dispersal records with scheduling and linkage data, and ServicingFeeEntry representing servicing fee revenue.
Dispersal Validators
convex/dispersal/validators.ts
Adds two Convex validators: dispersalStatusValidator for the literal "pending" status and calculationDetailsValidator for numeric calculation detail fields.
Schema Refactoring
convex/schema.ts
Updates dispersalEntries table to use imported validators instead of inline definitions for status and calculationDetails fields.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 Organized with care, in types so neat,
Validators shared, the refactor complete,
Dispersal flows clear, with calculations blessed,
From chaos of inline, to structure at best! 🌟

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main changes: adding dispersal validators and types, plus extracting reusable schema validators from inline definitions.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch ENG79
📝 Coding Plan
  • Generate coding plan for human review comments

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 and usage tips.

Copy link
Copy Markdown
Owner Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

@Connorbelez Connorbelez marked this pull request as ready for review March 18, 2026 22:59
Copilot AI review requested due to automatic review settings March 18, 2026 22:59
Copy link
Copy Markdown

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

Connorbelez has reached the 50-review limit for trial accounts. To continue receiving code reviews, upgrade your plan.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR introduces a small “dispersal” domain module that centralizes Convex validators and TS types for dispersal accounting records, and refactors the main Convex schema to reuse those validators instead of inline definitions.

Changes:

  • Added convex/dispersal/validators.ts with reusable validators for dispersal status and calculation audit details.
  • Added convex/dispersal/types.ts with domain types (CalculationDetails, DispersalEntry, ServicingFeeEntry).
  • Refactored convex/schema.ts to import and use the new dispersal validators for dispersalEntries.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
convex/schema.ts Replaces inline status / calculationDetails validators for dispersalEntries with imports from the new dispersal module.
convex/dispersal/validators.ts Introduces reusable Convex validators for dispersal status and calculation detail fields.
convex/dispersal/types.ts Adds TS domain types to represent dispersal entries and the calculation audit payload in a shared location.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Copy Markdown
Owner Author

@coderabbitai please review

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Mar 19, 2026

@Connorbelez Sure, I'll review PR #136 right away!


🧠 Learnings used
Learnt from: Connorbelez
Repo: Connorbelez/tanstackTemplate PR: 5
File: specs/governed-transitions/chunks/chunk-01-schema-machine/context.md:209-213
Timestamp: 2026-03-13T03:17:24.805Z
Learning: In the Connorbelez/tanstackTemplate repository, do not flag .md files for markdown formatting/linting issues (e.g., MD040 fenced code block language). Only reference .md files (specs, PRDs, design docs) when they reveal architectural drift or implementation inconsistencies against actual code.

Learnt from: CR
Repo: Connorbelez/tanstackTemplate PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-03-16T16:49:07.648Z
Learning: After completing a major unit of work, run `coderabbit review --plain` to get a code review summary and check for potential issues or improvements

Learnt from: CR
Repo: Connorbelez/tanstackTemplate PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-03-16T06:17:10.192Z
Learning: After completing a major unit of work, run `coderabbit review --plain` to get a code review summary and check for potential issues or improvements

Learnt from: CR
Repo: Connorbelez/tanstackTemplate PR: 0
File: CLAUDE.md:0-0
Timestamp: 2026-03-16T16:48:37.308Z
Learning: After completing a major unit of work, run `coderabbit review --plain` to get a code review summary

Learnt from: CR
Repo: Connorbelez/tanstackTemplate PR: 0
File: .cursorrules:0-0
Timestamp: 2026-03-12T16:41:13.825Z
Learning: Applies to **/convex/schema.ts : Define Convex database schemas using `defineSchema` and `defineTable`, specifying required and optional fields with appropriate validators from the `v` builder

Learnt from: CR
Repo: Connorbelez/tanstackTemplate PR: 0
File: .cursorrules:0-0
Timestamp: 2026-03-12T16:41:13.825Z
Learning: Applies to **/convex/schema.ts : Use the `v` validator builder from Convex for schema validation, supporting types like v.string(), v.id(), v.number(), v.boolean(), v.optional(), v.array(), v.object(), v.union(), etc.

Learnt from: CR
Repo: Connorbelez/tanstackTemplate PR: 0
File: .cursorrules:0-0
Timestamp: 2026-03-12T16:41:13.825Z
Learning: Applies to **/convex/schema.ts : Use Convex built-in data types as documented, including VId for references, VOptional for nullable fields, VUnion for discriminated unions, and VArray for collections
✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@Connorbelez Connorbelez merged commit 663998d into main Mar 19, 2026
5 of 7 checks passed
@coderabbitai coderabbitai bot mentioned this pull request Mar 28, 2026
Connorbelez added a commit that referenced this pull request Apr 20, 2026
…chema validators (#136)

## Create dispersal domain types and validators

Create `convex/dispersal/validators.ts` with `dispersalStatusValidator` and `calculationDetailsValidator`, and `convex/dispersal/types.ts` with `CalculationDetails`, `DispersalEntry`, and `ServicingFeeEntry` types for the dispersal accounting domain. Refactor `schema.ts` to import these validators instead of using inline definitions for dispersal entries.

<!-- This is an auto-generated comment: release notes by coderabbit.ai -->

## Summary by CodeRabbit

* **Chores**
  * Reorganized dispersal system infrastructure with dedicated type and validator modules for improved code maintainability and consistency.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
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