Repository navigation
refactor(archive): own semantic pricing - #672
Conversation
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (12)
📝 WalkthroughWalkthroughThis PR relocates pricing-related functionality from Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Poem
✨ Finishing Touches📝 Generate docstrings
🧪 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. Review rate limit: 0/1 reviews remaining, refill in 60 minutes.Comment |
Polylogue Proof PackRefs: Affected Domains
Required Gates
Known Gaps
Oracle / Cost
|
There was a problem hiding this comment.
Pull request overview
Moves archive cost-estimation (“pricing”) semantics out of the shrinking polylogue.lib facade and into the archive semantic layer (polylogue.archive.semantic), aligning ownership with the archive domain model and topology plan.
Changes:
- Introduces
polylogue/archive/semantic/pricing.pyand removespricing.pyfrom the lib-root primitives list/topology projection. - Updates operational/runtime/product code and unit tests to import pricing payloads/helpers from
polylogue.archive.semantic.pricing. - Regenerates topology docs/status to reflect the new ownership and file counts.
Reviewed changes
Copilot reviewed 11 out of 12 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
polylogue/archive/semantic/pricing.py |
New archive-owned pricing/cost-estimation module and payload models. |
polylogue/archive/session/runtime.py |
Updates session profile builder to import harmonize_session_cost from archive semantic pricing. |
polylogue/operations/archive.py |
Updates archive operations to use the new pricing module import path. |
polylogue/products/archive.py |
Updates product contracts to reference pricing payload types from archive semantic pricing. |
tests/unit/core/test_pricing.py |
Updates pricing tests to import from the new module. |
tests/unit/core/test_semantic_facts.py |
Updates semantic facts tests to import harmonize_session_cost from the new module. |
tests/unit/core/test_conversation_semantics.py |
Updates conversation semantics tests to import harmonize_session_cost from the new module. |
tests/unit/mcp/test_tool_contracts.py |
Updates MCP tool contract tests to import pricing payloads from the new module. |
tests/unit/operations/test_archive_helpers.py |
Updates operations helper tests to import CostEstimatePayload from the new module. |
devtools/build_topology_projection.py |
Removes pricing.py from the lib-root primitive set used for topology projection. |
docs/plans/topology-target.yaml |
Moves pricing ownership from lib-root to archive-semantic and updates LOC counts. |
docs/topology-status.md |
Updates generated topology status counts reflecting the new archive-semantic file. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
## Summary Move provider/model cost-estimation semantics from `polylogue.lib` into archive semantic ownership. ## Problem `pricing.py` estimates costs from archive message model and token facts. It is not a generic library primitive, and keeping it under `polylogue.lib` left another archive semantic in the shrinking library root. ## Solution - Rename `polylogue/lib/pricing.py` to `polylogue/archive/semantic/pricing.py`. - Update operations, session runtime, product payload, MCP, and tests to import the semantic owner directly. - Remove `pricing.py` from the remaining `lib-root` topology primitive list and regenerate topology docs. Ref #635 ## Verification - `devtools build-topology-projection && devtools verify-topology` — realized=695 declared=695 blocking=False - `ruff check polylogue/ tests/ devtools/` — all checks passed - `mypy polylogue/` — no issues found in 695 source files - `pytest -q tests/unit/core/test_pricing.py tests/unit/core/test_semantic_facts.py tests/unit/core/test_conversation_semantics.py tests/unit/mcp/test_tool_contracts.py tests/unit/operations/test_archive_helpers.py` — 120 passed - `devtools render-all --check` — sync OK - pre-push `devtools verify --quick` — all checks passed
Summary
Move provider/model cost-estimation semantics from
polylogue.libinto archive semantic ownership.Problem
pricing.pyestimates costs from archive message model and token facts. It is not a generic library primitive, and keeping it underpolylogue.libleft another archive semantic in the shrinking library root.Solution
polylogue/lib/pricing.pytopolylogue/archive/semantic/pricing.py.pricing.pyfrom the remaininglib-roottopology primitive list and regenerate topology docs.Ref #635
Verification
devtools build-topology-projection && devtools verify-topology— realized=695 declared=695 blocking=Falseruff check polylogue/ tests/ devtools/— all checks passedmypy polylogue/— no issues found in 695 source filespytest -q tests/unit/core/test_pricing.py tests/unit/core/test_semantic_facts.py tests/unit/core/test_conversation_semantics.py tests/unit/mcp/test_tool_contracts.py tests/unit/operations/test_archive_helpers.py— 120 passeddevtools render-all --check— sync OKdevtools verify --quick— all checks passedSummary by CodeRabbit
Refactor
Chores