Skip to content

refactor(archive): move stats and coverage out of lib - #666

Merged
Sinity merged 1 commit into
masterfrom
feature/refactor/archive-stats-coverage-clean
May 1, 2026
Merged

Sinity merged 1 commit into
masterfrom
feature/refactor/archive-stats-coverage-clean

Conversation

@Sinity

@Sinity Sinity commented May 1, 2026

Copy link
Copy Markdown
Owner

Summary

Move archive statistics and coverage diagnostics from polylogue.lib into polylogue.archive, and move their direct unit tests into the archive test bucket.

Problem

coverage.py and stats.py describe archive-domain diagnostics and value payloads, but they still lived in the generic lib root. That kept the remaining lib surface broader than its intended primitive/facade role.

Solution

  • Rename polylogue/lib/coverage.py to polylogue/archive/coverage.py.
  • Rename polylogue/lib/stats.py to polylogue/archive/stats.py.
  • Update MCP, operations, protocol, repository, TUI, and test imports.
  • Update topology generation so these files are no longer classified as lib-root primitives.
  • Move direct coverage/stat tests under tests/unit/archive/.

Ref #635

Verification

  • devtools build-topology-projection && devtools verify-topology — realized=697 declared=697 blocking=False
  • ruff check polylogue/ tests/ devtools/ — all checks passed
  • mypy polylogue/ — no issues found in 697 source files
  • pytest -q tests/unit/archive/test_coverage_diagnostics.py tests/unit/archive/test_archive_stats.py tests/unit/archive/test_query_miss_diagnostics.py tests/unit/mcp/test_tool_contracts.py tests/unit/mcp/test_server_surfaces.py tests/unit/core/test_facade_api.py — 147 passed
  • devtools render-all --check — sync OK
  • pre-push devtools verify --quick — all checks passed

Copilot AI review requested due to automatic review settings May 1, 2026 20:45
@coderabbitai

coderabbitai Bot commented May 1, 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 46 minutes and 5 seconds before requesting another review.

To keep reviews running without waiting, you can enable usage-based add-on for your organization. This allows additional reviews beyond the hourly cap. Account admins can enable it under billing.

⌛ 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: c4988ce4-6fa0-4bed-9fed-7d500ec41d18

📥 Commits

Reviewing files that changed from the base of the PR and between 42297d4 and bac3a95.

📒 Files selected for processing (16)
  • devtools/build_topology_projection.py
  • docs/plans/topology-target.yaml
  • docs/topology-status.md
  • polylogue/archive/coverage.py
  • polylogue/archive/stats.py
  • polylogue/mcp/payloads.py
  • polylogue/mcp/server_product_tools.py
  • polylogue/operations/archive.py
  • polylogue/protocols.py
  • polylogue/storage/repository/vectors/repository_vectors.py
  • polylogue/ui/tui/screens/dashboard.py
  • tests/unit/archive/test_archive_stats.py
  • tests/unit/archive/test_coverage_diagnostics.py
  • tests/unit/archive/test_query_miss_diagnostics.py
  • tests/unit/mcp/test_server_surfaces.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/archive-stats-coverage-clean

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
Review rate limit: 0/1 reviews remaining, refill in 46 minutes and 5 seconds.

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

@Sinity
Sinity merged commit a863f8b into master May 1, 2026
12 of 13 checks passed
@Sinity
Sinity deleted the feature/refactor/archive-stats-coverage-clean branch May 1, 2026 20:46
@github-actions

github-actions Bot commented May 1, 2026

Copy link
Copy Markdown
Contributor

Polylogue Proof Pack

Refs: origin/master..HEAD
Changed paths: 0

Affected Domains

  • none

Required Gates

  • devtools verify --quick — full PR gate remains explicit
  • devtools verify — full PR gate remains explicit
  • devtools build-package — deployment readiness gate; run when packaging or release confidence matters
  • nix flake check — deployment readiness gate; run when packaging or release confidence matters

Known Gaps

  • none for affected domains

Oracle / Cost

  • oracle mix: {}
  • cost tier: {}
  • stale evidence: 0
  • manual review cells: 0

Copilot AI 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.

Pull request overview

Refactors archive-domain diagnostics by relocating statistics and coverage utilities out of polylogue.lib into polylogue.archive, tightening the intended “lib as facade/primitive surface” boundary while updating topology metadata and unit tests accordingly.

Changes:

  • Moved archive diagnostics modules to polylogue.archive (stats.py, coverage.py) and updated all internal imports (MCP, operations, protocols, repository, TUI).
  • Relocated direct unit tests for these modules into the archive test bucket.
  • Updated topology projection inputs/status so these modules are no longer treated as lib-root primitives.

Reviewed changes

Copilot reviewed 15 out of 16 changed files in this pull request and generated no comments.

Show a summary per file
File Description
tests/unit/mcp/test_tool_contracts.py Update ArchiveStats import to polylogue.archive.stats.
tests/unit/mcp/test_server_surfaces.py Update ArchiveStats import to polylogue.archive.stats.
tests/unit/archive/test_query_miss_diagnostics.py Update ArchiveStats import to polylogue.archive.stats.
tests/unit/archive/test_coverage_diagnostics.py Update analyze_coverage import to polylogue.archive.coverage.
tests/unit/archive/test_archive_stats.py Update ArchiveStats import to polylogue.archive.stats.
polylogue/ui/tui/screens/dashboard.py Update ArchiveStats import to polylogue.archive.stats.
polylogue/storage/repository/vectors/repository_vectors.py Update ArchiveStats imports/types to polylogue.archive.stats.
polylogue/protocols.py Update TYPE_CHECKING ArchiveStats import to polylogue.archive.stats.
polylogue/operations/archive.py Update TYPE_CHECKING ArchiveStats alias import to polylogue.archive.stats.
polylogue/mcp/server_product_tools.py Update analyze_coverage import to polylogue.archive.coverage.
polylogue/mcp/payloads.py Update TYPE_CHECKING ArchiveStats import to polylogue.archive.stats.
polylogue/archive/stats.py New home for ArchiveStats dataclass and serialization helpers.
polylogue/archive/coverage.py New home for coverage diagnostics; adjusts type-only import to archive conversation models.
docs/topology-status.md Refresh topology counts after reclassification/moves.
docs/plans/topology-target.yaml Reclassify moved files under polylogue/archive/* and remove lib/* entries.
devtools/build_topology_projection.py Stop classifying stats.py/coverage.py as lib-root primitives.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sinity added a commit that referenced this pull request May 7, 2026
## Summary
Move archive statistics and coverage diagnostics from `polylogue.lib`
into `polylogue.archive`, and move their direct unit tests into the
archive test bucket.

## Problem
`coverage.py` and `stats.py` describe archive-domain diagnostics and
value payloads, but they still lived in the generic `lib` root. That
kept the remaining `lib` surface broader than its intended
primitive/facade role.

## Solution
- Rename `polylogue/lib/coverage.py` to `polylogue/archive/coverage.py`.
- Rename `polylogue/lib/stats.py` to `polylogue/archive/stats.py`.
- Update MCP, operations, protocol, repository, TUI, and test imports.
- Update topology generation so these files are no longer classified as
`lib-root` primitives.
- Move direct coverage/stat tests under `tests/unit/archive/`.

Ref #635

## Verification
- `devtools build-topology-projection && devtools verify-topology` —
realized=697 declared=697 blocking=False
- `ruff check polylogue/ tests/ devtools/` — all checks passed
- `mypy polylogue/` — no issues found in 697 source files
- `pytest -q tests/unit/archive/test_coverage_diagnostics.py
tests/unit/archive/test_archive_stats.py
tests/unit/archive/test_query_miss_diagnostics.py
tests/unit/mcp/test_tool_contracts.py
tests/unit/mcp/test_server_surfaces.py
tests/unit/core/test_facade_api.py` — 147 passed
- `devtools render-all --check` — sync OK
- pre-push `devtools verify --quick` — all checks passed
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.

2 participants