Skip to content

test(sdk): thread computers e2e against built package - #82

Merged
calvin-archastro merged 1 commit into
mainfrom
test/thread-computers-e2e
Oct 22, 2026
Merged

calvin-archastro merged 1 commit into
mainfrom
test/thread-computers-e2e

Conversation

@calvin-archastro

@calvin-archastro calvin-archastro commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Review on ArchCode

Problem and intent

  • ArchDev task tsk_00P3MwVmlsfLC0KnJpssNu ("Published TypeScript and Python SDKs include thread computers") needs proof that the published @archastro/sdk (0.21.0, regenerated in chore(sdk): regenerate from openapi@main #80) carries the thread-computer and computer-share methods.
  • No test in this repo exercises threads.computers.create/list or agent_computers.update over HTTP, and no existing test loads the built package entry point (all import ../src).

What changed

  • Adds packages/sdk/__tests__/thread-computers.e2e.test.ts → test published SDK creates and lists thread computers and updates computer shares.
    1. Imports @archastro/sdk (workspace self-reference → dist/index.js, the files npm publishes), not src/.
    2. Starts a node:http loopback server with canned responses and records each request.
    3. PlatformClient.withToken(apiKey, accessToken, baseUrl) → threads.computers.create (POST, 201) → threads.computers.list (GET, 200) → agent_computers.update(..., { acl: { grants: [] } }) (PATCH, 204).
    4. Asserts returned bodies (void on 204), method/path/JSON body sequence, and x-archastro-api-key + Authorization: Bearer + JSON content type on every request.
  • No generated code, CI or package version changes. CI already discovers __tests__/**/*.test.ts; ci.yml builds before npm test.

Scope / risk / user impact

  • Test-only. Risk: low. No user impact.
  • Caveat: npm test in a fresh clone now needs npm run build first for this one file (dist is gitignored); every workflow already builds first.

Testing

  • Canonical e2e: packages/sdk/__tests__/thread-computers.e2e.test.ts › published SDK creates and lists thread computers and updates computer shares.
    • Actors: generated SDK client/runtime (real fetch) ↔ loopback HTTP server over a real TCP socket.
    • Fidelity: production generated resources + HTTP runtime; the server is canned and records the wire contract only.
    • Not proven here: real platform authorization/provisioning, retries/faults, non-empty acl.add/acl.remove.
  • Runs:
    1. In repo (after npm run build): 1 passed. Full npm test --workspaces --if-present: 146 passed.
    2. Same file in a scratch consumer with @archastro/sdk@0.21.0 from npm (integrity sha512-+YOlT5c3…l/Q==) + vitest 4.1.4: 1 passed.
    3. Mutation check: renaming the PATCH route in the canned server makes the test fail with ApiError: not_found.
  • Automatic coverage: CI / Tests job → npm test --workspaces --if-present → vitest run (PR + push to main).

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@calvin-archastro
calvin-archastro merged commit cfdd4fd into main Oct 22, 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