Skip to content

chore: More test file lint fixes - #3757

Open
pulpdrew wants to merge 4 commits into
drew/jest-mockedfrom
drew/more-test-lint-fixes
Open

pulpdrew wants to merge 4 commits into
drew/jest-mockedfrom
drew/more-test-lint-fixes

Conversation

@pulpdrew

Copy link
Copy Markdown
Contributor

Summary

This PR fixes more lint warnings in test files and lowers the lint baseline accordingly.

Screenshots or video

No behavior changes.

How to reproduce

How to test on Vercel preview

References

  • Linear Issue:
  • Related PRs:

@pulpdrew
pulpdrew added this pull request to stack #3756 November 21, 2026 15:04
@pulpdrew
pulpdrew requested a review from a team as a code owner November 21, 2026 15:04
@changeset-bot

changeset-bot Bot commented Nov 21, 2026 •

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: a3afe16

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

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

@vercel

vercel Bot commented Nov 21, 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 21, 2026 3:29pm UTC
hyperdx-storybook Ready Ready Preview Nov 21, 2026 3:29pm UTC

Request Review

@github-actions

github-actions Bot commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor

E2E Test Results

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

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

Tests ran across 4 shards in parallel.

View full report →

@pulpdrew pulpdrew changed the title Drew/more test lint fixes chore: More test file lint fixes Nov 21, 2026
@github-actions github-actions Bot added the review/tier-2 Low risk — AI review + quick human skim label Nov 21, 2026
@github-actions

github-actions Bot commented Nov 21, 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: 4 (+ 1235 in test files, excluded from tier calculation)
  • Branch: drew/more-test-lint-fixes
  • Author: pulpdrew

To override this classification, remove the review/tier-2 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

github-actions Bot commented Nov 21, 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:

  • 🔴 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 · 🟡 0 P2 · 🔵 3 P3

No inline comments. 3 P3 folded at the bottom.

🔵 3 P3 — no action needed before merge
  • 🔵 P3 packages/app/src/hooks/__tests__/useMetadata.test.tsx:464 — Parameters<typeof fromPartial<TSource>>[0][] hand-derives a type that shoehorn already exports as PartialDeep → Write the parameter as data: PartialDeep<TSource>[] (import PartialDeep from @total-typescript/shoehorn). That is how this same PR types mockHistory in hooks/__tests__/useAlertAnnotations.test.tsx:116.
  • 🔵 P3 packages/app/src/hooks/__tests__/useAvailableMetricNames.test.ts:48 — Deleting the mockQuery helper copies the default query fields into all four tests → Keep a typed helper instead, e.g. mockQuery = (o: PartialDeep<ReturnType<typeof useGetKeyValues>>) => mockUseGetKeyValues.mockReturnValue(fromPartial({ data: undefined, isLoading: false, isPlaceholderData: false, ...o })). That keeps the defaults in one place and still drops the cast.
  • 🔵 P3 packages/app/src/hooks/__tests__/useChartConfig.test.tsx:2190 — The promises now have types, but resolvePromise1/2/3 are still (value: any) => void, so resolved values go unchecked → Declare the resolvers as (value: ResponseJSON<Record<string, string | number>>) => void, matching the promise type (as resolveMockResponse1/3 already do at lines 1770 and 1834). The values passed to resolvePromiseN(...) are then type-checked and the leftover any goes away.

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

github-actions Bot commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor

Deep Review

✅ No critical issues found.

This PR is a mechanical test-file lint cleanup: as any casts replaced with typed helpers (fromPartial/fromAny from @total-typescript/shoehorn, jest.mocked), single-property result casts replaced with toMatchObject, string literals replaced with enum members, and two lint baselines lowered (oxlint --max-warnings 468→372 in packages/app/package.json, app.as-any 184→99 in scripts/ci/ratchet-baseline.json).

Independent verification confirmed the author's "no behavior change" claim:

  • The app.as-any: 99 baseline exactly matches the real word-anchored (\bas any\b) count in the app package, so the ratchet will not break CI.
  • fromPartial/fromAny are compile-time identity helpers, so every refactored mock returns a runtime-identical object; no field read by code-under-test was dropped.
  • Enum substitutions equal their prior string literals (SourceKind.Log === 'log', MetricsDataType.Gauge === 'gauge', etc.), so filtering logic is unaffected.
  • toMatchObject replacements preserve assertion strength — each prior cast checked a single property, which toMatchObject checks identically.
  • The null→undefined mock change in DBSearchPage.test.tsx hits the same if (!source) branch in useDefaultOrderBy, so coverage is unchanged.
🔵 P3 nitpicks (1)
  • packages/app/src/hooks/__tests__/useAvailableMetricNames.test.ts:26 — deleting the reusable mockQuery(overrides) helper makes its four call sites each re-spell the full data/isLoading/isPlaceholderData default set.
    • Fix: restore a thin typed helper that returns fromPartial({ data: undefined, isLoading: false, isPlaceholderData: false, ...overrides }) so each test specifies only the field it cares about.

Reviewers (5): correctness, testing, maintainability, project-standards, kieran-typescript.

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

This branch was successfully deployed

2 active deployments
Preview – hyperdx-storybook — a3afe16a Deployed Nov 21, 2026 by vercel[bot]
Preview – hyperdx-oss — a3afe16a Deployed Nov 21, 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-2 Low risk — AI review + quick human skim

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant