Skip to content

feat(sdk): add merge source SHA guards - #60

Open
necolas wants to merge 1 commit into
devfrom
necolas/sdk-merge-source-sha-guard
Open

feat(sdk): add merge source SHA guards#60
necolas wants to merge 1 commit into
devfrom
necolas/sdk-merge-source-sha-guard

Conversation

@necolas

@necolas necolas commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Why

A caller can preview source commit A, then merge a newer source tip if the
source ref advances before the merge request. The SDKs do not expose the
server's expected_source_sha guard.

Scope

  • Add expectedSourceSha, expected_source_sha, and ExpectedSourceSHA to
    TypeScript, Python, and Go merge options.
  • Trim and send the value as expected_source_sha.
  • Keep existing merge calls unchanged when callers omit the option.
  • Document the preview-to-merge flow in each SDK and the code-storage skill.

Typed merge error mapping remains in SDK PR #59.

Blast Radius

This is an additive SDK change. Existing calls omit the new request field. The
server contract comes from monorepo PR #2395.

Verification

  • TypeScript: pnpm exec vitest --run passes 271 tests.
  • TypeScript: pnpm build builds ESM, CommonJS, and declarations.
  • Python: ./venv/bin/pytest -q passes 206 tests. It reports 66 existing
    deprecation warnings.
  • Python: ./venv/bin/ruff check pierre_storage tests passes.
  • Python: ./venv/bin/mypy pierre_storage passes with no issues.
  • Python: the scoped Ruff format check passes. The repository-wide check still
    flags the unchanged tests/test_route_contract.py file.
  • Go: go test ./... passes.
  • Go: go vet ./... passes.
  • git diff --check passes.

Callers can preview one source commit, then merge a later source tip if
the source ref advances before the merge request.

Add optional source SHA guards to TypeScript, Python, and Go merge
calls. Trim and send the guard as expected_source_sha, and omit it for
existing calls.
@notion-workspace

Copy link
Copy Markdown

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.

1 participant