Repository navigation
refactor(api): take the confidence-badge thresholds from pkg/exchange - #1453
Conversation
confidenceBucketFor kept its own copies of the 200/3/50 cut-offs because the pinned pkg did not export them yet. The pin (ff6225d5ff04) now exports exchange.ConfidenceHighSavingsUSD, ConfidenceHighMinCount and ConfidenceMediumSavingsUSD, so use them directly. The drawer badge and the reshape ranking it accompanies can no longer drift apart. Behaviour is unchanged: the boundary table in handler_recommendations_test.go still pins the literal values. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Warning Review limit reached
This review includes 1 billable file and costs up to $0.25. Or wait 59 minutes for your next included review. View limit details
Comment |
|
Independent review (IAmJSD's agent, fresh context, given only the diff, the issue and the PR text): VERDICT: APPROVE Blocking:
Non-blocking:
Attacked: Read the pinned Body-stale: none Reviewer: rD2. Bar while the maintainers are away (set by IAmJSD as acting owner): one approving independent review on the head, two for money, auth and security paths. |
|
Local verification at |
|
Merged by IAmJSD's agent at IAmJSD's request (IAmJSD is acting owner while the maintainers are away), under the bar IAmJSD set: 1 approving independent review(s) on |
Closes #343
Why
The confidence badge in the recommendation drawer (
confidenceBucketFor) kept its own copies of the 200 / 3 / 50 cut-offs, whilepkg/exchangescores the reshape ranking that the badge accompanies. A comment said to alias them once thecloud-commitments-go/pkgpin exported the constants. The pin on main (ff6225d5ff04) now exportsexchange.ConfidenceHighSavingsUSD,ConfidenceHighMinCountandConfidenceMediumSavingsUSD.What
internal/api/handler_recommendations.go: deletes the three local constants.confidenceBucketFornow compares againstexchange.ConfidenceHighSavingsUSD,exchange.ConfidenceHighMinCountandexchange.ConfidenceMediumSavingsUSD. The doc comment is updated to match. Behaviour is unchanged.The other two acceptance items on #343 were already on main:
setCacheHeaderscallscacheControlForExt(A06-020, refactor(server/api): share the Cache-Control table and name the confidence thresholds #1266).handler_recommendations_test.go.With this PR, nothing is left on the issue.
Verification
handler_recommendations_test.gopins the literal values (200 / 199.99, count 3 / 2, 50 / 49.99, count 0 and negative). It passes unchanged, which proves the exchange constants equal the old literals.go build ./... && go vet ./... && go vet -tags integration ./... && (cd tests/e2e && go vet -tags e2e ./...): pass.golangci-lintv2.10.1 on./internal/api/..., with and without--build-tags integration: 0 issues.gocyclo -over 10 internal/api/handler_recommendations.go: nothing reported.go test -race -short -count=1 ./internal/api/: ok.go test -race -tags integration -count=1 ./internal/api/: everything passed exceptTestRIExchangeTokenRoutes_Integration_MissingAnswersLikeWrongTokenandTestApproveRIExchange_Integration_SessionMissingIs404. Both failed while starting their own Postgres container (wait until ready ... context deadline exceeded) on a heavily loaded shared host (load average about 35). Neither test touches the recommendation drawer. On rerun, the first passed. The second hit the same container-start timeout twice, so this run has no local result for it; CI covers it.scripts/test-git-secrets-allowlist.sh: 183 PASS, 0 FAIL.🤖 Generated with Claude Code