Skip to content

fix(cli): Repair zsh completion during setup - #1524

Merged
MathurAditya724 merged 2 commits into
mainfrom
codex/cli-completion-investigation
Oct 16, 2026
Merged

MathurAditya724 merged 2 commits into
mainfrom
codex/cli-completion-investigation

Conversation

@MathurAditya724

@MathurAditya724 MathurAditya724 commented Oct 16, 2026 •

Copy link
Copy Markdown
Member

sentry cli setup now enables zsh tab completion whether completion has already been initialized by another tool or has never been initialized. Previously, setup could append Sentry's completion directory after compinit had scanned fpath, leaving the installed completion unregistered.

Re-running setup replaces the legacy Sentry-managed fpath command in place, repairing existing installs while keeping subsequent runs idempotent. Custom configuration is preserved, noninteractive shells skip completion initialization, and uninstall removes the complete managed command.

Regression coverage runs setup against fresh, previously initialized, and existing-install configurations, then checks registration and autoloading in real zsh processes. Tests isolate zsh's installed functions from unrelated insecure runner directories, including an explicit insecure-directory fixture, without disabling completion security checks. The CLI CI job installs zsh. Stale Bun comments in the affected setup and shell files now describe the Node implementations.

End-to-end validation of both the production npm bundle and a locally built standalone macOS arm64 binary reproduced broken Tab completion before setup, then verified command and subcommand expansion after setup in fresh terminals. Fresh installs, repeated setup, and native setup --install binary placement also passed. Repeated setup left configuration unchanged. These tests built the PR code locally; they did not download or publish a release.

Local typecheck, lint, and 147 related tests pass. With UTC and an isolated home, the full workspace run passes all other suites; the CLI reports 10,861 passed tests and 19 skipped tests, with one existing musl-installer fixture still failing because it assumes Linux while running on macOS. That baseline file is unchanged in this PR.

Register Sentry completion after initializing zsh completion when needed.
Migrate the legacy managed fpath command when setup runs again, with
real-shell regression coverage.

Co-Authored-By: GPT-6 Codex <[email protected]>
@vercel

vercel Bot commented Oct 16, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated
sentry-local Skipped Skipped Oct 16, 2026 8:09pm UTC

Request Review

Limit regression shells to zsh's installed function directories so unrelated
insecure runner directories cannot prompt without a terminal. Include an
insecure directory fixture and correct stale Bun comments.

Co-Authored-By: GPT-6 Codex <[email protected]>
@MathurAditya724
MathurAditya724 marked this pull request as ready for review October 16, 2026 20:30
@github-actions github-actions Bot added the risk: medium PR risk score: medium label Oct 16, 2026
@MathurAditya724
MathurAditya724 merged commit 1ad9cfe into main Oct 16, 2026
36 checks passed
@MathurAditya724
MathurAditya724 deleted the codex/cli-completion-investigation branch October 16, 2026 20:34
joshuawayzwright pushed a commit to joshuawayzwright/sentry-mcp that referenced this pull request Nov 16, 2026
…getsentry#1524)

Follow-up to getsentry#1520. Investigates whether a canonical, machine-readable
source exists for "which datasets accept a sort on grouped aggregates"
and records the finding.

