Skip to content

refactor(api): rename durable products to insights - #685

Merged
Sinity merged 2 commits into
masterfrom
feature/refactor/insight-docs-api-vocabulary
May 2, 2026
Merged

Sinity merged 2 commits into
masterfrom
feature/refactor/insight-docs-api-vocabulary

Conversation

@Sinity

@Sinity Sinity commented May 2, 2026 •

Copy link
Copy Markdown
Owner

Summary

Renames the durable archive read-model vocabulary from products to insights across public API, sync API, MCP maintenance, operation/proof/artifact identifiers, generated docs, and tests.

Problem

The CLI and package layout already expose these derived archive read models as insights, but the public Python API, MCP maintenance surface, machine payloads, and verification artifacts still used product names. That kept the old framing alive in user-facing contracts and made the naming cleanup incomplete.

Solution

  • Renamed facade and sync methods such as get_session_product_status, list_session_profile_products, and rebuild_session_products to the corresponding *_insight* / *_insights forms.
  • Renamed the MCP admin maintenance tool to rebuild_session_insights and regenerated the committed MCP schema witness.
  • Renamed durable insight payload metadata from product_kind to insight_kind.
  • Updated artifact paths, operation specs, proof subjects, validation lanes, benchmark catalogs, docs, and tests from session-product vocabulary to session-insight vocabulary.
  • Kept the persisted storage/maintenance target identity session_products in place; that is a schema/maintenance migration boundary for a separate slice.

Verification

  • pytest -q tests/unit/devtools/test_validation_lanes.py tests/unit/mcp/test_tool_schema_witness.py tests/unit/showcase/test_exercise_catalog.py tests/unit/devtools/test_artifact_graph.py tests/unit/proof/test_structural_error_evidence.py tests/unit/devtools/test_scenario_projections.py tests/unit/mcp/test_server_surfaces.py tests/unit/devtools/test_scenario_coverage.py tests/unit/devtools/test_quality_registry.py tests/unit/devtools/test_executable_scenarios.py tests/unit/operations/test_specs.py → 247 passed in 12.69s
  • pytest -q tests/unit/storage/test_repair.py tests/unit/cli/test_check.py tests/unit/storage/test_embedding_stats.py tests/unit/storage/test_session_insight_status_descriptors.py tests/unit/core/test_artifact_graph.py tests/unit/devtools/test_artifact_graph.py tests/unit/core/test_artifact_specs.py tests/unit/operations/test_specs.py → 80 passed in 11.45s
  • devtools verify --quick → all checks passed
  • pytest -q --ignore=tests/integration → 5784 passed in 175.35s

Ref #635

Summary by CodeRabbit

Release Notes

  • Refactor

    • Unified archive API method naming conventions across archive, CLI, and operations surfaces.
    • Updated runtime artifact graph and operational specifications for session data processing.
    • Realigned internal operation routing and readiness tracking systems.
  • Documentation

    • Updated user-facing API documentation with new method names and examples.
    • Refreshed command catalogs, validation workflows, and benchmark scenarios.

Problem: the public API, MCP maintenance tool, proof/reporting vocabulary, and docs still exposed durable read models as products even though the CLI has already moved to insights. That kept the old product framing alive in user-facing contracts and generated verification surfaces.

What changed: renamed the public facade and sync methods to *_insights, changed the MCP maintenance tool to rebuild_session_insights, changed archive insight payloads from product_kind to insight_kind, updated artifact/operation/proof/scenario identifiers to session-insight vocabulary, and refreshed generated docs and witnesses. Persisted storage table/maintenance target identity remains session_products for the dedicated schema/migration slice.

Verification: devtools verify --quick; pytest -q --ignore=tests/integration.
Copilot AI review requested due to automatic review settings May 2, 2026 02:58
@coderabbitai

coderabbitai Bot commented May 2, 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 48 minutes and 51 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: e806f286-2d8b-4675-94b2-03c0bb5595a4

📥 Commits

Reviewing files that changed from the base of the PR and between 69707dd and 5091556.

📒 Files selected for processing (4)
  • tests/baselines/showcase/help-insights-enrichments.txt
  • tests/baselines/showcase/help-insights-profiles.txt
  • tests/baselines/showcase/help-insights-threads.txt
  • tests/baselines/showcase/help-insights-work-events.txt
📝 Walkthrough

Walkthrough

This PR performs a comprehensive terminology shift from "products" to "insights" across the entire codebase. Method names, type fields, operation names, artifact nodes, documentation, and tests are renamed to align with new insight-centric terminology. No functional behavior changes; all contracts remain semantically equivalent with renamed identifiers.

Changes

Terminology Shift: Products → Insights

Layer / File(s) Summary
Model & Type Field Definitions
polylogue/insights/archive.py, polylogue/insights/archive_models.py
Renamed discriminator field product_kind → insight_kind across all ArchiveInsightModel subclasses (profiles, enrichments, work events, phases, threads, tag rollups, summaries, analytics, costs, debt). Module docstrings updated to reflect insight nomenclature.
Registry & Discovery
polylogue/insights/registry.py
Renamed registry descriptors and dispatch from product-centric (InsightType.operations_method_name="list_*_products") to insight-centric ("list_*_insights"). Updated error messages and public exports (fetch_insights, fetch_insights_async, InsightQueryError).
Aggregation Helpers
polylogue/insights/archive_rollups.py, polylogue/insights/archive_summaries.py
Renamed public functions: aggregate_session_tag_rollup_products → aggregate_session_tag_rollup_insights, aggregate_*_session_summary_products → aggregate_*_session_summary_insights.
Readiness & Export
polylogue/insights/readiness.py, polylogue/insights/export_bundles.py, polylogue/insights/resume.py
Renamed readiness/export operations: get_product_readiness_report → get_insight_readiness_report, export_product_bundle → export_insight_bundle. Updated protocol signatures in ResumeOperations to use insight-specific accessors.
Archive Operations Protocol
polylogue/api/archive.py
Renamed protocol methods in _ArchiveOperationsSurface and mixin wrappers in PolylogueArchiveMixin: get_session_product_status → get_session_insight_status, rebuild_session_products → rebuild_session_insights, and all session/archive accessors from *_product(s) to *_insight(s).
Async Insights Facade
polylogue/api/insights.py
Renamed all async delegation methods in _InsightOperationsSurface and PolylogueInsightsMixin: list_session_tag_rollup_products → list_session_tag_rollup_insights, and similar for work events, phases, threads, summaries, analytics, costs, debt.
Sync Insights Bridge
polylogue/api/sync/insights.py
Renamed all sync wrapper methods in SyncInsightQueriesMixin from *_product(s) to *_insight(s) to match facade API changes.
Backend Query Implementations
polylogue/storage/backends/async_sqlite_archive.py, polylogue/storage/backends/query_store.py, polylogue/storage/insights/session/status.py
Renamed backend status accessors: get_session_product_status → get_session_insight_status, session_product_status_sync/async → session_insight_status_sync/async.
Storage Operations Layer
polylogue/operations/archive.py, polylogue/operations/__init__.py
Renamed all public archive operations methods from *_products to *_insights (session profiles, enrichments, work events, phases, threads, rollups, summaries, analytics, debt, costs). Updated __all__ exports. Replaced internal helpers: _slice_products → _slice_insights, provider_analytics_product → provider_analytics_insight.
Runtime Artifact Graph
polylogue/artifacts/__init__.py
Replaced session-product artifact nodes with session-insight equivalents (session_product_rows → session_insight_rows, session_product_fts → session_insight_fts, session_product_readiness → session_insight_readiness). Updated downstream dependencies for readiness, analytics, and debt results to consume session-insight nodes.
Operation Specs
polylogue/operations/specs.py
Renamed operations: materialize-session-insights (was product), project-session-insight-readiness (was product), query-session-insight-status (was product). Updated operation inputs/outputs to reference session-insight artifact nodes and registry method names (list_*_insights).
Scenario & Maintenance Infrastructure
polylogue/scenarios/execution.py, polylogue/scenarios/operational_surfaces.py, polylogue/maintenance/targets.py, devtools/synthetic_benchmark_catalog.py, devtools/synthetic_benchmark_runtime.py
Renamed scenario/operational surface metadata: _INSIGHT_OPERATION_BY_METHOD keys switched to list_*_insights, operation names (query-session-insight-status), lane names (live-session-insight-repair → semantic-insight-normalization), maintenance readiness targets. Synthetic benchmark campaign session-product-materialization → session-insight-materialization.
CLI & Tool Integration
polylogue/cli/commands/insights.py, polylogue/cli/shared/check_support.py, polylogue/cli/shared/check_workflow.py, polylogue/cli/shared/helper_summary.py, polylogue/cli/shared/helpers.py, polylogue/mcp/server_insight_tools.py, polylogue/mcp/server_maintenance_tools.py
Updated CLI command wiring to call get_insight_readiness_report / export_insight_bundle instead of product equivalents. Renamed progress callback: make_session_product_progress_callback → make_session_insight_progress_callback. Updated MCP tool implementations to dispatch to get_session_profile_insight and rebuild_session_insights.
Devtools Configuration
devtools/command_catalog.py, devtools/validation_lane_catalog_*.py, polylogue/mcp/insight_tool_contracts.py
Updated command/lane metadata and MCP tool contracts to reference insight-based naming (campaign example session-insight-materialization, lane names semantic-insight-*, live-session-insight-repair).
Documentation
README.md, docs/*.md
Updated all documentation to reflect insight terminology (README examples use polylogue insights ..., validation/verification/library docs reference insight artifacts/lanes/methods).
Pipeline & Proof
polylogue/pipeline/run_stages.py, polylogue/pipeline/services/parsing_*.py, polylogue/storage/repair.py, polylogue/storage/derived/derived_status.py, polylogue/storage/embeddings/embedding_stats.py, polylogue/proof/*.py
Updated status reads to use session_insight_status_sync/async, updated readiness/repair progress parameter names from session_product_* to session_insight_*, updated proof catalog/subject discovery to reference insight types/surfaces.
Tests & Fixtures
tests/**/*.py, tests/data/witnesses/*, tests/infra/mcp.py
Comprehensively updated test fixtures, assertions, mocks, and imports to use insight-renamed methods/types/fields. Updated MCP tool schema witness and expected tool names.
Storage Documentation
polylogue/storage/**/*.py (module docstrings only)
Updated module-level docstrings to describe insight-oriented functionality instead of product-oriented. No logic or function signature changes.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~75 minutes

Possibly related PRs

Suggested labels

type:refactor, area:api, area:cli, area:docs, area:mcp, area:storage, area:qa

Poem

🐰 Hopping through the code with glee,
"Products" become "insights" for all to see!
From archive.py to tests so bright,
Renamed fields dance in the light—
Same spirit, fresh words taking flight! ✨

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/refactor/insight-docs-api-vocabulary

@github-actions

github-actions Bot commented May 2, 2026 •

Copy link
Copy Markdown
Contributor

Polylogue Proof Pack

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

Affected Domains

  • architecture_discipline — 4 claim(s), maturity growing
  • benchmark_coverage — 0 claim(s), maturity seed
  • cli_surface — 0 claim(s), maturity established
  • distribution — 0 claim(s), maturity seed
  • docs_media — 0 claim(s), maturity seed
  • migration_safety — 0 claim(s), maturity nascent
  • mutation_coverage — 0 claim(s), maturity growing
  • operational_resilience — 14 claim(s), maturity seed
  • performance — 0 claim(s), maturity nascent
  • pipeline_correctness — 0 claim(s), maturity growing
  • provider_coverage — 0 claim(s), maturity growing
  • scenario_coverage — 0 claim(s), maturity nascent
  • schema_correctness — 1 claim(s), maturity growing
  • security_privacy — 0 claim(s), maturity nascent
  • site_publication — 0 claim(s), maturity seed
  • spec_accuracy — 0 claim(s), maturity seed
  • spec_completeness — 3 claim(s), maturity seed
  • storage_correctness — 0 claim(s), maturity established
  • surface_parity — 1 claim(s), maturity nascent
  • test_quality — 1 claim(s), maturity growing
  • unclassified — 18 claim(s), maturity seed

Required Gates

  • devtools render-all --check — generated surface or renderer changed
  • devtools verify-manifests — structural manifest changed
  • devtools affected-obligations --path devtools/build_topology_projection.py — refresh structural obligation routing
  • devtools verify-topology — topology projection changed
  • pytest tests/unit/cli — CLI command surface changed
  • pytest tests/unit/proof/test_evidence_runners.py — CLI proof runners exercise command output
  • devtools render-cli-reference --check — CLI reference is generated from command help
  • pytest tests/unit/operations/test_specs.py — operation spec routing metadata changed
  • devtools artifact-graph --json — operation specs feed artifact graph views
  • pytest tests/unit/proof — proof kernel or catalog changed
  • pytest tests/unit/devtools/test_render_verification_catalog.py — catalog renderer changed
  • devtools render-verification-catalog --check — verification catalog must stay current
  • 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

  • distribution: dev_install: Not verified in CI; devshell is canonical environment [owner: distribution; next: Add package/build or cross-artifact CI gate], distribution: No scenario for install/package verification [owner: scenario-coverage; next: Add scenario family or generated projection for this subject], install_parity: No cross-artifact equivalence verification (wheel vs sdist vs Nix) [owner: distribution; next: Add package/build or cross-artifact CI gate], macos: No macOS CI runner [owner: distribution; next: Add package/build or cross-artifact CI gate], sdist: Not built or tested in CI [owner: distribution; next: Add package/build or cross-artifact CI gate], wheel: Not built or tested in CI [owner: distribution; next: Add package/build or cross-artifact CI gate], windows: No Windows CI runner [owner: distribution; next: Add package/build or cross-artifact CI gate]
  • docs_media: docs_media: No scenario for documentation freshness verification [owner: scenario-coverage; next: Add scenario family or generated projection for this subject], docs_media: README examples and media are not yet generated from executable scenario projections. [owner: docs-media; next: Add executable scenario projection or media integrity gate], docs_media: Screenshots and VHS media have no committed nonblank/readability verification. [owner: docs-media; next: Add executable scenario projection or media integrity gate]
  • migration_safety: migration_safety: No scenario for migration safety verification [owner: scenario-coverage; next: Add scenario family or generated projection for this subject]
  • performance: performance: No scenario family exercising memory or throughput budgets [owner: scenario-coverage; next: Add scenario family or generated projection for this subject]
  • security_privacy: dependency_audit: No dependency vulnerability scanning in CI [owner: security-privacy; next: Add dedicated security/privacy gate for this area], file_permissions: Crawl-source file permissions not verified [owner: security-privacy; next: Add dedicated security/privacy gate for this area], secrets_detection: No automated secrets scanning in CI [owner: security-privacy; next: Add dedicated security/privacy gate for this area], security_privacy: Security verification uses unit tests, not scenario specs [owner: scenario-coverage; next: Add scenario family or generated projection for this subject], xss_prevention: No dedicated XSS test file; relies on snapshot rendering [owner: security-privacy; next: Add dedicated security/privacy gate for this area]
  • site_publication: site_publication: Static-site publication has no visual or hyperlink integrity gate. [owner: docs-media; next: Add executable scenario projection or media integrity gate]
  • storage_correctness: storage_correctness: No dedicated scenario family for storage-layer verification [owner: scenario-coverage; next: Add scenario family or generated projection for this subject]
  • test_quality: direct_coverage: Coverage per-module not tracked (only aggregate fail_under) [owner: test-quality; next: Add measurable quality gate for this dimension], flakiness: No systematic flakiness tracking, CI retry, or quarantine [owner: test-quality; next: Add measurable quality gate for this dimension], fuzz: Atheris fuzz targets not run in CI [owner: test-quality; next: Add measurable quality gate for this dimension], mock_depth: Mock depth not measured or enforced [owner: test-quality; next: Add measurable quality gate for this dimension]

Oracle / Cost

  • oracle mix: {"construction_sanity": 509, "drift_check": 5, "manual_review": 1, "proof": 37, "smoke": 12}
  • cost tier: {"static": 548, "unit": 16}
  • stale evidence: 561
  • manual review cells: 1

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

Renames the durable archive read-model vocabulary from products to insights across Polylogue’s public async/sync APIs, MCP maintenance tooling, operational specs/artifacts, devtools catalogs, docs, and tests—aligning user-facing contracts with the existing CLI/package framing.

Changes:

  • Renamed facade + sync API methods (e.g., get_session_*_product* → *_insight*) and updated insight payload metadata (product_kind → insight_kind).
  • Renamed MCP maintenance tool (rebuild_session_products → rebuild_session_insights) and updated the committed schema witness.
  • Updated operation/artifact identifiers, lane/scenario catalogs, docs, and test expectations to the new “insights” vocabulary (while preserving the storage target identity session_products).

Reviewed changes

