Summary
Promote Trawl's BillingQuotaService extraction up to Devkit so every downstream benefits.
Trawl extracted the quota/meter enforcement logic from billing.requireQuota.js into a dedicated BillingQuotaService.assertCanExecute(...) for testability and reuse (sharing the enforcement path with MCP tool callers). This promote-up task ports that extraction to Devkit.
Changes
- New:
modules/billing/services/billing.quota.service.js — assertCanExecute({ orgId, organization, user, resource, action }) — single source of truth for both legacy quota + meter mode enforcement
- Refactor:
modules/billing/middlewares/billing.requireQuota.js — now a thin wrapper around BillingQuotaService, behavior unchanged
- New tests:
modules/billing/tests/billing.quota.service.unit.tests.js — direct service-layer unit tests
- Updated tests:
modules/billing/tests/billing.quota.unit.tests.js — adapted to mock at the service boundary
Why
- Pure refactor — behavior is identical, Trawl has been running this in prod for weeks
- After merge +
/update-stack, Trawl's billing.requireQuota.js becomes byte-compatible with Devkit's
- All other downstreams (comes, montaine, pierreb, ism) inherit the service-layer extraction on their next
/update-stack
Plan reference
Infra plan Task D.1: docs/superpowers/plans/2026-05-30-trawl-devkit-perfect-alignment.md
Summary
Promote Trawl's
BillingQuotaServiceextraction up to Devkit so every downstream benefits.Trawl extracted the quota/meter enforcement logic from
billing.requireQuota.jsinto a dedicatedBillingQuotaService.assertCanExecute(...)for testability and reuse (sharing the enforcement path with MCP tool callers). This promote-up task ports that extraction to Devkit.Changes
modules/billing/services/billing.quota.service.js—assertCanExecute({ orgId, organization, user, resource, action })— single source of truth for both legacy quota + meter mode enforcementmodules/billing/middlewares/billing.requireQuota.js— now a thin wrapper aroundBillingQuotaService, behavior unchangedmodules/billing/tests/billing.quota.service.unit.tests.js— direct service-layer unit testsmodules/billing/tests/billing.quota.unit.tests.js— adapted to mock at the service boundaryWhy
/update-stack, Trawl'sbilling.requireQuota.jsbecomes byte-compatible with Devkit's/update-stackPlan reference
Infra plan Task D.1:
docs/superpowers/plans/2026-05-30-trawl-devkit-perfect-alignment.md