Fix start:test isolated config after split-config refactor - #2958
Merged
Conversation
DEV_APP_DATA_PATH only redirected app.json, leaving cli.json and shared.json pointing at ~/.studio/ — real sites could leak into the test instance. Adds DEV_CONFIG_DIR support to getConfigDirectory() so a single env var redirects the entire config directory, covering all three split config files. Removes the now-redundant DEV_APP_DATA_PATH check from getUserDataFilePath().
Collaborator
📊 Performance Test ResultsComparing f1d9df3 vs trunk app-size
site-editor
site-startup
Results are median values from multiple test runs. Legend: 🟢 Improvement (faster) | 🔴 Regression (slower) | ⚪ No change (<50ms diff) |
katinthehatsite
approved these changes
Apr 1, 2026
Contributor
|
I will retrigger the failed tests now 👀 |
chubes4
added a commit
that referenced
this pull request
Jul 2, 2026
Two linked bugs let a freshly-converted MySQL site break on the next `studio start`, even though the conversion itself imported cleanly: 1. paths.ts hardcoded the daemon home to ~/.studio, ignoring the DEV_CONFIG_DIR sandbox that the rest of the CLI honors via getConfigDirectory(). A sandboxed CLI (the MySQL POC, or start:test) therefore connected to the default ~/.studio daemon, which for the POC is the stock MySQL-unaware Studio.app daemon — it never launched mysqld and drove the isolated site through the wrong process manager. Derive PROCESS_MANAGER_HOME from getConfigDirectory() so the daemon socket lives alongside cli.json/shared.json. When DEV_CONFIG_DIR is unset getConfigDirectory() returns ~/.studio, so normal installs are byte-for -byte unchanged; an explicit STUDIO_PROCESS_MANAGER_HOME still wins. This finishes what #2958 set out to do ("redirect the entire config directory") but which only covered well-known-paths.ts. 2. ensureWpConfig() silently fell back to DB_NAME='wordpress' whenever the engine config was absent. Combined with (1), a start via the wrong daemon rewrote a converted site's wp-config.php back to 'wordpress', severing it from its studio_<id> database. Add a guard that refuses to overwrite an existing non-default DB_NAME when no MySQL engine config is provided, instead of corrupting the config. Proven on the real studio-native-local-runtime site: full stop -> start round-trip now boots on MySQL 8.4.10, serves HTTP 200, and keeps DB_NAME=studio_1322c571c44e43ca80826cd1 with all content intact. ## AI assistance - **AI assistance:** Yes - **Tool(s):** Claude Opus 4.8 via Claude Code - **Used for:** Root-causing the two bugs from source, writing the fixes and the guard unit test, and verifying the stop/start round-trip on the converted runtime.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Related issues
How AI was used in this PR
Claude Code was used to investigate the root cause and implement the fix.
Proposed Changes
This PR adds
DEV_CONFIG_DIRenv var support togetConfigDirectory()intools/common/lib/well-known-paths.ts, redirecting the entire~/.studio/config directory when set.The config refactor split the single appdata file into three files (
app.json,cli.json,shared.json). The oldDEV_APP_DATA_PATHonly redirectedapp.json—cli.json(sites, snapshots) andshared.json(auth) still pointed at~/.studio/, so real developer sites could appear in the test instance.Testing Instructions
npm run start:test— app should open with no sites and no auth/tmp/studio-test/is created with the isolated config files~/.studio/cli.jsonand~/.studio/shared.jsonare unchanged after the sessionnpm startand confirm your real sites still appear normallyPre-merge Checklist