Skip to content

Comments

fix: validate reset+price mutual exclusivity, remove description field#72

Open
autumnbillinginternalapp[bot] wants to merge 1 commit intonextfrom
jj/atmn-fixes
Open

fix: validate reset+price mutual exclusivity, remove description field#72
autumnbillinginternalapp[bot] wants to merge 1 commit intonextfrom
jj/atmn-fixes

Conversation

@autumnbillinginternalapp
Copy link

@autumnbillinginternalapp autumnbillinginternalapp bot commented Feb 19, 2026

Two atmn fixes (flagged by Ayush):

1. Validate reset + price conflict
A planFeature with both reset (free allocation) and price with amount/tiers (paid) should error — these are conflicting billing models. Added validation in push/validate.ts.

Example that now errors:

planFeature({
  feature_id: credits.id,
  included: 500_000,
  reset: { interval: "month" },
  price: { amount: 217, billing_method: "prepaid" },
})

2. Remove description field
Removed description from Plan model, builder, all transforms (apiToSdk, sdkToCode, sdkToApi), typegen config, and constants.

Files changed: 9 files across validate, models, builders, transforms, typegen, constants, and tests.


Summary by cubic

Enforces a validation that a planFeature cannot have both reset and price, and removes the Plan.description field across the codebase. This prevents conflicting billing models and simplifies the plan schema.

  • Bug Fixes

    • Block reset + price (amount or tiers) on the same planFeature with a clear error.
  • Migration

    • Remove description from all plan configs and usages; the field is no longer supported.

Written for commit f11a389. Summary will update on new commits.

Greptile Summary

Two fixes to the plan configuration system: validation for conflicting billing models and removal of unused description field.

Key Changes:

  • Bug fixes: Added validation to prevent planFeature from having both reset (free allocation) and price with amount/tiers (paid billing), which are conflicting billing models
  • API changes: Removed description field from Plan model across all layers (models, builders, transforms, typegen, tests)

Confidence Score: 2/5

  • This PR has a critical bug that will cause runtime failures in the push command
  • The validation logic addition is correct, but atmn/src/commands/push/push.ts still references plan.description which no longer exists on the Plan type. This will cause runtime errors when comparing/normalizing plans. The file has @ts-nocheck which prevented TypeScript from catching this.
  • Pay close attention to atmn/src/commands/push/push.ts - it contains a reference to the removed description field that must be fixed

Important Files Changed

Filename Overview
atmn/src/commands/push/validate.ts Added validation to prevent reset+price conflicts, logic is correct and well-documented
atmn/src/compose/models/planModels.ts Removed description field from Plan type definition
atmn/src/lib/transforms/sdkToApi/plan.ts Removed description from ApiPlanParams interface and transformation logic
atmn/src/commands/push/push.ts File references removed plan.description field in normalization function, causing runtime error

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[Plan Model<br/>planModels.ts] -->|removed description field| B[Builder Functions<br/>builderFunctions.ts]
    B -->|plan builder| C[User Config<br/>autumn.config.ts]
    C -->|push command| D[Validation<br/>validate.ts]
    D -->|NEW: validates reset+price conflict| E{Valid?}
    E -->|Yes| F[Transform SDK to API<br/>sdkToApi/plan.ts]
    E -->|No| G[Error: conflicting billing models]
    F -->|removed description| H[API Call]
    A -->|removed description| I[Transform API to SDK<br/>apiToSdk/plan.ts]
    I -->|pull command| C
    A -->|removed description| J[Code Generator<br/>sdkToCode/plan.ts]
    J -->|codegen| C
    K[Type Config<br/>typeConfigs.ts] -->|removed description default| B
Loading

Last reviewed commit: f11a389

(5/5) You can turn off certain types of comments like style here!

1. Added validation that planFeature cannot have both top-level 'reset'
   and 'price' with amount/tiers - these are conflicting billing models.
   reset = free allocation, price = paid usage.

2. Removed 'description' field from Plan model, builder, transforms,
   typegen config, and constants. Field is no longer supported.
@vercel
Copy link

vercel bot commented Feb 19, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
autumn-ui Error Error Feb 19, 2026 1:33pm

Request Review

Copy link

@cubic-dev-ai cubic-dev-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.

No issues found across 9 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Copy link

@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.

9 files reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

Comment on lines 426 to 428
Copy link

Choose a reason for hiding this comment

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

plan.description no longer exists on the Plan type (removed in this PR), this code will fail at runtime

Suggested change
// description field removed from Plan model
Prompt To Fix With AI
This is a comment left during a code review.
Path: atmn/src/commands/push/push.ts
Line: 426-428

Comment:
`plan.description` no longer exists on the `Plan` type (removed in this PR), this code will fail at runtime

```suggestion
	// description field removed from Plan model
```

How can I resolve this? If you propose a fix, please make it concise.

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.

0 participants