Repository navigation
feat: attribute CLI requests and call the v1.0 API - #88
Merged
Merged
Conversation
The backend attributes traffic by the Doist-Platform header; without it the CLI's requests show up as 'unknown'. This covers the CLI's one direct fetch (extended search). SDK-routed requests follow once @doist/comms-sdk ships its new headers option. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The SDK's headers option shipped in @doist/comms-sdk 3.7.0, so the CLI can now attribute every request, not just the direct-fetch search path. Both paths send Doist-Platform: cli and Doist-Version (the package version). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
roryist
marked this pull request as ready for review
October 21, 2026 09:17
doistbot
reviewed
Oct 21, 2026
doistbot
left a comment
Member
There was a problem hiding this comment.
This PR cleanly adds Doist-Platform: cli and Doist-Version attribution headers to both the SDK-routed requests and the direct-fetch search call, with tests updated to match and no inline issues flagged.
I also included a few optional follow-up notes in the details below.
Optional follow-up notes (2)
src/lib/search-api.ts:109: The attribution headers ('Doist-Platform'/'Doist-Version' plus the packageJson import) are now duplicated in api.ts and search-api.ts. Search is exactly the path that was missed when attribution was first added, so drift here is plausible. Consider exporting a shared constant (e.g. from a small lib module) and using it in both places.
src/lib/api.test.ts:138:
Doist-Versionis only checked for semver shape, so a hardcoded placeholder like0.0.0would pass even though the stated contract is that the value ispackage.json.version. ImportingpackageJsonin the test and asserting equality is just as release-bump-proof asstringMatchingand matches the existing pattern insrc/commands/update/update.test.ts. The same matcher is used atsrc/lib/api.test.ts:150andsrc/lib/search-api.test.ts:56.
Review follow-ups: one exported constant instead of two copies, and tests pin Doist-Version to package.json's version rather than a shape. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The version was hardcoded three times; DEFAULT_API_VERSION is a root SDK export, so search now moves with the SDK-routed calls on any bump. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@doist/comms-sdk 3.8.1 defaults to v1.0; the search path derives its version from the same constant, so both flip together. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
doist-release-bot Bot
added a commit
that referenced
this pull request
Oct 21, 2026
## [3.7.0](v3.6.6...v3.7.0) (2026-10-21) ### Features * attribute CLI requests and call the v1.0 API ([#88](#88)) ([78685f4](78685f4))
Contributor
|
🎉 This PR is included in version 3.7.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
TL;DR
Every request the CLI makes now tells Comms who it is (
Doist-Platform: cliplusDoist-Versionwith the CLI's own release) and calls the canonical v1.0 API. What the requests do is unchanged.Why
Comms tags every request's traces, metrics and logs with the calling platform and its version, so we can watch old versions drain off and know when it's safe to turn things off. The CLI was invisible in that picture: it sent no attribution headers, so its traffic showed up as
unknown.The SDK couldn't carry extra headers until comms-sdk#104 and #105 shipped in v3.7.0 today, so this PR started with just the one search call that bypasses the SDK, and now covers both.
What changes
Doist-Platform: cli+Doist-VersionDoist-Platform: cli+Doist-VersionThe SDK dependency moves 3.4.0 → 3.8.1 (feature releases only, no breaking changes), which also flips the default API version to
v1.0(comms-sdk#107). The direct-fetch search path derives its version from the SDK'sDEFAULT_API_VERSIONinstead of hardcoding it, and both paths share one exported headers constant, so neither the version nor the attribution can drift between them. TheDoist-Versionvalue is the CLI's ownpackage.jsonversion, the same onetdc --versionprints.No new metrics here: the server side already counts these tags (comms-backend#1122/#1124/#1127); healthy looks like
platform:clireplacing a slice ofplatform:unknownonce this releases.Things to look at
stringMatching) keeps them from breaking on every release bump.Authorization.References
Part of the client-attribution work: comms-web#1456, comms-ios#803, Todoist#30806.
(Written by Rory's agent)
🤖 Generated with Claude Code