You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: .agents/skills/charges/SKILL.md
+4Lines changed: 4 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -459,6 +459,9 @@ Important behavior:
459
459
- stored-at filtering uses `stored_at < cutoff`
460
460
- the cutoff is the run's `StoredAtLT`
461
461
- the service-period end is expected to behave as exclusive in lifecycle tests
462
+
-`GetDetailedRatingForUsage(...)` owns the current-run filtering rule: only realization runs with `ServicePeriodTo < input.ServicePeriodTo` are prior runs; a current run already present on the charge must be ignored rather than stripped by mutating the charge in the caller
463
+
- minimum commitment is final-only for usage-based snapshots; detailed rating ignores it when the current service-period end is before the charge intent service-period end
464
+
- realtime/current totals should ignore minimum commitment before the charge intent service-period end and include it at/after the service-period end
462
465
463
466
This means late-arriving events can become eligible in later advances if their `stored_at` was previously too new but later falls before the next cutoff.
464
467
@@ -511,6 +514,7 @@ Use these conventions for lifecycle tests:
511
514
- use `streaming/testutils.WithStoredAt(...)` to simulate late events
512
515
- when testing stored-at cutoffs, remember the predicate is exclusive: an event with `stored_at == StoredAtLT` is excluded, and an event with `stored_at` before `StoredAtLT` is included
513
516
- when testing service-period cutoffs, remember the event-time window is half-open: an event with `event_time == ServicePeriodTo` is excluded
517
+
- prefer `streamingtestutils.NewMockStreamingConnector(...)` plus the real billing rating service when a usage-based rating test should exercise production quantity lookup, pricing, discounts, or commitments end-to-end
514
518
- prefer `clock.FreezeTime(...)` for exact `StoredAtLT` / `AllocateAt` assertions
515
519
- rely on the default billing profile unless the test explicitly needs customer-specific override behavior
516
520
- for credit-only charges (usage-based or flat fee), `Create(...)` itself may return an already-advanced charge — assert the returned charge's status, do not assume it will be `created`
0 commit comments