Skip to content

The SDKs raise a typed WrongCell that names the org and its cell - #521

Merged
zlareb1 merged 1 commit into
mainfrom
feat/cell-wrong-cell-error
Nov 12, 2026
Merged

zlareb1 merged 1 commit into
mainfrom
feat/cell-wrong-cell-error

Conversation

@zlareb1

@zlareb1 zlareb1 commented Nov 11, 2026 •

Copy link
Copy Markdown
Member

Changelog category (leave one):

  • New feature

Changelog entry (one or two sentences a user of Loom can read without the diff; the release pull request collects these into the release notes):

The Python and TypeScript SDKs raise WrongCell (a PreconditionFailed) for the server's 409 WRONG_CELL, with .org and .cell naming the org and the cell that holds it, so a client can look that cell's host up with the router's GET /cells/lookup and call it.

Why

The seventh of the pull requests that implement cells. It stacks on #520. #473 added WRONG_CELL and said the SDKs map it by status until a typed error comes; a caller had to parse the message to learn which cell holds its org.

Design

  • Server (server/core/errors.py): WrongCellError puts org and cell in its detail (cell is '' when the router named none, for a caller that may not place the org). The detail tells the caller nothing new: the message already named both. The org is one the caller may act in (a principal is checked with may_act_in_org first), a configured sign-up or JIT org, or one a platform admin named (ratelimit.set), and an org's cell is public through the lookup.
  • Python SDK (sdk/python/loom/errors.py): WrongCell(PreconditionFailed), registered for WRONG_CELL; from_response fills .org and .cell from the detail. Exported from loom.
  • TypeScript SDK (sdk/typescript/src/errors.ts): WrongCell extends PreconditionFailed, chosen for a 409 with code WRONG_CELL; org and cell read the detail. Exported from the package.
  • Both stay PreconditionFailed subclasses, so a caller that catches that today keeps working.
  • The SDK references and the TypeScript README list the class, and the errors reference's WRONG_CELL row tells a raw HTTP or MCP caller about detail.cell and the lookup; the SDK public-surface snapshot gains WrongCell.

Scope and risk

Additive: two detail fields and one error class in each SDK. Still to come with the routing pull request: routing rules 1 to 4, loom login --org and the org-first sign-in page.

Compatibility, rollout and rollback

An SDK of this release talking to a server without the detail fields gets a WrongCell whose cell and org are ''. An older SDK keeps mapping WRONG_CELL to PreconditionFailed and ignores the new fields.

Tests

  • tests/unit/test_sdk_errors_from_response.py: every server code maps to its documented SDK class (now WRONG_CELL → WrongCell); a WrongCellError's own detail, with and without a cell, becomes a WrongCell that is a PreconditionFailed and names the org and the cell.
  • sdk/typescript/src/errors.test.ts: a 409 WRONG_CELL is a WrongCell and a PreconditionFailed, naming the org and cell, and '' with no cell in the detail; test/package/exports.test.ts lists the export.
  • tests/unit/test_sdk_surface_contract.py: the snapshot is updated.
  • At this head: the TypeScript SDK's npm run check (lint, type-check, 318 tests) and npm run check:dist pass; the SDK and doc unit tests pass (795 passed before the snapshot update, then the surface contract); make lint and make typecheck pass. The full unit suite has not run on this stack.

AI assistance in the code (leave one; writing this description with AI is fine):

  • AI-generated (an agent wrote most of the diff): Claude Code.

  • I can explain every line of this diff and how it interacts with the rest of Loom.

Checklist

  • make format-check, make lint, make typecheck and make test-unit pass (the full unit suite result follows in Tests).
  • Generated files are regenerated in this PR, not by hand: the SDK op tables, docs/reference/configuration.md and the docs/reference/ tables (python scripts/codegen/docs_reference.py), the reach manifest, schemas/schema.sql (make schema-dump) and the Codex plugin copies (python3 scripts/codegen/agent_plugin_sync.py).
  • A new migration is additive and numbered after the latest on main; no merged migration is edited.
  • A behaviour change to any file a plugin ships (hooks/, lib/, bin/, skills/, .mcp.json, the Codex plugin-defaults.json) bumps both plugin manifests' version, and no other open PR uses that version.
  • The frontend builds (npm --prefix frontend run build) and its tests pass, if frontend/ changed.
  • Docs under docs/ describe the system as it now is, and this description names any operator steps and wire changes.
  • Repository text has no dates, people, host names, internal namespaces, ticket or decision numbers; the history goes in this description (tests/unit/test_public_copy.py).
  • Commits are signed off (git commit -s), as CONTRIBUTING.md asks.

🤖 Generated with Claude Code

@zlareb1
zlareb1 force-pushed the feat/cell-wrong-cell-error branch from 1f1a1b2 to f920c51 Compare November 12, 2026 01:10
@zlareb1
zlareb1 marked this pull request as ready for review November 12, 2026 01:10
@zlareb1
zlareb1 merged commit b5dd4f5 into main Nov 12, 2026
@zlareb1
zlareb1 deleted the feat/cell-wrong-cell-error branch November 12, 2026 01:11
@zlareb1 zlareb1 mentioned this pull request Nov 12, 2026
3 tasks done
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