Repository navigation
feat(insurance): add the Archera comparison route and error mapping - #797
Conversation
…atus endpoint Adds internal/archera (ARCHERA_ORG_ID, ARCHERA_PLAN_ID, ARCHERA_API_KEY_SECRET; key resolved lazily through the secret resolver, mutex-guarded so a failed resolve is retried) and GET /api/insurance/status, gated on view:recommendations plus an unrestricted account scope (scoped sessions get 404). Status reports setting presence by name only and makes no outbound call. The comparison endpoint follows in a separate PR. Refs #785 #786 Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Maps pkg/insurance.Comparison to an explicit snake_case DTO: exact decimal strings from big.Rat (null for unknown, error for non-terminating values, no float64), vendor strings stripped of control/format characters and capped at 256 bytes, per-offer AssessProductSupport (source and evidence only when supported), lease_attached, no org ID, currency null with a note, and the required Archera disclosures. The route follows in a separate PR. Refs #785 #786 Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
GET /api/insurance/comparison, behind the status route's gate (view:recommendations plus an unrestricted account scope, else 404). Vendor errors map to fixed client text, 429 surfaces Retry-After (header and JSON) only when the vendor gave a positive value, the vendor message and key are never returned or logged, and a response over 5 MiB fails instead of dropping rows. clientError gains optional response headers. Refs #785 #786 Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
|
Warning Review limit reached
This review includes 8 billable files and costs up to $2.00.
Reviews can continue after your included limit without a manual trigger. An admin must approve usage-based billing. Or wait 18 minutes for your next included review. View limit details
Comment |
…lden fixture One fixture gives every numeric field a distinct value (hundreds digit names the block, units digit the field) and compares the full JSON to a golden file; 25 field-mapping mutations (swaps, nils, blanked blocks, dropped term/payment/ is_current/provider) each fail. Also tests PlanID cleaning and passes the real testing.T to the number helpers. Refs #785 #786 Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The basis note said upfront figures are one-time dollars, but Archera provides no currency and the DTO reports currency null. Say one-time amounts, update the golden file, and test that no platform-authored note names a currency. Refs #785 #786 Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
|
Gate review at 9f422e6 (base retargeted to main after #796 merged; the tree diff against main is only this PR's 8 files): CHANGES REQUESTED (not merging). What holds (mutations run from git archive; each fails a test): the access gate removed; AllowsAll removed; HTTPError.Message passed through; err text logged; Retry-After sent when 0; Retry-After header renamed; 5xx mapped to non-502; the 5 MiB cap removed; hc non-nil in app.go; a filter added to the request; Findings:
|
…pin wiring Adds a HandleRequest-level test for the Retry-After header and retry_after_seconds (present when positive, absent at 0 or missing), pins the message for every mapped vendor status, and makes the app.go wiring test require the same provider instance in reinitializeAfterConnect. Refs #785 #786 Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
|
Gate re-run at a2736b5: CLEAN, merging.
|
PR2b-2 of #785, stacked on #796 (base is that branch; retarget to main after #796 merges). Security-sensitive: handles an API key path, authz and vendor error text.
Verification (local macOS, synthetic data, no live Archera calls): go build, vet, golangci-lint 0 issues, go test for every internal package, and go test -tags integration for internal/api, internal/server and internal/purchase, all exit 0.
Refs #785 #786
🤖 Generated with Claude Code