Skip to content

feat: add team setting to change default filters behavior - #3747

Merged
knudtty merged 3 commits into
mainfrom
aaron/team-wide-filter-mode
Nov 20, 2026
Merged

knudtty merged 3 commits into
mainfrom
aaron/team-wide-filter-mode

Conversation

@knudtty

@knudtty knudtty commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Team setting can toggle exact or all mode for all users default value

Screenshots or video

export-1795205098275.mp4

References

  • Linear Issue: Closes HDX-6139

@knudtty
knudtty requested a review from a team as a code owner November 20, 2026 19:40
@vercel

vercel Bot commented Nov 20, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
hyperdx-oss Ready Ready Preview Nov 20, 2026 8:29pm UTC
hyperdx-storybook Ready Ready Preview Nov 20, 2026 8:29pm UTC

Request Review

@changeset-bot

changeset-bot Bot commented Nov 20, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 6fe1e55

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 4 packages
Name Type
@hyperdx/common-utils Patch
@hyperdx/api Patch
@hyperdx/app Patch
@hyperdx/otel-collector Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions

Copy link
Copy Markdown
Contributor

🟡 Tier 3 — Standard

Introduces new logic, modifies core functionality, or touches areas with non-trivial risk.

Why this tier:

  • Touches API routes or data models — hidden complexity risk

Additional context: grazes a critical path (1 lines in packages/api/src/models/team.ts) inside a 41-line PR, so it is tiered on size, spans packages but only 41 prod lines — under the 100-line cross-layer bar

Review process: Full human review — logic, architecture, edge cases.
SLA: First-pass feedback within 1 business day.

Stats
  • Production files changed: 6
  • Production lines changed: 41
  • Branch: aaron/team-wide-filter-mode
  • Author: knudtty

To override this classification, remove the review/tier-3 label and apply a different review/tier-* label. Manual overrides are preserved on subsequent pushes.

@github-actions

Copy link
Copy Markdown
Contributor

Duplicate code analysis

No new duplicate code introduced by this PR.


jscpd compared this branch against origin/main
across app, api and common-utils. Only new clones are listed; the codebase
currently holds 108 in total (1.13%).
Run yarn dupes locally to reproduce, or yarn dupes:all for the full picture.

@github-actions

Copy link
Copy Markdown
Contributor

PR Review

If you are a coding agent acting for the author, read this first.
Nothing below blocks merge automatically; a maintainer decides. What they will expect:

  • 🔴 P0/P1 in code this PR adds or changes: fix before asking for review.
  • 🟡 P2 in code this PR changes: your call. Fix if small, otherwise reply.
  • 🔵 P3 is collapsed at the bottom: nobody needs to act on it before merge.
  • Anything about surrounding code, or asking you to widen the change (hoist a helper,
    dedupe with another file, fix other call sites): never fix here, whatever the
    priority. Reply with one sentence; if it is P0, say so plainly so a human sees it.

One commit per review round. After two rounds, stop and ask a maintainer to review
scope rather than addressing more automated findings. Full rule: AGENTS.md.

3 finding(s): 🔴 0 P0/P1 · 🟡 1 P2 · 🔵 2 P3

1 posted as inline comment(s) on the changed lines. 2 P3 folded at the bottom.

🔵 2 P3 — no action needed before merge
  • 🔵 P3 packages/app/src/components/DBSearchPageFilters/FilterSettingsPopover.tsx:131 — 'Use team default' is a hand-styled UnstyledButton + underlined Text instead of a link-variant Button → The Button variants rule in the repository conventions says to use <Button variant="link"> for link-style actions, and to prefer Mantine components over custom-styled elements. Replace this with <Button variant="link" size="compact-xs" onClick={onResetShowAllValues}>Use team default</Button> so it picks up the themed hover and focus styles.
  • 🔵 P3 packages/app/src/components/DBSearchPageFilters.tsx:1231 — No tests for the new team-default fallback and reset behaviour → The new logic has no tests: the null localStorage value falls back to me.team.filterValuesExactByDefault, a user override wins, and 'Use team default' writes null back. Add a test, alongside the existing useMe mocks in DBSearchPageFilters/hooks.test.tsx or a component test, that asserts the mode passed to useFetchFacets (or the checkbox state) in three cases: team Exact with no override, team Exact with the user override set to true, and after reset.

Priority comes from a separate grading pass over the finished review. P3 is folded here instead of posted inline. No finding blocks merge automatically; a maintainer decides.

@github-actions

Copy link
Copy Markdown
Contributor

