Skip to content

feat(frontend/riexchange): inline column filters via shared lib (refs #166) - #789

Merged
cristim merged 3 commits into
feat/multicloud-web-frontendfrom
refactor/riexchange-column-filters
Jun 3, 2026
Merged

feat(frontend/riexchange): inline column filters via shared lib (refs #166)#789
cristim merged 3 commits into
feat/multicloud-web-frontendfrom
refactor/riexchange-column-filters

Conversation

@cristim

@cristim cristim commented May 28, 2026

Copy link
Copy Markdown
Member

Summary

Wires inline column filters to the RI Exchange reshape-recommendations
table using the helpers extracted in merged #570 (parseNumericFilter +
generic applyColumnFilters). Each column header now carries a filter
button that opens a popover; numeric columns get a free-text expression
input (supports >N, >=N, <N, <=N, N..M, exact match,
comma-separated OR), categorical columns get a checkbox list with an
"(All)" tri-state and a Clear footer.

Numeric predicates compare against the display-rounded cell value so
typing the figure the user sees (e.g. 95.0 for utilization) matches
the rendered cell.

Columns wired

  • Categorical — Source RI, Source instance type, Target instance type, Reason
  • Numeric — Source count, Target count, Utilization %, Normalized used, Normalized purchased

Scope guard

  • No changes to the convertible-RI table, exchange modal, automation
    settings, or exchange history.
  • No changes to the Plans or History modules — those land in sibling
    follow-up PRs that own their own state slices.
  • Count-spinner min/max HTML attributes on the modal are unrelated
    input bounds and are left alone.

Test plan

  • npm test -- riexchange — 65 suites pass, all 2149 tests green
  • npm test -- column-filters — shared-lib suite still green
  • npm test -- riexchange-column-filters — new 7-test regression
    suite covers expr, set, AND across kinds, invalid expr (skipped),
    display-rounded comparison, and clear-column semantics
  • npx tsc --noEmit clean

Refs #166.

@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/m Days type/feat New capability 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 8 minutes and 3 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: 9aaefe04-20fa-4c26-9b02-2c47e17f4dcf

📥 Commits

Reviewing files that changed from the base of the PR and between eb85a50 and 8bc017d.

📒 Files selected for processing (5)
  • frontend/src/__tests__/riexchange-column-filters.test.ts
  • frontend/src/__tests__/riexchange-permissions.test.ts
  • frontend/src/__tests__/riexchange.test.ts
  • frontend/src/riexchange.ts
  • frontend/src/state.ts
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch refactor/riexchange-column-filters

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

Rate Limit Exceeded

@cristim have exceeded the limit for the number of chat messages per hour. Please wait 54 minutes and 14 seconds before sending another message.

@cristim
cristim force-pushed the refactor/riexchange-column-filters branch from a3d6aa3 to 7ef4327 Compare June 1, 2026 17:04
@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 added 3 commits June 3, 2026 16:46
…lters slice

Mirrors the recommendations slice shape (extracted in #570) so the RI Exchange
reshape-recommendations table can wire inline column filters via the shared
applyColumnFilters helper.

Slice is independent of the recommendations slice — column-id shape is
reshape-specific (source/target instance types, normalized units, utilization
%), and persistence stays out of scope on this iteration to match the
existing pattern.

Refs #166.
Wires per-column filter popovers to the RI Exchange reshape-recommendations
table using the helpers extracted in merged #570 (parseNumericFilter +
applyColumnFilters). Categorical columns (Source RI, Source/Target instance
types, Reason) get a checkbox-list popover; numeric columns (Source/Target
count, Utilization %, Normalized used/purchased) get a free-text expression
popover that supports `>N`, `>=N`, `<N`, `<=N`, `N..M` ranges, exact match,
and comma-separated OR.

Numeric predicates compare against the display-rounded cell value so a user
typing the displayed figure (e.g. 95.0 for utilization) matches the cell
they see. Broken expressions are skipped (inline error in the popover)
rather than collapsing the table.

Filter state lives in the RI Exchange-specific slice on state.ts; no
cross-tab coupling.  No drive-by changes to the rest of the RI Exchange
page (convertible-RI table, exchange modal, automation settings, history).

Test-mocks for the riexchange + riexchange-permissions suites updated to
expose the new state getters/setters so the existing happy-path assertions
still pass.

Refs #166.
Adds focused regression coverage for the RI Exchange filter wiring on top
of the shared lib (issue #166 follow-up to merged #570):

  * empty filter record returns a defensive clone of the input
  * numeric expression filter narrows by predicate
  * categorical set filter narrows by membership
  * multiple filters AND together across kinds
  * broken numeric expressions are skipped rather than treated as match-none
  * numeric predicates compare against the display-rounded cell value
    (utilization toFixed(1) regression guard)
  * clearing a column drops its narrowing

The popover / state-slice / button-rendering wiring is exercised by the
existing riexchange test suite; this file pins the pure-function
contract the lib + extractor + precision composition relies on.

Refs #166.
@cristim
cristim force-pushed the refactor/riexchange-column-filters branch from 7ef4327 to 8bc017d Compare June 3, 2026 14:48
@cristim

cristim commented Jun 3, 2026

Copy link
Copy Markdown
Member Author

Rebased on feat/multicloud-web-frontend. Resolved one conflict in frontend/src/__tests__/riexchange.test.ts: the base's roles-to-group-membership auth migration (#914) changed the getCurrentUser mock to return groups: [...] instead of role: 'admin', while this PR added three column-filter state mocks (getRiExchangeColumnFilters, setRiExchangeColumnFilter, clearAllRiExchangeColumnFilters). Kept both additively: base's groups-form getCurrentUser plus the new column-filter mocks.

Verification post-rebase: npm run build clean (only the pre-existing entrypoint-size warning); all three riexchange suites pass (riexchange.test.ts, riexchange-permissions.test.ts, riexchange-column-filters.test.ts). The only failing suite is recommendations-lookback.test.ts, which this PR does not touch (pre-existing on base).

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jun 3, 2026

Copy link
Copy Markdown
Contributor

@cristim Thanks for the detailed rebase notes! The additive merge strategy (keeping both the groups-form getCurrentUser from #914 and the new column-filter mocks) sounds correct. Triggering a review now.


🧠 Learnings used
Learnt from: cristim
Repo: LeanerCloud/CUDly PR: 0
File: :0-0
Timestamp: 2026-05-05T15:44:54.463Z
Learning: In the LeanerCloud/CUDly repository, when a CodeRabbit review flags something as "outside-diff" that was already implemented in an earlier commit of the same PR, it is likely a stale-snapshot artifact where the review diff was generated against a pre-fix view. The inline comment convention `(CR pass on PR #<number> Finding N)` is used by the maintainer (cristim) to mark lines that were changed in direct response to a prior CodeRabbit review pass.
✅ 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

effort/m Days impact/few Limited audience priority/p3 Polish / idea / may never ship severity/low Minor harm triaged Item has been triaged type/feat New capability urgency/eventually No deadline

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant