Skip to content

feat(init): add --org flag and fix misleading multi-org error#549

Closed
betegon wants to merge 5 commits intomainfrom
fix/init-org-flag
Closed

feat(init): add --org flag and fix misleading multi-org error#549
betegon wants to merge 5 commits intomainfrom
fix/init-org-flag

Conversation

@betegon
Copy link
Copy Markdown
Member

@betegon betegon commented Mar 24, 2026

Summary

  • Add --org <slug> flag to sentry init for symmetry with --team and discoverability. Equivalent to the positional sentry init <org>/ syntax — users who see "organization not found" and run --help now have an obvious flag to use.
  • Fix the --yes + multiple-orgs error message: it said "Set SENTRY_ORG" but sentry init never reads that env var. Now references --org and the target syntax.

Test plan

  • sentry init --help shows --org flag
  • sentry init --org acme-corp behaves like sentry init acme/
  • sentry init --org acme-corp ./mydir behaves like sentry init acme/ ./mydir
  • sentry init acme/ --org other-org → error: "conflicts with target org"
  • sentry init --yes with multiple orgs shows updated error message referencing --org
  • Unit tests pass

🤖 Generated with Claude Code

- Add --org flag for symmetry with --team and discoverability.
  Equivalent to the positional `sentry init <org>/` syntax.
  Conflicts with target-provided org are caught at parse time.
- Fix multiple-orgs error in --yes mode: was "Set SENTRY_ORG"
  (which init never reads), now references --org and the target syntax.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 24, 2026

Semver Impact of This PR

🟡 Minor (new features)

📋 Changelog Preview

This is how your changes will appear in the changelog.
Entries from this PR are highlighted with a left border (blockquote style).


New Features ✨

  • (formatters) Colorize SQL in DB span descriptions by BYK in #546
  • (init) Add --org flag and fix misleading multi-org error by betegon in #549
  • Add sentry sourcemap inject and sentry sourcemap upload commands by BYK in #547
  • Native debug ID injection and sourcemap upload by BYK in #543

Internal Changes 🔧

Coverage

  • Use informational-patch input instead of sed hack by BYK in #544
  • Make checks informational on release branches by BYK in #541

Other

  • (ci) Upgrade GitHub Actions to Node 24 runtime by BYK in #542
  • (issue-list) Use collapse parameter to skip unused Snuba queries by BYK in #545
  • Regenerate skill files by github-actions[bot] in ec1ffe28

🤖 This preview updates automatically when you update the PR.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 24, 2026

Codecov Results 📊

126 passed | Total: 126 | Pass Rate: 100% | Execution Time: 0ms

📊 Comparison with Base Branch

Metric Change
Total Tests
Passed Tests
Failed Tests
Skipped Tests

✨ No test changes detected

All tests are passing successfully.

✅ Patch coverage is 100.00%. Project has 1039 uncovered lines.
✅ Project coverage is 96.03%. Comparing base (base) to head (head).

Coverage diff
@@            Coverage Diff             @@
##          main       #PR       +/-##
==========================================
+ Coverage    96.03%    96.03%        —%
==========================================
  Files          193       193         —
  Lines        26142     26142         —
  Branches         0         0         —
==========================================
+ Hits         25103     25103         —
- Misses        1039      1039         —
- Partials         0         0         —

Generated by Codecov Action

betegon and others added 3 commits March 24, 2026 11:50
…t check

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The --org flag was inconsistent with all other commands (none have it).
The right fix is to make the org/project positional syntax unambiguous
in the help text by using labeled examples with generic my-org/my-project
names instead of acme/, which could be mistaken for a filesystem path.

Also updates the multiple-orgs error message to use the positional syntax.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Copy link
Copy Markdown

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

return {
ok: false,
error: `Multiple organizations found (${slugs}). Set SENTRY_ORG to specify which one.`,
error: `Multiple organizations found (${slugs}). Use 'sentry init my-org/ [directory]' to specify which one.`,
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Error message omits --org flag the PR promised

High Severity

The PR title and description explicitly state that an --org flag is being added and that this error message "now references --org and the target syntax." However, the --org flag is entirely missing — InitFlags has no org property, parameters.flags has no org definition, and no alias is registered. The updated error message at line 698 only mentions positional syntax (sentry init my-org/) and not --org. Every --org-related item in the test plan (five of six) would fail. This appears to be the primary feature of the PR but its implementation was not included.

Additional Locations (1)
Fix in Cursor Fix in Web

@betegon
Copy link
Copy Markdown
Member Author

betegon commented Mar 24, 2026

closing this. related #554

@betegon betegon closed this Mar 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant