Skip to content

Commit 16a1445

Browse files
nullvariantclaude
andauthored
fix(git-id-switcher): switch to X-Extension-Id custom header for analytics (#307)
The User-Agent approach in 0.16.18 was ineffective because Node.js fetch() overrides User-Agent to "node". Now uses X-Extension-Id custom header which assets worker forwards to analytics worker for correct VSCODE/is_likely_human=1 classification. 🖥️ IDE: [Cursor](https://cursor.sh) 🔌 Extension: [Claude Code](https://claude.ai/download) Model-Raw: claude-opus-4-6 Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
1 parent a651ab2 commit 16a1445

4 files changed

Lines changed: 11 additions & 6 deletions

File tree

extensions/git-id-switcher/CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
## [0.16.19] - 2026-02-13
11+
12+
### Fixed
13+
14+
- **Switch to X-Extension-Id custom header for analytics classification**: The User-Agent approach in 0.16.18 was ineffective because Node.js `fetch()` overrides User-Agent to `"node"`. Now uses `X-Extension-Id: git-id-switcher` custom header, which the assets worker forwards to the analytics worker for correct VSCODE/is_likely_human=1 classification.
15+
1016
## [0.16.18] - 2026-02-13
1117

1218
### Fixed

extensions/git-id-switcher/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "git-id-switcher",
33
"displayName": "%extension.displayName%",
44
"description": "%extension.description%",
5-
"version": "0.16.18",
5+
"version": "0.16.19",
66
"publisher": "nullvariant",
77
"icon": "images/icon.png",
88
"engines": {

extensions/git-id-switcher/src/ui/documentationInternal.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export const DOCUMENT_HASHES: Record<string, string> = {
2525
'AGENTS.md': 'cb8170851742743e584cf21ff3427c78dc1c9471fd56d25a19abc174ed4fdd61',
2626
'CODE_OF_CONDUCT.md': 'a5eb286c902437bbe0f6d409894f20e51c172fa869fe2f151bfa388f9d911b54',
2727
'CONTRIBUTING.md': '4150f8810aec7b2e8eff9f3c69ee1bae1374843f50a812efa6778cba27a833cd',
28-
'extensions/git-id-switcher/CHANGELOG.md': '0eec5a04436e23fa644aa7694f6410cebf6d1c4af26300bf4dab0d4cec8d15eb',
28+
'extensions/git-id-switcher/CHANGELOG.md': '09ec3ba05e93b80cfaff401d0a35b3fb3816b26bd3432101e7d1a0e89e05b3d2',
2929
'extensions/git-id-switcher/docs/ARCHITECTURE.md': 'a12dd717f83b28b648972a826701a29fcfd575e351c487f8c421402f80ac3d25',
3030
'extensions/git-id-switcher/docs/CONTRIBUTING.md': '7d6ad2bc4d8c838790754cb9df848cb65f9fdce7e1a13e5c965b83a3d5b6378c',
3131
'extensions/git-id-switcher/docs/DESIGN_PHILOSOPHY.md': 'f9718b61ac161cb466dbc76845688e7acacf4e5fdc4b8b9553269dba4a094f6b',

extensions/git-id-switcher/src/ui/documentationPublic.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -92,11 +92,10 @@ async function fetchDocumentByPath(path: string): Promise<string | null> {
9292
const url = `${ASSET_BASE_URL}/${path}`;
9393

9494
// Add headers for analytics classification and CI/test filtering
95-
// Node.js fetch doesn't include VSCode's User-Agent (Code/x.y.z),
96-
// so analytics worker classifies requests as OTHER/is_likely_human=0.
97-
// Setting User-Agent with "Code/" prefix matches existing classifyTraffic detection.
95+
// Node.js fetch overrides User-Agent to "node", so custom header is needed.
96+
// Assets worker forwards X-Extension-Id to analytics worker for classification.
9897
const headers: Record<string, string> = {
99-
'User-Agent': `Code/${vscode.version} git-id-switcher`,
98+
'X-Extension-Id': 'git-id-switcher',
10099
};
101100
if (isTestEnvironment()) {
102101
headers['X-Test-Environment'] = 'true';

0 commit comments

Comments
 (0)