Skip to content

feat: fetch key limit now applies per map - #3392

Merged
kodiakhq[bot] merged 3 commits into
mainfrom
aaron/map-filter-key-distribution
Oct 19, 2026
Merged

kodiakhq[bot] merged 3 commits into
mainfrom
aaron/map-filter-key-distribution

Conversation

@knudtty

@knudtty knudtty commented Oct 16, 2026

Copy link
Copy Markdown
Contributor

Summary

The fetch key limit now applies per map. Previously, the behavior was a bit random. If you find 100 LogAttributes, often times the ResourceAttributes wouldn't display in the filters at all, and values would not be fetched for any ResourceAttribute columns. Now, for a fetch key limit of n, there will be n keys attempting to fetch values instead of 100 total across all maps.

References

  • Linear Issue: Closes HDX-5752

@changeset-bot

changeset-bot Bot commented Oct 16, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: e2a57ba

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

This PR includes changesets to release 3 packages
Name Type
@hyperdx/app Patch
@hyperdx/api 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

@vercel

vercel Bot commented Oct 16, 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 Oct 19, 2026 2:57pm UTC
hyperdx-storybook Ready Ready Preview Oct 19, 2026 2:57pm UTC

Request Review

@github-actions

github-actions Bot commented Oct 16, 2026 •

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 125 in total (1.69%).
Run yarn dupes locally to reproduce, or yarn dupes:all for the full picture.

Comment thread packages/app/src/hooks/useMetadata.tsx Resolved
Comment thread packages/app/src/hooks/useMetadata.tsx Resolved
@github-actions

github-actions Bot commented Oct 16, 2026 •

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:

  • 🔴 critical or 🟠 major in code this PR adds or changes: fix before asking for review.
  • 🔵 minor in code this PR changes: your call. Fix if small, otherwise reply.
  • 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
    severity. Reply with one sentence; if it is critical, 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.

2 finding(s): 🔴 0 critical · 🟠 1 major · 🔵 1 minor

None could be anchored to changed lines; they are listed below.

Findings outside the changed lines

  • 🟠 packages/app/src/components/DBSearchPageFilters/hooks.ts:212 — The sidebar still cuts the key list at the first maxKeys keys overall, so it disagrees with the new per-map request → listRequestedFacets still gets escapedKeysToFetch.slice(0, maxKeys). When there are more than maxKeys keys, the ResourceAttributes keys whose values are now requested are not in requestedKeys. While values are loading they get no placeholder and are not added to pendingKeys. Once their values arrive, listRequestedFacets puts them at the end through its 'results the request didn't name' fallback (packages/app/src/components/DBSearchPageFilters/utils.ts:56), so they show up late and out of order. Move the per-map limit into one shared helper, for example limitKeysPerMapColumn(keys, max) next to parseKeyPath in common-utils. Call it from both useMultipleGetKeyValues and this useMemo so the two can't drift apart.
1 minor
  • 🔵 packages/app/src/hooks/__tests__/useMetadata.test.tsx:43 — The new test only checks the hook's arguments to getKeyValuesWithMVs, not what the filter sidebar lists → The test would still pass with the hooks.ts mismatch above, because nothing checks what the sidebar shows. In packages/app/src/components/DBSearchPageFilters/hooks.test.tsx, the existing case that sets useFilterKeysFetchLimit.mockReturnValue(1) uses one flat key list. Add a case with keys from two Map columns. Assert that a key from the second map appears in keyValues/pendingKeys while the request is in flight, in request order.

Severity is the reviewer's own estimate and is used for ordering, not filtering. No finding blocks merge automatically; a maintainer decides.

@github-actions

github-actions Bot commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

🔵 Tier 2 — Low Risk

Small, isolated change with no API route or data model modifications.

Why this tier:

  • Standard feature/fix — introduces new logic or modifies core functionality

Review process: AI review + quick human skim (target: 5–15 min). Reviewer validates AI assessment and checks for domain-specific concerns.
SLA: Resolve within 4 business hours.

Stats
  • Production files changed: 2
  • Production lines changed: 33 (+ 59 in test files, excluded from tier calculation)
  • Branch: aaron/map-filter-key-distribution
  • Author: knudtty

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

@greptile-apps

greptile-apps Bot commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge, with a non-blocking sidebar loading and ordering issue.

Fix All in Claude CodeFindings

  1. P2 Later maps lack loading rows ▶

Summary

The PR gives each Map column its own filter-value key limit.

  • Filter values load up to the configured limit from each Map column.

Reviews (4) · Last reviewed commit: "Merge branch 'main' into aaron/map-filte..." · Reviewed by Greptile

@github-actions

github-actions Bot commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

Deep Review

Scope: 3 files (useMetadata.tsx, TeamQueryConfigSection.tsx, test) + changeset, vs base 85675fc8.
Intent: Make the Filter Keys Fetch Limit apply per Map column so a wide Map (e.g. LogAttributes) no longer crowds out ResourceAttributes and other columns.
Mode: report-only.

✅ No critical issues found. Correctness review verified key/condition alignment, the count < maxKeys boundary, cache-key stability, and column grouping — all sound. One recommended test gap below.

🟡 P2 — recommended

  • packages/app/src/hooks/__tests__/useMetadata.test.tsx:512 — The new per-column limit test only exercises exact mode (getKeyValuesWithMVs); the all mode path (streamAllKeyValues with keyExpressions: limitedKeys at useMetadata.tsx:587) is equally changed but has no assertion that the limit is applied, so a regression on that branch would pass silently.
    • Fix: Add an all mode case (or parametrize the new test over ['all','exact']) asserting streamAllKeyValues receives keyExpressions equal to the limited key set.
    • testing, previous-comments
🔵 P3 nitpicks (3)
  • packages/app/src/hooks/useMetadata.tsx:548 — The per-column cap now fetches up to maxKeys keys per Map column plus one shared bucket, so value-lookup load scales with roughly maxKeys × (Map columns + 1) instead of maxKeys total; bounded (~3–4×) in practice but larger near the 1000 max. This is the intended tradeoff.

    • Fix: Confirm the inflated key count is acceptable at the configured maximum, or consider a global ceiling layered on top of the per-column cap.
  • packages/app/src/hooks/useMetadata.tsx:527 — The per-column limiting reduce mutates its accumulator and carries countByColumn scratch state that is discarded on destructure; a small extracted pure helper would read more directly and be unit-testable without the hook harness.

    • Fix: Extract the limiting logic into a module-level limitKeysPerColumn(keys, keyConditions, maxKeys) returning { limitedKeys, limitedKeyConditions }.
  • packages/app/src/components/TeamSettings/TeamQueryConfigSection.tsx:322 — The tooltip says the limit applies "per map column," but all top-level (non-Map) columns share a single '' bucket of size maxKeys, which the wording does not convey.

    • Fix: Note in the tooltip that non-Map columns share one bucket, or confirm top-level columns are few enough that the gap is immaterial.

Reviewers (6): correctness, testing, maintainability, kieran-typescript, performance, previous-comments.

Testing gaps:

  • all mode per-column limiting (streamAllKeyValues / keyExpressions) has no coverage — same issue as the open prior-review comment.
  • No case for sparse keyConditions (some entries undefined) to confirm limitedKeyConditions stays index-aligned with kept keys.

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 Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

E2E Test Results

✅ All tests passed • 436 passed • 1 skipped • 1546s

Status Count
✅ Passed 436
❌ Failed 0
⚠️ Flaky 2
⏭️ Skipped 1

Tests ran across 4 shards in parallel.

View full report →

@knudtty
knudtty force-pushed the aaron/map-filter-key-distribution branch from 7625bb7 to c934292 Compare October 16, 2026 18:34
@knudtty
knudtty force-pushed the aaron/map-filter-key-distribution branch from c934292 to 86aa449 Compare October 16, 2026 18:34
Comment thread packages/app/src/hooks/useMetadata.tsx Resolved
Comment thread packages/app/src/hooks/useMetadata.tsx Resolved
databaseName: chartConfig.from.databaseName,
tableName: chartConfig.from.tableName,
keyExpressions: keys.slice(0, maxKeys),
keyExpressions: limitedKeys,

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.

P2 Later maps lack loading rows

The hook now fetches keys beyond the first global maxKeys, but the sidebar still passes escapedKeysToFetch.slice(0, maxKeys) to listRequestedFacets. With 100 LogAttributes keys followed by ResourceAttributes, the resource filters get no loading rows. They appear only when their values arrive, and later maps follow completion order rather than request order.

Use the same per-map selection for the sidebar's requested-key list so these filters stay visible and keep their order while loading.

Fix in Claude Code Fix in Conductor Fix in Cursor Fix in Codex

@kodiakhq
kodiakhq Bot merged commit a89b324 into main Oct 19, 2026
31 checks passed
@kodiakhq
kodiakhq Bot deleted the aaron/map-filter-key-distribution branch October 19, 2026 15:03

This branch was successfully deployed

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

Labels

automerge review/tier-2 Low risk — AI review + quick human skim

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants