From 627d14ee312c0b6379bbf1d41c95fc0af6adadb3 Mon Sep 17 00:00:00 2001 From: Pierre Brisorgueil Date: Thu, 4 Jun 2026 21:02:59 +0200 Subject: [PATCH 1/2] docs(billing): document meter service as calc-agnostic; downstream cost semantics stay downstream --- modules/billing/README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/modules/billing/README.md b/modules/billing/README.md index d5e057c46..a14acc75b 100644 --- a/modules/billing/README.md +++ b/modules/billing/README.md @@ -2,6 +2,12 @@ Stripe-based billing with per-plan quota management and meter-based compute pricing. +## Module boundary — the meter service is calc-agnostic + +`billing.meter.service.js` converts a feature-keyed **USD cost map → meter units** via config ratios (`dollarsToUnitRatio`, per-plan `ratios`) and applies config knobs (`runBase`, `maxUnitsPerOperation`). It does **not** know what a run costs. + +**Downstream cost semantics — what a scrap/op costs, per-run infra base, product-specific floors/caps — live in the downstream's own cost module + config (e.g. Trawl `modules/costs`), never inline in this service.** An inline downstream patch here is silently wiped by `/update-stack`: a tier0 run-base floor added downstream inside a `billing.meter.service.js` copy was lost on the next stack sync, zero-ing metering for free-tier scrapes (trawl `#1293` → `#1316`). If a behaviour must live in this service, add it as a **default-off config knob**, never a hardcoded downstream rule. + ## Quota System ### Configuration From 9dac4f5ee8cccc722953bf2abd96966d3b20aa5e Mon Sep 17 00:00:00 2001 From: Pierre Brisorgueil Date: Fri, 5 Jun 2026 09:31:17 +0200 Subject: [PATCH 2/2] =?UTF-8?q?docs(billing):=20fix=20spelling=20=E2=80=94?= =?UTF-8?q?=20scrape/op,=20zeroing?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Per Copilot inline review: scrap/op → scrape/op (consistent with "scrapes" below), zero-ing → zeroing. --- modules/billing/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/billing/README.md b/modules/billing/README.md index a14acc75b..3d97d1ba0 100644 --- a/modules/billing/README.md +++ b/modules/billing/README.md @@ -6,7 +6,7 @@ Stripe-based billing with per-plan quota management and meter-based compute pric `billing.meter.service.js` converts a feature-keyed **USD cost map → meter units** via config ratios (`dollarsToUnitRatio`, per-plan `ratios`) and applies config knobs (`runBase`, `maxUnitsPerOperation`). It does **not** know what a run costs. -**Downstream cost semantics — what a scrap/op costs, per-run infra base, product-specific floors/caps — live in the downstream's own cost module + config (e.g. Trawl `modules/costs`), never inline in this service.** An inline downstream patch here is silently wiped by `/update-stack`: a tier0 run-base floor added downstream inside a `billing.meter.service.js` copy was lost on the next stack sync, zero-ing metering for free-tier scrapes (trawl `#1293` → `#1316`). If a behaviour must live in this service, add it as a **default-off config knob**, never a hardcoded downstream rule. +**Downstream cost semantics — what a scrape/op costs, per-run infra base, product-specific floors/caps — live in the downstream's own cost module + config (e.g. Trawl `modules/costs`), never inline in this service.** An inline downstream patch here is silently wiped by `/update-stack`: a tier0 run-base floor added downstream inside a `billing.meter.service.js` copy was lost on the next stack sync, zeroing metering for free-tier scrapes (trawl `#1293` → `#1316`). If a behaviour must live in this service, add it as a **default-off config knob**, never a hardcoded downstream rule. ## Quota System