Chore/replace as any with shoehorn - #2890
Conversation
|
|
@Vansh98789 is attempting to deploy a commit to the HyperDX Team on Vercel. A member of the Team first needs to authorize it. |
Greptile SummaryThe PR converts app test fixtures from
Confidence Score: 5/5The 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.
|
| 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. |
Reviews (4): Last reviewed commit: "Merge branch 'main' into chore/replace-a..." | Re-trigger Greptile
| timestampValueExpression: 'Timestamp', | ||
| resourceAttributesExpression: 'ResourceAttributes', | ||
| } as TSource; | ||
| }) as TSource; |
There was a problem hiding this comment.
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!
138fb3a to
43b172d
Compare
43b172d to
725e180
Compare
|
Hi @pulpdrew |
Summary
Replaces
as anymock fixtures in three app test files withfromPartial()from@total-typescript/shoehorn, and replaces the raw string'line' as anywith the typedDisplayType.Lineenum.as anyassertions 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 botheslint-disablesuppressions.DBTimeChart.test.tsx— Converted 7 fixtures (useSource×3,useMVOptimizationExplanation×3, plusdisplayType) and removed allas anysuppressions.DBRowSidePanel.viewTraceTimeFilter.test.tsx— ConvertedROOT_SOURCEand removed theeslint-disablesuppression.@total-typescript/shoehornas a dev dependency of@hyperdx/app.scripts/ci/ratchet-baseline.json(app.as-any215 → ~206,app.eslint-disable143 → ~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:
References
Fixes: #2852