Skip to content

fix(usage): keep projected reads off the buckets [ING-631] - #6440

Merged
vincent-pochet merged 1 commit into
mainfrom
fix/usage-projected-off-buckets
Sep 21, 2026
Merged

vincent-pochet merged 1 commit into
mainfrom
fix/usage-projected-off-buckets

Conversation

@vincent-pochet

Copy link
Copy Markdown
Collaborator

Stacked on #6268, review that one first.

Context

Part of the realtime usage project.

Projected usage is not computed with the rest of a fee: Fees::ProjectionService re-aggregates the
charge from the events at presentation time, over a window it rebuilds from the fee's persisted
properties. A computation serving its units from the pre-aggregated buckets while the projection
counts events renders a projection below the usage it projects.

Description

  • Keep a computation asked for projected usage on the events store, whatever the caller opted in to.

The three projected call sites do not ask for the buckets today, so nothing changes; the refusal
makes that a property of the computation rather than of every caller remembering it.

@lago-claude-ai-agent

Copy link
Copy Markdown
Contributor

Automated pre-review (advisory, not a required check) — verdict: PASS · CI green

PASS — The projected-read guard keeps the initial usage and serializer projection on the same event-backed source, while preserving bucket reads for current usage. The focused ClickHouse spec covers both the returned units and absence of a bucket fetch.

Base automatically changed from feat/usage-bucket-routing to main September 18, 2026 15:21
## Context

Projected usage is not computed with the rest of a fee: the presentation layer
calls `Fees::ProjectionService`, which re-aggregates the charge from the events
over a window it rebuilds from the fee's persisted properties. A computation
serving its units from the pre-aggregated buckets while the projection counts
events would render a projection below the usage it projects, which reads as a
nonsense number.

## Description

A computation asked for projected usage keeps reading events, whatever the
caller opted in to. The three projected call sites do not ask for the buckets
today, so nothing changes; the refusal makes that a property of the computation
rather than of every caller remembering it.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@vincent-pochet
vincent-pochet force-pushed the fix/usage-projected-off-buckets branch from f07cbb0 to 46222fe Compare September 18, 2026 15:31
@lago-claude-ai-agent

Copy link
Copy Markdown
Contributor

Automated pre-review (advisory, not a required check) — verdict: PASS · CI green

PASS — The centralized provider guard keeps projected usage and its presentation-time projection on the event source. The regression spec distinguishes bucket data from event data and verifies that projected reads skip the bucket fetch; no affected sibling path is left inconsistent.

@vincent-pochet
vincent-pochet merged commit debb483 into main Sep 21, 2026
12 checks passed
@vincent-pochet
vincent-pochet deleted the fix/usage-projected-off-buckets branch September 21, 2026 07:21
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