Skip to content

feat(sdk)!: catch up to the current AgentDrive contract, state filter included - #16

Merged
jiashuoz merged 3 commits into
mainfrom
refactor/state-filter
Sep 11, 2026
Merged

jiashuoz merged 3 commits into
mainfrom
refactor/state-filter

Conversation

@jiashuoz

Copy link
Copy Markdown
Member

Why

The vendored contract was AgentDrive's pre-port snapshot — compatibility policy 1, 34 paths, imported from a repository that has not hosted the file since the 2026-08-29 monorepo port. The live contract is policy 2 with 44 paths.

So this is not the one-parameter patch it looked like from the API side. The SDKs were ten operations behind before the rename existed, and the importer could not read the current contract at all: it asserts policy == 1 and points source_repository / source_path at coordinates that no longer resolve.

What

Three fixes make the import possible:

  • SOURCE_REPOSITORY → tokencanopy/tokencanopy, SOURCE_PATH → apps/drive/tests/openapi.golden.json, so a provenance record names a file that exists.
  • The policy assertion is pinned to a new SUPPORTED_POLICY_VERSION = 2 rather than loosened to a floor (>= 1). A policy bump is AgentDrive changing the rules its contract is judged by — a decision to read deliberately, not one to absorb silently.
  • The helper tests move with both.

Then the regeneration carries everything at once: python / typescript / go regenerated from tokencanopy/tokencanopy@100aa364 with the pinned generator image (digest unchanged), bringing the ten missing operations and their models.

The facades follow the renamed filter. drives.list, folders.list, artifacts.list, grants.list and shares.list now take state where they took lifecycle, matching the query parameter the generated clients send after tokencanopy/tokencanopy#681. This is breaking for any caller passing the option — but the API rejects lifecycle outright now, so an SDK that kept the old option name would only fail later and less legibly.

Both packages go to 0.1.0: a breaking option rename plus ten new operations is not a patch.

Validation

  • python3 -m unittest discover -s tests — 28 passed (the import-helper suite, updated for the new coordinates).
  • python3 -m scripts.check_contract_provenance — provenance and generator pin consistent.
  • python3 scripts/check_operation_coverage.py — every contract operation present in all three generated SDKs.
  • bash scripts/generate-sdks.sh && bash scripts/check-generated-freshness.sh — run again after committing: worktree clean, so regeneration is idempotent and CI's freshness gate will agree.
  • sdk/python: 130 passed. sdk/typescript: 12 passed. sdk/go: builds clean (no test files).

Not in this PR

Publishing. publish.yml is a separate workflow_dispatch and needs a human decision — npm @tokencanopy/agentdrive-sdk and PyPI agentdrive-sdk are both public surfaces, and the Go module tag follows the version input.

Worth knowing before that dispatch: anyone on 0.0.3 passing lifecycle is already broken against the deployed API, because the rename shipped without an alias. Publishing 0.1.0 is the fix for them, not the break.

🤖 Generated with Claude Code

https://claude.ai/code/session_01AiYiPkSwvRWDfthQUtx11Q

jiashuoz and others added 3 commits September 11, 2026 11:10
…er included

The vendored contract was AgentDrive's pre-port snapshot: compatibility
policy 1, 34 paths, imported from a repository that has not hosted the file
since the 2026-08-29 monorepo port. The live contract is policy 2 with 44
paths, so the SDKs were ten operations behind before this change and the
importer could not read the current file at all -- it asserted policy == 1
and pointed `source_repository` / `source_path` at the old coordinates.

Three fixes make the import possible, then the regeneration carries
everything at once:

  * `SOURCE_REPOSITORY` / `SOURCE_PATH` now name
    tokencanopy/tokencanopy and apps/drive/tests/openapi.golden.json, so a
    provenance record points at a file that exists.
  * The policy assertion is pinned to `SUPPORTED_POLICY_VERSION = 2` rather
    than loosened to a floor. A bump is AgentDrive changing the rules its
    contract is judged by; that is a decision to read, not to absorb.
  * Regenerated python/typescript/go from the merged contract
    (tokencanopy/tokencanopy@100aa364) with the pinned generator image.

The hand-written facades follow the renamed filter: `drives.list`,
`folders.list`, `artifacts.list`, `grants.list` and `shares.list` take
`state` where they took `lifecycle`, matching the query parameter the
generated clients now send. That rename is a BREAKING change for any caller
passing the option; the API rejects the old spelling outright, so an SDK
that kept it would only fail later and less clearly.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AiYiPkSwvRWDfthQUtx11Q
The facade option rename is breaking and the contract catch-up adds ten
operations, so neither is a patch release. The generator does not own these
version fields; it reads SDK_VERSION and leaves the committed manifests
alone, which is why regeneration after the bump changes nothing.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AiYiPkSwvRWDfthQUtx11Q
The bump touched the two package manifests and stopped there, but the
version lives in six places the contract suite pins together: both
manifests, the lockfile, `agentdrive_sdk.__version__`, the Go README, and
`generate-sdks.sh`'s own `SDK_VERSION` default. That last one is the
load-bearing one -- CI regenerates without setting SDK_VERSION, so a stale
default rewrites every generated metadata file back to the old version and
the failure surfaces as generated-code drift rather than as the one number
that was missed. Regenerating with the new default carries it into the
generated clients too.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AiYiPkSwvRWDfthQUtx11Q
@jiashuoz
jiashuoz merged commit 52590ae into main Sep 11, 2026
4 checks passed
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