Skip to content

Migrate position mutations to POST - #389

Open
silentgeckoaudit3801 wants to merge 9 commits into
Quantarq:mainfrom
silentgeckoaudit3801:api/post-position-mutations-216
Open

Migrate position mutations to POST#389
silentgeckoaudit3801 wants to merge 9 commits into
Quantarq:mainfrom
silentgeckoaudit3801:api/post-position-mutations-216

Conversation

@silentgeckoaudit3801

Copy link
Copy Markdown

Closes #216.

Changes:

  • moves /api/open-position and /api/close-position from GET to POST
  • adds IdempotencyKeyMiddleware and allows the Idempotency-Key CORS header
  • sends stable idempotency keys from the frontend mutation calls
  • updates position/outbox/frontend tests for POST and replay behavior

Validation:

  • parsed changed Python files with ast.parse
  • did not run the full project test suite locally because that would require installing/executing project dependencies in this environment

response = client.get(
f"/api/open-position?position_id={position_id}&transaction_hash=valid_transaction_hash"
)
assert response.status_code == 405
headers=headers,
)

assert first_response.status_code == 200
)

assert first_response.status_code == 200
assert second_response.status_code == 200

assert first_response.status_code == 200
assert second_response.status_code == 200
assert first_response.json() == "pending"
assert first_response.status_code == 200
assert second_response.status_code == 200
assert first_response.json() == "pending"
assert second_response.json() == "pending"
assert second_response.status_code == 200
assert first_response.json() == "pending"
assert second_response.json() == "pending"
assert mock_write.call_count == 1
@silentgeckoaudit3801

Copy link
Copy Markdown
Author

CI note: the only failing check I can see is Test Suite (Python 3.12), and its log fails before tests run while pulling postgres:16 from Docker Hub (context deadline exceeded). The 3.13 suite, integration tests, frontend test, lint, Bandit, and CodeQL checks completed successfully. I do not have permission to rerun the upstream job from this fork.

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.

Migrate open-position/close-position to POST

2 participants