Skip to content

Chore/replace as any with shoehorn - #2890

Open
Vansh98789 wants to merge 3 commits into
hyperdxio:mainfrom
Vansh98789:chore/replace-as-any-with-shoehorn
Open

Chore/replace as any with shoehorn#2890
Vansh98789 wants to merge 3 commits into
hyperdxio:mainfrom
Vansh98789:chore/replace-as-any-with-shoehorn

Conversation

@Vansh98789

Copy link
Copy Markdown

Summary

Replaces as any mock fixtures in three app test files with fromPartial() from @total-typescript/shoehorn, and replaces the raw string 'line' as any with the typed DisplayType.Line enum.

as any assertions bypass type-checking entirely, so a renamed or retyped field can silently pass through the test. fromPartial({...}) keeps the same brevity while still type-checking every field that is provided, meaning breaking changes to mocked types now fail at compile time.

Changes

  • MetricTableModelForm.test.tsx — Converted 2 fixtures (SAVED_SOURCE, switched-kind source) and removed both eslint-disable suppressions.
  • DBTimeChart.test.tsx — Converted 7 fixtures (useSource ×3, useMVOptimizationExplanation ×3, plus displayType) and removed all as any suppressions.
  • DBRowSidePanel.viewTraceTimeFilter.test.tsx — Converted ROOT_SOURCE and removed the eslint-disable suppression.
  • Added @total-typescript/shoehorn as a dev dependency of @hyperdx/app.
  • Re-baselined scripts/ci/ratchet-baseline.json (app.as-any 215 → ~206, app.eslint-disable 143 → ~139).

All three suites pass, lint and typecheck are clean, and the ratchet baseline only moved downward.

Screenshots or video

N/A — no UI changes.

How to test on Vercel preview

N/A — non-UI change. Covered by unit tests:

yarn workspace @hyperdx/app jest \
  src/components/__tests__/MetricTableModelForm.test.tsx \
  src/components/__tests__/DBTimeChart.test.tsx \
  src/components/__tests__/DBRowSidePanel.viewTraceTimeFilter.test.tsx

References

Fixes: #2852

@changeset-bot

changeset-bot Bot commented Aug 12, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 41c31ca

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 Aug 12, 2026

Copy link
Copy Markdown

@Vansh98789 is attempting to deploy a commit to the HyperDX Team on Vercel.

A member of the Team first needs to authorize it.

@greptile-apps

greptile-apps Bot commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

The PR converts app test fixtures from as any to fromPartial, uses the typed chart display enum, adds ShoeHorn as an app development dependency, and deletes the API MongoDB model entry module.

  • Reworks fixtures in three component test suites.
  • Adds @total-typescript/shoehorn to the app workspace and lockfile.
  • Removes packages/api/src/models/index.ts.

Confidence Score: 5/5

The PR appears safe to merge based on the eligible blocking findings in this follow-up review.

No blocking failure remains in the PR-wide scoring set.

Important Files Changed

Filename Overview
packages/api/src/models/index.ts Deletes the API module that previously contained MongoDB connection setup and shared exports.
packages/app/package.json Adds @total-typescript/shoehorn as a development dependency.
packages/app/src/components/tests/DBRowSidePanel.viewTraceTimeFilter.test.tsx Converts the root source fixture to use fromPartial.
packages/app/src/components/tests/DBTimeChart.test.tsx Converts hook-result fixtures to fromPartial and replaces the raw display-type assertion with DisplayType.Line.
packages/app/src/components/tests/MetricTableModelForm.test.tsx Converts metric-source fixtures to use fromPartial.
yarn.lock Locks @total-typescript/shoehorn version 0.1.2.

Fix All in Greploop

Reviews (4): Last reviewed commit: "Merge branch 'main' into chore/replace-a..." | Re-trigger Greptile

timestampValueExpression: 'Timestamp',
resourceAttributesExpression: 'ResourceAttributes',
} as TSource;
}) as TSource;

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 Redundant fixture type assertions

fromPartial<TSource> already returns TSource, so the trailing as TSource is unnecessary and conflicts with the repository guidance to prefer inference over casts. The same redundant pattern appears on the newly converted fixtures in DBTimeChart.test.tsx and MetricTableModelForm.test.tsx, obscuring that fromPartial itself supplies and validates the target type.

Context Used: CLAUDE.md (source)

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

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

@Vansh98789
Vansh98789 force-pushed the chore/replace-as-any-with-shoehorn branch 2 times, most recently from 138fb3a to 43b172d Compare August 12, 2026 18:08
@Vansh98789
Vansh98789 force-pushed the chore/replace-as-any-with-shoehorn branch from 43b172d to 725e180 Compare August 12, 2026 18:16
@Vansh98789

Copy link
Copy Markdown
Author

Hi @pulpdrew
Deep review is failing due to pull_request_target fork-checkout restrictions since this is from a fork -might need maintainer approval or a workflow tweak.
Thanks

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Replace as any mock fixtures in three app test files with shoehorn

3 participants