Skip to content

chore: Remove dead code - #3087

Merged
aleksanderkatan merged 4 commits into
mainfrom
chore/remove-dead-code
Nov 5, 2026
Merged

aleksanderkatan merged 4 commits into
mainfrom
chore/remove-dead-code

Conversation

@vende11s

Copy link
Copy Markdown
Collaborator

closes #3069

Copilot AI lite review requested due to automatic review settings September 28, 2026 10:21

Copilot AI left a comment

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.

Copilot review overview

🟢 Approval recommended

No unresolved review issues were identified.

Review effort: Lite
Findings: None

What changed in this PR

Removes dead code and unused types, helpers, modules, and parameters across TypeGPU packages.

Changes:

  • Deletes unused utilities, type aliases, guards, and interfaces.
  • Removes the obsolete React hook and task queue.
  • Simplifies radiance-cascade and Three.js-related data.
File Description
packages/​unplugin-typegpu/​src/​core/​filter.ts Removes unused filter type
packages/​typegpu/​src/​types.ts Removes unused buffer usage type
packages/​typegpu/​src/​tgsl/​generationHelpers.ts Removes unused helper
packages/​typegpu/​src/​taskQueue.ts Deletes unused task queue
packages/​typegpu/​src/​shared/​utilityTypes.ts Removes unused utility type
packages/​typegpu/​src/​extension.ts Removes unused extension types
packages/​typegpu/​src/​data/​wgslTypes.ts Removes unused vector types and guards
packages/​typegpu/​src/​data/​dataTypes.ts Removes deprecated unused alias
packages/​typegpu/​src/​core/​vertexLayout/​vertexAttribute.ts Removes unused attribute type
packages/​typegpu/​src/​core/​texture/​texture.ts Removes unused texel type
packages/​typegpu/​src/​core/​texture/​externalTexture.ts Removes unused guard
packages/​typegpu/​src/​core/​pipeline/​typeGuards.ts Removes unused render-pass guard
packages/​typegpu/​src/​core/​function/​tgpuComputeFn.ts Removes unused options interface
packages/​typegpu/​src/​core/​function/​comptime.ts Removes unused comptime guard
packages/​typegpu-three/​src/​typegpu-node.ts Removes unused setup-stage data
packages/​typegpu-react/​src/​core/​use-render.ts Deletes obsolete hook
packages/​typegpu-radiance-cascades/​src/​runner.ts Stops initializing unused cascade dimensions
packages/​typegpu-radiance-cascades/​src/​cascades.ts Removes unused struct field
packages/​typegpu-geometry/​src/​utils.ts Removes unused midpoint function
packages/​typegpu-cli/​src/​utils/​types.ts Removes unused inferred types
packages/​typegpu-cli/​src/​utils/​pm.ts Removes unused package-manager runner

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@pullfrog pullfrog Bot left a comment

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.

✅ No new issues found.

Reviewed changes — the full diff of commit 40a413861 (21 files, +4 / −240), a purely dead-code removal matching the checklist in #3069.

  • Whole-file deletions — packages/typegpu/src/taskQueue.ts (TaskQueue) and packages/typegpu-react/src/core/use-render.ts (useRender/UseRenderOptions); neither is referenced by a barrel or export map.
  • Unused exports removed — among others pmRun, AppJson/TsConfig, midPoint, SetupStageData/getSetupStageData, isComptimeFn, ComputeFnOptions, isTgpuRenderPass, isExternalTexture, TexelData, AnyUnstruct, isVecBoolInstance, isConcrete, NotAllowed/ExtensionGuard, OmitPropsExact, concretizeSnippets, BufferUsage, TransformHookFilter.
  • CascadeStaticParams.cascadeDim dropped — removed from the schema and its runner.ts initializer; only baseProbes and cascadeCount are read by shaders.