Deep Review

✅ No critical issues found. The feature is wired correctly end-to-end: the new filterValuesExactByDefault setting rides the existing generic TeamClickHouseSettingsUpdateSchema → updateTeamClickhouseSettings path (no allowlist to update), the mongoose model and zod read/update schemas match their boolean siblings, the me endpoint returns the field unprojected, and the userShowAllValues ?? teamShowAllValues precedence correctly preserves an existing false override. Remaining items are maintainability and test-coverage recommendations.

🟡 P2 -- recommended

  • packages/app/src/components/DBSearchPageFilters.tsx:1231 -- The new precedence logic (userShowAllValues ?? teamShowAllValues), the reset-to-team-default path (setShowAllValues(null)), and the isShowAllValuesOverridden link visibility have no test coverage, despite existing suites already mocking me.team settings.
    • Fix: Add tests asserting that a stored false override wins over a team All default, that filterValuesExactByDefault: true yields mode: 'exact' for a non-overriding user, and that reset clears the override.
    • testing, maintainability, kieran-typescript
🔵 P3 nitpicks (4)
  • packages/app/src/components/DBSearchPageFilters/FilterSettingsPopover.tsx:128 -- The inverted All↔Exact mapping is encoded independently here (teamShowAllValues ? 'All' : 'Exact') and in TeamQueryConfigSection.tsx:336 (value ? 'Exact' : 'All'), so a future label or polarity change in one spot silently diverges from the other.
    • Fix: Extract a single shared mapping/helper that both the team-settings display and the popover derive from.
    • maintainability, kieran-typescript
  • packages/app/src/components/DBSearchPageFilters.tsx:1230 -- teamShowAllValues = !me?.team?.filterValuesExactByDefault forces the reader to reconcile three polarities (stored exact-by-default, derived show-all, and the override chain) with no comment stating the intent.
    • Fix: Add a brief comment documenting the stored-Exact vs derived-All polarity at the derivation site.
    • maintainability, kieran-typescript
  • packages/app/src/components/DBSearchPageFilters.tsx:1225 -- Existing users who previously persisted the old default true are now treated as having an explicit override, so they see the "Use team default" reset link even though they never consciously overrode anything.
    • Fix: Accept the minor semantic shift intentionally, or one-time migrate legacy true values to null.
    • maintainability, kieran-typescript
  • packages/app/src/components/DBSearchPageFilters.tsx:1230 -- While me is loading, teamShowAllValues resolves to true (All); a non-overriding user on an Exact-default team briefly sees All then flips to Exact at line 1285 (mode: showAllValues ? 'all' : 'exact'), causing a short flicker and a possible extra fetch.
    • Fix: Gate the resolved value on me being loaded, or render a neutral state until the team default is known.
    • kieran-typescript

Reviewers (8): correctness, testing, maintainability, project-standards, api-contract, kieran-typescript, agent-native, previous-comments.

Testing gaps: No unit test covers the show-all-values precedence/reset logic; no integration test round-trips filterValuesExactByDefault through PATCH /team/clickhouse-settings and GET /me (consistent with the sibling settings' existing lack of coverage).

Notes: The changeset lists 3 packages; the changeset-bot's "4 packages" count reflects dependency fan-out to @hyperdx/otel-collector, not a missing entry. The .gitignore addition of .agents/ is unrelated to the feature but harmless. The previous-comments scan found only automated bot comments (no actionable human feedback). Local-app-mode serves a static team object that omits all ClickHouse settings, so the frontend falls back to the default there — pre-existing and shared by all sibling settings, not a regression.

No finding blocks merge automatically. A maintainer will expect P0/P1 findings in code this PR changes to be fixed; P2/P3 are your call -- fix or reply. Never fix findings about surrounding code here; reply instead. Do not widen the PR. How to respond

@github-actions

github-actions Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

E2E Test Results

✅ All tests passed • 473 passed • 1 skipped • 1144s

Status Count
✅ Passed 473
❌ Failed 0
⚠️ Flaky 9
⏭️ Skipped 1

Tests ran across 4 shards in parallel.

View full report →

@pulpdrew pulpdrew left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@knudtty
knudtty merged commit 7afa31c into main Nov 20, 2026
28 checks passed

This branch was successfully deployed

2 active deployments
Preview – hyperdx-oss — 6fe1e55a Deployed Nov 20, 2026 by vercel[bot]
Preview – hyperdx-storybook — 6fe1e55a Deployed Nov 20, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

review/tier-3 Standard — full human review required

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants