feat(sdk): return typed merge errors - #59
Open
necolas wants to merge 1 commit into
Open
Conversation
necolas
force-pushed
the
necolas/preview-merge-ephemeral-sdk
branch
from
September 8, 2026 18:34
d578dd4 to
863d00d
Compare
Map stable merge conflict and guard 409 codes to RefUpdateError in TypeScript, Python, and Go. Expose conflict and guard details with language-native field names. Keep unknown 409 codes and non-409 failures as API errors. Document the behavior change and coordinated non-patch release.
necolas
force-pushed
the
necolas/sdk-merge-typed-errors
branch
from
September 8, 2026 18:44
9fb43cf to
ed00d70
Compare
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.
Why
Callers must distinguish merge conflicts, stale target guards, and stale source guards without parsing human error text. The current SDKs return
ApiErrororAPIErrorfor every merge failure, even when the server provides a stable 409 code and structured recovery data.Before this change, the new regression tests failed because all three SDKs returned their generic API error for
merge_conflictandprecondition_failedresponses.This PR wraps the contracts from monorepo PR #2392 and monorepo PR #2395. The required SDK foundation from SDK PR #51 is now part of
dev.Scope
merge_conflict409 responses toRefUpdateErrorwith reasonconflict, conflict paths, and the merge base.precondition_failed409 responses toRefUpdateErrorwith the guard plus expected and actual SHAs.The separate SDK source-guard task will add the
expectedSourceSha,expected_source_sha, andExpectedSourceSHArequest options.Tradeoffs
Known merge 409 responses now use
RefUpdateErrorinstead of the generic API error type. This is the intended behavior change and must not ship as a patch.Blast Radius
Callers that catch the generic API error for a known merge 409 must migrate to
RefUpdateError. Unknown codes and other HTTP statuses keep their current behavior.The new fields extend Go's exported
RefUpdateErrorstruct. External unkeyed struct literals can require an update. Keyed literals and normal returned-error handling remain compatible.Verification
pnpm exec vitest --runpasses 277 tests.pnpm buildbuilds ESM, CommonJS, and declarations../venv/bin/ruff check pierre_storage testspasses../venv/bin/mypy pierre_storagepasses with no issues../venv/bin/pytest -qpasses 211 tests. It reports 65 existing deprecation warnings.go test ./...passes.git diff --checkpasses.