Skip to content

feat: report product materialization coverage and readiness #376

Closed

Description

@Sinity

Context

Polylogue derived products have become first-class downstream inputs: session profiles, work events, phases/threads, rollups, and future export bundles. Consumers need to know not only whether a table exists, but whether the product is current, complete for a provider/date range, and compatible with the current schema.

This came up while consuming Polylogue from Lynchpin: session_work_events was valuable and fast to read directly, but product coverage and freshness had to be inferred manually from table contents. Earlier Lynchpin integration also hit legacy materialized profile rows whose inference payload shape no longer matched the current model.

Execution-strengthened scope

Make this a canonical product-readiness contract, not just another health command. The implementation should define a typed report in the product/storage/operations layer first, then expose the same report through CLI/facade surfaces. devtools, future product export bundles (#375), MCP, and external consumers should be able to reuse the report without scraping CLI text or reimplementing SQLite checks.

The report should answer three questions for each product family:

  • storage readiness: are the expected table/FTS/index artifacts present and populated enough to read safely?
  • coverage readiness: which providers/date ranges/conversation counts are covered, partially covered, stale, empty, or missing?
  • contract readiness: which materializer/schema/inference/enrichment versions produced the rows, and are any rows incompatible with current typed models?

It should also include an aggregate verdict suitable for deployment gates and export manifests: ready, partial, empty, missing, stale, legacy, or unknown, with evidence and repair hints.

Problem

Current health/check/rebuild surfaces do not expose enough product-readiness detail for downstream consumers or operators. The missing distinctions are important:

  • product table absent vs present-but-empty;
  • product rows generated by an older schema/payload version;
  • product coverage by provider and date range;
  • raw conversations newer than their derived products;
  • partial materialization where only some providers/products are current;
  • rows quarantined or skipped during product refresh;
  • recommended repair command for the specific stale/missing product.

Without this, consumers either trust products too much or reimplement ad hoc coverage checks against SQLite internals.

Scope

Add a product materialization readiness report, available through CLI and library surfaces and consumable by MCP/export code.

Candidate command/API shape:

polylogue products status --format json
polylogue products status --product session-work-events --since 2026-03-01 --until 2026-03-31

The report should include, per product:

  • product id/name and schema or payload version;
  • table/storage presence;
  • row count;
  • provider coverage;
  • min/max timestamps or dates where applicable;
  • source conversation count vs materialized row coverage where meaningful;
  • stale/raw-newer-than-product indicators;
  • legacy/incompatible payload counts;
  • current storage/readiness artifact flags, reusing existing status descriptors where possible;
  • last successful refresh metadata if available;
  • recommended repair/rebuild command.

Acceptance criteria

  • Product readiness can be queried in machine-readable form without direct SQLite inspection.
  • A typed report model exists below CLI surfaces and is reachable from operations/facade code.
  • polylogue products status renders both human-readable and JSON output from the same report contract.
  • At least session profiles, session enrichments, work events, phases, work threads, day summaries, week summaries, tag rollups, and provider analytics produce a report entry, even where some coverage fields are intentionally unknown.
  • At least session profiles and work events report row count, provider coverage, date range, and schema/materialization version.
  • The report distinguishes absent, stale, partial, legacy-incompatible, empty, and ready states.
  • A downstream export can include the readiness report in its manifest or coverage file without depending on CLI rendering.
  • Tests cover ready, missing, empty, stale, partial, and legacy/incompatible product states.
  • Generated CLI/help/proof surfaces are refreshed.

Non-goals

  • Redesigning the product extraction taxonomy.
  • Hiding all low-level SQLite diagnostics; this is a stable summary layer over them.
  • Making every historical product perfectly complete before the status surface lands.
  • Implementing the product export bundle itself; feat: add versioned product export bundles for downstream consumers #375 should consume this contract later.

Activity

  1. Sinity commented on Apr 23, 2026

    @Sinity
    OwnerAuthor

    Starting execution.

    Decision log before coding:

    • Treat this as a reusable readiness contract below CLI, not a CLI-only status view.
    • Reuse the existing session-product status descriptors and repository/product reads where possible instead of adding parallel health machinery.
    • Make polylogue products status a thin rendering surface over a typed operations/facade report so feat: add versioned product export bundles for downstream consumers #375 can embed the same report in export manifests later.
    • Keep the first implementation broad across current product families, while making profile/work-event coverage the deepest vertical slice.
  2. Sinity commented on Apr 23, 2026

    @Sinity
    OwnerAuthor

    Execution log for #376:

    • Strengthened the issue before implementation to require a canonical typed product-readiness contract below CLI surfaces, reusable by devtools/export/MCP/downstream consumers.
    • Implemented polylogue/product_readiness.py as the report kernel for storage readiness, coverage readiness, version/schema-contract readiness, aggregate verdicts, evidence, and repair hints.
    • Wired the contract through archive operations, Polylogue.product_readiness_report(), and polylogue products status plain/JSON output.
    • Covered the current product families: session profiles, session enrichments, work events, phases, work threads, tag rollups, day summaries, week summaries, and provider analytics.
    • Added tests for ready, empty, partial, stale, missing, and legacy states plus CLI JSON/plain/root-filter behavior.
    • Refreshed generated CLI/help/proof/showcase surfaces, including the new help-products-status baseline.

    Verification run:

    • pytest -q tests/unit/core/test_product_readiness.py tests/unit/cli/test_products.py -> 37 passed
    • devtools lab-scenario verify-baselines -> Ran 44 exercises; All baselines match
    • devtools verify -> all checks passed
    • devtools verify --quick -> all checks passed
    • pre-push devtools verify --quick -> all checks passed

    PR: #380

  3. added a commit that references this issue on Apr 23, 2026
    820a2cb
  4. added a commit that references this issue on May 7, 2026
    a72d827
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:cliarea:pipelinearea:storagetype:feat

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions