Skip to content

feat(perf): add locust perf test for credential flows#418

Open
ctol3r wants to merge 1 commit into
mainfrom
codex/add-performance-test-report-for-qps
Open

feat(perf): add locust perf test for credential flows#418
ctol3r wants to merge 1 commit into
mainfrom
codex/add-performance-test-report-for-qps

Conversation

@ctol3r
Copy link
Copy Markdown
Owner

@ctol3r ctol3r commented Dec 27, 2025

Summary

  • add Locust load test for issuing, verifying and presenting credentials
  • document how to run performance suite

Testing

  • locust -f perf/locustfile.py --headless -u 1 -r 1 -t 2s --host http://localhost:4000 (fails: connection refused)
  • npm test (fails: npm error canceled)

Codex Task


Note

Introduces a Locust-based performance suite for credential flows.

  • Adds perf/locustfile.py to load test GraphQL issue (create), verify, and present steps against /graphql
  • Enforces SLO: exits non-zero if verify p95 latency exceeds 250ms via events.quitting check
  • Documents setup and headless run commands in perf/README.md

Written by Cursor Bugbot for commit ddc6bfc. This will update automatically on new commits. Configure here.

Why: need perf suite for issue/verify flows
What: add perf/locustfile.py and instructions
Risk: script assumes backend at localhost:4000; fails if server absent
Tests: locust -f perf/locustfile.py --headless -u 1 -r 1 -t 2s --host http://localhost:4000 (fails without server)
Docs: perf/README.md
@chatgpt-codex-connector
Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

Comment thread perf/locustfile.py
self.client.post("/graphql", json=verify_payload, name="verify")

present_payload = {"query": "query{credentials{id}}"}
self.client.post("/graphql", json=present_payload, name="present")
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale credential used when issue step fails

The self.credential_id instance variable is only initialized once in on_start() and persists across task iterations. If an issue request fails but a previous iteration succeeded, credential_id retains the old value, causing verify and present to run with a stale credential. This masks issue failures and gives misleading performance results since the test doesn't actually test a fresh "issue → verify → present" flow per iteration. The credential_id needs to be reset to None at the start of each issue_verify_present task execution.

Additional Locations (1)

Fix in Cursor Fix in Web

Comment thread perf/locustfile.py
stats = environment.stats.get("verify", "POST")
if stats and stats.get_response_time_percentile(0.95) > 250:
print("Verify p95 >250ms")
environment.process_exit_code = 1
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test passes silently when no verify requests occur

The quitting event handler only sets a non-zero exit code when stats exists AND p95 exceeds 250ms. If all issue requests fail (e.g., server down, endpoint broken), credential_id is never set, no verify requests are made, stats is None, and the test exits with code 0 (success). A completely broken system would pass the performance test, masking critical failures.

Fix in Cursor Fix in Web

Comment thread perf/locustfile.py
self.client.post("/graphql", json=verify_payload, name="verify")

present_payload = {"query": "query{credentials{id}}"}
self.client.post("/graphql", json=present_payload, name="present")
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GraphQL errors counted as success for verify/present

The verify and present requests don't use catch_response=True and don't validate the response body. GraphQL endpoints return HTTP 200 even for errors (with errors in the response body). Any GraphQL error responses would be recorded as successful requests in Locust stats, causing misleading p95 latency measurements and potentially passing a test where verifications are actually failing.

Fix in Cursor Fix in Web

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant