Repository navigation
refactor(data-objectstack): route batchTransaction through the client SDK only (#2694) - #2757
Merged
Merged
Conversation
… SDK only (#2694) @objectstack/client@^16 (framework #3271, the current dependency floor) ships data.batchTransaction, so ObjectStackAdapter.batchTransaction now calls the typed SDK method directly. Remove the transitional hand-rolled fetch('/api/v1/batch') branch — a feature-detect shim kept while the SDK method was unreleased. Per AGENTS.md §7, adapter data always flows through @objectstack/client, never a raw fetch. No behavior change: the SDK still drives the server's atomic POST /api/v1/batch, one MutationEvent fires per committed op (no double-fire), and the adapter still degrades to the non-atomic emulateBatchTransaction when this backend lacks the endpoint (404/405) or its runtime can't do transactions (501). Every other status still surfaces to the caller. - Rework the fallback tests to drive the "no server atomicity" path via the SDK method throwing a status-decorated error (the raw-fetch mock is gone). - Update the master-detail ADR + data-source guide to describe the SDK transport. - Add a changeset. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SyjBH45icswG9FKmCestH2
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
os-zhuang
marked this pull request as ready for review
July 20, 2026 12:50
…on-sdk-dogfood-g699qo # Conflicts: # packages/data-objectstack/src/index.ts
Contributor
✅ Console Performance Budget
📦 Bundle Size Report
Size Limits
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #2694 (optional cleanup half).
Context
#2694had two parts:@objectstack/clientis bumped to^16.0.0-rc.0onmain(changesetalign-objectstack-deps-16-rc), and16.0.0-rc.0shipsdata.batchTransaction. The adapter's feature-detect already routed master-detail saves through the SDK, andonMutation.test.tsproves SDK path taken + oneMutationEventper committed op (no double-fire).What
ObjectStackAdapter.batchTransactionnow calls the typed SDK methodclient.data.batchTransaction(operations)directly. The transitionalhand-rolled
fetch('/api/v1/batch')mainline — a feature-detect shim kept whilethe SDK method was unreleased — is deleted. Per AGENTS.md §7, adapter data
always flows through
@objectstack/client, never a rawfetch. The change islocalized to the one method (net −40 lines) and also drops one
as anycast (themethod is now a typed part of the
@objectstack/client@^16API).No behavior change
POST /api/v1/batch.MutationEventper committed op, emitted once (no double-fire).(404/405) or its runtime can't do transactions (501), the SDK method throws a
status-decorated error and the adapter degrades to the non-atomic
emulateBatchTransaction— exactly as before. Every other status(400/401/403/409/500) still surfaces to the caller.
discovery-advertised batch capability, not yet advertised).
Tests / docs
method throwing (the raw-fetch mock is gone). 89/89
data-objectstacktestspass;
type-checkclean.docs/adr/0001-…) + data-source guide todescribe the SDK transport; added a changeset (
patch).Version-policy note (resolved)
The client dep is still a pre-release (
^16.0.0-rc.0), and the merged version-bumpchangeset had noted "the raw-fetch branch stays as a defensive fallback (removal
tracked in #2694)." The caret range guarantees
data.batchTransactionfor anyresolved version and
#2694is the tracking issue for this removal, so themaintainer approved proceeding now (merge on green CI) rather than waiting for a
stable
16.0.0.🤖 Generated with Claude Code
https://claude.ai/code/session_01SyjBH45icswG9FKmCestH2