Migrates two metering gates from Doppler env vars to LaunchDarkly flags so ops can flip them per-env without a Vercel redeploy.
metronome-enabled-entities (string-array) replaces METRONOME_ENABLED_ENTITIES. Consumed by isMetronomeEntityEnabled() in delivery_gate.ts, which gates both the delivery path (deliverMetronomeEvent) and the request-path preflight (checkMeteringLimit).metronome-billing-go-live-date (string, ISO 8601) replaces METRONOME_BILLING_GO_LIVE_DATE. Read in deliverMetronomeEvent to grandfather orgs created before the cutoff. Empty / unparseable value keeps existing fail-closed behavior (every org treated as grandfathered, nothing bills).Both flags are already configured in LaunchDarkly with per-env defaults matching today's Doppler values.
File changes:
apps/apollo/src/common/lib/external/launchDarkly.ts — add 2 flag keys + 2 provider methods (getMetronomeEnabledEntities, getMetronomeBillingGoLiveDate).apps/apollo/src/lib/metering/delivery_gate.ts — isMetronomeEntityEnabled becomes async, reads from LD.apps/apollo/src/lib/metering/deliver_metronome_event.ts — await new async gate; shouldSkipToolCallsForPremium becomes async; cutoff parsed from LD with Number.isNaN(getTime()) fail-closed handling.apps/apollo/src/lib/metering/blocking.ts — await new async gate.apps/apollo/src/env.ts — drop both env vars (schema + process.env mapping).pnpm test:unit src/lib/metering/ — blocking.test.ts, deliver_metronome_event.test.ts, contracts.test.ts all green. Test mocks swapped from envState to ldState (mutating enabledEntities / billingGoLiveDate); the "fail-closed when unset" case now sets ldState.billingGoLiveDate = undefined.METRONOME_ENABLED_ENTITIES / METRONOME_BILLING_GO_LIVE_DATE will follow once this lands and a deploy confirms LD reads.🤖 Generated with Claude Code
Based on git blame analysis of 10 file(s):
| Contributor | Contribution | Files |
|---|---|---|
| Zen Agent | 38% | 4 |
| abir-taheer | 17% |
| 3 |
| haxzie | 12% | 5 |
| Dhawal Upadhyay | 7% | 3 |
| anshugarg15 | 5% | 3 |
Recommend: Zen Agent and shamsharoon. Zen Agent has recent edits across multiple core files (including launchDarkly yesterday) and broad familiarity with this area; shamsharoon made several metering changes and tests today and is the primary author for those modules, so they can quickly validate behavior and tests.
🤖 Based on git blame with recency weighting (recent edits count more).
:x: Patch coverage is 82.92683% with 7 lines in your changes missing coverage. Please review.
| Files with missing lines | Patch % | Lines |
|---|---|---|
| ...pps/apollo/src/common/lib/external/launchDarkly.ts | 58.82% | 7 Missing :warning: |
| Flag | Coverage Δ | |
|---|---|---|
| e2e-tests | 6.05% <58.53%> (+0.01%) | :arrow_up: |
| self-hosted-tests | 5.57% <9.75%> (-0.01%) | :arrow_down: |
| unit-tests | 58.95% <82.92%> (+<0.01%) | :arrow_up: |
Flags with carried forward coverage won't be shown. Click here to find out more.
| Files with missing lines | Coverage Δ | |
|---|---|---|
| apps/apollo/src/env.ts | 94.33% <ø> (-0.10%) | :arrow_down: |
| apps/apollo/src/lib/metering/blocking.ts | 84.89% <100.00%> (ø) | |
| ...apollo/src/lib/metering/deliver_metronome_event.ts | 100.00% <100.00%> (ø) | |
| apps/apollo/src/lib/metering/delivery_gate.ts | 100.00% <100.00%> (ø) | |
| ...pps/apollo/src/common/lib/external/launchDarkly.ts | 65.93% <58.82%> (-0.10%) | :arrow_down: |
... and 4 files with indirect coverage changes