Skip to content

fix: Address Scott's review: restore version option, JSDoc, and shared test BASE#4

Merged
amix merged 5 commits into
mainfrom
amix/restore-jsdoc-and-version
May 21, 2026
Merged

fix: Address Scott's review: restore version option, JSDoc, and shared test BASE#4
amix merged 5 commits into
mainfrom
amix/restore-jsdoc-and-version

Conversation

@amix
Copy link
Copy Markdown
Member

@amix amix commented May 21, 2026

Context

Follow-up to Scott's review on #2. Two themes: the apiVersion config should have stayed (just change the default), and a lot of JSDoc was stripped as collateral damage while removing batch overloads — those docs feed the SDK documentation site.

What was changed

  • ClientConfig / CommsApiOptions accept version?: ApiVersion again, default 'v1'. ApiVersion is a one-entry union for now; adding a future version is a one-liner in API_VERSIONS.
  • Restored full @param / @returns / @example JSDoc on every client method (~1.2k lines). Single-signature methods stay; no batch references reintroduced.
  • Extracted the duplicated const BASE = 'https://comms.todoist.com/api/v1' into TEST_API_BASE_URL in testUtils/test-defaults.ts.

Verified: type-check, oxlint, oxfmt, full Vitest (114/114).

Refs

amix and others added 3 commits May 21, 2026 13:01
PR #2 hardcoded `v1` everywhere. Per Scott's review, the right move
was to change the default — not drop the option. Restores `version?:
ApiVersion` on `ClientConfig` / `CommsApiOptions`, defaulting to `'v1'`.
The `ApiVersion` union currently lists only `'v1'`; new versions just
need a one-line entry in `API_VERSIONS`.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
PR #2 stripped `@param` / `@returns` / `@example` blocks as collateral
damage while collapsing the batch overloads. Per Scott's review, those
JSDocs feed the SDK documentation site. Restored from the bootstrap
SDK and re-anchored onto the current single-signature methods, with
all batch references dropped.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Each MSW test was redeclaring `const BASE = 'https://comms.todoist.com/api/v1'`.
Moved to `TEST_API_BASE_URL` in `testUtils/test-defaults.ts`, imported
as `BASE` at the call sites to keep the tests readable.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@amix amix changed the title Address Scott's review: restore version option, JSDoc, and shared test BASE fix: Address Scott's review: restore version option, JSDoc, and shared test BASE May 21, 2026
@amix amix requested a review from scottlovegrove May 21, 2026 11:02
@amix amix added the 👀 Show PR PR must be reviewed before or after merging label May 21, 2026
@amix amix marked this pull request as ready for review May 21, 2026 11:03
Copy link
Copy Markdown
Member

@doistbot doistbot left a comment

Choose a reason for hiding this comment

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

This PR thoughtfully restores the API version configuration, revives important JSDoc comments for the SDK site, and centralizes test URL defaults. These updates do a great job improving the generated documentation and standardizing configuration across the client. There are just a few remaining details to resolve regarding mismatches between the restored JSDocs and the current TypeScript types, along with some logic duplication in the base URL construction that could be streamlined and covered by an additional request-level test.

Share FeedbackReview Logs

Comment thread src/clients/groups-client.ts
Comment thread src/clients/groups-client.ts
Comment thread src/clients/threads-client.ts Outdated
Comment thread src/clients/comments-client.ts Outdated
Comment thread src/clients/comments-client.ts Outdated
Comment thread src/clients/users-client.ts Outdated
Comment thread src/clients/base-client.ts Outdated
Comment thread src/testUtils/test-defaults.ts Outdated
Comment thread src/clients/users-client.ts Outdated
Comment thread src/clients/base-client.ts Outdated
Comment thread src/clients/comments-client.ts
Comment thread src/testUtils/test-defaults.ts Outdated
amix added 2 commits May 21, 2026 13:40
…lper

- Sync client JSDoc with current request types (drop sendAsIntegration /
  recipients from create/update comment + thread docs, fix updateComment
  content required, fix UpdateUserArgs example name vs fullName,
  workspaceId required on getThreads and group add/remove ops, soften
  updatePassword.currentPassword wording).
- Add `@param args` root descriptions to GroupsClient.getGroup / deleteGroup
  so JSDoc tooling parses the destructured args correctly.
- Route BaseClient.getBaseUri through getCommsBaseUri so the default and
  custom-base paths share one URL builder; teach the helper to preserve
  the path on custom domains (e.g. `https://proxy/comms` →
  `.../comms/api/v1/`).
- Derive TEST_API_BASE_URL from getCommsBaseUri() so the default host /
  version live in one place.
- Add a request-level test that calls the SDK with a custom baseUrl and
  asserts the final request URL.
Per Scott's review on #4: the shared TEST_API_BASE_URL was only used in
two test files. Replace the remaining hardcoded `apiUrl('api/v1/...')`
calls in `add-comment-helper.test.ts` and `custom-fetch-simple.test.ts`
so every API-side test goes through the same constant.

Deprecated-param cleanup is intentionally deferred to a follow-up PR.
@amix amix merged commit 14f9111 into main May 21, 2026
4 checks passed
@amix amix deleted the amix/restore-jsdoc-and-version branch May 21, 2026 11:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

👀 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