Repository navigation
fix(api): getRecommendationDetail 404s on hidden recs (closes #214) - #839
Conversation
#214) getRecommendationDetail previously called ListRecommendations which runs applyAccountOverrides, so any rec hidden by an account-service override silently 404d on deep-link. The fix: - Add ID filter field to RecommendationFilter + SQL pushdown via payload->>'id' in buildRecommendationFilter. - Add Scheduler.GetRecommendationByID: fetches by ID bypassing applyAccountOverrides, still applies suppressions (suppressed = actively dismissed = 404), then calls ResolveAccountConfigsForRecs to compute hidden_by reasons. - Add overrideHiddenReasons helper (scheduler_overrides.go) to name each failing dimension: "enabled=false", "engine", "region", "resource_type". - getRecommendationDetail now calls GetRecommendationByID; propagates hidden_by into RecommendationDetailResponse.HiddenBy. - Add HiddenBy []string json:"hidden_by,omitempty" to RecommendationDetailResponse; add hidden_by? to TS interface. - Update SchedulerInterface in api and server packages. - Tests: 3 new scheduler unit tests (visible/hidden/absent) + updated handler tests to use GetRecommendationByID mock; mock.AssertExpectations wired via t.Cleanup on all detail-path test cases.
|
@coderabbitai review |
|
Warning Review limit reached
More reviews will be available in 22 minutes and 31 seconds. Learn how PR review limits work. Your organization has run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (12)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
✅ Actions performedReview triggered.
|
|
@coderabbitai full review |
✅ Actions performedFull review triggered. |
GetRecommendationByID was added to server.SchedulerInterface (issue #214) but testutil.MockScheduler was not updated, causing go vet to fail with interface satisfaction errors in internal/server and cmd/lambda packages. Also apply gofmt alignment to scheduler_overrides_test.go comment block.
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
Summary
getRecommendationDetailpreviously calledListRecommendationswhich runsapplyAccountOverrides, so a rec hidden by an account-service override silently 404d on deep-link (issue fix(api): getRecommendationDetail 404s on hidden recs instead of returning a 'filtered-out' marker #214). A deep-linked URL now returns the rec payload with ahidden_bymarker instead.Scheduler.GetRecommendationByIDfetches by ID, applies suppressions, and checks override reasons without dropping the rec.overrideHiddenReasonsnames each failing dimension (enabled=false,engine,region,resource_type).RecommendationDetailResponsegainshidden_by []string(omitempty); TSRecommendationDetailinterface gains optionalhidden_by?: string[].Test plan
go test github.com/LeanerCloud/CUDly/internal/scheduler/...passes (3 new cases: visible / hidden-by-override / absent)go test github.com/LeanerCloud/CUDly/internal/api/...passes (new hidden_by case + updated detail tests usingGetRecommendationByIDmock withAssertExpectations)go build ./...cleanenabled=falseoverride: 200 withhidden_by: ["enabled=false"]