Repository navigation
feat(api): expose import explain payloads (#2178) - #2200
Conversation
Problem: #2178 already has the CLI ImportExplain vertical, but library callers could not ask for the same non-mutating detector/parser explanation without shelling out to the CLI. What changed: add Polylogue.explain_import(path, source_name, limit), document it in the library API, and cover the facade with both successful Codex JSONL input and bounded malformed-input reporting. Verification: devtools test tests/unit/api/test_facade_contracts.py -k 'explain_import or undiscovered_async_methods or public_async_methods_have_return_annotations' -q; devtools verify --quick.
|
Warning Review limit reached
More reviews will be available in 37 minutes and 4 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 To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based credits. 🚦 How do rate limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan refill rate. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, the refill rate gradually slows as usage increases. The highest same-day bursts are limited more strictly. 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 (3)
✨ 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 |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 16291dccad
ℹ️ 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".
|
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. |
Summary
Adds
Polylogue.explain_import(...)as the Python API counterpart to the existingpolylogue import PATH --explainCLI path. The method returns the sharedImportExplainPayloadwithout writing archive rows, so library callers can inspect provider detection, parser mode, produced counts, skips, and caveats directly.Problem
#2178 already has a CLI vertical for ImportExplain, but the explanation surface was not reusable from the async facade. That left Python/API consumers either shelling out to the CLI or reimplementing the local-path explanation helper, while the issue's next slices need shared API/MCP/daemon/web reuse.
Solution
PolylogueArchiveMixin.explain_import(path, source_name="unknown", limit=100)and delegate to the existingpolylogue.sources.import_explain.explain_import_pathhelper.docs/library-api.md.This does not close #2178. Raw/source-ref lookup plus daemon/MCP/web reuse remain owned by the issue.
Verification
devtools test tests/unit/api/test_facade_contracts.py -k "explain_import or undiscovered_async_methods or public_async_methods_have_return_annotations" -q-> 4 passed, 213 deselected.devtools verify --quick-> exit_code 0.Ref #2178