In apps/apollo/src/lib/events/handlers/usage_metered/handler.ts (lines 125, 170, 213), the three trackMeteredUsage call sites used as TrackMeteredUsageInput<...> to annotate the object literals. The as cast is a type assertion that bypasses structural checking: TypeScript accepts the object even if required dimension keys are missing or extra unknown keys are present.
Replacing each as with satisfies enforces that the literal conforms to the full TrackMeteredUsageInput<EntityType> contract (including the entity-specific dimensions shape derived from required_dimensions / optional_dimensions in the registry) while preserving the inferred type for downstream use. No object literals required changes because the dimensions were already structurally correct; the fix only adds the enforcement that was missing.
entities/tool_calls.ts, entities/premium_tool_calls.ts, and entities/sessions.ts to confirm all required dimensions are present and no extra unknown keys appear.MeteringDimensionsFromDefinition type maps required dims to required properties and optional dims to optional properties, confirming satisfies will correctly enforce the contract.check-types locally (no node_modules in isolated worktree). Relying on CI check-types as the gate.metering_dimension (the constant is as const so this is not expected), the type guard would pass but runtime delivery could be wrong. CI typecheck is the definitive validator.🤖 Generated with Claude Code