Repository navigation
chore: Remove deprecated writePartial - #3484
Priyanshu0007 wants to merge 3 commits into
Conversation
There was a problem hiding this comment.
✅ 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:
writePartialis gone fromTgpuBufferand buffer bindings, leavingpatchas the only partial-write entry point. - Type and symbol cleanup:
InferPartial,InferPartialRecord,$reprPartial, andconvertPartialToPatchare removed, including the$reprPartialdeclarations on array, struct, disarray, unstruct, and decorated schemas. - Public export:
typegpu/datano longer exportsInferPartial;InferPatchis untouched. - Tests: the partial-write cases in
buffer.test.tsnow exercisepatch, and theconvertPartialToPatchsuite is deleted together with the helper. - Benchmark: the partial-write suite builds
Record<number, { pos: v3f; vel: v3f }>and callspatch, 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.
deepseek-v4.1-flash-1017 (free via Pullfrog for OSS) | 𝕏
There was a problem hiding this comment.
🟡 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
writePartialand its supporting types, symbols, and conversion helper. - Migrates existing buffer tests and benchmarks to
patchwith 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
There was a problem hiding this comment.
✅ 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()inpartial-write.tsprobes forbuffer.patchand falls back to a typed legacywritePartialcall, so rows using oldertypegpuversions 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-awareandoxfmt --checkpass on the file, and a scopedtsc --noEmitoversrc/pages/benchmark/**is clean (Record<number, BoidValue>is a validInferPatchfor 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.
deepseek-v4.1-flash-1017 (free via Pullfrog for OSS) | 𝕏
|
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 |
There was a problem hiding this comment.
✅ 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:
Suitegains an optionalgetSkipReason,createSuiteaccepts it, andgetFilteredSuitesspreads the suite so the hook survives test filtering. The filter now keys onentry[1].tests, which also fixes the previous check that counted suite keys rather than tests. - Runner wiring:
runSuitesForTgpuprobes each suite beforesetup(), records skipped suites with a reason, and returns them next to the benches. - Results UI:
ResultsTablecaptions by parameter set, renders a placeholder when no benches ran, lists skipped suites, and rows are keyed by the uniqueparameterSet.key(no longer crashes on an emptybenchesarray). - Benchmark suite: the partial-write tasks call
buffer.patchdirectly;getSkipReasonprobes ad.u32buffer forpatchand 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.
deepseek-v4.1-flash-1017 (free via Pullfrog for OSS) | 𝕏
iwoplaza
left a comment
There was a problem hiding this comment.
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.
a8fb098 to
e522ce1
Compare


Closes #3434
Removes
buffer.writePartial/binding.writePartial, deprecated since 0.11 in favor ofpatch, plus the code that only existed for it:InferPartial,InferPartialRecord,$reprPartialandconvertPartialToPatch.buffer.test.tsnow usepatch, with the same expected writes.patch.test:types,test:styleandtest:circular-depspass. The partial-write tests pass. The few other unit test failures I saw locally also happen onmain(Node 22 has noFloat16Array, and one test needs Deno ≥ 2.8).Breaking: anyone still using
writePartialord.InferPartialshould switch topatch/d.InferPatch.