Copilot reviewed 105 out of 105 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
tests/witnesses/cli-command-surface.witness.json Updates CLI command-surface witness semantic facts for renamed surfaces.
tests/unit/storage/test_session_insight_status_descriptors.py Updates session status descriptor tests to session_insight_status_*.
tests/unit/storage/test_embedding_stats.py Adjusts embedding stats tests to patch new session-insight status helpers.
tests/unit/storage/test_derived_status.py Updates derived status tests to use session_insight_status_sync.
tests/unit/showcase/test_exercise_catalog.py Renames exercise catalog targets/artifacts/operations to insight vocabulary.
tests/unit/proof/test_structural_error_evidence.py Updates proof evidence expectations for renamed artifact paths/nodes.
tests/unit/pipeline/test_run_stages_runtime.py Updates pipeline stage wiring to call get_session_insight_status.
tests/unit/operations/test_specs.py Updates operation catalog expectations for insight operation names/paths.
tests/unit/operations/test_archive_helpers.py Renames helper _slice_products → _slice_insights in tests.
tests/unit/mcp/test_tool_contracts.py Updates MCP tool contract tests to insight methods + insight_kind key.
tests/unit/mcp/test_server_surfaces.py Updates MCP server surface tool-name expectations.
tests/unit/devtools/test_validation_lanes.py Updates lane catalog expectations for insight paths/artifacts/ops.
tests/unit/devtools/test_scenario_projections.py Updates scenario projection names to insight materialization.
tests/unit/devtools/test_scenario_coverage.py Updates scenario coverage expectations for insight paths/artifacts.
tests/unit/devtools/test_quality_registry.py Updates quality registry expectations for insight campaigns/lanes.
tests/unit/devtools/test_execution_specs.py Updates doctor execution spec expected operation targets.
tests/unit/devtools/test_executable_scenarios.py Updates executable scenario metadata expectations for insight readiness.
tests/unit/devtools/test_benchmark_campaigns.py Updates benchmark campaign expectations for insight campaign naming.
tests/unit/devtools/test_artifact_graph.py Updates artifact graph rendering expectations for insight nodes/ops.
tests/unit/core/test_sync_surface_runtime.py Updates sync surface bridge/mixin forwarding to insight methods.
tests/unit/core/test_resume.py Updates resume tests wording and function names to “insights”.
tests/unit/core/test_insight_registry_runtime.py Updates registry runtime tests to reflect insight naming and errors.
tests/unit/core/test_insight_readiness.py Updates readiness tests to call insight_readiness_report + new status fn.
tests/unit/core/test_insight_export_bundles.py Updates export bundle tests to export_insight_bundle naming.
tests/unit/core/test_facade_api.py Updates public facade API tests for insight methods + insight_kind.
tests/unit/core/test_artifact_specs.py Updates artifact spec expectations for insight artifact names/paths.
tests/unit/core/test_artifact_graph.py Updates artifact graph structure expectations for insight nodes/ops.
tests/unit/cli/test_source_selection_helpers.py Updates CLI helper patch target for provider analytics insight listing.
tests/unit/cli/test_insights_command_runtime.py Updates CLI insights command runtime tests for renamed operations methods.
tests/unit/cli/test_insights.py Updates CLI insights integration-like tests for insight_kind and status fn.
tests/unit/cli/test_check_support_runtime.py Updates check workflow tests for renamed progress callback plumbing.
tests/unit/cli/test_analytics.py Renames provider analytics operation function references to insights.
tests/unit/archive/test_repo_identity.py Updates archive summary aggregation import to insight naming.
tests/integration/test_health.py Updates integration docstring to session-insight terminology.
tests/infra/mcp.py Updates MCP tool allowlist/fixtures for rebuild_session_insights.
tests/data/witnesses/mcp-tool-schemas.json Updates committed MCP schema witness for renamed maintenance tool.
polylogue/storage/repository/insight/timeline_reads.py Updates module docstring terminology to “insight”.
polylogue/storage/repository/insight/thread_reads.py Updates module docstring terminology to “insight”.
polylogue/storage/repository/insight/profile_reads.py Updates module docstring terminology to “insight”.
polylogue/storage/repair.py Renames session status function usage + progress callback args to insight naming.
polylogue/storage/query_models.py Updates query model docstrings from product to insight wording.
polylogue/storage/insights/session/status.py Renames exported session status functions to session_insight_status_*.
polylogue/storage/insights/session/runtime.py Updates session runtime module docstring to insight naming.
polylogue/storage/insights/session/rebuild.py Updates rebuild module docstring to insight naming.
polylogue/storage/insights/insight_read_support.py Updates hydration helper module docstring to insight naming.
polylogue/storage/embeddings/embedding_stats.py Updates imports/calls to use session-insight status functions.
polylogue/storage/derived/derived_status.py Updates derived status collection to use session-insight status function.
polylogue/storage/backends/query_store.py Renames backend query-store method to get_session_insight_status.
polylogue/storage/backends/queries/session_insight_timeline_writes.py Updates query module docstring to insight naming.
polylogue/storage/backends/queries/session_insight_timeline_reads.py Updates query module docstring to insight naming.
polylogue/storage/backends/queries/session_insight_thread_queries.py Updates query module docstring to insight naming.
polylogue/storage/backends/queries/session_insight_summary_queries.py Updates query module docstring to insight naming.
polylogue/storage/backends/queries/session_insight_profile_writes.py Updates query module docstring to insight naming.
polylogue/storage/backends/queries/session_insight_profile_reads.py Updates query module docstring to insight naming.
polylogue/storage/backends/queries/mappers_insight_timelines.py Updates mapper module docstring to insight naming.
polylogue/storage/backends/queries/mappers_insight_legacy.py Updates legacy mapper module docstring to insight naming.
polylogue/storage/backends/async_sqlite_archive.py Renames async backend method to get_session_insight_status.
polylogue/scenarios/operational_surfaces.py Updates operational surface variant names/descriptions to insight vocabulary.
polylogue/scenarios/execution.py Updates scenario metadata mapping to insight operations + renamed status op.
polylogue/proof/subjects.py Updates proof subject docstrings while keeping subject kind/id namespace.
polylogue/proof/models.py Updates SubjectRef docstring wording to insight registry.
polylogue/proof/generated_scenarios.py Updates generated scenario claim text to insight vocabulary.
polylogue/proof/catalog.py Updates proof claim docstrings/descriptions while keeping claim/query namespace.
polylogue/pipeline/services/parsing_workflow.py Updates parsing workflow docstring to session-insight materialization wording.
polylogue/pipeline/services/parsing_models.py Updates parsing model comment to session-insight refresh wording.
polylogue/pipeline/run_stages.py Renames materialize-stage status call to get_session_insight_status.
polylogue/operations/specs.py Renames operation specs/artifact dependencies to insight naming.
polylogue/operations/archive.py Renames Archive operations mixin methods and helper names to insights.
polylogue/operations/init.py Updates exports to list_provider_analytics_insights.
polylogue/mcp/server_maintenance_tools.py Renames MCP maintenance tool to rebuild_session_insights.
polylogue/mcp/server_insight_tools.py Updates MCP insight tool module docs + session-profile tool implementation naming.
polylogue/mcp/insight_tool_contracts.py Updates MCP tool contract docs from product to insight wording.
polylogue/maintenance/targets.py Updates maintenance target descriptions + doctor readiness operation name.
polylogue/insights/resume.py Renames operations protocol usage from product to insight methods.
polylogue/insights/registry.py Renames registry docs and dispatch method names to insight vocabulary.
polylogue/insights/readiness.py Updates readiness module wording + error messages to insight vocabulary.
polylogue/insights/export_bundles.py Renames export bundle API internals to “insight” vocabulary.
polylogue/insights/archive_summaries.py Renames summary aggregation helpers to *_insights.
polylogue/insights/archive_rollups.py Renames rollup aggregation helper to *_insights.
polylogue/insights/archive_models.py Updates archive insight base model docs to insight vocabulary.
polylogue/insights/archive.py Renames payload metadata key from product_kind to insight_kind.
polylogue/insights/init.py Updates package-level docs to insight framing.
polylogue/cli/shared/insight_command_contracts.py Updates CLI insight command contracts docs to insight vocabulary.
polylogue/cli/shared/helpers.py Updates helper wiring to list_provider_analytics_insights.
polylogue/cli/shared/helper_summary.py Renames helper_summary injected callable parameter to insights naming.
polylogue/cli/shared/check_workflow.py Renames check workflow session progress callback plumbing to insight naming.
polylogue/cli/shared/check_support.py Renames progress callback factory to make_session_insight_progress_callback.
polylogue/cli/insights_rendering.py Updates rendering module docs to insight vocabulary.
polylogue/cli/commands/insights.py Updates insights CLI to call renamed operations methods for status/export.
polylogue/artifacts/init.py Renames session-product artifact nodes/paths to session-insight equivalents.
polylogue/api/sync/insights.py Renames sync mixin methods to insight vocabulary.
polylogue/api/insights.py Renames async facade mixin methods for insight queries.
polylogue/api/archive.py Renames public facade methods (rebuild_insights, insight_readiness_report, etc.).
docs/verification-lab.md Updates docs to refer to “archive CLI” rather than “product CLI”.
docs/verification-catalog.md Updates generated verification catalog wording for session insight claims.
docs/library-api.md Updates library API docs/examples to new insight imports and method names.
docs/devtools.md Updates devtools docs to “archive CLI” wording.
devtools/validation_lane_catalog_contracts.py Renames semantic-product lane key to semantic-insight.
devtools/validation_lane_catalog_composites.py Renames lane families/members from product to insight naming.
devtools/synthetic_benchmark_runtime.py Renames benchmark campaign key/name strings to session-insight materialization.
devtools/synthetic_benchmark_catalog.py Renames synthetic benchmark entry + artifact targets to insight naming.
devtools/command_catalog.py Updates devtools command examples/use_when strings for renamed campaign + CLI wording.
devtools/build_topology_projection.py Removes obsolete root move map and updates archive CLI wording in comments.
README.md Updates top-level README terminology and example commands from products → insights.

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

