Skip to content

feat(ladder): phase 1 - provider-neutral engine core (pkg/ladder) #1334

Closed

Description

@cristim

Part of LeanerCloud/cloud-commitments-go#27 (commitment laddering automation). Phase 1 of 4: provider-neutral engine core in a new pkg/ladder package (sibling of pkg/exchange, no internal/ or provider imports). Pure logic, no cloud calls.

PRs:

  1. Types + plan + capability interface: LayerType/LayerRole/ActionType/LadderMode/LadderCadence typed enums; LadderConfig, UsageBaseline (absent values as *float64, never 0-coerced), LayerState, PlannedAction (Rationale + DataSources + money as *big.Rat), LadderPlan.Explain() for the approval-email body; LadderCapability + narrow LadderStore interfaces. Table-driven tests.
  2. Allocation algorithm (allocate.go): baseline low-water-mark -> target (default 100% of baseline) -> gap -> three-layer split (base/flex/buffer) with utilization-protection clamp (never commit above observed floor); fail-loud HOLD on nil baseline; named constants for all defaults, config-overridable. Table-driven tests covering nil baseline, zero gap, buffer > gap, expiring commitments, clamp at floor.
  3. Tranche laddering (ladder.go): ramp schedule (reuse internal/config RampSchedule semantics) -> staggered tranche scheduled dates so term expiries never bunch up. Property-style tests on staggering.

Layer/role mapping: AWS = {EC2InstanceSP:base, ComputeSP:flex, ConvertibleRI:buffer}; Azure = {Reservation:base+buffer (exchangeable), SavingsPlan:flex}.

Activity

  1. cristim commented on Jul 3, 2026

    @cristim
    MemberAuthor

    PR 1 of 3 merged: #1338 (pkg/ladder core types, enums, plan rendering, capability interfaces) is in main. Remaining for phase 1: #1340 (allocation algorithm, now retargeted to main) and #1341 (tranche building, auto-follows). Recommend keeping this issue open until both land.

  2. cristim commented on Jul 27, 2026

    @cristim
    MemberAuthor

    Verification sweep against main (101f099fb) on 2026-07-27 finds this already resolved.
    Laddering phase 1 is complete: PRs #1338, #1340 and #1341 are all merged, and pkg/ladder has all 5 implementation files plus tests.
    Evidence: PRs #1338, #1340, #1341.
    Recommending close. Reopen if a later laddering phase needs its own tracking issue instead.

  3. cristim commented on Sep 2, 2026

    @cristim
    MemberAuthor

    Verified resolved at 3c0f8ac: pkg/ladder contains the typed enums, plan and capability interfaces, the Allocate three-layer allocation algorithm and the BuildTranches staggered-tranche builder, each with tests. Evidence: pkg/ladder/allocate.go:122 and pkg/ladder/ladder.go:72 (#1338, #1340, #1341). Residual axes checked: later phases are tracked by LeanerCloud/cloud-commitments-platform#70 and LeanerCloud/cloud-commitments-go#28, not this phase-1 issue. Closing as completed; reopen if the behaviour recurs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions