fix: address PR review feedback (round 9)

- Fix emoji clearing bug: use _UNSET sentinel in update_collective so
  emoji=None sends {"emoji": null} instead of raising ValueError
- Move collectives_get_trashed_collectives to Read Tools section
- Remove redundant is_trash field from ListTrashedPagesResponse
- Add page lifecycle note to collectives_trash_page docstring
- Add unit test for clearing collective emoji via update_collective
- Add integration test for clearing collective emoji via MCP tool

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Chris Coutinho
2026-03-28 09:19:53 +01:00
co-authored by Claude Opus 4.6
parent cb16060b1b
commit 52470ea713
5 changed files with 79 additions and 31 deletions
@@ -461,10 +461,28 @@ async def test_get_page_404(mocker):
async def test_update_collective_no_fields_raises_value_error(mocker):
"""Test that update_collective raises ValueError when called with no fields."""
client = CollectivesClient(mocker.AsyncMock(spec=httpx.AsyncClient), "testuser")
# Omitting emoji entirely (not passing it) should raise
with pytest.raises(ValueError, match="At least one field"):
await client.update_collective(collective_id=1)
async def test_update_collective_clear_emoji(mocker):
"""Test that update_collective sends null emoji to clear it."""
mock_response = _ocs_response(
{"collective": _sample_collective(1, "Test Wiki", emoji=None)}
)
mock_request = mocker.patch.object(
CollectivesClient, "_make_request", return_value=mock_response
)
client = CollectivesClient(mocker.AsyncMock(spec=httpx.AsyncClient), "testuser")
result = await client.update_collective(collective_id=1, emoji=None)
assert result["emoji"] is None
call_args = mock_request.call_args
assert call_args[1]["json"] == {"emoji": None}
async def test_set_page_emoji_clear(mocker):
"""Test that set_page_emoji sends null emoji to clear it."""
page = _sample_page(10, "Test Page")