Skip to content

feat: cross-stack error taxonomy (#249) + aid_escrow MAX_ALLOWED_TOKENS guard (#233) - #1

Open
precy41 wants to merge 1 commit into
mainfrom
feat/error-taxonomy-249-and-allowlist-cap-233
Open

feat: cross-stack error taxonomy (#249) + aid_escrow MAX_ALLOWED_TOKENS guard (#233)#1
precy41 wants to merge 1 commit into
mainfrom
feat/error-taxonomy-249-and-allowlist-cap-233

Conversation

@precy41

@precy41 precy41 commented Jul 22, 2026

Copy link
Copy Markdown
Owner

Summary

Closes ChainForgee#249 and ChainForgee#233 in one PR.

ChainForgee#249 Cross-stack error taxonomy

  • Canonical source of truth: docs/errors.yaml (15 cross-service + 23 Soroban contract identifiers).
  • Backend (NestJS): src/common/errors/codes.ts mirrors the YAML; AllExceptionsFilter attaches errorCode on every ErrorResponse. Added optional errorCode field to ApiResponseDto.
  • AI service (FastAPI): schemas/error_codes.py mirrors the same enum (extends str for byte-identical JSON). HTTPException / RequestValidationError / AIServiceError / generic handlers and the body-size middleware all emit canonical strings. Fixed latent CODE_BODY_LENGTH_MISMATCH typo in _send_400_mismatch.
  • Parity tests: app/backend/src/common/errors/codes.spec.ts and app/ai-service/tests/test_error_codes.py guard both enums against drift.

ChainForgee#233 aid_escrow MAX_ALLOWED_TOKENS guard

  • Rust contract: MAX_ALLOWED_TOKENS = 32, new Error::TooManyAllowedTokens = 23 variant, length gate runs before per-token validate_token so a bogus 33rd address can't trigger extra host invocations.
  • Backend mapper: soroban-error.mapper.ts covers 19..23 in both the numeric map and the string-fallback map so they never silently fall through to the catch-all 500.
  • Tests: Rust covers rejection at length+1, per-token InvalidToken at length=32 (threshold pin), and constant-drift guard MAX_ALLOWED_TOKENS == 32. Backend mapper spec mirrors via numeric and string-fallback tests.

Follow-ups (post-merge)

  • Tighten substring matchers in mapContractErrorMessage (includes -> word-boundary anchors).
  • Optional dedicated REQUEST_TIMEOUT identifier for HTTP 408 instead of overloading UPSTREAM_TIMEOUT.

Refs ChainForgee#249, ChainForgee#233.

…LLOWED_TOKENS guard (ChainForgee#233)

Co-authored-by: ChainForge <noreply@chainforge.local>
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.

Shared error-code taxonomy module

1 participant