Skip to content

Tiered price: tierBehaviour type vs runtime/docs spelling mismatch (atmn 1.1.8) #87

Description

@helpingwithtech

Summary

In atmn@1.1.8, the tiered plan-item price field is inconsistent across the TypeScript type, the CLI runtime, the Zod schema, and the docs. The net effect is that the documented way of configuring tiers fails type-checking, while the type-checkable way is silently dropped at push time.

The mismatch (3 layers)

  • TS builder typePriceWithTiers (in compose/models/planModels.d.ts) declares tierBehaviour (British spelling) and marks it required:
    type PriceWithTiers = PriceBaseFields & {
        amount?: never;
        tiers: Array<{ to: number | "inf"; amount: number }>;
        tierBehaviour: "graduated" | "volume"; // British + required
    };
  • CLI runtime (dist/cli.js) reads the American tierBehavior when serialising to the push payload and when generating config:
    ...priceWithBilling.tierBehavior !== undefined && { tier_behavior: priceWithBilling.tierBehavior }
    // and: tierBehavior: api.price.tier_behavior
  • Zod schema (PlanItemSchema) uses snake_case tier_behavior and marks it optional.
  • Docs (Volume-Based Tiers, CLI tab) use the American tierBehavior, and the tiered example in cli/config omits it entirely (graduated is the default).

Effect / reproduction

Given a tiered price item:

  • Following the docs (tierBehavior: "volume", or omitting it) → tsc fails:
    error TS2322: ... Property 'tierBehaviour' is missing in type '...' but required in type 'PriceWithTiers'.
    
  • Using tierBehaviour (British) to satisfy the type → compiles, but the value is dropped at push (the serialiser reads tierBehavior), so volume can never be set via the CLI; Autumn always falls back to the graduated default.

Suggested fix

Align the builder type with the runtime + Zod + docs:

  • Rename PriceWithTiers.tierBehaviourtierBehavior (American), and
  • Make it optional (graduated is the documented default).

Verified on atmn@1.1.8 (latest at time of writing).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions