Skip to content

refactor(mutations): centralize tag operations through shared contract (#862) - #991

Merged
Sinity merged 1 commit into
masterfrom
feature/refactor/tag-mutation-centralization
May 9, 2026
Merged

Sinity merged 1 commit into
masterfrom
feature/refactor/tag-mutation-centralization

Conversation

@Sinity

@Sinity Sinity commented May 9, 2026

Copy link
Copy Markdown
Owner

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

Route CLI and MCP tag mutations through a shared operation contract
instead of calling RepositoryWriteMixin/tag_store directly. Surfaces
idempotency outcome from PR #978.

Refs #862
Copilot AI review requested due to automatic review settings May 9, 2026 17:22
@coderabbitai

coderabbitai Bot commented May 9, 2026

Copy link
Copy Markdown

Warning

Rate limit exceeded

@Sinity has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 36 minutes and 26 seconds before requesting another review.

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 @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 7052c3d0-c53d-4706-b547-ef3db1444095

📥 Commits

Reviewing files that changed from the base of the PR and between cfd11c6 and 24d6836.

📒 Files selected for processing (8)
  • AGENTS.md
  • polylogue/api/archive.py
  • polylogue/cli/commands/tags.py
  • polylogue/cli/query_actions.py
  • polylogue/mcp/server_mutation_tools.py
  • polylogue/surfaces/payloads.py
  • tests/unit/mcp/test_tag_idempotency.py
  • tests/unit/mcp/test_tool_contracts.py
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/refactor/tag-mutation-centralization

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@Sinity
Sinity enabled auto-merge (squash) May 9, 2026 17:23
@Sinity
Sinity merged commit 6428192 into master May 9, 2026
4 of 11 checks passed
@Sinity
Sinity deleted the feature/refactor/tag-mutation-centralization branch May 9, 2026 17:23

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 24d6836c24

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread polylogue/cli/query_actions.py Resolved
@Sinity
Sinity removed the request for review from Copilot May 9, 2026 17:43
Sinity added a commit that referenced this pull request May 11, 2026
…n supplied (#1012) (#1017)

## Summary

Closes part of #1012. ``apply_modifiers`` always routed ``add_tags``
through ``env.polylogue.add_tag`` even when the caller passed a custom
``repo`` argument, causing every ``test_apply_modifiers_contract``
Hypothesis example to fail with ``ConversationNotFoundError`` because
the strategy-built summaries were never persisted to the polylogue
archive.

The metadata path already routed correctly through ``repo`` (line 108);
only the tag path bypassed the supplied repo, leaving the two paths
asymmetric.

## Solution

``polylogue/cli/query_actions.py::apply_modifiers`` now tracks whether
the caller supplied a custom ``repo``; when they did, tag mutations are
sent directly through ``repo.add_tag``. With no custom repo, the call
still falls back to ``env.polylogue.add_tag`` so interactive CLI use
keeps the facade's idempotency and conversation-existence checks.

The fix originated as orphan commit ``b6b75442`` on a defunct
``worktree-agent-a81e3a2a`` worktree branch (post-merge cleanup of PR
#991 that never got its own follow-up PR). Recovered during a
worktree-cleanup audit and integrated as a focused PR.

## Verification

- ``nix develop -c pytest
tests/unit/cli/test_query_exec_laws.py::test_apply_modifiers_contract``
→ 1 passed (60 Hypothesis examples).
- ``nix develop -c devtools verify --quick`` → all checks passed.

The ``@pytest.mark.xfail`` marker added in PR #1013 should be removed
once this lands and the test re-runs cleanly on master. The other two
xfails tracked by #1012
(``test_tags_command_plain_paths_cover_empty_hint_and_tabular_counts``,
``test_prose_only_drops_claude_code_protocol_artifacts``) are
independent of this fix; see #1016 for the latter.

Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
@Sinity

Sinity commented Oct 1, 2026

Copy link
Copy Markdown
Owner Author

Historical Codex triage: evidence checked at 5ebcfe5. This records that source revision; it does not claim a fresh review of current master.

Only the rows listed above are dispositioned. Held findings remain open.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant