-
Notifications
You must be signed in to change notification settings - Fork 266
fix(cli): seed config projects into the database on CLI-only installs #1354
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
da5424f
fix(cli): seed config projects into the database on CLI-only installs
phernandez aebe9cf
test(mcp): stop relying on an empty local database as the routing signal
phernandez cc8b54a
fix(core): keep cloud-mode projects out of local reconciliation
phernandez e78be50
test(mcp): expect the local miss for a cloud-mode entry under --local
phernandez c78d8fb
fix(core): keep local rows for cloud projects that have a local sync …
phernandez a143d25
fix(core): clear sync metadata on set-cloud and retry reconciliation …
phernandez 662964b
fix(core): converge stale rows for cloud-only entries and keep a norm…
phernandez 00d5206
fix(core): count a legacy path-only cloud copy as a local copy
phernandez f057cd4
fix(core): only an absolute legacy path counts as a local cloud copy
phernandez 33805d6
fix(core): require the cloud sync copy to be an absolute path
phernandez File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,56 @@ | ||
| """Regression tests for a fresh, CLI-only install (#1334, #974).""" | ||
|
|
||
| import os | ||
| import subprocess | ||
| from pathlib import Path | ||
|
|
||
| PROJECT_ROOT = Path(__file__).parent.parent.parent | ||
|
|
||
|
|
||
| def _pristine_env(home: Path) -> dict[str, str]: | ||
| """A profile with no Basic Memory state, and none inherited from the developer or CI.""" | ||
| env = { | ||
| key: value | ||
| for key, value in os.environ.items() | ||
| if not key.startswith("BASIC_MEMORY_") and key != "PYTEST_CURRENT_TEST" | ||
| } | ||
| env.update( | ||
| HOME=str(home), | ||
| USERPROFILE=str(home), | ||
| BASIC_MEMORY_HOME=str(home / "basic-memory"), | ||
| BASIC_MEMORY_CONFIG_DIR=str(home / ".basic-memory"), | ||
| BASIC_MEMORY_NO_PROMOS="1", | ||
| ) | ||
| return env | ||
|
|
||
|
|
||
| def _bm(args: list[str], env: dict[str, str]) -> subprocess.CompletedProcess[str]: | ||
| return subprocess.run( | ||
| ["uv", "run", "bm", *args], | ||
| capture_output=True, | ||
| text=True, | ||
| env=env, | ||
| # Guards a wedged install, not a performance budget: first run creates | ||
| # the database and runs migrations. | ||
| timeout=90, | ||
| cwd=PROJECT_ROOT, | ||
| ) | ||
|
|
||
|
|
||
| def test_fresh_cli_install_can_use_the_bootstrapped_default_project(tmp_path): | ||
| """The auto-created `main` project must exist in the database, not just config.json. | ||
|
|
||
| A fresh install seeds `main` into config.json. Only the API/MCP server lifespan | ||
| used to reconcile that into the projects table, so a CLI-only flow hit | ||
| "Project not found: 'main'" on every default-project command while | ||
| `project add main` refused with "already exists" (#1334). | ||
| """ | ||
| home = tmp_path / "home" | ||
| home.mkdir() | ||
| env = _pristine_env(home) | ||
|
|
||
| status = _bm(["status"], env) | ||
|
|
||
| assert status.returncode == 0, status.stderr | ||
| assert "Project not found" not in status.stdout + status.stderr | ||
| assert "main" in status.stdout |
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.