Repository navigation
Chore/replace as any with shoehorn - #2890
Vansh98789 wants to merge 3 commits into
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
| id: 'log-src', | ||
| kind: 'log', | ||
| traceSourceId: 'trace-src', | ||
| 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 |
|
@Vansh98789 Why is |
The |
|
@karl-power, could you let me know why this PR was closed? |
|
@Vansh98789 While the heart of this change is good, the changeset removed a critical file without explanation (and the file remains deleted in your changeset, despite your claim that it was just removed in git). |
|
Got your point, @teeohhem. The file you’re referring to is |
## Summary Replace unsafe mock assertions in the three issue-scoped test files. Reuse makeLogSource for complete log sources and satisfies TMetricSource for the metric fixture. Keep @total-typescript/shoehorn only for intentionally partial query-hook results, as requested by #2852. ## Latest conflict resolution Merged upstream main 6767349 normally in bb758b0. The sole conflict was scripts/ci/ratchet-baseline.json. Actual merged app counts are as-any 204, ts-ignore 0, eslint-disable 140, @source 0; other package baselines and upstream changes are retained. Counts are syntactic, not runtime validation. The PR remains limited to the original six files. No production changes, new helpers, factory moves, ratchet-rule changes, or changeset. ## Verification - Frozen Yarn install passed with peer warnings. - yarn lint:fix passed; make ci-lint, type checks, ratchet and OpenAPI sync passed on retry. - lint-staged passed serially with a 4 GiB Node heap; Knip passed. No hook bypass was used. Initial concurrent checks hit memory pressure; lint-staged exhausted its default heap and lint encountered a temporary missing file. - All three affected Jest suites passed: 43 tests. - Full make ci-unit run: common-utils 2652 tests / 72 snapshots, API 1075 tests / 2 snapshots, CLI 412 tests, hdx-eval 111 tests passed. The parallel app run had 3979 passes and 58 failures across 36 suites under resource pressure. - All 36 failed app suites passed when rerun serially without coverage: 598 tests. No timeout or code changes. The full parallel command itself was not green. - Release-notes and changeset-hash script tests passed separately: 49 tests. - Diff checks passed; working tree clean. ## Review scope The complete source fixtures remain in the existing factory module. fromPartial is confined to intentionally incomplete query-result state/methods, not source construction. Suggested factory relocation and broader mock cleanup remain outside this issue-scoped change. ## Preview N/A: test maintenance. Vouching and Vercel authorization remain maintainer-side processes. Fixes #2852 Related: #2890 (closed) Implemented and verified with Codex assistance. Co-authored-by: Drew Davis <6097246+pulpdrew@users.noreply.github.com>
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