fix: address PR review feedback (round 6)

- Fix assign_tag sending Content-Type header with no body
- Mark collectives_update_collective as idempotent (no ETag involved)
- Raise OCSError when 'data' key missing instead of silent fallback
- Tighten color validator to 3 or 6 hex chars only
- Add comment explaining null emoji semantics in set_page_emoji

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Chris Coutinho
2026-03-26 14:38:11 +01:00
co-authored by Claude Opus 4.6
parent aa46c6147b
commit 85119bde91
4 changed files with 10 additions and 9 deletions
@@ -358,8 +358,8 @@ async def test_restore_page(mocker):
# --- Error Handling ---
async def test_ocs_missing_data_raises_key_error(mocker):
"""Test that OCS envelope without 'data' key causes KeyError on field access."""
async def test_ocs_missing_data_raises_ocs_error(mocker):
"""Test that OCS envelope without 'data' key raises OCSError."""
mock_response = create_mock_response(
status_code=200,
json_data={
@@ -371,9 +371,7 @@ async def test_ocs_missing_data_raises_key_error(mocker):
mocker.patch.object(CollectivesClient, "_make_request", return_value=mock_response)
client = CollectivesClient(mocker.AsyncMock(spec=httpx.AsyncClient), "testuser")
# _unwrap_ocs returns {} when "data" is absent; the caller then
# raises KeyError when accessing the expected key (e.g. "collectives")
with pytest.raises(KeyError):
with pytest.raises(OCSError, match="missing 'data' field"):
await client.get_collectives()