...F.FFFF.                                                               [100%]
=================================== FAILURES ===================================
__________________ TestLsCommand.test_ls_with_subpath_filter ___________________

self = <tests.unit.cli.test_ls.TestLsCommand object at 0x108d6f6f0>

    def test_ls_with_subpath_filter(self):
        """Test ls with collection and subpath filter."""
        runner = CliRunner()
    
        mock_coll = MagicMock()
        mock_coll.id = "coll-notes"
        mock_coll.name = "notes"
        mock_coll.path = "/data/notes"
    
        mock_doc_x = MagicMock()
        mock_doc_x.path = "/data/notes/ideas/x.md"
    
        mock_doc_y = MagicMock()
        mock_doc_y.path = "/data/notes/done/y.md"
    
        mock_index_path = MagicMock()
        mock_index_path.exists.return_value = True
    
        with (
            patch("sif.cli.commands.ls.Database") as mock_db_cls,
            patch("sif.cli.commands.ls.DocumentRepository") as mock_doc_repo_cls,
            patch("sif.cli.commands.ls.CollectionRepository") as mock_coll_repo_cls,
        ):
            mock_db = MagicMock()
            mock_db.connection.__enter__ = MagicMock(return_value=mock_db.connection)
            mock_db.connection.__exit__ = MagicMock(return_value=False)
            mock_db_cls.return_value = mock_db
    
            mock_coll_repo = MagicMock()
            mock_coll_repo.get_by_name.return_value = mock_coll
            mock_coll_repo_cls.return_value = mock_coll_repo
    
            mock_doc_repo = MagicMock()
            mock_doc_repo.list_by_collection.return_value = [mock_doc_x, mock_doc_y]
            mock_doc_repo_cls.return_value = mock_doc_repo
    
            result = runner.invoke(ls_cmd, ["notes", "ideas"], obj={"index_path": mock_index_path})
    
        assert result.exit_code == 0
>       assert "x.md" in result.output
E       AssertionError: assert 'x.md' in ''
E        +  where '' = <Result okay>.output

tests/unit/cli/test_ls.py:160: AssertionError
_______________ TestLsCommand.test_ls_subpath_is_segment_aligned _______________

self = <tests.unit.cli.test_ls.TestLsCommand object at 0x10c2bb020>

    def test_ls_subpath_is_segment_aligned(self) -> None:
        """Relative subpath resolves against the collection root, whole segments only."""
        result = self._invoke_ls(
            "/data/notes",
            ["/data/notes/python/a.md", "/data/notes/python2/b.md"],
            ["notes", "python"],
        )
    
        assert result.exit_code == 0
>       assert "a.md" in result.output
E       AssertionError: assert 'a.md' in ''
E        +  where '' = <Result okay>.output

tests/unit/cli/test_ls.py:235: AssertionError
__________ TestLsCommand.test_ls_subpath_absolute_is_segment_aligned ___________

self = <tests.unit.cli.test_ls.TestLsCommand object at 0x10c2bb240>

    def test_ls_subpath_absolute_is_segment_aligned(self) -> None:
        """Absolute subpath matches whole segments, never a sibling prefix like python2."""
        result = self._invoke_ls(
            "/data/notes",
            ["/data/notes/python/a.md", "/data/notes/python2/b.md"],
            ["notes", "/data/notes/python"],
        )
    
        assert result.exit_code == 0
        assert "a.md" in result.output
>       assert "b.md" not in result.output
E       AssertionError: assert 'b.md' not in 'notes\n└── ...  └── b.md\n'
E         
E         'b.md' is contained here:
E                 └── b.md
E         ?           ++++

tests/unit/cli/test_ls.py:248: AssertionError
___________________ TestLsCommand.test_ls_subpath_exact_file ___________________

self = <tests.unit.cli.test_ls.TestLsCommand object at 0x108d97b50>

    def test_ls_subpath_exact_file(self) -> None:
        """An exact-file subpath selects that document only."""
        result = self._invoke_ls(
            "/data/notes",
            ["/data/notes/python/a.md", "/data/notes/python2/b.md"],
            ["notes", "python/a.md"],
        )
    
        assert result.exit_code == 0
>       assert "a.md" in result.output
E       AssertionError: assert 'a.md' in ''
E        +  where '' = <Result okay>.output

tests/unit/cli/test_ls.py:259: AssertionError
_________________ TestLsCommand.test_ls_subpath_trailing_slash _________________

self = <tests.unit.cli.test_ls.TestLsCommand object at 0x108d97d50>

    def test_ls_subpath_trailing_slash(self) -> None:
        """A trailing-slash subpath selects the same documents as the bare form."""
        result = self._invoke_ls(
            "/data/notes",
            ["/data/notes/python/a.md", "/data/notes/python2/b.md"],
            ["notes", "python/"],
        )
    
        assert result.exit_code == 0
>       assert "a.md" in result.output
E       AssertionError: assert 'a.md' in ''
E        +  where '' = <Result okay>.output

tests/unit/cli/test_ls.py:271: AssertionError
=========================== short test summary info ============================
FAILED tests/unit/cli/test_ls.py::TestLsCommand::test_ls_with_subpath_filter
FAILED tests/unit/cli/test_ls.py::TestLsCommand::test_ls_subpath_is_segment_aligned
FAILED tests/unit/cli/test_ls.py::TestLsCommand::test_ls_subpath_absolute_is_segment_aligned
FAILED tests/unit/cli/test_ls.py::TestLsCommand::test_ls_subpath_exact_file
FAILED tests/unit/cli/test_ls.py::TestLsCommand::test_ls_subpath_trailing_slash
5 failed, 5 passed in 0.08s
