Skip to content

feat: add product export bundles - #381

Merged
Sinity merged 1 commit into
masterfrom
feature/feat/product-export-bundles
Apr 23, 2026
Merged

Sinity merged 1 commit into
masterfrom
feature/feat/product-export-bundles

Conversation

@Sinity

@Sinity Sinity commented Apr 23, 2026 •

Copy link
Copy Markdown
Owner

Summary

Adds a versioned archive-product export bundle surface for downstream consumers. Bundles contain product JSONL payloads, Pydantic-derived product schemas, readiness coverage, a manifest with provenance, and a generated README.

Problem

Product surfaces were inspectable through CLI/API commands, but there was no durable handoff format that packaged product rows together with the readiness evidence and schema contracts needed by downstream tools. Consumers had to infer whether exported rows were complete, stale, or safe to trust.

Solution

  • Added polylogue/product_export_bundles.py with typed bundle request/result models, exportable product normalization, registry-backed product fetching, product schema emission, manifest writing, readiness coverage, target protection, and cleanup on failed writes.
  • Wired the bundle writer through archive operations and the Polylogue facade with export_product_bundle().
  • Added polylogue products export with provider/date bounds, repeated --product, JSON output, overwrite support, and inherited root filters.
  • Updated generated CLI, quality, verification-catalog, and showcase help baselines for the new command.
  • Added unit coverage for bounded exports, existing-target protection, stale-readiness manifests, and the CLI JSON surface.

Verification

  • ruff check polylogue/product_export_bundles.py polylogue/operations/archive.py polylogue/facade_archive.py polylogue/cli/commands/products.py tests/unit/core/test_product_export_bundles.py tests/unit/cli/test_products.py
  • mypy polylogue/product_export_bundles.py polylogue/operations/archive.py polylogue/facade_archive.py polylogue/cli/commands/products.py tests/unit/core/test_product_export_bundles.py tests/unit/cli/test_products.py
  • pytest -q tests/unit/core/test_product_export_bundles.py tests/unit/cli/test_products.py -> 36 passed
  • devtools lab-scenario verify-baselines -> All baselines match
  • devtools verify -> all checks passed
  • devtools verify --quick -> all checks passed
  • pre-push devtools verify --quick -> all checks passed

Closes #375

Summary by CodeRabbit

New Features

  • Added products export subcommand to export product data as versioned bundles with manifest and coverage metadata
  • Supports filtering by product, provider, and time range
  • Supports JSON output mode and overwrite semantics

Documentation

  • Updated CLI reference and help text for new export functionality

Tests

  • Added unit and integration tests for product export operations

Problem: downstream consumers need a stable handoff format for derived archive products, including coverage and readiness evidence rather than ad hoc CLI scraping.

What changed: add a versioned product export bundle writer with manifest, readiness coverage, product schemas, JSONL payloads, generated README, target protection, and degraded-readiness recording. Wire it through archive operations, the Polylogue facade, and the products export CLI command.

Verification: pytest -q tests/unit/core/test_product_export_bundles.py tests/unit/cli/test_products.py; devtools lab-scenario verify-baselines; devtools verify; devtools verify --quick.

Closes #375

Co-Authored-By: Codex <[email protected]>
@coderabbitai

coderabbitai Bot commented Apr 23, 2026 •

Copy link
Copy Markdown

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 6340f54d-a69a-4935-9094-0151d6a2bd46

📥 Commits

Reviewing files that changed from the base of the PR and between 820a2cb and 1ec29ee.

📒 Files selected for processing (11)
  • docs/cli-reference.md
  • docs/test-quality-workflows.md
  • docs/verification-catalog.md
  • polylogue/cli/commands/products.py
  • polylogue/facade_archive.py
  • polylogue/operations/archive.py
  • polylogue/product_export_bundles.py
  • tests/baselines/showcase/help-products-export.txt
  • tests/baselines/showcase/help-products.txt
  • tests/unit/cli/test_products.py
  • tests/unit/core/test_product_export_bundles.py

📝 Walkthrough

Walkthrough

A new polylogue products export CLI subcommand and supporting infrastructure enable exporting versioned archive product bundles (sessions, work events, etc.) with manifest metadata, schema descriptors, and coverage information for downstream consumption. The implementation spans CLI, facade, operations, and core export layers.

Changes

Cohort / File(s) Summary
Documentation Updates
docs/cli-reference.md, docs/test-quality-workflows.md, docs/verification-catalog.md
CLI reference, quality-workflow registry, and verification catalog snapshots updated to document the new products export command with associated scenario projections and proof obligations. Subject count and obligation counts incremented.
CLI Command Implementation
polylogue/cli/commands/products.py
Introduces products export subcommand accepting output directory, optional product/provider/time-range filters, and --format/--overwrite/--json output controls. Executes export via env.operations.export_product_bundle, catches ProductExportBundleError, and emits JSON or plain-text bundle summary with manifest/coverage paths and per-product readiness/row counts.
Core Export Module
polylogue/product_export_bundles.py
New 327-line module defining request/result/manifest models, ProductExportBundleError, and async export_product_bundle() generator. Normalizes product names, queries readiness coverage, fetches product data with per-field bounds support, writes schema/JSONL files atomically, emits manifest with metadata/query provenance, and publishes bundle via temp-directory replacement.
Facade & Operations Layer
polylogue/facade_archive.py, polylogue/operations/archive.py
Adds export_product_bundle method to PolylogueArchiveMixin and ArchiveProductAggregateMixin, plus Protocol typing for _ArchiveOperationsSurface. Methods forward requests to core export_product_bundle function with config/request parameters.
Test Baselines
tests/baselines/showcase/help-products-export.txt, tests/baselines/showcase/help-products.txt
Captures expected help text for new products export subcommand and updates parent products command help to include the export entry.
Unit Tests
tests/unit/cli/test_products.py, tests/unit/core/test_product_export_bundles.py
CLI test validates export in JSON mode for profiles product and verifies bundle artifacts. Core module tests cover bounded export with manifest/coverage/schema output, existing-target protection, and stale readiness detection.

