MCPcopy
hub / github.com/MemPalace/mempalace / test_nested_gitignore_layers

Method test_nested_gitignore_layers

tests/test_sync.py:323–366  ·  view source on GitHub ↗

Subdir .gitignore can deny what root allows.

(self, tmp_dir, palace_path)

Source from the content-addressed store, hash-verified

321 assert "d_doom" not in survivors
322
323 def test_nested_gitignore_layers(self, tmp_dir, palace_path):
324 """Subdir .gitignore can deny what root allows."""
325 from mempalace.sync import sync_palace
326
327 repo_path = Path(tmp_dir) / "repo"
328 (repo_path / "vendor").mkdir(parents=True)
329 # Root gitignore is empty.
330 (repo_path / ".gitignore").write_text("\n")
331 # Subdir gitignore ignores everything under vendor/.
332 (repo_path / "vendor" / ".gitignore").write_text("*.py\n")
333 (repo_path / "vendor" / "lib.py").write_text("# nested-ignored\n")
334
335 client = chromadb.PersistentClient(path=palace_path)
336 col = client.get_or_create_collection(
337 "mempalace_drawers", metadata={"hnsw:space": "cosine"}
338 )
339 col.add(
340 ids=["d_nested"],
341 documents=["x"],
342 embeddings=[[1.0, 0.0, 0.0]],
343 metadatas=[
344 {
345 "wing": "demo",
346 "room": "vendor",
347 "source_file": str(repo_path / "vendor" / "lib.py"),
348 "chunk_index": 0,
349 "added_by": "miner",
350 "filed_at": "2026-05-09T00:00:00",
351 }
352 ],
353 )
354 del client
355
356 sync_palace(
357 palace_path=palace_path,
358 project_dirs=[str(repo_path)],
359 dry_run=False,
360 )
361
362 client, col = _open_drawers(palace_path)
363 try:
364 assert "d_nested" not in _drawer_ids(col)
365 finally:
366 del client
367
368 def test_closet_purge_runs_on_apply(self, synced_world):
369 """Closets pointing at removed sources must also disappear."""

Callers

nothing calls this directly

Calls 5

sync_palaceFunction · 0.90
_open_drawersFunction · 0.85
_drawer_idsFunction · 0.85
addMethod · 0.45

Tested by

no test coverage detected