fix: scope derived graph state to explicit palace - #2018
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes a palace-isolation bug where derived graph sidecars (hallways / tunnels) could be persisted to the ambient default palace even when the CLI was run with an explicit --palace, by introducing an explicit palace_path override in MempalaceConfig and threading that selected config through miners and graph persistence helpers.
Changes:
- Add
MempalaceConfig(palace_path=...)override that takes precedence over env/file config, and use it to derive palace-scopedhallway_file/tunnel_file. - Thread the selected palace config through mining flows and graph derivation (hallways + topic/entity tunnels) so persistence lands beside the chosen palace.
- Add/extend regression tests ensuring explicit and default palaces’ sidecars stay isolated.
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| tests/test_palace_graph_tunnels.py | Adds regression coverage that topic tunnel persistence is scoped by explicit config/palace. |
| tests/test_miner.py | Updates miner integration tests to assert derived graph computations receive the selected palace config. |
| tests/test_hallways.py | Adds regression coverage that hallways persistence/listing is scoped by explicit config/palace. |
| tests/test_format_miner.py | Ensures format miner threads palace config into topic tunnel computation and supports palace override in the fake config. |
| tests/test_config.py | Adds coverage that explicit palace_path overrides env + file config and yields correct sidecar paths. |
| mempalace/palace_graph.py | Adds optional config threading for tunnel creation and derived tunnel computation paths. |
| mempalace/miner.py | Constructs a palace-scoped config for derived graph writes and threads it through topic/entity tunnel + hallway computation. |
| mempalace/hallways.py | Adds config plumbing to hallways compute + list APIs (but see review comment about deletion). |
| mempalace/format_miner.py | Uses palace-scoped config when mining formats and when computing topic tunnels. |
| mempalace/convo_miner.py | Uses palace-scoped config and threads it into hallway computation after convo mining. |
| mempalace/config.py | Extends MempalaceConfig with explicit palace_path override precedence. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Merged
3 tasks
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.
Summary
MempalaceConfigaccept an explicit palace-path override that outranks ambient environment and file config--palacemining mode keeps derived graph state beside the selected palaceWhy
A real local CLI smoke test for the 3.6.0 maintenance work found that:
mempalace --palace /tmp/example/palace mine ...stored drawers in
/tmp/example/palace, but hallway/entity-tunnel derivation instantiated a fresh ambientMempalaceConfig()and wrote into the user's default~/.mempalacesidecars. This could silently mix graph relationships between palaces.Validation
uv run pytest tests/ -q --ignore=tests/benchmarks— 3286 passed, 31 skippeduv run ruff check .uv run ruff format --check .hallways.json, its tunnel file remained isolated, and SHA checks confirmed the default hallway and tunnel files were unchangedRelease context
Discovered while testing the proposed 3.6.0 maintenance fixes on an actual local MemPalace installation. This should land before the release because the bug can contaminate a user's default graph merely by testing another palace with
--palace.