`sentry` commands skip a `.sentryclirc` above the repository root that the docs and `createSentrySDK` read
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 35/100
- issue の種類
- バグ
- 明瞭さ
- おおむね明確
- 活発さ
- 活発
- 技術スタック
- cli, typescript
調査の方向性
The two readers differ: the CLI boot fills a cache in packages/cli/src/lib/dsn/project-root.ts that loadSentryCliRc in packages/cli/src/lib/sentryclirc.ts reuses, while packages/cli/src/lib/sdk-invoke.ts skips that boot. Run the attached reproducer after pnpm run bundle in packages/cli to see both forms' results. Done means both forms read the same .sentryclirc files in every step, with the reproducer exiting 0; the maintainers still have to decide whether the code or the docs change.
索引モデルが issue の本文から書いたものです。
説明
Environment
sentrybundled frommainat e72bcc06cafabd9bac550b7aa3b59861e6d0a0f5 with no uncommitted changes (sentry --version:0.52.0-dev.0), and[email protected]from npm, which does the same- node v26.12.1 on win32 x64, and node v20.20.2 on linux x64 with
[email protected], which does the same
Steps to Reproduce
- Make a home folder whose
~/.sentryclircsets the org:[defaults] org=home-org - Make a folder
org/whose.sentryclircsets another org, and a repository below it,org/repo/, holding a.gitfolder:[defaults] org=above-org - In
org/repo/, runsentry release view 1.0.0withSENTRY_URLandSENTRY_AUTH_TOKENset (hereSENTRY_URLnames a local stand-in for the Sentry API), then callcreateSentrySDK({ url, token }).release.view({ orgVersion: "1.0.0" })withurlnaming the same server. - Do steps 2 and 3 again with a folder
url/whose.sentryclircsets a self-hosted server, aboveurl/repo/.git/:[defaults] url=https://sentry.example.com - Do step 3 again in
none/repo/, a repository with no.sentryclircabove it.
Expected Result
sentry commands read the .sentryclirc files the docs describe: "The CLI looks for .sentryclirc files by walking up from your current directory toward the filesystem root" (configuration.md#L9), the walk loadSentryCliRc documents (sentryclirc.ts#L316-L321) and createSentrySDK calls make. So from one folder both forms read the same files: in step 3 both name above-org, in step 4 both reach the server or both are refused, and in step 5 both take home-org from ~/.sentryclirc.
Actual Result
In step 3 the CLI takes the org from ~/.sentryclirc and the SDK takes it from org/.sentryclirc, above the repository:
# in <tmp>/org/repo, below a .sentryclirc that sets org
$ SENTRY_URL=http://127.0.0.1:64229 SENTRY_AUTH_TOKEN=example-token sentry release view 1.0.0
[… 17 lines: the release table …]
Detected from .sentryclirc (<tmp>\home\.sentryclirc)
exit 0; requests the stand-in received: GET /api/0/organizations/home-org/ -> 200, GET /api/0/organizations/home-org/releases/1.0.0/ -> 200
# in <tmp>/org/repo, below a .sentryclirc that sets org
> createSentrySDK({ url: "http://127.0.0.1:64229", token: "example-token" }).release.view({ orgVersion: "1.0.0" })
returned release 1.0.0
exit 0; requests the stand-in received: GET /api/0/organizations/above-org/ -> 200, GET /api/0/organizations/above-org/releases/1.0.0/ -> 200
In step 4 the CLI reaches the server, and the SDK is refused by url/.sentryclirc before it sends a request:
# in <tmp>/url/repo, below a .sentryclirc that sets a self-hosted url
$ SENTRY_URL=http://127.0.0.1:64229 SENTRY_AUTH_TOKEN=example-token sentry release view 1.0.0
[… 17 lines: the release table …]
Detected from .sentryclirc (<tmp>\home\.sentryclirc)
exit 0; requests the stand-in received: GET /api/0/organizations/home-org/ -> 200, GET /api/0/organizations/home-org/releases/1.0.0/ -> 200
# in <tmp>/url/repo, below a .sentryclirc that sets a self-hosted url
> createSentrySDK({ url: "http://127.0.0.1:64229", token: "example-token" }).release.view({ orgVersion: "1.0.0" })
Config at <tmp>\url\.sentryclirc: https://sentry.example.com
Refusing to route requests here because it doesn't match the host your Sentry credentials are for (http://127.0.0.1:64229).
To use this host, run: sentry auth login --url https://sentry.example.com
To keep using your current credentials, remove this URL override.
exitCode 13
exit 13; requests the stand-in received: none
In step 5 both name home-org.
The CLI reads the .sentryclirc files once, at its boot (cli.ts#L892), in the project-root walk (project-context.ts#L29). That walk stops at a repository-root marker, a VCS folder such as .git, a CI file such as .github or .gitlab-ci.yml, or an .editorconfig with root = true (dsn/project-root.ts#L589-L598, the markers at L60-L84 and L257-L307), at a DSN .env (L584-L587) or at the home folder (L610-L613), and caches what it read as loadSentryCliRc's answer for that folder, "a cache hit instead of a second walk" (L540-L557). An SDK call does not run that boot (sdk-invoke.ts#L408-L420), so its loadSentryCliRc misses the cache and walks to the filesystem root, as the docs say (sentryclirc.ts#L296-L344).
Reproducer
https://gist.github.com/YevheniiKotyrlo/28abb2a95412cd1133f7ec48e0a4401d
It runs steps 1 to 5 in a temporary folder against a local stand-in for the Sentry API that records each request. Each run starts from the caller's environment without its SENTRY_* and GIT_* variables and sets its own: HOME and USERPROFILE (the home folder of step 1), SENTRY_CONFIG_DIR (a folder of its own), TMPDIR, TEMP and TMP (a folder below the temporary folder), SENTRY_URL and SENTRY_AUTH_TOKEN for the CLI (the SDK gets url and token), and SENTRY_CLI_NO_TELEMETRY, SENTRY_CLI_NO_UPDATE_CHECK and NO_COLOR. The verdict depends on the home folder, on SENTRY_CONFIG_DIR, which keeps out a stored login that would let a self-hosted URL pass, and on SENTRY_URL and SENTRY_AUTH_TOKEN (url and token for the SDK), which send both forms to the stand-in; the rest keep telemetry, the update check, colour and what the runs leave in a temporary folder out of it. It exits 1 while the two forms read different files from org/repo or url/repo, 0 once they read the same files from both, the ones the docs describe or, should the docs change instead, the ones the CLI reads now, and 2 when a step fails, a run of step 5 does not name home-org, a run ends another way, or the run is interrupted. A .sentryclirc that sets org or url in a folder above the temporary folder would apply to the SDK's runs from every repository, so the reproducer then stops with 2; point TMPDIR (TEMP and TMP on Windows) at a folder with none above it. It needs Node 20+, and no Sentry account.
node repro.mjs # sentry@latest from npm
node repro.mjs 0.50.0 # a given version from npm
node repro.mjs <toolkit> # a getsentry/toolkit checkout: runs `pnpm run bundle` in packages/cli first
Its result on main:
RESULT (exit 1): defect shows (sentry 0.52.0-dev.0 built from e72bcc06cafa): from one folder in a repository, the CLI and the SDK read different .sentryclirc files: below a .sentryclirc that sets org, the CLI named home-org and the SDK named above-org; below a .sentryclirc that sets a self-hosted url, the CLI reached the stand-in and the SDK was refused (exit 13)
Its whole output on main
node v26.12.1 on win32 x64
$ # sentry: getsentry/toolkit at e72bcc06cafabd9bac550b7aa3b59861e6d0a0f5, no uncommitted changes
$ pnpm run bundle # in packages/cli
$ # the folders, below the temporary folder <tmp>
<tmp>/home/.sentryclirc [defaults] org=home-org (HOME and USERPROFILE)
<tmp>/none/repo/.git/
<tmp>/org/.sentryclirc [defaults] org=above-org
<tmp>/org/repo/.git/
<tmp>/url/.sentryclirc [defaults] url=https://sentry.example.com
<tmp>/url/repo/.git/
$ sentry --version
0.52.0-dev.0
# in <tmp>/none/repo, below no .sentryclirc
$ SENTRY_URL=http://127.0.0.1:64229 SENTRY_AUTH_TOKEN=example-token sentry release view 1.0.0
Release 1.0.0
━━━━━━━━━━━━━
╭─────────────┬─────────────╮
│ Version │ 1.0.0 │
│ Status │ Unreleased │
│ Created │ Jan 1 │
│ Released │ — │
│ First Event │ — │
│ Last Event │ — │
│ Ref │ — │
│ Commits │ 0 │
│ Deploys │ 0 │
│ New Issues │ 0 │
│ Projects │ example-app │
╰─────────────┴─────────────╯
Detected from .sentryclirc (<tmp>\home\.sentryclirc)
exit 0; requests the stand-in received: GET /api/0/organizations/home-org/ -> 200, GET /api/0/organizations/home-org/releases/1.0.0/ -> 200
# in <tmp>/none/repo, below no .sentryclirc
> createSentrySDK({ url: "http://127.0.0.1:64229", token: "example-token" }).release.view({ orgVersion: "1.0.0" })
returned release 1.0.0
exit 0; requests the stand-in received: GET /api/0/organizations/home-org/ -> 200, GET /api/0/organizations/home-org/releases/1.0.0/ -> 200
# in <tmp>/org/repo, below a .sentryclirc that sets org
$ SENTRY_URL=http://127.0.0.1:64229 SENTRY_AUTH_TOKEN=example-token sentry release view 1.0.0
Release 1.0.0
━━━━━━━━━━━━━
╭─────────────┬─────────────╮
│ Version │ 1.0.0 │
│ Status │ Unreleased │
│ Created │ Jan 1 │
│ Released │ — │
│ First Event │ — │
│ Last Event │ — │
│ Ref │ — │
│ Commits │ 0 │
│ Deploys │ 0 │
│ New Issues │ 0 │
│ Projects │ example-app │
╰─────────────┴─────────────╯
Detected from .sentryclirc (<tmp>\home\.sentryclirc)
exit 0; requests the stand-in received: GET /api/0/organizations/home-org/ -> 200, GET /api/0/organizations/home-org/releases/1.0.0/ -> 200
# in <tmp>/org/repo, below a .sentryclirc that sets org
> createSentrySDK({ url: "http://127.0.0.1:64229", token: "example-token" }).release.view({ orgVersion: "1.0.0" })
returned release 1.0.0
exit 0; requests the stand-in received: GET /api/0/organizations/above-org/ -> 200, GET /api/0/organizations/above-org/releases/1.0.0/ -> 200
# in <tmp>/url/repo, below a .sentryclirc that sets a self-hosted url
$ SENTRY_URL=http://127.0.0.1:64229 SENTRY_AUTH_TOKEN=example-token sentry release view 1.0.0
Release 1.0.0
━━━━━━━━━━━━━
╭─────────────┬─────────────╮
│ Version │ 1.0.0 │
│ Status │ Unreleased │
│ Created │ Jan 1 │
│ Released │ — │
│ First Event │ — │
│ Last Event │ — │
│ Ref │ — │
│ Commits │ 0 │
│ Deploys │ 0 │
│ New Issues │ 0 │
│ Projects │ example-app │
╰─────────────┴─────────────╯
Detected from .sentryclirc (<tmp>\home\.sentryclirc)
exit 0; requests the stand-in received: GET /api/0/organizations/home-org/ -> 200, GET /api/0/organizations/home-org/releases/1.0.0/ -> 200
# in <tmp>/url/repo, below a .sentryclirc that sets a self-hosted url
> createSentrySDK({ url: "http://127.0.0.1:64229", token: "example-token" }).release.view({ orgVersion: "1.0.0" })
Config at <tmp>\url\.sentryclirc: https://sentry.example.com
Refusing to route requests here because it doesn't match the host your Sentry credentials are for (http://127.0.0.1:64229).
To use this host, run: sentry auth login --url https://sentry.example.com
To keep using your current credentials, remove this URL override.
exitCode 13
exit 13; requests the stand-in received: none
RESULT (exit 1): defect shows (sentry 0.52.0-dev.0 built from e72bcc06cafa): from one folder in a repository, the CLI and the SDK read different .sentryclirc files: below a .sentryclirc that sets org, the CLI named home-org and the SDK named above-org; below a .sentryclirc that sets a self-hosted url, the CLI reached the stand-in and the SDK was refused (exit 13)
- 主要言語
- TypeScript
- スター
- 975
- フォーク
- 189
- 平均マージ
- 19時間 57分
- マージ済み PR(30日)
- 542
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
getsentry/toolkit のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
getsentry/toolkit#2583 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 77/100
getsentry/toolkit#2531 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
mcp-feedback-pattern
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
getsentry/toolkit#2458 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
getsentry/toolkit#2444 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
mcp-feedback-pattern
難易度 2/5 1〜3時間 初心者へのやさしさ 67/100
getsentry/toolkit#2362 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
getsentry/toolkit の issue をすべて見る
似ている issue
-
sumHorizontal, maxHorizontal, minHorizontal, allHorizontal, anyHorizontal, struct and argSortBy treat strings as literals instead of column names対応中かも @tomaionescu が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
pola-rs/nodejs-polars#486 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
jaegertracing/jaeger-ui#4853 ·
メンテナーはふだん 1 日以内に返信
-
area/plugins platform/linux reproduced type/bug version/v2
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
anomalyco/opencode#66970 · コメント 3 件 ·
メンテナーはふだん 1 日以内に返信
-
area:tui enhancement platform:macos
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
anthropics/claude-code#112838 ·
-
approved check:passed streams:add
難易度 2/5 1〜3時間 初心者へのやさしさ 66/100
メンテナーはふだん 1 日以内に返信