fix(pifs): surface projection dimension mismatches

This commit is contained in:
BukeLy 2026-05-31 21:23:19 +08:00
parent e293814bc0
commit 20b2225444
2 changed files with 19 additions and 2 deletions

View file

@ -162,8 +162,7 @@ def _parse_agent_command(
def _filesystem_from_workspace(workspace: str) -> PageIndexFileSystem:
filesystem = PageIndexFileSystem(Path(workspace).expanduser())
with contextlib.suppress(Exception):
filesystem.configure_existing_projection_retrieval()
filesystem.configure_existing_projection_retrieval()
return filesystem

View file

@ -25,6 +25,24 @@ def test_cli_workspace_configures_existing_projection_retrieval(monkeypatch, tmp
assert filesystem.projection_retrieval_configured is True
def test_cli_workspace_surfaces_projection_dimension_mismatch(monkeypatch, tmp_path):
import pytest
from pageindex.filesystem import cli
class MismatchedFileSystem:
def __init__(self, workspace):
self.workspace = Path(workspace)
def configure_existing_projection_retrieval(self):
raise RuntimeError("summary projection index dimension mismatch: rebuild")
monkeypatch.setattr(cli, "PageIndexFileSystem", MismatchedFileSystem)
with pytest.raises(RuntimeError, match="dimension mismatch"):
cli._filesystem_from_workspace(str(tmp_path / "workspace"))
def test_cli_passthrough_invokes_pifs_command_executor(monkeypatch, capsys, tmp_path):
from pageindex.filesystem import cli