Skip to content

refactor(insights): remove productivity rollups - #1556

Merged
Sinity merged 1 commit into
masterfrom
feature/refactor/remove-productivity-rollups
May 25, 2026
Merged

Sinity merged 1 commit into
masterfrom
feature/refactor/remove-productivity-rollups

Conversation

@Sinity

@Sinity Sinity commented May 25, 2026 •

Copy link
Copy Markdown
Owner

Summary

Removes the productivity_rollups insight surface after the #1511 consumer audit showed it had no dedicated storage table and no Lynchpin consumer. The surface was an aggregation over already-suspect timing and work-event labels, so keeping it public made Polylogue look more semantically confident than the substrate supports.

Problem

productivity_rollups exposed first-class CLI/MCP/API operations while deriving its meaning from engaged_duration_ms and session_work_events.kind, both of which are under active construct-validity cleanup. Unlike day_session_summaries or WorkEventKind, the audit found no cross-repo consumer requiring a paired Lynchpin migration.

Solution

Deleted polylogue/insights/productivity.py, its tests, and every public registration path: insight registry, archive operations, async/sync API mixins, operation specs, runtime artifact path, scenario mapping, MCP schema witness, and generated CLI/verification/topology docs.

Deliberately left these in place because they are not dead standalone surfaces:

Verification

  • ruff format --check polylogue tests -> pass.
  • ruff check polylogue tests -> pass.
  • Focused API/operation/artifact/scenario/MCP contract tests -> 182 passed.
  • MCP schema witness tests -> 26 passed.
  • devtools render-all --check -> pass.
  • devtools verify --json -> exit 0; 812 pytest-testmon tests passed.
  • Pre-push devtools verify --quick -> exit 0.

Ref #1511

Summary by CodeRabbit

  • Documentation

    • Updated CLI reference documentation to remove productivity rollup command entries
    • Removed documentation sections describing productivity rollup insights and associated configuration options
  • Chores

    • Removed the polylogue insights productivity command
    • Removed productivity rollup insight query methods from public APIs
    • Removed related runtime artifacts and operation specifications

Review Change Stack

Problem: the productivity_rollups insight was a synthetic aggregation over construct-invalid engaged-duration and work-event kind labels. The #1511 audit found no dedicated storage table or external Lynchpin consumer, so keeping it exposed made the read-pull surface look more meaningful than it was.\n\nWhat changed: delete the productivity rollup model, registry entry, archive/API/sync operations, CLI/MCP generated surfaces, runtime artifact path, scenario mapping, and dedicated tests. This deliberately does not touch day_session_summaries, provider analytics, session enrichments, or WorkEventKind because those have real consumers or need paired replacement work.\n\nVerification: ruff format --check polylogue tests; ruff check polylogue tests; focused pytest for API/operation/artifact/scenario/MCP contracts: 182 passed; MCP witness pytest: 26 passed; devtools render-all --check; devtools verify --json: exit 0, 812 pytest-testmon tests passed.\n\nRef #1511
@coderabbitai

coderabbitai Bot commented May 25, 2026 •

Copy link
Copy Markdown

Caution

Review failed

Pull request was closed or merged during review

📝 Walkthrough

Walkthrough

This PR removes the productivity_rollups insight feature across the entire system: deleting the core implementation module, removing public API methods, eliminating operation specs and registry entries, unwiring the artifact graph, updating all test expectations, and cleaning up generated documentation.

Changes

Productivity Rollups Feature Removal

Layer / File(s) Summary
Public API contracts and facades
polylogue/api/insights.py, polylogue/api/sync/insights.py
list_productivity_rollup_insights() method is removed from both the async mixin and sync facade, along with ProductivityRollupInsight and ProductivityRollupInsightQuery type imports.
Insight registry configuration
polylogue/insights/registry.py
The productivity_rollups insight type registration is removed from the registry; the ProductivityRollupInsightQuery import is deleted. New cost and archive-debt insight registrations are added.
Operation specs and operations layer
polylogue/operations/specs.py, polylogue/operations/archive.py, polylogue/operations/__init__.py
The query-productivity-rollups operation spec is removed from RUNTIME_OPERATION_SPECS, the ArchiveInsightAggregateMixin.list_productivity_rollup_insights() implementation is deleted, internal _SessionInsightReaders protocol is eliminated, and list_productivity_rollup_insights stops being exported from polylogue.operations.
Scenario execution operation dispatch
polylogue/scenarios/execution.py
The _INSIGHT_OPERATION_BY_METHOD mapping entry for list_productivity_rollup_insights → query-productivity-rollups is removed.
Runtime artifact graph and paths
polylogue/artifacts/runtime.py
The productivity_rollup_results artifact node and productivity-rollup-query-loop artifact path are removed from the runtime artifact graph declarations.
Test contract expectations and fixtures
tests/unit/api/test_facade_contracts.py, tests/unit/core/test_artifact_graph.py, tests/unit/core/test_artifact_specs.py, tests/unit/devtools/test_scenario_coverage.py, tests/unit/mcp/test_envelope_contracts.py, tests/unit/operations/test_specs.py, tests/data/witnesses/mcp-tool-schemas.json
Test contract mappings and expected artifact graph paths are updated to remove productivity-rollup expectations; facade contract expectations swap productivity rollups with cost/archive-debt insights; MCP tool schema witness data is updated to remove productivity_rollups entry.
Generated documentation and metadata
docs/cli-reference.md, docs/insights.md, docs/plans/topology-target.yaml, docs/test-quality-workflows.md, docs/topology-status.md, docs/verification-catalog.md
CLI reference removes productivity subcommand, insights documentation removes productivity_rollups description, topology projections and metadata counts are updated across multiple generated files, test-quality workflow metrics are recalculated, topology drift dashboard counts decrease by one, and verification catalog entries for productivity command are removed.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • Sinity/polylogue#1329: Updates daemon ingest endpoint semantics in /api/ingest request/response handling.

Suggested labels

type:refactor, area:qa

🐰 A productivity rollup was a notion so grand,
Hour-of-day histograms we had so carefully planned,
But now they're retired from this codebase so clean,
Making room for new metrics not yet foreseen. ✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 60.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: removing the productivity rollups insight surface from the codebase.
Description check ✅ Passed The description comprehensively covers all required sections: Summary, Problem, Solution, Verification, and Risks/Follow-ups. It clearly explains the rationale, scope, and validation performed.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/refactor/remove-productivity-rollups

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 merged commit a831ccd into master May 25, 2026
6 of 7 checks passed
@Sinity
Sinity deleted the feature/refactor/remove-productivity-rollups branch May 25, 2026 06:57
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