Repository navigation
feat(api): expose read view profiles (#1997) - #2023
Conversation
Problem: #1997 made read-view profiles executable for CLI consumers, but Python and MCP callers still had to infer the profile contract from CLI output or duplicate the metadata vocabulary. That left the profile registry short of the shared-surface contract expected by #1825.\n\nWhat changed: add JSON-native serialization to SessionViewProfile, route the read-views CLI through that shared payload helper, expose list_read_view_profiles on the Python facade, and add a read-role MCP tool returning the same profile items in an MCP envelope. The MCP discovery and envelope matrices now cover the tool.\n\nVerification:\n- devtools test tests/unit/archive/test_view_profiles.py tests/unit/cli/test_click_app.py tests/unit/api/test_facade_contracts.py tests/unit/mcp/test_tool_contracts.py tests/unit/mcp/test_envelope_contracts.py -k 'read_view_profiles or read_views or nullary_methods or every_registered_tool_is_classified or expected_tool_names_subset' -> 7 passed, 339 deselected\n- devtools verify --quick -> exit_code 0
|
Warning Review limit reached
More reviews will be available in 35 minutes and 8 seconds. Learn how PR review limits work. Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file). ⌛ How to resolve this issue?After more reviews become available, 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 include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (9)
✨ 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 |
|
@codex review |
|
Codex Review: Didn't find any major issues. Keep it up! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
Summary
Expose the executable read-view profile registry through Python and MCP, and route the CLI JSON command through the same shared payload helper.
Problem
#1997 made session read-view profiles executable for CLI consumers, but the metadata contract was still effectively CLI-local. Python and MCP callers had no shared way to discover the same view IDs, evidence/lossiness policy, supported formats, or handoff semantics, which left #1825-style surface parity incomplete.
Solution
SessionViewProfilenow owns JSON-native serialization, andread_view_profile_payloads()is the shared helper for adapters. Thepolylogue read-views --format jsoncommand uses that helper instead of duplicatingasdict()logic,PolylogueArchiveMixin.list_read_view_profiles()exposes it to Python consumers, and MCP registerslist_read_view_profilesas a read-role tool returning{read_views, total}with the same item payloads. MCP discovery/envelope tests and facade-contract tests pin the new surface.Verification
devtools test tests/unit/archive/test_view_profiles.py tests/unit/cli/test_click_app.py tests/unit/api/test_facade_contracts.py tests/unit/mcp/test_tool_contracts.py tests/unit/mcp/test_envelope_contracts.py -k 'read_view_profiles or read_views or nullary_methods or every_registered_tool_is_classified or expected_tool_names_subset'->7 passed, 339 deselecteddevtools verify --quick->exit_code 0devtools verify --quick->exit_code 0Refs #1997
Refs #1825