Repository navigation
refactor(api): rename durable products to insights - #685
Conversation
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.
|
Warning Rate limit exceeded
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 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 configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (4)
📝 WalkthroughWalkthroughThis 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. ChangesTerminology Shift: Products → Insights
Estimated code review effort🎯 4 (Complex) | ⏱️ ~75 minutes Possibly related PRs
Suggested labels
Poem
✨ Finishing Touches🧪 Generate unit tests (beta)
|
Polylogue Proof PackRefs: Affected Domains
Required Gates
Known Gaps
Oracle / Cost
|
There was a problem hiding this comment.
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.
| 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", |
| 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"), |
| 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.""" | |||
| "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.
There was a problem hiding this comment.
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 winPotential correctness/memory risk in
_ASYNC_COLUMN_CACHEkeying byid(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 sameid, causing_table_has_columnto 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 foundIf 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 winRename the exported helper to keep the public surface on insight terminology.
emit_product_listis 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 anemit_insight_listentry point here and keepemit_product_listonly 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 winKeep deprecated
*_productsasync 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 winKeep 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, andexport_product_bundlewill fail withAttributeErrorimmediately 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 winWire the new raw session-insight repair path into the operation catalog.
raw-session-insight-repair-loopis 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
📒 Files selected for processing (105)
README.mddevtools/build_topology_projection.pydevtools/command_catalog.pydevtools/synthetic_benchmark_catalog.pydevtools/synthetic_benchmark_runtime.pydevtools/validation_lane_catalog_composites.pydevtools/validation_lane_catalog_contracts.pydocs/devtools.mddocs/library-api.mddocs/test-quality-workflows.mddocs/verification-catalog.mddocs/verification-lab.mdpolylogue/api/archive.pypolylogue/api/insights.pypolylogue/api/sync/insights.pypolylogue/artifacts/__init__.pypolylogue/cli/commands/insights.pypolylogue/cli/insights_rendering.pypolylogue/cli/shared/check_support.pypolylogue/cli/shared/check_workflow.pypolylogue/cli/shared/helper_summary.pypolylogue/cli/shared/helpers.pypolylogue/cli/shared/insight_command_contracts.pypolylogue/insights/__init__.pypolylogue/insights/archive.pypolylogue/insights/archive_models.pypolylogue/insights/archive_rollups.pypolylogue/insights/archive_summaries.pypolylogue/insights/export_bundles.pypolylogue/insights/readiness.pypolylogue/insights/registry.pypolylogue/insights/resume.pypolylogue/maintenance/targets.pypolylogue/mcp/insight_tool_contracts.pypolylogue/mcp/server_insight_tools.pypolylogue/mcp/server_maintenance_tools.pypolylogue/operations/__init__.pypolylogue/operations/archive.pypolylogue/operations/specs.pypolylogue/pipeline/run_stages.pypolylogue/pipeline/services/parsing_models.pypolylogue/pipeline/services/parsing_workflow.pypolylogue/proof/catalog.pypolylogue/proof/generated_scenarios.pypolylogue/proof/models.pypolylogue/proof/subjects.pypolylogue/scenarios/execution.pypolylogue/scenarios/operational_surfaces.pypolylogue/storage/backends/async_sqlite_archive.pypolylogue/storage/backends/queries/mappers_insight_legacy.pypolylogue/storage/backends/queries/mappers_insight_timelines.pypolylogue/storage/backends/queries/session_insight_profile_reads.pypolylogue/storage/backends/queries/session_insight_profile_writes.pypolylogue/storage/backends/queries/session_insight_summary_queries.pypolylogue/storage/backends/queries/session_insight_thread_queries.pypolylogue/storage/backends/queries/session_insight_timeline_reads.pypolylogue/storage/backends/queries/session_insight_timeline_writes.pypolylogue/storage/backends/query_store.pypolylogue/storage/derived/derived_status.pypolylogue/storage/embeddings/embedding_stats.pypolylogue/storage/insights/insight_read_support.pypolylogue/storage/insights/session/rebuild.pypolylogue/storage/insights/session/runtime.pypolylogue/storage/insights/session/status.pypolylogue/storage/query_models.pypolylogue/storage/repair.pypolylogue/storage/repository/insight/profile_reads.pypolylogue/storage/repository/insight/thread_reads.pypolylogue/storage/repository/insight/timeline_reads.pytests/data/witnesses/mcp-tool-schemas.jsontests/infra/mcp.pytests/integration/test_health.pytests/unit/archive/test_repo_identity.pytests/unit/cli/test_analytics.pytests/unit/cli/test_check_support_runtime.pytests/unit/cli/test_insights.pytests/unit/cli/test_insights_command_runtime.pytests/unit/cli/test_source_selection_helpers.pytests/unit/core/test_artifact_graph.pytests/unit/core/test_artifact_specs.pytests/unit/core/test_facade_api.pytests/unit/core/test_insight_export_bundles.pytests/unit/core/test_insight_readiness.pytests/unit/core/test_insight_registry_runtime.pytests/unit/core/test_resume.pytests/unit/core/test_sync_surface_runtime.pytests/unit/devtools/test_artifact_graph.pytests/unit/devtools/test_benchmark_campaigns.pytests/unit/devtools/test_executable_scenarios.pytests/unit/devtools/test_execution_specs.pytests/unit/devtools/test_quality_registry.pytests/unit/devtools/test_scenario_coverage.pytests/unit/devtools/test_scenario_projections.pytests/unit/devtools/test_validation_lanes.pytests/unit/mcp/test_server_surfaces.pytests/unit/mcp/test_tool_contracts.pytests/unit/operations/test_archive_helpers.pytests/unit/operations/test_specs.pytests/unit/pipeline/test_run_stages_runtime.pytests/unit/proof/test_structural_error_evidence.pytests/unit/showcase/test_exercise_catalog.pytests/unit/storage/test_derived_status.pytests/unit/storage/test_embedding_stats.pytests/unit/storage/test_session_insight_status_descriptors.pytests/witnesses/cli-command-surface.witness.json
| "semantic-insight-normalization": pytest_lane( | ||
| "semantic-insight-normalization", | ||
| "Semantic/session product normalization, operator/toolchain narrowing, schema contracts, and provider parser cleanup", | ||
| 900, |
There was a problem hiding this comment.
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 | |
There was a problem hiding this comment.
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.
| 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)) |
There was a problem hiding this comment.
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.
| selected_insights = _selected_insight_names(request.insights) | ||
| readiness = await operations.get_insight_readiness_report( | ||
| InsightReadinessQuery( | ||
| insights=selected_products, | ||
| insights=selected_insights, |
There was a problem hiding this comment.
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 = 2Also 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.
| 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))) |
There was a problem hiding this comment.
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.""" | |||
There was a problem hiding this comment.
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.
| 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", |
There was a problem hiding this comment.
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.
| 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).
| 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.""" |
There was a problem hiding this comment.
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.
| 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"), |
There was a problem hiding this comment.
🧹 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.
| "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" |
There was a problem hiding this comment.
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.
| "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.
## 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
## 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 -->
## 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
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
get_session_product_status,list_session_profile_products, andrebuild_session_productsto the corresponding*_insight*/*_insightsforms.rebuild_session_insightsand regenerated the committed MCP schema witness.product_kindtoinsight_kind.session_productsin 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.69spytest -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.45sdevtools verify --quick→ all checks passedpytest -q --ignore=tests/integration→ 5784 passed in 175.35sRef #635
Summary by CodeRabbit
Release Notes
Refactor
Documentation