Skip to content

chore: Remove deprecated writePartial - #3484

Open
Priyanshu0007 wants to merge 3 commits into
software-mansion:mainfrom
Priyanshu0007:chore/remove-write-partial
Open

Priyanshu0007 wants to merge 3 commits into
software-mansion:mainfrom
Priyanshu0007:chore/remove-write-partial

Conversation

@Priyanshu0007

Copy link
Copy Markdown

Closes #3434

Removes buffer.writePartial / binding.writePartial, deprecated since 0.11 in favor of patch, plus the code that only existed for it: InferPartial, InferPartialRecord, $reprPartial and convertPartialToPatch.

- buffer.writePartial([{ idx: 2, value: d.vec3f(1, 2, 3) }]);
+ buffer.patch({ 2: d.vec3f(1, 2, 3) });
  • The partial-write tests in buffer.test.ts now use patch, with the same expected writes.
  • The partial-write benchmark now uses patch.
  • The 0.11 blog post and migration guide are left as they are.

test:types, test:style and test:circular-deps pass. The partial-write tests pass. The few other unit test failures I saw locally also happen on main (Node 22 has no Float16Array, and one test needs Deno ≥ 2.8).

Breaking: anyone still using writePartial or d.InferPartial should switch to patch / d.InferPatch.

Copilot AI balanced review requested due to automatic review settings December 1, 2026 18:32

@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.

Approach: sound — writePartial was a thin wrapper over patch, so removing it along with the types and symbols that existed only for it is the right scope, and every live reference is migrated.

Reviewed changes

  • Public API removed: writePartial is gone from TgpuBuffer and buffer bindings, leaving patch as the only partial-write entry point.
  • Type and symbol cleanup: InferPartial, InferPartialRecord, $reprPartial, and convertPartialToPatch are removed, including the $reprPartial declarations on array, struct, disarray, unstruct, and decorated schemas.
  • Public export: typegpu/data no longer exports InferPartial; InferPatch is untouched.
  • Tests: the partial-write cases in buffer.test.ts now exercise patch, and the convertPartialToPatch suite is deleted together with the helper.
  • Benchmark: the partial-write suite builds Record<number, { pos: v3f; vel: v3f }> and calls patch, preserving the same write sets.

pnpm --filter typegpu test:types passes on head. A repo-wide search finds no remaining code references — only the historical 0.11 blog post and migration guide, which are correctly left alone; the shipped skills describe patch and never referenced writePartial.

( ◦°^°◦) 🧹 Clean sweep — no stragglers found.

Pullfrog  | Fix it ➔ | View workflow run | Using deepseek-v4.1-flash-1017 (free via Pullfrog for OSS) | 𝕏

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.

🟡 Changes recommended

The partial-write benchmarks call buffer.patch unconditionally, causing pre-0.11 versions to fail instead of producing measurements; a compatible writePartial fallback is needed.

1 open issue
What changed in this PR

Removes the deprecated writePartial API from TypeGPU buffers and bindings, completing the transition to patch described in #3434.

Changes:

  • Removes writePartial and its supporting types, symbols, and conversion helper.
  • Migrates existing buffer tests and benchmarks to patch with numeric-keyed sparse updates.
  • Leaves the historical 0.11 blog post and migration guide unchanged.
File Description
packages/​typegpu/​tests/​internal/​partialIo.test.ts Removes tests for the deleted conversion helper.
packages/​typegpu/​tests/​buffer.test.ts Migrates partial-write tests while preserving expected writes.
packages/​typegpu/​src/​shared/​symbols.ts Removes $reprPartial.
packages/​typegpu/​src/​shared/​repr.ts Removes legacy partial-inference types.
packages/​typegpu/​src/​data/​wgslTypes.ts Removes partial-representation tokens from WGSL schemas.
packages/​typegpu/​src/​data/​partialIO.ts Deletes convertPartialToPatch.
packages/​typegpu/​src/​data/​index.ts Removes the public InferPartial export.
packages/​typegpu/​src/​data/​dataTypes.ts Removes legacy partial typing from data schemas.
packages/​typegpu/​src/​data/​attributes.ts Removes partial typing from decorated schemas.
packages/​typegpu/​src/​core/​buffer/​bufferBinding.ts Removes the binding’s writePartial interface and implementation.
packages/​typegpu/​src/​core/​buffer/​buffer.ts Removes the buffer’s writePartial interface and implementation.
apps/​typegpu-docs/​src/​pages/​benchmark/​test-suites/​partial-write.ts Migrates four benchmark tasks to patch.

Review effort: Balanced

@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.

Approach: sound — the benchmark page loads typegpu per row from npm or a PR commit, so a runtime capability check is the right way to keep pre-patch versions measurable.

Reviewed changes

  • Benchmark compatibility fallback: setup() in partial-write.ts probes for buffer.patch and falls back to a typed legacy writePartial call, so rows using older typegpu versions run again instead of throwing.
  • Shared write path: the four partial-write tasks delegate to one ctx.writeBoids(indices) helper, preserving the same index sets and values as before.
  • Type and format checks: oxlint --type-aware and oxfmt --check pass on the file, and a scoped tsc --noEmit over src/pages/benchmark/** is clean (Record<number, BoidValue> is a valid InferPatch for the boid array).

The historical 0.11 blog post and migration guide still mention writePartial, which matches the PR body's intent; the shipped skills describe patch and need no update.

( ◦°^°◦) ✅ Delta clean — the fallback covers old versions without touching the main removal.

Pullfrog  | View workflow run | Using deepseek-v4.1-flash-1017 (free via Pullfrog for OSS) | 𝕏

@iwoplaza

iwoplaza commented Dec 3, 2026

Copy link
Copy Markdown
Collaborator

Thanks for the PR! I think I'd prefer if the benchmark test was just skipped (with a visible message in the app) if we're trying to compare with a version that doesn't implement .patch(), could you make that change?

@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.

Approach: sound — the new commit replaces the per-suite legacy fallback with a general getSkipReason hook, so each suite declares up front whether the loaded version can run it and unsupported versions are reported instead of failing mid-run.

Reviewed changes

Reviewed the delta from 427d3b61 to a8fb0988, which swaps the writePartial fallback for a capability-aware skip flow.

  • Skip hook on suites: Suite gains an optional getSkipReason, createSuite accepts it, and getFilteredSuites spreads the suite so the hook survives test filtering. The filter now keys on entry[1].tests, which also fixes the previous check that counted suite keys rather than tests.
  • Runner wiring: runSuitesForTgpu probes each suite before setup(), records skipped suites with a reason, and returns them next to the benches.
  • Results UI: ResultsTable captions by parameter set, renders a placeholder when no benches ran, lists skipped suites, and rows are keyed by the unique parameterSet.key (no longer crashes on an empty benches array).
  • Benchmark suite: the partial-write tasks call buffer.patch directly; getSkipReason probes a d.u32 buffer for patch and skips on versions that lack it.

Verified oxlint --type-aware and oxfmt --check clean on the four changed files, and a scoped tsc --noEmit passes. tgpu.init() requests an independent device per call and destroy() only tears down that root's own device, so the probe's init/destroy cannot disturb the later setup() init.

( ◦°^°◦) ✅ Delta clean — the skip flow keeps old versions from failing without reintroducing the removed API.

Pullfrog  | View workflow run | Using deepseek-v4.1-flash-1017 (free via Pullfrog for OSS) | 𝕏

@iwoplaza iwoplaza left a comment

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.

Looks good! Thanks for the contribution 🐸

Remove buffer.writePartial and binding.writePartial (deprecated since 0.11
in favor of patch), along with InferPartial, InferPartialRecord, $reprPartial
and convertPartialToPatch. Partial-write tests and the benchmark now use patch.
…tch`

The benchmark loads the selected typegpu version at runtime, so versions
before 0.11 have no buffer.patch. Pick the writer during setup and fall back
to writePartial with { idx, value }[] input there.
Instead of falling back to writePartial, suites can now declare a
getSkipReason check. The partial-write suite uses it to skip versions that
don't implement buffer.patch(), and the results show which suites were
skipped and why. Suites with no selected tests are no longer run either.
@iwoplaza
iwoplaza force-pushed the chore/remove-write-partial branch from a8fb098 to e522ce1 Compare December 4, 2026 15:18

This branch has not been deployed

No deployments
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 deprecated writePartial

3 participants