🐛 fix: align POST /opportunity body with OpportunityFormDataWithAgentSubmitter#696
Closed
arturasmckwcz wants to merge 2 commits into
Closed
🐛 fix: align POST /opportunity body with OpportunityFormDataWithAgentSubmitter#696arturasmckwcz wants to merge 2 commits into
arturasmckwcz wants to merge 2 commits into
Conversation
…Submitter NewOpportunity sent `agentId` (camelCase), which the backend ignored, so the opportunity was never linked to the agent. Rename to `agent_id` per the SDK contract. The create endpoint does not accept a contact object, so contact is now persisted via a follow-up PATCH /opportunity/:id; that PATCH is best-effort and does not fail the create. Bump need4deed-sdk to 0.0.110. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The submit button was only disabled while the mutation was pending, so an agent could submit before GET /agent/me resolved (or if it errored), sending agent_id: undefined and creating an unlinked opportunity. Disable submit until the agent is loaded, and bail in handleSubmit as defense-in-depth. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Collaborator
Author
|
Superseded by #693, which rewrote |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
NewOpportunity(the agent-authenticated "create opportunity" screen) posted toPOST /opportunity/with a body that didn't match the SDK contractOpportunityFormDataWithAgentSubmitter:agentId(camelCase). The endpoint expectsagent_id(snake_case), confirmed against both the SDK type (bumped toneed4deed-sdk@0.0.110) and the runtime swagger. Since the schema isadditionalProperties: true, the backend silently dropped the unknown key — so opportunities were never linked to their agent.contactobject that isn't part of the create contract, so the agent's contact details were silently dropped too.Fix
agentId→agent_idso the agent link actually binds.title,agent_id).PATCH /opportunity/:id(ApiOpportunityPatch.contact), chained inside a singlemutationFnso there's one toast and one navigation.need4deed-sdkto0.0.110.Testing
yarn typecheck✅yarn lint✅ (only pre-existing warnings in unrelated files)🤖 Generated with Claude Code