fix(cli): cmd_compress writes to mempalace_closets (#1244)#1319
Merged
fix(cli): cmd_compress writes to mempalace_closets (#1244)#1319
Conversation
…ad them (#1244) `cmd_compress` was writing AAAK-compressed drawers to a `mempalace_compressed` collection, but every read path (`palace.get_closets_collection`, `searcher.py`, `repair.py`) reads from `mempalace_closets`. Result: for non-mined palaces (or any palace where the user ran `mempalace compress` expecting to backfill the closet/index layer), the compressed output was silently invisible — written to a collection nothing else opens. Fix the writer rather than renaming the readers: "closets" is the user-visible feature name baked into the public API (`get_closets_collection`), the searcher hybrid path, repair/HNSW diagnostics, and docs. Renaming the readers would churn 15+ call sites and the README for no benefit. The compressed AAAK strings are exactly what closets are conceptually — compact pointers scanned by an LLM to locate the right drawer — so they belong in `mempalace_closets`. Tests: - Update `test_cmd_compress_stores_results` to assert the collection name passed to `get_or_create_collection` is `mempalace_closets`. - Add `test_cmd_compress_output_readable_via_get_closets_collection`: end-to-end with a real ChromaBackend, seed a drawer, run cmd_compress, then read back via the same `get_closets_collection` helper that palace.py / searcher use. Regression test for the wrong-collection bug. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
CI requires ruff format --check on the whole touched file. Pre-existing drift, no logic change.
4 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.
Closes #1244.
Problem
cmd_compress(inmempalace/cli.py) was writing AAAK-compressed drawers to a collection namedmempalace_compressed, but every read path in the codebase reads frommempalace_closets:mempalace/palace.py::get_closets_collection(the canonical accessor)mempalace/searcher.py(hybrid search)mempalace/repair.py(HNSW capacity check)mempalace/closet_llm.py,mempalace/diary_ingest.py,mempalace/miner.pySo for any user running
mempalace compressto backfill the closet/index layer on a non-mined palace, the compressed output was silently written to a dead collection nothing else opens — invisible to search, never scanned by the LLM.Fix
Update the writer in
cmd_compressto usemempalace_closets(matching the readers), instead of renaming the 15+ readers. Rationale:get_closets_collection), README claims tests, and architectural diagrams.Tests
test_cmd_compress_stores_resultsto assert the collection name passed toget_or_create_collectionismempalace_closets.test_cmd_compress_output_readable_via_get_closets_collection— end-to-end regression with a realChromaBackend: seeds a drawer, runscmd_compress, then reads back through the sameget_closets_collectionhelper thatpalace.py/searcher.pyuse. Fails on the old code, passes on the fix.Test plan
python -m pytest tests/ -v --ignore=tests/benchmarks -x -k "compress or closet"— 94 passedpython -m pytest tests/test_cli.py -v— 54 passedruff check .— All checks passedruff format --check— only pre-existing format drift on develop, no new issues introduced by this PRGenerated with Claude Code