Skip to content

fix(ux): show account display name in Opportunities for non-admin users - #1434

Merged
cristim merged 2 commits into
mainfrom
fix/1419-account-display-name
Jul 17, 2026
Merged

cristim merged 2 commits into
mainfrom
fix/1419-account-display-name

Conversation

@cristim

@cristim cristim commented Jul 17, 2026

Copy link
Copy Markdown
Member

Summary

  • Switch loadRecommendations() from api.listAccounts() to api.listAccountsMinimal() in recommendations.ts
  • listAccounts() hits GET /api/accounts (requires admin view:accounts); non-admin users get a 403, .catch(()=>[]) silences it, the accountNamesCache stays empty, and every row shows the raw account UUID instead of the display name
  • listAccountsMinimal() hits GET /api/accounts/list which requires only view:recommendations - the same permission that gates the entire Opportunities page - so standard users get account names too
  • Add tests asserting listAccountsMinimal is called (not listAccounts), that the display name appears in the rendered row, and that the raw ID is still used as fallback when no matching account is found

Closes #1419

…rs (#1419)

Switch loadRecommendations() from api.listAccounts() to
api.listAccountsMinimal() to populate the accountNamesCache.

listAccounts() calls GET /api/accounts which requires the admin
view:accounts permission; non-admin users receive a 403, .catch(()=>[])
silences it, the cache stays empty, and every row falls back to showing
the raw account UUID.

listAccountsMinimal() calls GET /api/accounts/list which is gated on
view:recommendations — the same permission that governs the whole
Opportunities page — so standard users can resolve account names just
like admin users.

Add tests verifying listAccountsMinimal is called (not listAccounts),
that the display name appears in the rendered row, and that the raw ID
is still used as a fallback when no matching entry is found.

Closes #1419
@cristim cristim added triaged Item has been triaged priority/p3 Polish / idea / may never ship severity/low Minor harm urgency/this-quarter Within the quarter impact/few Limited audience effort/s Hours type/bug Defect labels Jul 17, 2026
@cristim

cristim commented Jul 17, 2026

Copy link
Copy Markdown
Member Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 17, 2026 •

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

You’ve reached a temporary PR review limit under our Fair Usage Limits Policy.

Your recent review volume is higher than typical usage, so adaptive limits are currently applied.

Next review available in: 10 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

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.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: a513dd08-a594-48af-8758-e6317ea1472a

📥 Commits

Reviewing files that changed from the base of the PR and between 473f69b and aa578be.

📒 Files selected for processing (5)
  • frontend/src/__tests__/recommendations-enabled-providers.test.ts
  • frontend/src/__tests__/recommendations-lookback.test.ts
  • frontend/src/__tests__/recommendations-permissions.test.ts
  • frontend/src/__tests__/recommendations.test.ts
  • frontend/src/recommendations.ts
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/1419-account-display-name

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

@coderabbitai

coderabbitai Bot commented Jul 17, 2026 •

Copy link
Copy Markdown
Contributor
✅ Action performed

Review finished.

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.

#1419)

The #1419 fix switched loadRecommendations() to api.listAccountsMinimal(),
but three sibling test suites mock ../api with listAccounts only. Without
a listAccountsMinimal stub the call returns undefined, loadRecommendations
throws before the toolbar/buttons render, and 38 assertions fail under the
full jest run (CI Frontend/Unit).

Add listAccountsMinimal: jest.fn().mockResolvedValue([]) to the ../api mock
in recommendations-permissions, recommendations-enabled-providers, and
recommendations-lookback so the full suite passes.
@cristim

cristim commented Jul 17, 2026

Copy link
Copy Markdown
Member Author

Fixed the failing sibling suites: added listAccountsMinimal: jest.fn().mockResolvedValue([]) to the ../api mock in recommendations-permissions.test.ts, recommendations-enabled-providers.test.ts, and recommendations-lookback.test.ts. These three suites mocked ../api with listAccounts only, so after the switch to listAccountsMinimal() the call returned undefined and loadRecommendations threw before rendering the toolbar (38 assertions failed).

Full jest run now exits 0: 78 suites passed, 2605 passed, 1 skipped. webpack build exits 0.

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 17, 2026 •

Copy link
Copy Markdown
Contributor

@cristim Thanks for fixing the sibling-suite mocks and validating the full Jest suite and webpack build. I’ll review the updated changes. 🐇

✅ Action performed

Review finished.

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 4edf2e1 into main Jul 17, 2026
19 of 21 checks passed
@cristim
cristim deleted the fix/1419-account-display-name branch July 17, 2026 10:36
@cristim

cristim commented Jul 17, 2026

Copy link
Copy Markdown
Member Author

Merged on the substantive CI signal (all Lint/Unit/Integration/Security/Build/E2E/Validate-Terraform green; only the non-blocking tflint pre-commit flake red) closes #1419.

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/bug Defect urgency/this-quarter Within the quarter

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug(ui): Account name shows account ID instead of display name for Standard users in Opportunities

1 participant