Skip to content

ref(devenv): Remove scripts/do.sh and scripts/lib.sh, slim .envrc - #129411

Open
sentry-junior[bot] wants to merge 3 commits into
masterfrom
ref/remove-do-lib-sh
Open

sentry-junior[bot] wants to merge 3 commits into
masterfrom
ref/remove-do-lib-sh

Conversation

@sentry-junior

@sentry-junior sentry-junior Bot commented Oct 31, 2026 •

Copy link
Copy Markdown
Contributor

.envrc had grown into activation, diagnosis, and repair all at once: it sourced scripts/lib.sh, could launch xcode-select --install, deleted shadowing sentry executables in a loop, hard-failed on a node version mismatch, and teed its own output to a tempfile. This cuts it from 238 lines to about 45, so it only sets environment variables and PATH, plus one cheap devenv sync hint. scripts/do.sh and scripts/lib.sh are deleted.

Activation

  • PATH order is now explicit, highest first: global devenv, .venv/bin, .devenv/bin, node_modules/.bin, gcloud, homebrew. The venv outranks every other checkout directory, so the deletion loop isn't needed. The package.json postinstall still removes node_modules/.bin/sentry for pnpm script runs. devenv still resolves to the global install, as it did before. gcloud moves from first place to just above homebrew.
  • dotenv_if_exists replaces the [ -f .env ] guard, so creating .env now triggers a reload too.
  • SENTRY_DEVSERVICES_DSN and the SENTRY_DEVENV_NO_REPORT opt-out are unchanged. The XDG_* exports from lib.sh are gone; only SENTRY_DEVENV_HOME needed one.
  • The node, node_modules, prek, and agent-skill checks move to devenv/checks/synced.py for devenv doctor. Its fix runs devenv sync.

Make targets. All eight keep their names, since migrations-drift CI, quick_drift_compare.py, test-cli, and people's fingers use them. The trivial ones are plain recipes. The database ones go through tools/dev_db.py:

  • create treats "already exists" as success but surfaces every other createdb failure. The shell version swallowed all of them with || true, including a stopped Postgres container.
  • reset-db is one ordered invocation, so make -j can't interleave drop, upgrade, and createuser.
  • It keeps the full sentry upgrade --noinput and the existing CI vs. local superuser behavior.
  • devenv sync calls .venv/bin/python -m tools.dev_db migrate directly instead of going through Make → do.sh → lib.sh.

CI. The dev env workflow now runs on devenv/** changes and checks that .envrc loads under direnv with sentry resolving to the venv. migrations-drift now also runs on tools/dev_db.py and Makefile changes.

Merge order

  1. getsentry/getsentry#22865 must merge first. getsentry's .envrc sources this one and calls the info/warn/require/show_commands_info helpers being deleted here. That PR switches to direnv's stdlib and works with both the old and new sentry .envrc.
  2. The doctor check needs fix(doctor): Stop builtin loader from filtering out repo checks devenv#251, released in 1.31.0. The sentry-devenv pin here is now >=1.31.0.

via @joshuarli.

--

View Session [Sentry]

.envrc mixed activation with diagnosis and repair: it sourced
scripts/lib.sh, launched xcode-select, deleted shadowing executables,
hard-failed on a node mismatch, and teed its own output to a tempfile.
It now only sets environment variables and PATH, with one cheap
`devenv sync` hint.

- PATH order is explicit: global devenv, .venv/bin, .devenv/bin,
  node_modules/.bin, gcloud, homebrew. The venv outranks every other
  checkout directory, so the executable-deletion loop is gone; the
  package.json postinstall still drops node_modules/.bin/sentry for pnpm.
- dotenv_if_exists watches .env while it's absent.
- The node, node_modules, prek, and agent-skill checks move to
  devenv/checks/synced.py for `devenv doctor`.
- The Make targets that dispatched through do.sh keep their names. The
  database ones go through tools/dev_db.py, which treats an existing
  database as success but surfaces every other createdb failure (the
  shell version ignored all of them). reset-db is one ordered
  invocation, so `make -j` can't interleave it.
- devenv sync calls tools.dev_db directly instead of `make
  apply-migrations`.
- CI: the dev env workflow now watches devenv/** and checks direnv
  activation; migrations-drift runs when tools/dev_db.py or the
  Makefile change.

Co-Authored-By: Joshua Li <14209781+joshuarli@users.noreply.github.com>
@github-actions github-actions Bot added the Scope: Backend Automatically applied to PRs that change backend components label Oct 31, 2026
sentry-junior Bot and others added 2 commits October 31, 2026 00:46
1.31.0 includes getsentry/devenv#251, so repo-defined doctor checks, including the one added in this PR, now load.

Co-Authored-By: opencode (DeepSeek V4.1 Flash) <opencode@local>
@joshuarli
joshuarli marked this pull request as ready for review October 31, 2026 13:35
@joshuarli
joshuarli requested review from a team as code owners October 31, 2026 13:35

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Scope: Backend Automatically applied to PRs that change backend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant