Skip to content

feat!: parse Comms URLs with the SDK - #55

Merged
scottlovegrove merged 2 commits into
mainfrom
feat/sdk-3-url-helpers
Aug 26, 2026
Merged

scottlovegrove merged 2 commits into
mainfrom
feat/sdk-3-url-helpers

Conversation

@scottlovegrove

Copy link
Copy Markdown
Collaborator

What

Takes @doist/comms-sdk 3.0.0 and moves the CLI's Comms URL parsing onto it. The SDK now holds the shared route rules (backed by @doist/sdk-kmp), so parseCommsUrl hands the URL over instead of walking path segments here.

The SDK covers everything the CLI's own parser did — both the /a/{workspaceId}/ and bare /{workspaceId}/ prefixes, the staging and local hosts, and the inbox and saved-thread routes — which removed about 900 characters of segment-walking including the parseInboxOrSavedThreadRoute helper.

Two things stay local:

  • Bare workspace URLs. They name no entity, so the SDK returns null; that case is still read here.
  • Malformed routes. They fall through to workspace-only rather than being misrouted as a thread, comment or conversation ref — the same protection the old parser had, now achieved by the SDK returning null.

The search fallback link now comes from getFullCommsURL too, rather than being the one hand-built URL left in the CLI.

Breaking

A Comms URL whose entity ID is not a base58-encoded UUIDv7 is no longer recognised. The old parser accepted any string in an ID position; the shared rules validate the format.

Comms only ever issues IDs in that format — the SDK's own generateId and isValidUuidV7Base58 are the source — so this rejects malformed links up front rather than passing them to the API and reporting "not found". The CLI's own looksLikeOpaqueCommsId already assumed the same shape.

Test fixtures

46 tests failed on this, purely because their fixture IDs were short placeholders (100, 200, CH1, TH1, 7YpL3oZ4kZ9vP7Q1tR2sX3z) that the shared rules reject. Left alone they would have quietly exercised the workspace-only fallback and proven nothing, so the URL fixtures now use real base58-encoded UUIDv7 values.

Verification

858 tests pass, type-check, lint:check and build all clean.

🤖 Generated with Claude Code

The SDK holds the shared Comms route rules, so parseCommsUrl hands the
URL to it rather than walking path segments here. Both the /a/{id}/ and
bare /{id}/ prefixes, the staging and local hosts, and the inbox and
saved thread routes are all covered by it.

A bare workspace URL names no entity, so the SDK does not recognise it;
that case is still read here, and a malformed route still falls through
to workspace-only rather than being misrouted as a thread, comment, or
conversation ref.

The search fallback link now comes from getFullCommsURL too, rather than
being the one hand-built URL left in the CLI.

Test IDs were short placeholders that the shared rules reject, so the
URL fixtures now use real base58-encoded UUIDv7 values.

BREAKING CHANGE: a Comms URL whose entity ID is not a base58-encoded
UUIDv7 is no longer recognised. Comms only issues IDs in that format, so
this rejects malformed links rather than passing them to the API.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@scottlovegrove scottlovegrove self-assigned this Aug 26, 2026
@doistbot
doistbot requested a review from henningmu August 26, 2026 10:10

@doistbot doistbot left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comms URL parsing now goes through the SDK, with the CLI keeping only the workspace-only and malformed-route fallbacks.

Few things worth tightening:

  • Add a workspace-only case for a well-formed path whose ID is not a base58 UUIDv7 (e.g. /a/12345/ch/CH1), so that breaking contract cannot silently regress.

Share FeedbackReview Logs

Comment thread src/lib/refs.test.ts
Every parse case now uses a valid base58-encoded UUIDv7, so the contract
this change introduces — a well-formed path whose id is not that shape
names no entity and reads as workspace-only — could regress without a
failure. Covers the channel, thread and conversation routes.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@scottlovegrove scottlovegrove added the 👀 Show PR PR must be reviewed before or after merging label Aug 26, 2026
@scottlovegrove
scottlovegrove merged commit 6fbd645 into main Aug 26, 2026
6 checks passed
@scottlovegrove
scottlovegrove deleted the feat/sdk-3-url-helpers branch August 26, 2026 10:32
doist-release-bot Bot added a commit that referenced this pull request Aug 26, 2026
## [3.0.0](v2.0.4...v3.0.0) (2026-08-26)

### ⚠ BREAKING CHANGES

* a Comms URL whose entity ID is not a base58-encoded
UUIDv7 is no longer recognised. Comms only issues IDs in that format, so
this rejects malformed links rather than passing them to the API.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

* test: pin the non-base58 id contract

Every parse case now uses a valid base58-encoded UUIDv7, so the contract
this change introduces — a well-formed path whose id is not that shape
names no entity and reads as workspace-only — could regress without a
failure. Covers the channel, thread and conversation routes.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

### Features

* parse Comms URLs with the SDK ([#55](#55)) ([6fbd645](6fbd645))
@doist-release-bot

Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 3.0.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@craigcarlyle craigcarlyle left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

released 👀 Show PR PR must be reviewed before or after merging

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants