fix(update): drop install-v1 Accept header on dist-tag fetch#10
Merged
Conversation
The npm registry rejects `Accept: application/vnd.npm.install-v1+json` on the dist-tag endpoint (`/<package>/<tag>`) with HTTP 406 — the abbreviated metadata format only applies to the package-doc endpoint (`/<package>`). `td update` was failing in production with `UPDATE_CHECK_FAILED: Registry request failed (HTTP 406)`. Drop the header; the dist-tag endpoint already returns a single small version document, so the header was never buying anything anyway. Adds a regression test that asserts `fetch` is called without the second options argument. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
doistbot
reviewed
May 9, 2026
Member
doistbot
left a comment
There was a problem hiding this comment.
This PR resolves an update check failure by removing an incompatible Accept header from npm registry dist-tag requests. Catching the HTTP 406 error and adding a regression test ensures the update mechanism remains reliable in production. There is a minor opportunity to simplify the new regression test by leveraging vi.mocked(fetch) and relying on toHaveBeenCalledWith for exact argument matching rather than manually inspecting the call array.
`expect(fetch).toHaveBeenCalledWith(url)` already enforces an exact argument match — it fails if a second `options` argument is passed, which is the only way the bad `Accept` header could come back. The manual `mock.calls[0]` array inspection added nothing. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
doist-release-bot Bot
added a commit
that referenced
this pull request
May 9, 2026
## [0.7.1](v0.7.0...v0.7.1) (2026-05-09) ### Bug Fixes * **update:** drop install-v1 Accept header on dist-tag fetch ([#10](#10)) ([4a7b36f](4a7b36f))
Contributor
|
🎉 This PR is included in version 0.7.1 🎉 The release is available on: Your semantic-release bot 📦🚀 |
scottlovegrove
added a commit
to Doist/todoist-cli
that referenced
this pull request
May 9, 2026
Picks up the dist-tag fetch fix (Doist/cli-core#10) — `td update` was failing with `UPDATE_CHECK_FAILED: HTTP 406` because cli-core 0.7.0 sent the abbreviated-metadata `Accept` header on a dist-tag URL, which the npm registry rejects. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.
Summary
fetchLatestVersionwas sendingAccept: application/vnd.npm.install-v1+jsonon the dist-tag endpoint (/<package>/<tag>). The npm registry rejects that combination with HTTP 406 — the abbreviated metadata format only applies to the package-doc endpoint (/<package>), not dist-tag resolutions.Reproduced live:
In production this surfaced as:
The dist-tag endpoint already returns a small single-version document, so the abbreviated-format header was never buying anything anyway — drop it.
Test plan
npm test— 184 tests pass; existing assertion updated; new regression test assertsfetchis called without an options argument so the bad header can't reappear silentlynpm run check/type-check/buildcleanfetchLatestVersion({ packageName: '@doist/todoist-cli', channel: 'stable' })returns1.62.1td update --check,td update --channel,td update --check --jsonall succeed against the real npm registry🤖 Generated with Claude Code