Skip to content

fix(api): getRecommendationDetail 404s on hidden recs (closes #214) - #839

Merged
cristim merged 2 commits into
feat/multicloud-web-frontendfrom
fix/214-wave12
Jun 3, 2026
Merged

cristim merged 2 commits into
feat/multicloud-web-frontendfrom
fix/214-wave12

Conversation

@cristim

@cristim cristim commented May 28, 2026

Copy link
Copy Markdown
Member

Summary

  • getRecommendationDetail previously called ListRecommendations which runs applyAccountOverrides, 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 a hidden_by marker instead.
  • Suppressed recs (actively dismissed) still 404 — that case is intentional and a banner there would be noise.
  • New Scheduler.GetRecommendationByID fetches by ID, applies suppressions, and checks override reasons without dropping the rec. overrideHiddenReasons names each failing dimension (enabled=false, engine, region, resource_type).
  • RecommendationDetailResponse gains hidden_by []string (omitempty); TS RecommendationDetail interface gains optional hidden_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 using GetRecommendationByID mock with AssertExpectations)
  • go build ./... clean
  • Deep-link to a rec under enabled=false override: 200 with hidden_by: ["enabled=false"]
  • Deep-link to a fully-suppressed rec: 404
  • Deep-link to a genuinely absent rec: 404

#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.
@cristim cristim added triaged Item has been triaged priority/p3 Polish / idea / may never ship severity/low Minor harm urgency/eventually No deadline impact/few Limited audience effort/s Hours type/chore Maintenance / non-user-visible labels May 28, 2026
@cristim

cristim commented May 28, 2026

Copy link
Copy Markdown
Member Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented May 28, 2026 •

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

@cristim, we couldn't start this review because you've reached your PR review rate limit.

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 @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 7ab7dda1-d10c-4dda-a8c7-8b874b2d30dc

📥 Commits

Reviewing files that changed from the base of the PR and between 4956d66 and 90073b6.

📒 Files selected for processing (12)
  • frontend/src/api/recommendations.ts
  • internal/api/handler_per_account_perms_test.go
  • internal/api/handler_recommendations.go
  • internal/api/handler_recommendations_test.go
  • internal/api/mocks_test.go
  • internal/api/types.go
  • internal/config/store_postgres_recommendations.go
  • internal/config/types.go
  • internal/scheduler/scheduler.go
  • internal/scheduler/scheduler_overrides_test.go
  • internal/server/interfaces.go
  • internal/testutil/mocks.go
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/214-wave12

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai

coderabbitai Bot commented May 28, 2026

Copy link
Copy Markdown
Contributor
✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@cristim

cristim commented May 30, 2026

Copy link
Copy Markdown
Member Author

@coderabbitai full review

@coderabbitai

coderabbitai Bot commented May 30, 2026

Copy link
Copy Markdown
Contributor
✅ Actions performed

Full 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.
@cristim

cristim commented Jun 1, 2026

Copy link
Copy Markdown
Member Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jun 1, 2026

Copy link
Copy Markdown
Contributor
✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@cristim
cristim merged commit 04607ae into feat/multicloud-web-frontend Jun 3, 2026
5 checks passed
@cristim
cristim deleted the fix/214-wave12 branch June 3, 2026 12:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

effort/s Hours impact/few Limited audience priority/p3 Polish / idea / may never ship severity/low Minor harm triaged Item has been triaged type/chore Maintenance / non-user-visible urgency/eventually No deadline

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant