Skip to content

refactor(core): move pipeline metrics out of lib - #665

Merged
Sinity merged 1 commit into
masterfrom
feature/refactor/core-metrics-clean
May 1, 2026
Merged

Sinity merged 1 commit into
masterfrom
feature/refactor/core-metrics-clean

Conversation

@Sinity

@Sinity Sinity commented May 1, 2026

Copy link
Copy Markdown
Owner

Summary

Move process and pipeline metrics helpers from polylogue.lib.metrics to polylogue.core.metrics.

Problem

The metrics module owns generic process RSS readers, stage timers, slow-item tracking, and pipeline metrics summaries. It is a shared measurement primitive used by pipeline/acquisition services, not miscellaneous lib code.

Solution

Rename polylogue/lib/metrics.py to polylogue/core/metrics.py, update pipeline/source/test imports, refresh topology, and keep no old-path shim.

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/lib/test_metrics.py tests/unit/pipeline/test_run_sources.py tests/unit/pipeline/test_run_stages_runtime.py tests/unit/pipeline/test_observers.py tests/benchmarks/test_pipeline.py — 99 passed
  • devtools render-all --check — sync OK
  • pre-push devtools verify --quick — all checks passed

Ref #635

Copilot AI review requested due to automatic review settings May 1, 2026 20:38
@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 53 minutes and 59 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: 434a02c2-74c4-4ef4-be8f-c4199b41829b

📥 Commits

Reviewing files that changed from the base of the PR and between ee04ccb and f2c3ef2.

📒 Files selected for processing (11)
  • devtools/build_topology_projection.py
  • docs/plans/topology-target.yaml
  • docs/topology-status.md
  • polylogue/core/metrics.py
  • polylogue/pipeline/run_execution.py
  • polylogue/pipeline/run_finalization.py
  • polylogue/pipeline/services/acquisition.py
  • polylogue/pipeline/services/ingest_batch.py
  • polylogue/pipeline/services/rendering.py
  • polylogue/sources/source_acquisition_components.py
  • tests/unit/lib/test_metrics.py
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/refactor/core-metrics-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 53 minutes and 59 seconds.

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

@Sinity
Sinity merged commit 42297d4 into master May 1, 2026
15 checks passed
@Sinity
Sinity deleted the feature/refactor/core-metrics-clean branch May 1, 2026 20:38
@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

Moves the pipeline/process metrics helpers out of polylogue.lib into polylogue.core, aligning metrics with other core runtime primitives and updating internal imports and topology metadata accordingly.

Changes:

  • Add polylogue/core/metrics.py (formerly polylogue.lib.metrics) and remove the old lib-root placement from topology tooling.
  • Update pipeline and source services to import RSS readers / PipelineMetrics from polylogue.core.metrics.
  • Refresh topology plan/status docs to reflect the new file ownership and counts.

Reviewed changes

Copilot reviewed 10 out of 11 changed files in this pull request and generated no comments.

Show a summary per file
File Description
tests/unit/lib/test_metrics.py Updates test import to polylogue.core.metrics.
polylogue/sources/source_acquisition_components.py Switches RSS metrics imports to polylogue.core.metrics.
polylogue/pipeline/services/rendering.py Switches current RSS import to polylogue.core.metrics.
polylogue/pipeline/services/ingest_batch.py Switches metrics imports to polylogue.core.metrics.
polylogue/pipeline/services/acquisition.py Switches peak RSS import to polylogue.core.metrics.
polylogue/pipeline/run_finalization.py Updates TYPE_CHECKING import of PipelineMetrics to core path.
polylogue/pipeline/run_execution.py Updates PipelineMetrics import to core path.
polylogue/core/metrics.py Introduces the moved metrics implementation under core primitives.
docs/topology-status.md Updates topology counts reflecting the move.
docs/plans/topology-target.yaml Moves metrics.py ownership from lib-root to core-primitive.
devtools/build_topology_projection.py Removes metrics.py from 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 process and pipeline metrics helpers from `polylogue.lib.metrics`
to `polylogue.core.metrics`.

## Problem

The metrics module owns generic process RSS readers, stage timers,
slow-item tracking, and pipeline metrics summaries. It is a shared
measurement primitive used by pipeline/acquisition services, not
miscellaneous `lib` code.

## Solution

Rename `polylogue/lib/metrics.py` to `polylogue/core/metrics.py`, update
pipeline/source/test imports, refresh topology, and keep no old-path
shim.

## 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/lib/test_metrics.py
tests/unit/pipeline/test_run_sources.py
tests/unit/pipeline/test_run_stages_runtime.py
tests/unit/pipeline/test_observers.py tests/benchmarks/test_pipeline.py`
— 99 passed
- `devtools render-all --check` — sync OK
- pre-push `devtools verify --quick` — all checks passed

Ref #635
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