Skip to content

chore: Make common-utils type checking faster - #3486

Merged
kodiakhq[bot] merged 1 commit into
mainfrom
drew/faster-type-checking
Oct 29, 2026
Merged

kodiakhq[bot] merged 1 commit into
mainfrom
drew/faster-type-checking

Conversation

@pulpdrew

Copy link
Copy Markdown
Contributor

Summary

Generates @hyperdx/common-utils type declarations with tsc + tsc-alias instead of tsup's DTS bundler. The bundler (rollup-plugin-dts) takes about 3× the time and memory.

packages/common-utils main This branch
yarn build (Docker/CI) 12.6–13.8 s, 1.9–2.3 GB peak RSS 4.7 s, 0.64–0.66 GB
yarn dev:build (yarn dev) 15.2–17.0 s, 2.2–2.7 GB 5.8–7.0 s, 0.59–0.66 GB

Changes:

  • tsup.config.ts: dts: false. This also drops the ignoreDeprecations workaround for the baseUrl that tsup's DTS bundler injected.
  • tsconfig.build.json (new): emits declarations only and excludes tests.
  • package.json: build runs tsup && yarn build:types. dev:build and ci:build call build. Before, dev:build ran tsup's DTS and then overwrote it with tsc output, so local dev already used tsc-emitted declarations.
  • src/core/handlebarsEnv.ts: HandlebarsTemplateDelegate → Handlebars.TemplateDelegate. The global name made tsc emit a .d.ts that never imports handlebars.

@vercel

vercel Bot commented Oct 28, 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 28, 2026 10:47pm UTC
hyperdx-storybook Ready Ready Preview Oct 28, 2026 10:47pm UTC

Request Review

@changeset-bot

changeset-bot Bot commented Oct 28, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 5427c12

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

@github-actions github-actions Bot added the review/tier-2 Low risk — AI review + quick human skim label Oct 28, 2026
@github-actions

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: 4
  • Production lines changed: 35
  • Branch: drew/faster-type-checking
  • 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 114 in total (1.41%).
Run yarn dupes locally to reproduce, or yarn dupes:all for the full picture.

@github-actions

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.

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

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

Findings outside the changed lines

1 minor
  • 🔵 nx.json:42 — nx.json comment is now out of date: ci:build no longer runs "tsup alone, no tsc --emitDeclarationOnly" → After this PR, ci:build, dev:build and build in packages/common-utils/package.json all run tsup && yarn build:types, so they write the same dist. The comment on the dev:build target in nx.json (lines 39-44) still says they write different dists. Reword it to keep only the general point (without outputs, a cache hit replays the log but leaves dist stale) and drop the claim that ci:build and dev:build produce different output, so the next reader doesn't go looking for a difference that no longer exists.

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

@greptile-apps

greptile-apps Bot commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; no actionable issues were found.

Summary

Moves declaration generation for @hyperdx/common-utils from tsup to tsc and tsc-alias.

  • Common-utils builds its declarations separately from its JavaScript.
  • Handlebars helpers use the package’s own compiled-template type.

No actionable issues were found. Builds were not run.

Reviews (1) · Last reviewed commit: "chore: Make common-utils type checking f..." · Reviewed by Greptile

@github-actions

Copy link
Copy Markdown
Contributor

Deep Review

✅ No critical issues found.

This is a low-risk build-config change: @hyperdx/common-utils now emits .d.ts via tsc --emitDeclarationOnly + tsc-alias instead of tsup's DTS bundler, plus a type-only rename in handlebarsEnv.ts. Six reviewers verified the declaration-emit setup, the published type surface, and the Handlebars namespace rename; none found a production-breaking or correctness regression.

Verified sound during review:

  • tsconfig.build.json correctly inherits declaration: true / outDir / rootDir / @/* paths from tsconfig.json, so emitDeclarationOnly: true is valid and emits .d.ts only.
  • Build order tsup && yarn build:types is safe — tsup's clean: true runs before tsc writes declarations, so nothing is clobbered.
  • Handlebars.TemplateDelegate resolves via the default import Handlebars from 'handlebars' under esModuleInterop, and matches the return type of hb.compile(...); the rename makes the emitted .d.ts self-contained instead of depending on an ambient global.
  • Test files in src/__tests__/ are excluded from the declaration build, and tsc emits one .d.ts per source file at the dist/<path> locations consumers deep-import.
🔵 P3 nitpicks (1)
  • packages/common-utils/tsconfig.build.json:6 — the test-exclusion list diverges in wording from the one in tsup.config.ts (src/**/__tests__/** + src/**/*.test.ts vs tsup's !src/__tests__/** + !src/**/*.test.*); outputs coincide today but a future non-test helper placed under a __tests__ directory would be compiled by tsup yet dropped from declarations.
    • Fix: Align the two exclusion patterns or add a comment in each config cross-referencing the other so they stay in sync.

Reviewers (6): correctness, testing, maintainability, project-standards, api-contract, kieran-typescript.

Testing gaps: No automated check asserts that every consumer deep-import path (e.g. dist/core/metadata, dist/filters) has both a .js and a matching .d.ts after build, nor that @/* aliases are fully rewritten (no residual from '@/') in the emitted declarations — a post-build smoke step would catch any tsc/tsc-alias regression in the new sole declaration path.

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

Copy link
Copy Markdown
Contributor

E2E Test Results

✅ All tests passed • 458 passed • 1 skipped • 1886s

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

Tests ran across 4 shards in parallel.

View full report →

@kodiakhq
kodiakhq Bot merged commit bb38217 into main Oct 29, 2026
33 checks passed
@kodiakhq
kodiakhq Bot deleted the drew/faster-type-checking branch October 29, 2026 00:15

This branch was successfully deployed

2 active deployments
Preview – hyperdx-oss — 5427c125 Deployed Oct 28, 2026 by vercel[bot]
Preview – hyperdx-storybook — 5427c125 Deployed Oct 28, 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