**Result: no such source exists today.** The OpenAPI spec (`@sentry/api`
`listOrganizationEvents`) models `sort` as a flat query param whose only
documented constraint is "must be in the `field` list" — it does not
encode per-dataset sort capability, and there is no dataset-capability
introspection endpoint. The spec's `dataset` enum (`errors | logs |
profile_functions | spans | tracemetrics | uptime_results`) does not
even include `discover`.

Given that, the hand-curated `SORTABLE_DATASETS` set stays, but:
- The `discover` entry is removed — it was unreachable, since `discover`
is not a valid `--dataset` value (see `DATASET_ALIASES`).
- The doc comment now records the research findings as an explicit
contract, with a note to revisit if Sentry ships a per-dataset
capability contract.

## Testing
`vitest run test/commands/explore.test.ts` (40 passed) and
`test/lib/api/explore.test.ts` (18 passed); biome clean on the changed
file.

Refs getsentry#1523

<!--
## Plan
1. Investigate candidate canonical sources for sortable-dataset
capability:
- @sentry/api OpenAPI spec (getsentry/sentry-api-schema @ 0.256.0):
fetched openapi-derefed.json.
- listOrganizationEvents `sort` is a flat query param, doc constraint
only "must be in field list".
- dataset enum: errors, logs, profile_functions, spans, tracemetrics,
uptime_results (no discover).
     - no capabilities/dataset-meta endpoint anywhere in spec.
- Conclusion: no machine-readable source; best achievable deliverable is
a documented contract.
2. explore.ts: remove dead `discover` from SORTABLE_DATASETS
(unreachable via DATASET_ALIASES);
   rewrite the doc comment to record the findings and the contract.
3. Verify no test referenced `discover`; run explore unit tests + lint.
-->

Co-authored-by: jared-outpost[bot] <jared-outpost[bot]@users.noreply.github.com>
joshuawayzwright pushed a commit to joshuawayzwright/sentry-mcp that referenced this pull request Nov 16, 2026
…getsentry#1524)

Follow-up to getsentry#1520. Investigates whether a canonical, machine-readable
source exists for "which datasets accept a sort on grouped aggregates"
and records the finding.

**Result: no such source exists today.** The OpenAPI spec (`@sentry/api`
`listOrganizationEvents`) models `sort` as a flat query param whose only
documented constraint is "must be in the `field` list" — it does not
encode per-dataset sort capability, and there is no dataset-capability
introspection endpoint. The spec's `dataset` enum (`errors | logs |
profile_functions | spans | tracemetrics | uptime_results`) does not
even include `discover`.

Given that, the hand-curated `SORTABLE_DATASETS` set stays, but:
- The `discover` entry is removed — it was unreachable, since `discover`
is not a valid `--dataset` value (see `DATASET_ALIASES`).
- The doc comment now records the research findings as an explicit
contract, with a note to revisit if Sentry ships a per-dataset
capability contract.

## Testing
`vitest run test/commands/explore.test.ts` (40 passed) and
`test/lib/api/explore.test.ts` (18 passed); biome clean on the changed
file.

Refs getsentry#1523

<!--
## Plan
1. Investigate candidate canonical sources for sortable-dataset
capability:
- @sentry/api OpenAPI spec (getsentry/sentry-api-schema @ 0.256.0):
fetched openapi-derefed.json.
- listOrganizationEvents `sort` is a flat query param, doc constraint
only "must be in field list".
- dataset enum: errors, logs, profile_functions, spans, tracemetrics,
uptime_results (no discover).
     - no capabilities/dataset-meta endpoint anywhere in spec.
- Conclusion: no machine-readable source; best achievable deliverable is
a documented contract.
2. explore.ts: remove dead `discover` from SORTABLE_DATASETS
(unreachable via DATASET_ALIASES);
   rewrite the doc comment to record the findings and the contract.
3. Verify no test referenced `discover`; run explore unit tests + lint.
-->

Co-authored-by: jared-outpost[bot] <jared-outpost[bot]@users.noreply.github.com>
joshuawayzwright pushed a commit to joshuawayzwright/sentry-mcp that referenced this pull request Nov 16, 2026
…getsentry#1524)

Follow-up to getsentry#1520. Investigates whether a canonical, machine-readable
source exists for "which datasets accept a sort on grouped aggregates"
and records the finding.

**Result: no such source exists today.** The OpenAPI spec (`@sentry/api`
`listOrganizationEvents`) models `sort` as a flat query param whose only
documented constraint is "must be in the `field` list" — it does not
encode per-dataset sort capability, and there is no dataset-capability
introspection endpoint. The spec's `dataset` enum (`errors | logs |
profile_functions | spans | tracemetrics | uptime_results`) does not
even include `discover`.

Given that, the hand-curated `SORTABLE_DATASETS` set stays, but:
- The `discover` entry is removed — it was unreachable, since `discover`
is not a valid `--dataset` value (see `DATASET_ALIASES`).
- The doc comment now records the research findings as an explicit
contract, with a note to revisit if Sentry ships a per-dataset
capability contract.

## Testing
`vitest run test/commands/explore.test.ts` (40 passed) and
`test/lib/api/explore.test.ts` (18 passed); biome clean on the changed
file.

Refs getsentry#1523

<!--
## Plan
1. Investigate candidate canonical sources for sortable-dataset
capability:
- @sentry/api OpenAPI spec (getsentry/sentry-api-schema @ 0.256.0):
fetched openapi-derefed.json.
- listOrganizationEvents `sort` is a flat query param, doc constraint
only "must be in field list".
- dataset enum: errors, logs, profile_functions, spans, tracemetrics,
uptime_results (no discover).
     - no capabilities/dataset-meta endpoint anywhere in spec.
- Conclusion: no machine-readable source; best achievable deliverable is
a documented contract.
2. explore.ts: remove dead `discover` from SORTABLE_DATASETS
(unreachable via DATASET_ALIASES);
   rewrite the doc comment to record the findings and the contract.
3. Verify no test referenced `discover`; run explore unit tests + lint.
-->

Co-authored-by: jared-outpost[bot] <jared-outpost[bot]@users.noreply.github.com>

This branch was previously deployed

1 inactive deployment
Preview — 05f05e9f Deployed Oct 16, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

risk: medium PR risk score: medium

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants