Skip to content

Fix close-position request body#298

Merged
ian-monaco merged 2 commits into
mainfrom
fix/close-position-request-body
Apr 23, 2026
Merged

Fix close-position request body#298
ian-monaco merged 2 commits into
mainfrom
fix/close-position-request-body

Conversation

@ian-monaco
Copy link
Copy Markdown
Contributor

Summary

  • remove duplicated position_id from the close-position JSON payload
  • keep the position identifier path-only for /api/v1/positions/{position_id}/close
  • update the positions API unit test to lock the request contract

Verification

  • bun test packages/core/tests/unit/api/positions.test.ts
  • bun run check

The close-position endpoint identifies the position in the URL path. Sending position_id again in the JSON body now fails against the backend's deny-unknown-fields request schema, so the SDK only sends close parameters in the body.

Constraint: Backend expects /api/v1/positions/{position_id}/close with close_type payload only

Rejected: Loosen backend JSON parsing | would hide stale client contracts instead of fixing SDK request shape

Confidence: high

Scope-risk: narrow

Directive: Keep resource IDs in path-only bodies out of SDK JSON payloads unless the backend contract explicitly requires duplication

Tested: bun test packages/core/tests/unit/api/positions.test.ts; bun run check
@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Apr 22, 2026

🦋 Changeset detected

Latest commit: 1fd5d17

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 5 packages
Name Type
@0xmonaco/core Patch
@0xmonaco/contracts Patch
@0xmonaco/mcp-server Patch
@0xmonaco/react Patch
@0xmonaco/types Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@ian-monaco ian-monaco closed this Apr 22, 2026
The close-position SDK fix changes the published @0xmonaco/core package behavior, so it needs a patch changeset for the release pipeline.

Constraint: Changesets bot requires package-impact metadata for SDK release PRs
Confidence: high
Scope-risk: narrow
Tested: bun test packages/core/tests/unit/api/positions.test.ts
Tested: bun run check
Not-tested: Full package publish pipeline
@ian-monaco ian-monaco reopened this Apr 22, 2026
Copy link
Copy Markdown
Contributor Author

@ian-monaco ian-monaco left a comment

Choose a reason for hiding this comment

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

Review pass: no issues found in the close-position SDK contract change. The request now keeps position_id path-only, the unit test locks that body shape, and the added changeset covers the @0xmonaco/core patch release. Local verification: bun test packages/core/tests/unit/api/positions.test.ts; bun run check.

@ian-monaco ian-monaco merged commit d42eec5 into main Apr 23, 2026
5 checks passed
@ian-monaco ian-monaco deleted the fix/close-position-request-body branch April 23, 2026 13:14
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.

2 participants