Sequence Diagram

sequenceDiagram
    actor User
    participant CLI as polylogue products export
    participant Ops as operations.archive
    participant Core as export_product_bundle()
    participant DB as SQLite Archive
    participant FS as File System
    
    User->>CLI: invoke with --out, --product, --since, --until, --format
    CLI->>Ops: export_product_bundle(request)
    Ops->>Core: export_product_bundle(operations, config, request)
    
    Core->>DB: query_readiness_coverage(selected_products, provider, since, until)
    DB-->>Core: coverage_report
    
    loop for each product
        Core->>DB: fetch_product_data(product, bounds)
        DB-->>Core: product_rows, errors/warnings
        Core->>FS: write schema.json
        Core->>FS: write product.jsonl
    end
    
    Core->>FS: write manifest.json (metadata, query, summaries, warnings)
    Core->>FS: write coverage.json (readiness verdicts)
    Core->>FS: write README.md (human summary)
    Core->>FS: atomic replace to target directory
    
    Core-->>Ops: ProductExportBundleResult
    Ops-->>CLI: result
    
    alt --json flag
        CLI->>User: JSON(result)
    else
        CLI->>User: plain text bundle summary
    end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Suggested labels

area:cli, area:storage

Poem

🐰 Hop along, dear bundles bound,
With schemas and summaries round,
Products exported, versioned with care,
Metadata trails for those who dare share!
Coverage and manifests packed in a heap—
Downstream consumers can gather their keep! 📦✨

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/feat/product-export-bundles

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@Sinity
Sinity merged commit f95bf9f into master Apr 23, 2026
8 of 12 checks passed
@Sinity
Sinity deleted the feature/feat/product-export-bundles branch April 23, 2026 05:44

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 1ec29eef47

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread polylogue/product_export_bundles.py Resolved
@Sinity

Sinity commented Apr 28, 2026

Copy link
Copy Markdown
Owner Author

🤖 Post-hoc audit note: this PR received bot review feedback verified against current HEAD as part of #544. 1 finding(s) confirmed still present → tracked in #550.

@Sinity
Sinity requested review from Copilot and removed request for Copilot May 1, 2026 00:44

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.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

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

Adds a versioned archive-product export bundle surface for downstream consumers. Bundles contain product JSONL payloads, Pydantic-derived product schemas, readiness coverage, a manifest with provenance, and a generated README.

## Problem

Product surfaces were inspectable through CLI/API commands, but there was no durable handoff format that packaged product rows together with the readiness evidence and schema contracts needed by downstream tools. Consumers had to infer whether exported rows were complete, stale, or safe to trust.

## Solution

- Added `polylogue/product_export_bundles.py` with typed bundle request/result models, exportable product normalization, registry-backed product fetching, product schema emission, manifest writing, readiness coverage, target protection, and cleanup on failed writes.
- Wired the bundle writer through archive operations and the `Polylogue` facade with `export_product_bundle()`.
- Added `polylogue products export` with provider/date bounds, repeated `--product`, JSON output, overwrite support, and inherited root filters.
- Updated generated CLI, quality, verification-catalog, and showcase help baselines for the new command.
- Added unit coverage for bounded exports, existing-target protection, stale-readiness manifests, and the CLI JSON surface.

## Verification

- `ruff check polylogue/product_export_bundles.py polylogue/operations/archive.py polylogue/facade_archive.py polylogue/cli/commands/products.py tests/unit/core/test_product_export_bundles.py tests/unit/cli/test_products.py`
- `mypy polylogue/product_export_bundles.py polylogue/operations/archive.py polylogue/facade_archive.py polylogue/cli/commands/products.py tests/unit/core/test_product_export_bundles.py tests/unit/cli/test_products.py`
- `pytest -q tests/unit/core/test_product_export_bundles.py tests/unit/cli/test_products.py` -> `36 passed`
- `devtools lab-scenario verify-baselines` -> `All baselines match`
- `devtools verify` -> `all checks passed`
- `devtools verify --quick` -> `all checks passed`
- pre-push `devtools verify --quick` -> `all checks passed`

Closes #375
@Sinity

Sinity commented Oct 1, 2026

Copy link
Copy Markdown
Owner Author

Historical Codex triage: evidence checked at 5ebcfe5. This records that source revision; it does not claim a fresh review of current master.

Only the rows listed above are dispositioned. Held findings remain open.

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.

feat: add versioned product export bundles for downstream consumers

2 participants