Skip to content

feat: Add Python backend API contract edge-case tests#5

Open
GautamKumarOffical wants to merge 1 commit into
jackjin1997:mainfrom
GautamKumarOffical:feat/api-contract-edge-tests
Open

feat: Add Python backend API contract edge-case tests#5
GautamKumarOffical wants to merge 1 commit into
jackjin1997:mainfrom
GautamKumarOffical:feat/api-contract-edge-tests

Conversation

@GautamKumarOffical

Copy link
Copy Markdown

Summary

Adds Python tests for backend API contract edge cases covering malformed payloads, async wrappers, and error response shape validation.

Changes

  • Added backend/api_contract.py with request validation helpers and error response construction
  • Added tests/backend_api/test_api_contract.py with 28 test cases covering:
    • Missing required fields returning structured contract errors
    • Invalid field types triggering validation errors
    • Pattern mismatch for email and symbol fields
    • Login credential validation (missing email, missing password, invalid format)
    • Order payload validation (missing symbol, invalid symbol format, invalid side/type, non-numeric quantity)
    • Error response shape assertions (code, message, request_id, details)
    • Async helper execution without requiring optional pytest plugins

Testing

  • python3 -m pytest -q tests/backend_api — all 28 tests pass
  • python3 build.py -m market — market module builds successfully
  • Diagnostic build log committed

Checklist

  • Tests pass locally
  • Diagnostic build log is committed
  • Fixtures isolated (no network dependencies)
  • Changes are scoped to the PR purpose

Signed-off-by: Gautam Kumar <gautamkumarofficial@users.noreply.github.com>
@coderabbitai

coderabbitai Bot commented Jun 19, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@GautamKumarOffical, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 57 minutes and 55 seconds. Learn how PR review limits work.

Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file).

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based credits.

🚦 How do rate limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan refill rate.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, the refill rate gradually slows as usage increases. The highest same-day bursts are limited more strictly.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: ed6e6ecd-e4d6-4d93-a09c-8636227a9220

📥 Commits

Reviewing files that changed from the base of the PR and between 2b54872 and 6c0d6e5.

📒 Files selected for processing (4)
  • backend/api_contract.py
  • diagnostic/build-209c3616.json
  • diagnostic/build-209c3616.logd
  • tests/backend_api/test_api_contract.py
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

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.

1 participant