feat(core-shared): add withRateLimit wrapper and conformance enforcement

- Add withRateLimit(rateLimit, fn) in rate-limit/with-rate-limit.ts,
  attaching the RateLimited brand at DI bind time
- Extend wireUseCase to accept optional rateLimit?: IRateLimit and
  compose withRateLimit innermost (before analytics/audit); propagate
  __rateLimited through analytics + audit inline wrappers
- Extend withSpan and withCapture PROPAGATED_BRANDS to include
  __rateLimited so the outermost binding carries the brand
- Extend assertFeatureConformance to require __rateLimited brand when
  manifest.useCases[name].rateLimit.length > 0; refactored into
  helper functions to stay within complexity thresholds
- Add rateLimit?: IRateLimit to BindContext; default to NoopRateLimit
  in web-next bindAllProduction and bindAllDevSeed aggregators
- Unit tests for withRateLimit brand attachment, factory passthrough,
  and composition; synthetic fixture tests for conformance errors

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-05-20 09:00:31 +00:00
parent 24b2490d86
commit cb61f51ee1
12 changed files with 477 additions and 61 deletions

View File

@@ -1,18 +1,18 @@
{
"generatedAt": "2026-05-20T08:43:15.868Z",
"commit": "a478a8e",
"generatedAt": "2026-05-20T08:59:30.996Z",
"commit": "24b2490",
"repo": {
"statements": 97.41,
"branches": 92.31,
"functions": 97.18,
"lines": 97.41,
"statements": 97.43,
"branches": 92.35,
"functions": 97.21,
"lines": 97.43,
"counts": {
"lf": 5867,
"lh": 5715,
"brf": 1184,
"brh": 1093,
"fnf": 354,
"fnh": 344
"lf": 5910,
"lh": 5758,
"brf": 1190,
"brh": 1099,
"fnf": 358,
"fnh": 348
}
},
"byPackage": {
@@ -101,17 +101,17 @@
}
},
"@repo/core-shared": {
"statements": 98.15,
"branches": 96.12,
"functions": 92.73,
"lines": 98.15,
"statements": 98.21,
"branches": 96.19,
"functions": 92.98,
"lines": 98.21,
"counts": {
"lf": 1133,
"lh": 1112,
"brf": 335,
"brh": 322,
"fnf": 110,
"fnh": 102
"lf": 1176,
"lh": 1155,
"brf": 341,
"brh": 328,
"fnf": 114,
"fnh": 106
}
},
"@repo/core-ui": {