Accept policy_holder_id as an alias for id on policy-holder objects - #106
Closed
fuhrysteve wants to merge 1 commit into
Closed
Accept policy_holder_id as an alias for id on policy-holder objects#106fuhrysteve wants to merge 1 commit into
fuhrysteve wants to merge 1 commit into
Conversation
The backend's single-PH GET serializes policy_holder_id but not id, and customer portals that drive the wizard programmatically via the step callbacks (doneStep2 -> choosePolicyHolder) pass PH objects keyed the same way. With no id: - the 0.8.2 status view fetched .../policy_holder/undefined (routing 404 on the CORS preflight, summary silently missing) - credential re-submits fell back from PUT (update-in-place) to POST (create), stranding the original broken PH and accumulating duplicates Observed in production traffic from a customer portal starting with their 0.8.2 upgrade (2026-07-07); the PUT->POST fallback predates it. Fix: resolvePolicyHolderId() falls back to policy_holder_id, applied at the three boundaries where an id-less PH can enter: - setStep4 normalizes integrator-passed policyHolder objects before storing them in state - getPolicyHolder() backfills id on the single-PH GET response so the post-submit refresh paths keep a usable object in state - PolicyHolderDetail degrades to a summary-less status card instead of fetching when no id resolves
Contributor
Author
|
Wrong repo - dev PRs go to LakeEriePartners/stream-connect-js-sdk; this repo takes release PRs only. Re-opened there. |
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.
What
resolvePolicyHolderId()acceptspolicy_holder_idas an alias foridon policy-holder objects, applied at the three boundaries where an id-less PH can enter the SDK:setStep4normalizes integrator-passedpolicyHolderobjects before storing them in stategetPolicyHolder()backfillsidon the single-PH GET response (the backend serializespolicy_holder_idbut notidon that endpoint), so the post-submit refresh paths keep a usable object in statePolicyHolderDetaildegrades to a summary-less status card instead of fetching when no id resolvesStreamPolicyHolderShortgains an optionalpolicy_holder_idfield documenting the alias.Why
A customer portal drives the wizard programmatically via the step callbacks (
doneStep2→choosePolicyHolder) and passes PH objects carryingpolicy_holder_idbut noid. Verified in production traffic (nginx ES index, correlated withX-SDK-Versionfrom SDKLogger):.../policy_holder/undefined— a routing 404 on the CORS preflight, ~50/week across 18 member IPs. Silent to the member (the summary fetch is non-fatal) but the claim-sync summary never rendered.policyHolder.idundefined, a credential re-submit falls back from PUT (update-in-place) to POST (create). The backend POST upserts on (username, payer, user), so same-username fixes work — but a changed username creates a new PH and strands the original broken one as permanently "Invalid". That tenant shows 0 PUTs in 30 days (every other SDK customer PUTs routinely) and 842 duplicate member+payer PH groups.The one-line fix on the integrator side is to include
id, but any integrator round-tripping our own single-PH GET response hits the same trap, so the SDK should tolerate the alias.Testing
npm test(biome + tsc) greenid:resolvePolicyHolderIdprefersidand only falls back when it's null/undefined