fix: use moodStarShortcut+moodMap for liked state, warn on silent fail (v0.4.6)
FW_DEBUG=1 investigation revealed: - wallmood can silently fail (200 OK, frozen modifDate, no state change) due to self-like restriction, unsupported post type (FAMILY_CREATED), or rate limit - Response contains two complementary like indicators: moodStarShortcut (primary) and moodMap (secondary) — both must be checked - liked: false with like=True now surfaces a warning instead of silently returning a misleading result - SPEC.md documents silent-fail scenarios and dual indicator pattern Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
|
||||
MCP server for [Family Wall](https://www.familywall.com) -- read and manage your family's circles, lists, and tasks directly from Claude.
|
||||
|
||||
## Features (v0.4.5)
|
||||
## Features (v0.4.6)
|
||||
|
||||
### Read
|
||||
|
||||
|
||||
@@ -324,8 +324,25 @@ a00.r.r → vollständiges Wall-Message-Objekt
|
||||
.rights.canDelete → "true"/"false"
|
||||
```
|
||||
|
||||
**Like-Zustand bestimmen:** `moodMap[accountId]` enthält `["STAR"]` wenn der
|
||||
jeweilige Account geliked hat. Leere Map oder fehlender Key = kein Like.
|
||||
**Like-Zustand bestimmen (zwei Indikatoren, beide auswerten):**
|
||||
|
||||
| Feld | Typ | Bedeutung |
|
||||
|---|---|---|
|
||||
| `moodStarShortcut` | `"true"` / `"false"` | Primär: direktes User-Like-Flag für den anfragenden Account |
|
||||
| `moodMap[accountId]` | `["STAR"]` | Sekundär: accountId → Mood-Liste; enthält `"STAR"` wenn geliked |
|
||||
|
||||
Beide Indikatoren können den Like-Zustand korrekt abbilden — je nach API-internem
|
||||
Speicherpfad ist nur einer gesetzt. Immer beide prüfen.
|
||||
|
||||
**Silent-Fail-Szenarien (API antwortet 200, aber Like wird nicht gesetzt):**
|
||||
- **Self-Like-Restriction**: Eigener Post kann nicht geliked werden
|
||||
(verifiziert: Account 23431898 kann Post `wall/23431854_31119189` nicht liken,
|
||||
obwohl API regulär antwortet — `modifDate` bleibt eingefroren)
|
||||
- **Unsupported Post-Typ**: `FAMILY_CREATED`-Posts ignorieren wallmood-Calls
|
||||
- **Rate-Limit**: Nach vielen Calls kann die API Still-Fails zurückgeben
|
||||
|
||||
Erkennungsmerkmal für Silent-Fail: `modifDate` im Response identisch zum Vorherigen
|
||||
AND `moodStarShortcut: false` AND `moodMap: {}`.
|
||||
|
||||
## Noch zu verifizieren
|
||||
|
||||
|
||||
+1
-1
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
|
||||
|
||||
[project]
|
||||
name = "mcp-familywall"
|
||||
version = "0.4.5"
|
||||
version = "0.4.6"
|
||||
description = "MCP server for Family Wall — read your family's lists and tasks via Claude"
|
||||
readme = "README.md"
|
||||
requires-python = ">=3.12"
|
||||
|
||||
@@ -532,15 +532,28 @@ def like_post(post_id: str, like: bool = True) -> str:
|
||||
indent=2,
|
||||
)
|
||||
|
||||
# Confirm the STAR is present in moodMap (server-side representation of a like).
|
||||
now_liked = any("STAR" in moods for moods in mood_map.values())
|
||||
# Two complementary indicators for the like state:
|
||||
# - moodStarShortcut: direct boolean per-user flag on the post object (primary)
|
||||
# - moodMap: dict of accountId → [mood types]; contains "STAR" when liked (secondary)
|
||||
# Use both so either storage path is covered.
|
||||
star_shortcut = wall_obj.get("moodStarShortcut") == "true"
|
||||
star_in_map = any("STAR" in moods for moods in mood_map.values())
|
||||
now_liked = star_shortcut or star_in_map
|
||||
|
||||
return json.dumps(
|
||||
{"liked": now_liked, "id": post_id, "author": account_id},
|
||||
ensure_ascii=False,
|
||||
indent=2,
|
||||
result: dict[str, Any] = {"liked": now_liked, "id": post_id, "author": account_id}
|
||||
|
||||
# Surface a warning when the like call apparently had no effect, so the
|
||||
# caller can distinguish a successful like from a silent API rejection
|
||||
# (e.g. rate limit, unsupported post type, or self-like restriction).
|
||||
if not now_liked:
|
||||
result["warning"] = (
|
||||
"Like may not have been applied. "
|
||||
"Possible causes: rate limit, unsupported post type (e.g. FAMILY_CREATED), "
|
||||
"or self-like restriction."
|
||||
)
|
||||
|
||||
return json.dumps(result, ensure_ascii=False, indent=2)
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Factory
|
||||
|
||||
Reference in New Issue
Block a user