Skip to content

feat(api): expose read view profiles (#1997) - #2023

Merged
Sinity merged 1 commit into
masterfrom
feature/feat/read-view-profile-api-1997
Jun 17, 2026
Merged

Sinity merged 1 commit into
masterfrom
feature/feat/read-view-profile-api-1997

Conversation

@Sinity

@Sinity Sinity commented Jun 17, 2026

Copy link
Copy Markdown
Owner

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

SessionViewProfile now owns JSON-native serialization, and read_view_profile_payloads() is the shared helper for adapters. The polylogue read-views --format json command uses that helper instead of duplicating asdict() logic, PolylogueArchiveMixin.list_read_view_profiles() exposes it to Python consumers, and MCP registers list_read_view_profiles as 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 deselected
  • devtools verify --quick -> exit_code 0
  • pre-push devtools verify --quick -> exit_code 0

Refs #1997
Refs #1825

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
@coderabbitai

coderabbitai Bot commented Jun 17, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@Sinity, we couldn't start this review because you've reached your PR review rate limit.

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 @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 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 configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 0f61dd30-d3d1-452f-a6ab-f8e2ace4fdba

📥 Commits

Reviewing files that changed from the base of the PR and between 837af0a and 9273bbd.

📒 Files selected for processing (9)
  • polylogue/api/archive.py
  • polylogue/archive/viewport/__init__.py
  • polylogue/archive/viewport/profiles.py
  • polylogue/cli/commands/read_views.py
  • polylogue/mcp/server_tools.py
  • tests/infra/mcp.py
  • tests/unit/api/test_facade_contracts.py
  • tests/unit/mcp/test_envelope_contracts.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/feat/read-view-profile-api-1997

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 commented Jun 17, 2026

Copy link
Copy Markdown
Owner Author

@codex review

@Sinity
Sinity merged commit 9b1f300 into master Jun 17, 2026
13 checks passed
@Sinity
Sinity deleted the feature/feat/read-view-profile-api-1997 branch June 17, 2026 04:15
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Keep it up!

Reviewed commit: 9273bbd6d9

ℹ️ 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".

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