Skip to content

[codex] Align bulk usage validation#217

Open
pq198363-ops wants to merge 1 commit into
Agentpay-Org:mainfrom
pq198363-ops:bounty-89-bulk-usage-parity
Open

[codex] Align bulk usage validation#217
pq198363-ops wants to merge 1 commit into
Agentpay-Org:mainfrom
pq198363-ops:bounty-89-bulk-usage-parity

Conversation

@pq198363-ops

Copy link
Copy Markdown

Closes #89.

Summary

  • extract a shared validateUsageItem helper so single and bulk usage ingestion share identifier and request-count validation
  • reject disabled services per item in POST /api/v1/usage/bulk with error: "service_disabled"
  • preserve the bulk partial-success contract so valid rows still accumulate while invalid or disabled rows are reported by index
  • document the bulk validation and disabled-service behavior

Verification

  • RED: npm run build; $env:NODE_ENV='test'; node --test dist/usage-bulk-parity.test.js failed before implementation because disabled services and empty/oversized identifiers were accepted by the bulk endpoint
  • GREEN focused: npm run build; $env:NODE_ENV='test'; node --test dist/usage-bulk-parity.test.js passed 2 tests
  • Full: npx prettier --check README.md src/routes/usage.ts src/usage-bulk-parity.test.ts
  • Full: npm run lint
  • Full: clean dist/, npm run build, then $env:NODE_ENV='test'; node --test dist/*.test.js dist/**/*.test.js passed 91 tests across 11 suites
  • Full: git diff --check

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Apply the disabled-service guard and identifier length caps to the bulk usage endpoint

1 participant