Comment on lines 178 to 182
def product_surface_subjects() -> tuple[SubjectRef, ...]:
"""Compile registered product types into proof subjects."""
"""Compile registered insight types into proof subjects."""
subjects = [
SubjectRef(
kind="product.surface",
Comment on lines 788 to 792
return (
Claim(
id="product.surface.registered",
description="Every registered product type has a corresponding proof subject.",
description="Every registered insight type has a corresponding proof subject.",
subject_query=Kind("product.surface"),
Comment on lines 315 to 319
def run_session_product_materialization_campaign(db_path: Path) -> CampaignResult:
"""Benchmark full durable session-product rebuild."""
"""Benchmark full durable session-insight rebuild."""
from polylogue.storage.backends.connection import open_connection
from polylogue.storage.insights.session.rebuild import rebuild_session_products_sync

@@ -1,4 +1,4 @@
"""Tests for the durable archive data insights CLI surfaces."""
"""Tests for the durable archive datan insights CLI surfaces."""
Comment on lines +14 to 16
"archive CLI root commands remain discoverable",
"retired audit/qa/showcase vocabulary stays out of public product help",
"query/read filters keep cwd-prefix and referenced-path semantically distinct"
Problem: the public insight query help changed from product search text to insight search text, but the committed showcase help baselines still expected the old wording.

What changed: updated the four affected insight help baselines for profiles, enrichments, work events, and threads.

Verification: devtools lab-scenario verify-baselines; pytest -q tests/unit/showcase/test_exercise_catalog.py tests/unit/cli/test_insights.py.

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 11

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (5)
polylogue/storage/backends/queries/session_insight_timeline_writes.py (1)

25-37: 🧹 Nitpick | 🔵 Trivial | ⚡ Quick win

Potential correctness/memory risk in _ASYNC_COLUMN_CACHE keying by id(conn).

Using id(conn) in a long-lived in-memory cache can be unsafe if the connection object is ever GC’d and a new connection later reuses the same id, causing _table_has_column to return a cached result for a different underlying database/connection state. The cache also has no eviction, so it can grow without bound across many connections.

♻️ Suggested fix (use per-connection weak keys)
+from weakref import WeakKeyDictionary
+
- _ASYNC_COLUMN_CACHE: dict[tuple[int, str], bool] = {}
+ _ASYNC_COLUMN_CACHE: "WeakKeyDictionary[aiosqlite.Connection, dict[str, bool]]" = WeakKeyDictionary()
 
 async def _table_has_column(conn: aiosqlite.Connection, table: str, column: str) -> bool:
-    key = (id(conn), f"{table}.{column}")
-    cached = _ASYNC_COLUMN_CACHE.get(key)
-    if cached is not None:
-        return cached
+    per_conn = _ASYNC_COLUMN_CACHE.get(conn)
+    key = f"{table}.{column}"
+    if per_conn is not None and key in per_conn:
+        return per_conn[key]
     cursor = await conn.execute(f"PRAGMA table_info({table})")
     rows = await cursor.fetchall()
     found = any(str(row["name"] if "name" in row else row[1]) == column for row in rows)
-    _ASYNC_COLUMN_CACHE[key] = found
+    if per_conn is None:
+        per_conn = {}
+        _ASYNC_COLUMN_CACHE[conn] = per_conn
+    per_conn[key] = found
     return found

If you want to keep id(conn) for simplicity, at least consider adding eviction/upper-bound to prevent unbounded growth.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@polylogue/storage/backends/queries/session_insight_timeline_writes.py` around
lines 25 - 37, The cache _ASYNC_COLUMN_CACHE keyed by id(conn) in
_table_has_column is unsafe because connection objects can be GC'd and their ids
reused and it also can grow unbounded; switch to a per-connection weak-key cache
(e.g., use weakref.WeakKeyDictionary or similar) mapping the actual conn object
to a set/dict of discovered columns and store/lookup by conn rather than
id(conn), or if you must keep id(conn) implement an eviction/size cap to prevent
unbounded growth; update all accesses in _table_has_column to use the new
weak-keyed structure and ensure entries are cleaned when connections are
collected.
polylogue/cli/insights_rendering.py (1)

30-48: 🛠️ Refactor suggestion | 🟠 Major | ⚡ Quick win

Rename the exported helper to keep the public surface on insight terminology.

emit_product_list is still exported from this module, so the old vocabulary survives on a public helper even though the rest of the PR renames the API to insights. Please add an emit_insight_list entry point here and keep emit_product_list only as a temporary compatibility alias if you still need it.

Suggested refactor
-def emit_product_list(*, key: str, items: list[object]) -> None:
+def emit_insight_list(*, key: str, items: list[object]) -> None:
     emit_success({"count": len(items), key: model_payloads(items)})

+
+emit_product_list = emit_insight_list
+
 
 __all__ = [
-    "emit_product_list",
+    "emit_insight_list",
+    "emit_product_list",
     "model_payload",
     "model_payloads",
     "render_insight_items",
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@polylogue/cli/insights_rendering.py` around lines 30 - 48, The module
currently exposes emit_product_list but the public API should use "insight"
terminology: add a new function emit_insight_list that has the same signature
and behavior as emit_product_list (i.e., calls emit_success({"count":
len(items), key: model_payloads(items)}) ), then keep emit_product_list as a
thin compatibility alias that calls emit_insight_list (or vice versa) and update
the __all__ export list to include "emit_insight_list" (retain
"emit_product_list" only if you need a temporary compatibility export).
Reference the existing emit_product_list function name and the __all__ list when
making the edits.
polylogue/api/insights.py (1)

33-94: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Keep deprecated *_products async aliases on the public insight surface.

Calls like list_session_tag_rollup_products, get_session_work_event_products, list_work_thread_products, and the other renamed async helpers will now fail for downstream consumers even though the behavior is unchanged. Adding deprecated passthrough aliases here would avoid turning a terminology cleanup into a hard API break.

Also applies to: 102-175

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@polylogue/api/insights.py` around lines 33 - 94, Public async method names
were renamed from "*_products" to "*_insights", breaking downstream callers; add
deprecated passthrough aliases for each old name (e.g.,
list_session_tag_rollup_products -> list_session_tag_rollup_insights,
get_session_work_event_products -> get_session_work_event_insights,
list_work_thread_products -> list_work_thread_insights, etc.) so existing
callers continue to work: implement async wrapper functions with the old names
that simply call and return the corresponding new methods and mark them
deprecated in docstring/comments; do this for all renamed pairs shown (including
the block covering the other methods referenced in lines 102-175) so every
removed "*_products" async helper delegates to its "*_insights" counterpart.
polylogue/api/archive.py (1)

79-125: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Keep deprecated product-named archive aliases for at least one release.

This removes the old public facade names outright, so existing callers of methods like get_session_product_status, get_session_profile_product, rebuild_products, product_readiness_report, and export_product_bundle will fail with AttributeError immediately after upgrade. Thin deprecated passthrough aliases here would let you land the vocabulary rename without forcing lockstep client migrations.

Also applies to: 183-240, 251-257, 332-337

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@polylogue/api/archive.py` around lines 79 - 125, Add thin deprecated
passthrough aliases for the old product-named API methods so existing callers
don’t break: implement methods named get_session_product_status,
get_session_profile_product, rebuild_products, product_readiness_report, and
export_product_bundle that simply call the new counterparts (e.g.,
get_session_insight_status, get_session_profile_insight,
rebuild_session_insights, get_insight_readiness_report, export_insight_bundle)
and emit a DeprecationWarning or log a deprecation message; place these aliases
alongside the new async method definitions (the same class/interface where
get_session_insight_status, get_session_profile_insight,
rebuild_session_insights, get_insight_readiness_report, and
export_insight_bundle are declared) so they remain for at least one release
before removal.
polylogue/operations/specs.py (1)

279-299: ⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Wire the new raw session-insight repair path into the operation catalog.

raw-session-insight-repair-loop is now a declared runtime path, but neither of the session-insight operations targets it. As written, graph.operations_for_path("raw-session-insight-repair-loop") will be empty, so the new path is disconnected in artifact-graph output and any downstream docs/proofs built from it.

Suggested fix
     OperationSpec(
         name="materialize-session-insights",
         kind=OperationKind.MATERIALIZATION,
         description="Build durable session-insight rows and their trigger-maintained FTS projections from archive conversations.",
         consumes=("session_insight_source_conversations",),
@@
-        path_targets=("session-insight-repair-loop",),
+        path_targets=("session-insight-repair-loop", "raw-session-insight-repair-loop"),
@@
     OperationSpec(
         name="project-session-insight-readiness",
         kind=OperationKind.PROJECTION,
         description="Project readiness, debt, and stale-surface semantics from durable session-insight rows and FTS state.",
         consumes=("session_insight_rows", "session_insight_fts"),
         produces=("session_insight_readiness",),
-        path_targets=("session-insight-repair-loop",),
+        path_targets=("session-insight-repair-loop", "raw-session-insight-repair-loop"),

Also applies to: 351-356

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@polylogue/operations/specs.py` around lines 279 - 299, The operation named
"materialize-session-insights" currently only targets
"session-insight-repair-loop" so the new runtime path
"raw-session-insight-repair-loop" is not wired; update the path_targets tuple on
the Operation spec for name="materialize-session-insights" to include
"raw-session-insight-repair-loop" (e.g.
path_targets=("session-insight-repair-loop","raw-session-insight-repair-loop")),
and make the same change to the other session-insight operation later in the
file that also defines path_targets (the block around the 351-356 region) so
graph.operations_for_path("raw-session-insight-repair-loop") returns this
operation.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@devtools/validation_lane_catalog_contracts.py`:
- Around line 154-157: The lane entry named "semantic-insight-normalization"
uses an outdated description mentioning “product normalization”; update the
human-readable description passed to pytest_lane for the
"semantic-insight-normalization" key to reflect the renamed insight vocabulary
(e.g., change “Semantic/session product normalization…” to “Semantic/session
insight normalization…” or similar) so the description matches the new key/name
and PR rename scope.

In `@docs/test-quality-workflows.md`:
- Line 158: The snapshot still contains the old phrase "session product" for the
`semantic-insight-normalization` entry; update the source registry/render input
where `semantic-insight-normalization` is defined to replace any remaining
"session product" occurrences with the new vocabulary (the intended term used
elsewhere), then regenerate the generated docs snapshot so the table row
(`semantic-insight-normalization` -> description) reflects the renamed
vocabulary; verify both instances referenced in the file (including the
duplicate at the other line) are corrected before committing.

In `@polylogue/api/sync/insights.py`:
- Around line 45-138: The sync API removed old *_product* method names and
should preserve one-release passthrough aliases to avoid breaking callers: add
deprecated sync methods (e.g., get_session_profile_product,
list_session_profile_product, get_session_enrichment_product,
list_session_enrichment_product, list_session_tag_rollup_product,
get_session_work_event_product, list_session_work_event_product,
get_session_phase_product, list_session_phase_product, get_work_thread_product,
list_work_thread_product, list_day_session_summary_product,
list_week_session_summary_product, list_provider_analytics_product,
list_session_cost_product, list_cost_rollup_product, list_archive_debt_product)
that simply call the new methods (get_session_profile_insight,
list_session_profile_insights, get_session_enrichment_insight, etc.) or delegate
to self._facade via run_coroutine_sync, and emit a DeprecationWarning (or use
warnings.warn) so callers are warned while staying source-compatible.

In `@polylogue/insights/export_bundles.py`:
- Around line 240-243: The manifest wire-format changed (the query payload now
uses query["insights"]) but the bundle version constant
INSIGHT_EXPORT_BUNDLE_VERSION in this module was not updated, so consumers can't
detect the layout change; update/bump INSIGHT_EXPORT_BUNDLE_VERSION to a new
value and ensure any other places in this file that build/export manifests (see
uses around operations.get_insight_readiness_report and InsightReadinessQuery
and the similar block at the 290-295 range) produce the new version number so
bundle readers can distinguish the two manifest shapes.

In `@polylogue/insights/resume.py`:
- Around line 393-414: The except blocks for get_session_profile_insight,
get_session_enrichment_insight, get_session_work_event_insights, and
get_session_phase_insights currently append ResumeUncertainty(detail=str(exc))
which can leak internal storage names like "session_products"; change these to
provide a sanitized/public-facing message instead of the raw exception
string—either use a mapping from internal insight keys to public labels (e.g.,
map "session_products" -> "products") and set
ResumeUncertainty(detail=f"{public_label} unavailable") or a generic message
like "insight unavailable", by adding a small helper (e.g.,
sanitize_insight_detail) and using it in each except block rather than str(exc).

In `@polylogue/proof/catalog.py`:
- Around line 786-792: The _product_surface_claims function mixes "insight"
wording with exported identifiers still using product.surface; update the
Claim(s) created by this function so exported identifiers and queries use the
new namespace consistently: change id="product.surface.registered" to
id="insight.surface.registered", change subject_query=Kind("product.surface") to
subject_query=Kind("insight.surface"), and update the human-facing description
text if it references "product" so it consistently says "insight"; ensure any
other Claim instances inside _product_surface_claims use the same insight.*
naming so external proof identifiers are uniform.

In `@polylogue/storage/insights/session/status.py`:
- Line 1: Update the inconsistent docstrings by replacing uses of the term
"product" with "session-insight" across this module: adjust the module header
docstring and all descriptor/query docstrings that mention "product" (search for
the literal token "product" in docstrings, including the descriptor and
repair-candidate query descriptions referenced in this file) so they
consistently use "session-insight" and match the module-level terminology.

In `@polylogue/storage/repair.py`:
- Around line 447-449: Replace the stale wording in the detail string so it
consistently uses "session-insight": change the branch that currently sets
detail="Session-product read models ready" (the conditional that references
session_products) to use "Session-insight read models ready" (matching the other
"session-insight" terminology and casing used elsewhere).

In `@tests/integration/test_health.py`:
- Around line 813-814: The docstring for
test_run_selected_maintenance_can_scope_to_session_products is inconsistent with
the preserved identity name "session_products" used in
targets=("session_products",) and the asserted result names; update the test
docstring to explicitly state that although the operation repairs the durable
session-insight layer, the preserved identity/name "session_products" is
intentionally used for scoping and assertions (so future readers won't change
targets to "insights"), referencing the test function name and the
targets=("session_products",) usage.

In `@tests/unit/cli/test_check_support_runtime.py`:
- Around line 334-335: The test is not asserting that run_check_workflow
forwards the renamed kwarg session_insight_progress_callback into
run_selected_maintenance; update the test to capture the patched
run_selected_maintenance mock (the patch already present for
"polylogue.cli.shared.check_workflow.run_selected_maintenance") and assert it
was called with session_insight_progress_callback="progress" (the value returned
by the patched make_session_insight_progress_callback) when run_check_workflow
is exercised; use the mock's call_args or assert_called_with to verify the kwarg
is present rather than only relying on the factory patch.

In `@tests/witnesses/cli-command-surface.witness.json`:
- Around line 14-16: Update the semantic witness string that still uses "public
product help": find the entry "retired audit/qa/showcase vocabulary stays out of
public product help" and replace the phrase "public product help" with the
normalized terminology used in this PR (e.g., "public archive/insight help") so
the string consistently reflects the renamed archive/insight vocabulary.

---

Outside diff comments:
In `@polylogue/api/archive.py`:
- Around line 79-125: Add thin deprecated passthrough aliases for the old
product-named API methods so existing callers don’t break: implement methods
named get_session_product_status, get_session_profile_product, rebuild_products,
product_readiness_report, and export_product_bundle that simply call the new
counterparts (e.g., get_session_insight_status, get_session_profile_insight,
rebuild_session_insights, get_insight_readiness_report, export_insight_bundle)
and emit a DeprecationWarning or log a deprecation message; place these aliases
alongside the new async method definitions (the same class/interface where
get_session_insight_status, get_session_profile_insight,
rebuild_session_insights, get_insight_readiness_report, and
export_insight_bundle are declared) so they remain for at least one release
before removal.

In `@polylogue/api/insights.py`:
- Around line 33-94: Public async method names were renamed from "*_products" to
"*_insights", breaking downstream callers; add deprecated passthrough aliases
for each old name (e.g., list_session_tag_rollup_products ->
list_session_tag_rollup_insights, get_session_work_event_products ->
get_session_work_event_insights, list_work_thread_products ->
list_work_thread_insights, etc.) so existing callers continue to work: implement
async wrapper functions with the old names that simply call and return the
corresponding new methods and mark them deprecated in docstring/comments; do
this for all renamed pairs shown (including the block covering the other methods
referenced in lines 102-175) so every removed "*_products" async helper
delegates to its "*_insights" counterpart.

In `@polylogue/cli/insights_rendering.py`:
- Around line 30-48: The module currently exposes emit_product_list but the
public API should use "insight" terminology: add a new function
emit_insight_list that has the same signature and behavior as emit_product_list
(i.e., calls emit_success({"count": len(items), key: model_payloads(items)}) ),
then keep emit_product_list as a thin compatibility alias that calls
emit_insight_list (or vice versa) and update the __all__ export list to include
"emit_insight_list" (retain "emit_product_list" only if you need a temporary
compatibility export). Reference the existing emit_product_list function name
and the __all__ list when making the edits.

In `@polylogue/operations/specs.py`:
- Around line 279-299: The operation named "materialize-session-insights"
currently only targets "session-insight-repair-loop" so the new runtime path
"raw-session-insight-repair-loop" is not wired; update the path_targets tuple on
the Operation spec for name="materialize-session-insights" to include
"raw-session-insight-repair-loop" (e.g.
path_targets=("session-insight-repair-loop","raw-session-insight-repair-loop")),
and make the same change to the other session-insight operation later in the
file that also defines path_targets (the block around the 351-356 region) so
graph.operations_for_path("raw-session-insight-repair-loop") returns this
operation.

In `@polylogue/storage/backends/queries/session_insight_timeline_writes.py`:
- Around line 25-37: The cache _ASYNC_COLUMN_CACHE keyed by id(conn) in
_table_has_column is unsafe because connection objects can be GC'd and their ids
reused and it also can grow unbounded; switch to a per-connection weak-key cache
(e.g., use weakref.WeakKeyDictionary or similar) mapping the actual conn object
to a set/dict of discovered columns and store/lookup by conn rather than
id(conn), or if you must keep id(conn) implement an eviction/size cap to prevent
unbounded growth; update all accesses in _table_has_column to use the new
weak-keyed structure and ensure entries are cleaned when connections are
collected.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: f1a1ba2c-aaef-44db-9272-10a3203e8166

📥 Commits

Reviewing files that changed from the base of the PR and between 188f73e and 69707dd.

📒 Files selected for processing (105)
  • README.md
  • devtools/build_topology_projection.py
  • devtools/command_catalog.py
  • devtools/synthetic_benchmark_catalog.py
  • devtools/synthetic_benchmark_runtime.py
  • devtools/validation_lane_catalog_composites.py
  • devtools/validation_lane_catalog_contracts.py
  • docs/devtools.md
  • docs/library-api.md
  • docs/test-quality-workflows.md
  • docs/verification-catalog.md
  • docs/verification-lab.md
  • polylogue/api/archive.py
  • polylogue/api/insights.py
  • polylogue/api/sync/insights.py
  • polylogue/artifacts/__init__.py
  • polylogue/cli/commands/insights.py
  • polylogue/cli/insights_rendering.py
  • polylogue/cli/shared/check_support.py
  • polylogue/cli/shared/check_workflow.py
  • polylogue/cli/shared/helper_summary.py
  • polylogue/cli/shared/helpers.py
  • polylogue/cli/shared/insight_command_contracts.py
  • polylogue/insights/__init__.py
  • polylogue/insights/archive.py
  • polylogue/insights/archive_models.py
  • polylogue/insights/archive_rollups.py
  • polylogue/insights/archive_summaries.py
  • polylogue/insights/export_bundles.py
  • polylogue/insights/readiness.py
  • polylogue/insights/registry.py
  • polylogue/insights/resume.py
  • polylogue/maintenance/targets.py
  • polylogue/mcp/insight_tool_contracts.py
  • polylogue/mcp/server_insight_tools.py
  • polylogue/mcp/server_maintenance_tools.py
  • polylogue/operations/__init__.py
  • polylogue/operations/archive.py
  • polylogue/operations/specs.py
  • polylogue/pipeline/run_stages.py
  • polylogue/pipeline/services/parsing_models.py
  • polylogue/pipeline/services/parsing_workflow.py
  • polylogue/proof/catalog.py
  • polylogue/proof/generated_scenarios.py
  • polylogue/proof/models.py
  • polylogue/proof/subjects.py
  • polylogue/scenarios/execution.py
  • polylogue/scenarios/operational_surfaces.py
  • polylogue/storage/backends/async_sqlite_archive.py
  • polylogue/storage/backends/queries/mappers_insight_legacy.py
  • polylogue/storage/backends/queries/mappers_insight_timelines.py
  • polylogue/storage/backends/queries/session_insight_profile_reads.py
  • polylogue/storage/backends/queries/session_insight_profile_writes.py
  • polylogue/storage/backends/queries/session_insight_summary_queries.py
  • polylogue/storage/backends/queries/session_insight_thread_queries.py
  • polylogue/storage/backends/queries/session_insight_timeline_reads.py
  • polylogue/storage/backends/queries/session_insight_timeline_writes.py
  • polylogue/storage/backends/query_store.py
  • polylogue/storage/derived/derived_status.py
  • polylogue/storage/embeddings/embedding_stats.py
  • polylogue/storage/insights/insight_read_support.py
  • polylogue/storage/insights/session/rebuild.py
  • polylogue/storage/insights/session/runtime.py
  • polylogue/storage/insights/session/status.py
  • polylogue/storage/query_models.py
  • polylogue/storage/repair.py
  • polylogue/storage/repository/insight/profile_reads.py
  • polylogue/storage/repository/insight/thread_reads.py
  • polylogue/storage/repository/insight/timeline_reads.py
  • tests/data/witnesses/mcp-tool-schemas.json
  • tests/infra/mcp.py
  • tests/integration/test_health.py
  • tests/unit/archive/test_repo_identity.py
  • tests/unit/cli/test_analytics.py
  • tests/unit/cli/test_check_support_runtime.py
  • tests/unit/cli/test_insights.py
  • tests/unit/cli/test_insights_command_runtime.py
  • tests/unit/cli/test_source_selection_helpers.py
  • tests/unit/core/test_artifact_graph.py
  • tests/unit/core/test_artifact_specs.py
  • tests/unit/core/test_facade_api.py
  • tests/unit/core/test_insight_export_bundles.py
  • tests/unit/core/test_insight_readiness.py
  • tests/unit/core/test_insight_registry_runtime.py
  • tests/unit/core/test_resume.py
  • tests/unit/core/test_sync_surface_runtime.py
  • tests/unit/devtools/test_artifact_graph.py
  • tests/unit/devtools/test_benchmark_campaigns.py
  • tests/unit/devtools/test_executable_scenarios.py
  • tests/unit/devtools/test_execution_specs.py
  • tests/unit/devtools/test_quality_registry.py
  • tests/unit/devtools/test_scenario_coverage.py
  • tests/unit/devtools/test_scenario_projections.py
  • tests/unit/devtools/test_validation_lanes.py
  • tests/unit/mcp/test_server_surfaces.py
  • tests/unit/mcp/test_tool_contracts.py
  • tests/unit/operations/test_archive_helpers.py
  • tests/unit/operations/test_specs.py
  • tests/unit/pipeline/test_run_stages_runtime.py
  • tests/unit/proof/test_structural_error_evidence.py
  • tests/unit/showcase/test_exercise_catalog.py
  • tests/unit/storage/test_derived_status.py
  • tests/unit/storage/test_embedding_stats.py
  • tests/unit/storage/test_session_insight_status_descriptors.py
  • tests/witnesses/cli-command-surface.witness.json

Comment on lines +154 to 157
"semantic-insight-normalization": pytest_lane(
"semantic-insight-normalization",
"Semantic/session product normalization, operator/toolchain narrowing, schema contracts, and provider parser cleanup",
900,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Update the lane description to match the renamed insight vocabulary.

The key/name now use semantic-insight-normalization, but the description still says “product normalization,” which is inconsistent with the PR’s rename scope.

Suggested patch
-        "Semantic/session product normalization, operator/toolchain narrowing, schema contracts, and provider parser cleanup",
+        "Semantic/session insight normalization, operator/toolchain narrowing, schema contracts, and provider parser cleanup",
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@devtools/validation_lane_catalog_contracts.py` around lines 154 - 157, The
lane entry named "semantic-insight-normalization" uses an outdated description
mentioning “product normalization”; update the human-readable description passed
to pytest_lane for the "semantic-insight-normalization" key to reflect the
renamed insight vocabulary (e.g., change “Semantic/session product
normalization…” to “Semantic/session insight normalization…” or similar) so the
description matches the new key/name and PR rename scope.

| `scale-fast` | 120 | Fast storage scale budgets |
| `scale-slow` | 360 | Slow local storage scale budgets |
| `semantic-product-normalization` | 900 | Semantic/session product normalization, operator/toolchain narrowing, schema contracts, and provider parser cleanup |
| `semantic-insight-normalization` | 900 | Semantic/session product normalization, operator/toolchain narrowing, schema contracts, and provider parser cleanup |

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Finish the vocabulary rename in the semantic-insight normalization text.

Both renamed semantic-insight-normalization entries still say session product, so the generated reference is still leaking the old term. Since this file is generated, please fix the source registry/render input and regenerate the snapshot.

Also applies to: 531-531

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@docs/test-quality-workflows.md` at line 158, The snapshot still contains the
old phrase "session product" for the `semantic-insight-normalization` entry;
update the source registry/render input where `semantic-insight-normalization`
is defined to replace any remaining "session product" occurrences with the new
vocabulary (the intended term used elsewhere), then regenerate the generated
docs snapshot so the table row (`semantic-insight-normalization` -> description)
reflects the renamed vocabulary; verify both instances referenced in the file
(including the duplicate at the other line) are corrected before committing.

Comment on lines +45 to +138
def get_session_insight_status(self) -> SessionInsightStatusSnapshot:
return run_coroutine_sync(self._facade.get_session_insight_status())

def get_session_profile_product(
def get_session_profile_insight(
self,
conversation_id: str,
*,
tier: str = "merged",
) -> SessionProfileInsight | None:
return run_coroutine_sync(self._facade.get_session_profile_product(conversation_id, tier=tier))
return run_coroutine_sync(self._facade.get_session_profile_insight(conversation_id, tier=tier))

def list_session_profile_products(
def list_session_profile_insights(
self,
query: SessionProfileInsightQuery | None = None,
) -> list[SessionProfileInsight]:
return run_coroutine_sync(self._facade.list_session_profile_products(query))
return run_coroutine_sync(self._facade.list_session_profile_insights(query))

def get_session_enrichment_product(self, conversation_id: str) -> SessionEnrichmentInsight | None:
return run_coroutine_sync(self._facade.get_session_enrichment_product(conversation_id))
def get_session_enrichment_insight(self, conversation_id: str) -> SessionEnrichmentInsight | None:
return run_coroutine_sync(self._facade.get_session_enrichment_insight(conversation_id))

def list_session_enrichment_products(
def list_session_enrichment_insights(
self,
query: SessionEnrichmentInsightQuery | None = None,
) -> list[SessionEnrichmentInsight]:
return run_coroutine_sync(self._facade.list_session_enrichment_products(query))
return run_coroutine_sync(self._facade.list_session_enrichment_insights(query))

def list_session_tag_rollup_products(
def list_session_tag_rollup_insights(
self,
query: SessionTagRollupQuery | None = None,
) -> list[SessionTagRollupInsight]:
return run_coroutine_sync(self._facade.list_session_tag_rollup_products(query))
return run_coroutine_sync(self._facade.list_session_tag_rollup_insights(query))

def get_session_work_event_products(self, conversation_id: str) -> list[SessionWorkEventInsight]:
return run_coroutine_sync(self._facade.get_session_work_event_products(conversation_id))
def get_session_work_event_insights(self, conversation_id: str) -> list[SessionWorkEventInsight]:
return run_coroutine_sync(self._facade.get_session_work_event_insights(conversation_id))

def list_session_work_event_products(
def list_session_work_event_insights(
self,
query: SessionWorkEventInsightQuery | None = None,
) -> list[SessionWorkEventInsight]:
return run_coroutine_sync(self._facade.list_session_work_event_products(query))
return run_coroutine_sync(self._facade.list_session_work_event_insights(query))

def get_session_phase_products(self, conversation_id: str) -> list[SessionPhaseInsight]:
return run_coroutine_sync(self._facade.get_session_phase_products(conversation_id))
def get_session_phase_insights(self, conversation_id: str) -> list[SessionPhaseInsight]:
return run_coroutine_sync(self._facade.get_session_phase_insights(conversation_id))

def list_session_phase_products(
def list_session_phase_insights(
self,
query: SessionPhaseInsightQuery | None = None,
) -> list[SessionPhaseInsight]:
return run_coroutine_sync(self._facade.list_session_phase_products(query))
return run_coroutine_sync(self._facade.list_session_phase_insights(query))

def get_work_thread_product(self, thread_id: str) -> WorkThreadInsight | None:
return run_coroutine_sync(self._facade.get_work_thread_product(thread_id))
def get_work_thread_insight(self, thread_id: str) -> WorkThreadInsight | None:
return run_coroutine_sync(self._facade.get_work_thread_insight(thread_id))

def list_work_thread_products(
def list_work_thread_insights(
self,
query: WorkThreadInsightQuery | None = None,
) -> list[WorkThreadInsight]:
return run_coroutine_sync(self._facade.list_work_thread_products(query))
return run_coroutine_sync(self._facade.list_work_thread_insights(query))

def list_day_session_summary_products(
def list_day_session_summary_insights(
self,
query: DaySessionSummaryInsightQuery | None = None,
) -> list[DaySessionSummaryInsight]:
return run_coroutine_sync(self._facade.list_day_session_summary_products(query))
return run_coroutine_sync(self._facade.list_day_session_summary_insights(query))

def list_week_session_summary_products(
def list_week_session_summary_insights(
self,
query: WeekSessionSummaryInsightQuery | None = None,
) -> list[WeekSessionSummaryInsight]:
return run_coroutine_sync(self._facade.list_week_session_summary_products(query))
return run_coroutine_sync(self._facade.list_week_session_summary_insights(query))

def list_provider_analytics_products(
def list_provider_analytics_insights(
self,
query: ProviderAnalyticsInsightQuery | None = None,
) -> list[ProviderAnalyticsInsight]:
return run_coroutine_sync(self._facade.list_provider_analytics_products(query))
return run_coroutine_sync(self._facade.list_provider_analytics_insights(query))

def list_session_cost_products(
def list_session_cost_insights(
self,
query: SessionCostInsightQuery | None = None,
) -> list[SessionCostInsight]:
return run_coroutine_sync(self._facade.list_session_cost_products(query))
return run_coroutine_sync(self._facade.list_session_cost_insights(query))

def list_cost_rollup_products(
def list_cost_rollup_insights(
self,
query: CostRollupInsightQuery | None = None,
) -> list[CostRollupInsight]:
return run_coroutine_sync(self._facade.list_cost_rollup_products(query))
return run_coroutine_sync(self._facade.list_cost_rollup_insights(query))

def list_archive_debt_products(
def list_archive_debt_insights(
self,
query: ArchiveDebtInsightQuery | None = None,
) -> list[ArchiveDebtInsight]:
return run_coroutine_sync(self._facade.list_archive_debt_products(query))
return run_coroutine_sync(self._facade.list_archive_debt_insights(query))

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Preserve deprecated sync aliases for the renamed insight helpers.

Removing the old *_product* sync methods means existing SyncPolylogue callers will break as soon as they upgrade, even though the implementation change is only a vocabulary swap. Adding one-release passthrough aliases here keeps the rename source-compatible while downstream users migrate.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@polylogue/api/sync/insights.py` around lines 45 - 138, The sync API removed
old *_product* method names and should preserve one-release passthrough aliases
to avoid breaking callers: add deprecated sync methods (e.g.,
get_session_profile_product, list_session_profile_product,
get_session_enrichment_product, list_session_enrichment_product,
list_session_tag_rollup_product, get_session_work_event_product,
list_session_work_event_product, get_session_phase_product,
list_session_phase_product, get_work_thread_product, list_work_thread_product,
list_day_session_summary_product, list_week_session_summary_product,
list_provider_analytics_product, list_session_cost_product,
list_cost_rollup_product, list_archive_debt_product) that simply call the new
methods (get_session_profile_insight, list_session_profile_insights,
get_session_enrichment_insight, etc.) or delegate to self._facade via
run_coroutine_sync, and emit a DeprecationWarning (or use warnings.warn) so
callers are warned while staying source-compatible.

Comment on lines +240 to +243
selected_insights = _selected_insight_names(request.insights)
readiness = await operations.get_insight_readiness_report(
InsightReadinessQuery(
insights=selected_products,
insights=selected_insights,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Bump the bundle version with this manifest shape change.

This switches the manifest query payload from the old product vocabulary to query["insights"], which is a wire-format change for bundle readers. INSIGHT_EXPORT_BUNDLE_VERSION in this module is still unchanged, so consumers that branch on bundle_version cannot reliably distinguish the two manifest layouts.

Suggested fix
-INSIGHT_EXPORT_BUNDLE_VERSION = 1
+INSIGHT_EXPORT_BUNDLE_VERSION = 2

Also applies to: 290-295

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@polylogue/insights/export_bundles.py` around lines 240 - 243, The manifest
wire-format changed (the query payload now uses query["insights"]) but the
bundle version constant INSIGHT_EXPORT_BUNDLE_VERSION in this module was not
updated, so consumers can't detect the layout change; update/bump
INSIGHT_EXPORT_BUNDLE_VERSION to a new value and ensure any other places in this
file that build/export manifests (see uses around
operations.get_insight_readiness_report and InsightReadinessQuery and the
similar block at the 290-295 range) produce the new version number so bundle
readers can distinguish the two manifest shapes.

Comment on lines 393 to 414
try:
profile = await operations.get_session_profile_product(conversation_id)
profile = await operations.get_session_profile_insight(conversation_id)
except ArchiveInsightUnavailableError as exc:
uncertainties.append(ResumeUncertainty(source="session_profile", detail=str(exc)))

enrichment: SessionEnrichmentInsight | None = None
try:
enrichment = await operations.get_session_enrichment_product(conversation_id)
enrichment = await operations.get_session_enrichment_insight(conversation_id)
except ArchiveInsightUnavailableError as exc:
uncertainties.append(ResumeUncertainty(source="session_enrichment", detail=str(exc)))

events: list[SessionWorkEventInsight] = []
try:
events = await operations.get_session_work_event_products(conversation_id)
events = await operations.get_session_work_event_insights(conversation_id)
except ArchiveInsightUnavailableError as exc:
uncertainties.append(ResumeUncertainty(source="work_events", detail=str(exc)))

phases: list[SessionPhaseInsight] = []
try:
phases = await operations.get_session_phase_products(conversation_id)
phases = await operations.get_session_phase_insights(conversation_id)
except ArchiveInsightUnavailableError as exc:
uncertainties.append(ResumeUncertainty(source="phases", detail=str(exc)))

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Do not leak session_products through the public resume payload.

Each except ArchiveInsightUnavailableError block forwards str(exc) directly into ResumeUncertainty.detail. That preserves the internal storage/maintenance name session_products in the public ResumeBrief contract, so this rename still exposes product vocabulary to clients.

Suggested direction
+def _public_unavailability_detail(exc: ArchiveInsightUnavailableError) -> str:
+    return str(exc).replace("session_products", "session insights")
+
+
 async def build_resume_brief(
     operations: ResumeOperations,
     session_id: str,
@@
     profile: SessionProfileInsight | None = None
     try:
         profile = await operations.get_session_profile_insight(conversation_id)
     except ArchiveInsightUnavailableError as exc:
-        uncertainties.append(ResumeUncertainty(source="session_profile", detail=str(exc)))
+        uncertainties.append(
+            ResumeUncertainty(source="session_profile", detail=_public_unavailability_detail(exc))
+        )
@@
     try:
         enrichment = await operations.get_session_enrichment_insight(conversation_id)
     except ArchiveInsightUnavailableError as exc:
-        uncertainties.append(ResumeUncertainty(source="session_enrichment", detail=str(exc)))
+        uncertainties.append(
+            ResumeUncertainty(source="session_enrichment", detail=_public_unavailability_detail(exc))
+        )
@@
     try:
         events = await operations.get_session_work_event_insights(conversation_id)
     except ArchiveInsightUnavailableError as exc:
-        uncertainties.append(ResumeUncertainty(source="work_events", detail=str(exc)))
+        uncertainties.append(
+            ResumeUncertainty(source="work_events", detail=_public_unavailability_detail(exc))
+        )
@@
     try:
         phases = await operations.get_session_phase_insights(conversation_id)
     except ArchiveInsightUnavailableError as exc:
-        uncertainties.append(ResumeUncertainty(source="phases", detail=str(exc)))
+        uncertainties.append(
+            ResumeUncertainty(source="phases", detail=_public_unavailability_detail(exc))
+        )
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@polylogue/insights/resume.py` around lines 393 - 414, The except blocks for
get_session_profile_insight, get_session_enrichment_insight,
get_session_work_event_insights, and get_session_phase_insights currently append
ResumeUncertainty(detail=str(exc)) which can leak internal storage names like
"session_products"; change these to provide a sanitized/public-facing message
instead of the raw exception string—either use a mapping from internal insight
keys to public labels (e.g., map "session_products" -> "products") and set
ResumeUncertainty(detail=f"{public_label} unavailable") or a generic message
like "insight unavailable", by adding a small helper (e.g.,
sanitize_insight_detail) and using it in each except block rather than str(exc).

@@ -1,4 +1,4 @@
"""Canonical session-product status and repair-candidate queries."""
"""Canonical session-insight status and repair-candidate queries."""

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Align remaining docstrings with the new session-insight terminology.

The module header now says “session-insight,” but descriptor docstrings still refer to “product,” leaving inconsistent language in the same API file.

Suggested patch
 class SessionInsightTableDescriptor:
-    """Table presence and optional row-count query for product status."""
+    """Table presence and optional row-count query for session-insight status."""
@@
 class SessionInsightReadyDescriptor:
-    """Readiness predicate over a product table and named status counts."""
+    """Readiness predicate over a session-insight table and named status counts."""

Also applies to: 22-23, 149-149, 165-165

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@polylogue/storage/insights/session/status.py` at line 1, Update the
inconsistent docstrings by replacing uses of the term "product" with
"session-insight" across this module: adjust the module header docstring and all
descriptor/query docstrings that mention "product" (search for the literal token
"product" in docstrings, including the descriptor and repair-candidate query
descriptions referenced in this file) so they consistently use "session-insight"
and match the module-level terminology.

Comment on lines 447 to +449
detail="Session-product read models ready"
if session_products == 0
else f"{session_products:,} pending/stale/orphaned session-product rows",
else f"{session_products:,} pending/stale/orphaned session-insight rows",

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Normalize remaining debt-status wording to “session-insight”.

Line 447 still emits “Session-product read models ready,” which is inconsistent with the renamed terminology in the same branch and user-facing output.

Proposed fix
         "session_products": _archive_debt_status(
             "session_products",
             issue_count=session_products,
-            detail="Session-product read models ready"
+            detail="Session-insight read models ready"
             if session_products == 0
             else f"{session_products:,} pending/stale/orphaned session-insight rows",
         ),
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
detail="Session-product read models ready"
if session_products == 0
else f"{session_products:,} pending/stale/orphaned session-product rows",
else f"{session_products:,} pending/stale/orphaned session-insight rows",
detail="Session-insight read models ready"
if session_products == 0
else f"{session_products:,} pending/stale/orphaned session-insight rows",
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@polylogue/storage/repair.py` around lines 447 - 449, Replace the stale
wording in the detail string so it consistently uses "session-insight": change
the branch that currently sets detail="Session-product read models ready" (the
conditional that references session_products) to use "Session-insight read
models ready" (matching the other "session-insight" terminology and casing used
elsewhere).

Comment on lines 813 to +814
def test_run_selected_maintenance_can_scope_to_session_products(self, cli_workspace: CliWorkspace) -> None:
"""Scoped maintenance should repair only the durable session-product layer."""
"""Scoped maintenance should repair only the durable session-insight layer."""

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Clarify docstring vs preserved identity name (session_products).

The updated docstring says this scoped maintenance repairs the “durable session-insight layer”, but the test still scopes using targets=("session_products",) and asserts results named "session_products". That mismatch is likely intentional (identity boundary retained), but it’s worth explicitly stating so future readers don’t “fix” the test targets back to insights prematurely.

🛠️ Proposed docstring tweak
-        """Scoped maintenance should repair only the durable session-insight layer."""
+        """Scoped maintenance should repair only the durable session-insight layer (while preserving the `session_products` identity name)."""
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@tests/integration/test_health.py` around lines 813 - 814, The docstring for
test_run_selected_maintenance_can_scope_to_session_products is inconsistent with
the preserved identity name "session_products" used in
targets=("session_products",) and the asserted result names; update the test
docstring to explicitly state that although the operation repairs the durable
session-insight layer, the preserved identity/name "session_products" is
intentionally used for scoping and assertions (so future readers won't change
targets to "insights"), referencing the test function name and the
targets=("session_products",) usage.

Comment on lines 334 to +335
patch("polylogue.cli.shared.check_workflow.run_selected_maintenance", return_value=[repair_result]),
patch("polylogue.cli.shared.check_workflow.make_session_product_progress_callback", return_value="progress"),
patch("polylogue.cli.shared.check_workflow.make_session_insight_progress_callback", return_value="progress"),

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick | 🔵 Trivial | ⚡ Quick win

Assert the renamed maintenance kwarg is actually forwarded.

This test patches make_session_insight_progress_callback, but it never verifies that run_check_workflow() passed session_insight_progress_callback= into run_selected_maintenance(). It would still pass if the factory were patched but the wiring regressed. Capture the maintenance mock and assert the kwarg is present with the expected value.

Suggested test tightening
-        patch("polylogue.cli.shared.check_workflow.run_selected_maintenance", return_value=[repair_result]),
+        patch(
+            "polylogue.cli.shared.check_workflow.run_selected_maintenance",
+            return_value=[repair_result],
+        ) as run_selected,
         patch("polylogue.cli.shared.check_workflow.make_session_insight_progress_callback", return_value="progress"),
         patch(
             "polylogue.cli.shared.check_workflow.vacuum_database", return_value=VacuumResult(ok=True, detail="vacuumed")
         ),
@@
     assert result.vacuum_result == VacuumResult(ok=True, detail="vacuumed")
     assert result.blob_report is run_blob_check.return_value
+    assert run_selected.call_args.kwargs["session_insight_progress_callback"] == "progress"
     run_blob_check.assert_called_once_with(env, config, json_output=True)
     persist_run.assert_called_once()
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@tests/unit/cli/test_check_support_runtime.py` around lines 334 - 335, The
test is not asserting that run_check_workflow forwards the renamed kwarg
session_insight_progress_callback into run_selected_maintenance; update the test
to capture the patched run_selected_maintenance mock (the patch already present
for "polylogue.cli.shared.check_workflow.run_selected_maintenance") and assert
it was called with session_insight_progress_callback="progress" (the value
returned by the patched make_session_insight_progress_callback) when
run_check_workflow is exercised; use the mock's call_args or assert_called_with
to verify the kwarg is present rather than only relying on the factory patch.

Comment on lines +14 to 16
"archive CLI root commands remain discoverable",
"retired audit/qa/showcase vocabulary stays out of public product help",
"query/read filters keep cwd-prefix and referenced-path semantically distinct"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Normalize remaining “product” wording in semantic facts

Line 15 still references “public product help”, which conflicts with the renamed archive/insight vocabulary in this PR. Please update that phrase as well so witness semantics stay consistent.

Proposed diff
-    "retired audit/qa/showcase vocabulary stays out of public product help",
+    "retired audit/qa/showcase vocabulary stays out of public archive help",
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
"archive CLI root commands remain discoverable",
"retired audit/qa/showcase vocabulary stays out of public product help",
"query/read filters keep cwd-prefix and referenced-path semantically distinct"
"archive CLI root commands remain discoverable",
"retired audit/qa/showcase vocabulary stays out of public archive help",
"query/read filters keep cwd-prefix and referenced-path semantically distinct"
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@tests/witnesses/cli-command-surface.witness.json` around lines 14 - 16,
Update the semantic witness string that still uses "public product help": find
the entry "retired audit/qa/showcase vocabulary stays out of public product
help" and replace the phrase "public product help" with the normalized
terminology used in this PR (e.g., "public archive/insight help") so the string
consistently reflects the renamed archive/insight vocabulary.

@Sinity
Sinity merged commit 0ea52b2 into master May 2, 2026
14 checks passed
@Sinity
Sinity deleted the feature/refactor/insight-docs-api-vocabulary branch May 2, 2026 03:22
Sinity added a commit that referenced this pull request May 2, 2026
## Summary

Renames the remaining session-products maintenance and storage-helper vocabulary to session insights.

## Problem

PR #685 moved public APIs, MCP, payloads, proof/reporting, and docs to insight vocabulary, but the repair target, rebuild/refresh helper names, and CLI doctor target still exposed `session_products`. The scan confirmed there is no SQLite `session_products` table; this was vocabulary around durable session insight materialization, not a schema table migration.

## Solution

- Renamed the maintenance target from `session_products` to `session_insights`.
- Renamed storage/pipeline helpers such as `rebuild_session_products_sync`, `refresh_session_products_bulk`, and `delete_session_products_for_conversation_async` to session-insight equivalents.
- Updated repair status, artifact graph, operation specs, scenarios, validation lanes, benchmark catalog/runtime, generated docs, CLI help baselines, and tests.
- Removed stale topology move rules for old `repository_product_` / `store_product_` root-file names and corrected docs to point at `storage/insights/session/` and `storage/repository/insight/`.

## Verification

- `pytest -q tests/unit/architecture/test_topology_invariants.py tests/unit/storage/test_repository_insight_runtime.py tests/unit/core/test_maintenance_targets.py tests/unit/storage/test_repair.py tests/unit/cli/test_check.py tests/unit/cli/test_check_support_runtime.py tests/unit/cli/test_insights.py tests/unit/devtools/test_validation_lanes.py tests/unit/devtools/test_benchmark_campaigns.py` → 281 passed in 11.97s
- `devtools verify --quick` → all checks passed
- `pytest -q --ignore=tests/integration` → 5784 passed in 162.83s

Ref #635
Sinity added a commit that referenced this pull request May 7, 2026
## Summary

Renames the durable archive read-model vocabulary from products to insights across public API, sync API, MCP maintenance, operation/proof/artifact identifiers, generated docs, and tests.

## Problem

The CLI and package layout already expose these derived archive read models as insights, but the public Python API, MCP maintenance surface, machine payloads, and verification artifacts still used product names. That kept the old framing alive in user-facing contracts and made the naming cleanup incomplete.

## Solution

- Renamed facade and sync methods such as `get_session_product_status`, `list_session_profile_products`, and `rebuild_session_products` to the corresponding `*_insight*` / `*_insights` forms.
- Renamed the MCP admin maintenance tool to `rebuild_session_insights` and regenerated the committed MCP schema witness.
- Renamed durable insight payload metadata from `product_kind` to `insight_kind`.
- Updated artifact paths, operation specs, proof subjects, validation lanes, benchmark catalogs, docs, and tests from session-product vocabulary to session-insight vocabulary.
- Kept the persisted storage/maintenance target identity `session_products` in place; that is a schema/maintenance migration boundary for a separate slice.

## Verification

- `pytest -q tests/unit/devtools/test_validation_lanes.py tests/unit/mcp/test_tool_schema_witness.py tests/unit/showcase/test_exercise_catalog.py tests/unit/devtools/test_artifact_graph.py tests/unit/proof/test_structural_error_evidence.py tests/unit/devtools/test_scenario_projections.py tests/unit/mcp/test_server_surfaces.py tests/unit/devtools/test_scenario_coverage.py tests/unit/devtools/test_quality_registry.py tests/unit/devtools/test_executable_scenarios.py tests/unit/operations/test_specs.py` → 247 passed in 12.69s
- `pytest -q tests/unit/storage/test_repair.py tests/unit/cli/test_check.py tests/unit/storage/test_embedding_stats.py tests/unit/storage/test_session_insight_status_descriptors.py tests/unit/core/test_artifact_graph.py tests/unit/devtools/test_artifact_graph.py tests/unit/core/test_artifact_specs.py tests/unit/operations/test_specs.py` → 80 passed in 11.45s
- `devtools verify --quick` → all checks passed
- `pytest -q --ignore=tests/integration` → 5784 passed in 175.35s

Ref #635


<!-- This is an auto-generated comment: release notes by coderabbit.ai -->

## Summary by CodeRabbit

## Release Notes

* **Refactor**
  * Unified archive API method naming conventions across archive, CLI, and operations surfaces.
  * Updated runtime artifact graph and operational specifications for session data processing.
  * Realigned internal operation routing and readiness tracking systems.

* **Documentation**
  * Updated user-facing API documentation with new method names and examples.
  * Refreshed command catalogs, validation workflows, and benchmark scenarios.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
Sinity added a commit that referenced this pull request May 7, 2026
## Summary

Renames the remaining session-products maintenance and storage-helper vocabulary to session insights.

## Problem

PR #685 moved public APIs, MCP, payloads, proof/reporting, and docs to insight vocabulary, but the repair target, rebuild/refresh helper names, and CLI doctor target still exposed `session_products`. The scan confirmed there is no SQLite `session_products` table; this was vocabulary around durable session insight materialization, not a schema table migration.

## Solution

- Renamed the maintenance target from `session_products` to `session_insights`.
- Renamed storage/pipeline helpers such as `rebuild_session_products_sync`, `refresh_session_products_bulk`, and `delete_session_products_for_conversation_async` to session-insight equivalents.
- Updated repair status, artifact graph, operation specs, scenarios, validation lanes, benchmark catalog/runtime, generated docs, CLI help baselines, and tests.
- Removed stale topology move rules for old `repository_product_` / `store_product_` root-file names and corrected docs to point at `storage/insights/session/` and `storage/repository/insight/`.

## Verification

- `pytest -q tests/unit/architecture/test_topology_invariants.py tests/unit/storage/test_repository_insight_runtime.py tests/unit/core/test_maintenance_targets.py tests/unit/storage/test_repair.py tests/unit/cli/test_check.py tests/unit/cli/test_check_support_runtime.py tests/unit/cli/test_insights.py tests/unit/devtools/test_validation_lanes.py tests/unit/devtools/test_benchmark_campaigns.py` → 281 passed in 11.97s
- `devtools verify --quick` → all checks passed
- `pytest -q --ignore=tests/integration` → 5784 passed in 162.83s

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