I verified every removed identifier has zero remaining references across the repo (including sibling consumers typegpu-gl, tgpu-gen, and apps/typegpu-docs), and that none were surfaced on the public API (data/index.ts lists the d namespace types explicitly, with no export * of wgslTypes.ts/dataTypes.ts). test:types passes for typegpu, typegpu-three, typegpu-react, typegpu-radiance-cascades, typegpu-geometry, typegpu-cli, and unplugin-typegpu. No release-note artifact is expected here since the repo has no changeset tooling.

Pullfrog  | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

@github-actions

github-actions Bot commented Sep 28, 2026 •

Copy link
Copy Markdown

pkg.pr.new

packages
Ready to be installed by your favorite package manager ⬇️

https://pkg.pr.new/software-mansion/TypeGPU/tgpu-gen@fdca0ca8e667d914ffcafb90e2503bf8f1af48c4
https://pkg.pr.new/software-mansion/TypeGPU/typegpu@fdca0ca8e667d914ffcafb90e2503bf8f1af48c4
https://pkg.pr.new/software-mansion/TypeGPU/@typegpu/cli@fdca0ca8e667d914ffcafb90e2503bf8f1af48c4
https://pkg.pr.new/software-mansion/TypeGPU/@typegpu/color@fdca0ca8e667d914ffcafb90e2503bf8f1af48c4
https://pkg.pr.new/software-mansion/TypeGPU/@typegpu/gl@fdca0ca8e667d914ffcafb90e2503bf8f1af48c4
https://pkg.pr.new/software-mansion/TypeGPU/@typegpu/radiance-cascades@fdca0ca8e667d914ffcafb90e2503bf8f1af48c4
https://pkg.pr.new/software-mansion/TypeGPU/@typegpu/react@fdca0ca8e667d914ffcafb90e2503bf8f1af48c4
https://pkg.pr.new/software-mansion/TypeGPU/@typegpu/three@fdca0ca8e667d914ffcafb90e2503bf8f1af48c4
https://pkg.pr.new/software-mansion/TypeGPU/unplugin-typegpu@fdca0ca8e667d914ffcafb90e2503bf8f1af48c4

benchmark
view benchmark

commit
view commit

@github-actions

github-actions Bot commented Sep 28, 2026 •

Copy link
Copy Markdown

Resolution Time Benchmark

---
config:
  themeVariables:
    xyChart:
      plotColorPalette: "#E63946, #3B82F6, #059669"
---
xychart
  title "Random Branching (🔴 PR | 🔵 main | 🟢 release)"
  x-axis "max depth" [1, 2, 3, 4, 5, 6, 7, 8]
  y-axis "time (ms)"
  line [0.53, 1.05, 2.41, 4.16, 4.63, 6.64, 14.02, 15.80]
  line [0.56, 1.12, 2.48, 4.05, 5.10, 6.87, 13.05, 16.03]
  line [0.74, 1.47, 3.22, 4.84, 5.57, 9.16, 19.09, 18.52]
Loading
---
config:
  themeVariables:
    xyChart:
      plotColorPalette: "#E63946, #3B82F6, #059669"
---
xychart
  title "Linear Recursion (🔴 PR | 🔵 main | 🟢 release)"
  x-axis "max depth" [1, 2, 3, 4, 5, 6, 7, 8]
  y-axis "time (ms)"
  line [0.16, 0.31, 0.41, 0.50, 0.61, 0.63, 0.82, 0.87]
  line [0.14, 0.27, 0.39, 0.49, 0.64, 0.66, 0.79, 0.88]
  line [0.25, 0.38, 0.54, 0.62, 0.84, 0.89, 1.07, 1.23]
Loading
---
config:
  themeVariables:
    xyChart:
      plotColorPalette: "#E63946, #3B82F6, #059669"
---
xychart
  title "Full Tree (🔴 PR | 🔵 main | 🟢 release)"
  x-axis "max depth" [1, 2, 3, 4, 5, 6, 7, 8]
  y-axis "time (ms)"
  line [0.60, 1.46, 2.31, 4.97, 8.22, 15.70, 33.72, 69.84]
  line [0.60, 1.40, 2.55, 3.91, 7.53, 15.15, 32.41, 67.30]
  line [0.74, 1.67, 2.81, 5.34, 9.34, 20.23, 42.98, 86.37]
Loading

@github-actions

github-actions Bot commented Sep 28, 2026 •

Copy link
Copy Markdown

Bundle size comparison (import * as ... in PR vs import * as ... in target):

🟢 Decreased ➖ Unchanged 🔴 Increased ❔ Unknown
0 356 0 0

No notable changes.

If you wish to run a comparison for other, slower bundlers, run the 'Tree-shake test' from the GitHub Actions menu.

Comment thread packages/typegpu/src/taskQueue.ts Outdated

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.

:(

@aleksanderkatan aleksanderkatan left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We already export some of our type guards, like isTgpuFn, isComputePipeline, isQuerySet, isVariable, isVertexLayout, isImmediateVar..., I think that type guards removed in this PR could be exported instead

@pullfrog pullfrog Bot left a comment

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.

ℹ️ No critical issues — one follow-up worth confirming.

Reviewed changes — the incremental delta since the prior pullfrog review (c728ba8ac..1ebf4e597, +14 / −1 across 3 files): commit 1ebf4e597 restored the three type guards deleted by the initial commit, after review feedback asked for them to be exported rather than removed.

  • Restored isComptimeFn in packages/typegpu/src/core/function/comptime.ts.
  • Restored isTgpuRenderPass and its TgpuRenderPass import in packages/typegpu/src/core/pipeline/typeGuards.ts.
  • Restored isExternalTexture in packages/typegpu/src/core/texture/externalTexture.ts.

ℹ️ Restored guards still aren't reachable from the package entry point

The three restored guards are declared with export inside their own modules, but none of them was added to packages/typegpu/src/indexNamedExports.ts, and a whole-repo grep finds no other references to any of them. From the public typegpu API they remain unreachable and unused — i.e. still dead code, which is what the review feedback asked to avoid by exporting them instead of deleting them. This may be an intentional deferral to a follow-up; flagging so it isn't lost.

Technical details
# Restored type guards are not wired into the public barrel

## Affected sites
- `packages/typegpu/src/core/function/comptime.ts:15` — `isComptimeFn` defined, zero references.
- `packages/typegpu/src/core/pipeline/typeGuards.ts:27` — `isTgpuRenderPass` defined, zero references.
- `packages/typegpu/src/core/texture/externalTexture.ts:19` — `isExternalTexture` defined, zero references.
- `packages/typegpu/src/indexNamedExports.ts:34-42` — the only named type-guard exports on the public barrel (`isTgpuFn`, `isComputePipeline`, `isPipeline`, …); the three restored guards are absent. `index.d.ts` re-exports this barrel via `export *`.

## Required outcome
- Add the three guards to `indexNamedExports.ts` to match the review request, or confirm the public export is deliberately deferred so that restoring the functions isn't reintroducing dead code under this PR.

## Open questions for the human
- Is exposing these guards part of this PR, or tracked as a separate follow-up?

Pullfrog  | Fix it ➔ | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

@iwoplaza

Copy link
Copy Markdown
Collaborator

@vende11s Is there (going to be) another PR that exposes the unremoved type guards through the public API?

@vende11s

Copy link
Copy Markdown
Collaborator Author

@iwoplaza I opened issue #3121, I feel like i'm not the right person for the job, as i'm uncertain about many of the type guards

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wouldn't delete this file. It is linked to the issue.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#3087 (comment)
we disscussed it earlier with @aleksanderkatan, but let me know what do you think

@aleksanderkatan
aleksanderkatan enabled auto-merge (squash) November 5, 2026 15:50
@aleksanderkatan
aleksanderkatan merged commit 13c6c0d into main Nov 5, 2026
9 checks passed
@aleksanderkatan
aleksanderkatan deleted the chore/remove-dead-code branch November 5, 2026 15:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

chore: Remove dead code

6 participants