Repository navigation
feat: add idempotency outcome to tag mutation payloads (#862) - #978
Conversation
Add `outcome` field to `MutationResultPayload` and `MCPMutationStatusPayload` so callers can distinguish the four tag-mutation states without parsing the status/detail fields: add_tag(conv, tag) where tag absent → outcome="added" add_tag(conv, tag) where tag present → outcome="no_op" remove_tag(conv, tag) where tag present → outcome="removed" remove_tag(conv, tag) where tag absent → outcome="not_present" Outcome is computed in `server_mutation_tools.py` and surfaced in both MCP JSON responses and CLI human-readable output. The field is optional (omitted from serialize when None) so backward compat is preserved. Refs #862 Co-Authored-By: Claude <[email protected]>
|
Warning Rate limit exceeded
You’ve run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (4)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
#862) (#991) ## Summary Routes CLI and MCP tag mutations through a shared operation contract, surfacing idempotency outcome from PR #978. API and daemon tag paths also adapted. ## Certification ### WORK Centralize tag mutation operations across surfaces (remaining AC of #862) ### REALIZATION 1. polylogue/surfaces/payloads.py: shared mutation contract 2. polylogue/cli/commands/tags.py + polylogue/mcp/server_mutation_tools.py: routed through contract 3. test: tests/unit/mcp/test_tag_idempotency.py + test_tool_contracts.py ### DECLARATION I declare the WORK item to be fully realized. Verified by: pytest. Refs #862
Summary
Add
outcomefield toMutationResultPayloadandMCPMutationStatusPayloadso callers can distinguish the four tag-mutation states without parsing the
status/detail fields.
Problem
add_tagandremove_tagreturnedstatus="ok"without indicating whetherthe operation was genuinely new or a no-op on already-present/absent tags.
Callers had to parse the
detailstring ("already_present","tag_not_present") to understand what happened. This made it hard to buildreliable automation on top of the mutation API.
Solution
Added
outcome: str | Nonefield to bothMutationResultPayloadandMCPMutationStatusPayloadinpolylogue/mcp/payloads.py. The field isNone-by-default and omitted from serialization whenNone(backwardcompatible).
Computed in
polylogue/mcp/server_mutation_tools.py:outcomeadd_tag"added"add_tag"no_op"remove_tag"removed"remove_tag"not_present"CLI output in
polylogue/cli/commands/tags.pyincludes outcome in bothhuman-readable and
--format jsonmodes.New tests in
tests/unit/mcp/test_tag_idempotency.pycover all four outcomesplus conversation-not-found and serialization roundtrip.
Verification
Refs #862
🤖 Generated with Claude Code