Skip to content

refactor(storage): move embedding helpers out of lib - #658

Merged
Sinity merged 1 commit into
masterfrom
feature/refactor/storage-embeddings-lib-clean
May 1, 2026
Merged

Sinity merged 1 commit into
masterfrom
feature/refactor/storage-embeddings-lib-clean

Conversation

@Sinity

@Sinity Sinity commented May 1, 2026

Copy link
Copy Markdown
Owner

Summary

Move the remaining polylogue.lib.embeddings helpers into polylogue.storage.embeddings and give the files storage-specific names: materialization.py and status_payload.py.

Problem

The embedding helpers were not generic library code. They read/write embedding storage state, materialize message vectors, and build storage-derived readiness payloads, while polylogue/storage/embeddings already owned the underlying stats, SQL, and support code.

Solution

Delete polylogue/lib/embeddings, move execution helpers to storage/embeddings/materialization.py, move status payload construction to storage/embeddings/status_payload.py, update CLI/pipeline/test imports, and point artifact/operation code references at the storage-owned payload builder rather than the CLI wrapper.

Verification

  • devtools build-topology-projection && devtools verify-topology — realized=696 declared=696 blocking=False
  • pytest -q tests/unit/cli/test_embed.py tests/unit/cli/test_run.py tests/unit/pipeline/test_run_stages_runtime.py — 72 passed
  • pytest -q tests/unit/storage/test_embedding_stats.py tests/unit/storage/test_derived_status.py tests/unit/storage/test_vec.py tests/unit/storage/test_backend.py — 71 passed
  • pytest -q tests/unit/core/test_artifact_graph.py tests/unit/operations/test_specs.py tests/unit/devtools/test_validation_lanes.py tests/unit/devtools/test_scenario_coverage.py — 154 passed
  • devtools render-all --check — sync OK
  • pre-push devtools verify --quick — all checks passed

Ref #635

Copilot AI review requested due to automatic review settings May 1, 2026 18:41
@coderabbitai

coderabbitai Bot commented May 1, 2026

Copy link
Copy Markdown

Warning

Rate limit exceeded

@Sinity has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 41 minutes and 45 seconds before requesting another review.

To keep reviews running without waiting, you can enable usage-based add-on for your organization. This allows additional reviews beyond the hourly cap. Account admins can enable it under billing.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 032201ac-e41b-4ed0-b6b5-f065b048847f

📥 Commits

Reviewing files that changed from the base of the PR and between 6b6fa66 and c6d6802.

📒 Files selected for processing (12)
  • docs/plans/topology-target.yaml
  • docs/topology-status.md
  • polylogue/artifacts/__init__.py
  • polylogue/cli/shared/embed_runtime.py
  • polylogue/cli/shared/embed_stats.py
  • polylogue/lib/embeddings/__init__.py
  • polylogue/operations/specs.py
  • polylogue/pipeline/run_stages.py
  • polylogue/storage/embeddings/__init__.py
  • polylogue/storage/embeddings/materialization.py
  • polylogue/storage/embeddings/status_payload.py
  • tests/unit/pipeline/test_run_stages_runtime.py
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/refactor/storage-embeddings-lib-clean

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
Review rate limit: 0/1 reviews remaining, refill in 41 minutes and 45 seconds.

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

@Sinity
Sinity merged commit 697fb01 into master May 1, 2026
13 of 14 checks passed
@Sinity
Sinity deleted the feature/refactor/storage-embeddings-lib-clean branch May 1, 2026 18:41
@github-actions

github-actions Bot commented May 1, 2026

Copy link
Copy Markdown
Contributor

Polylogue Proof Pack

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

Affected Domains

  • none

Required Gates

  • devtools verify --quick — full PR gate remains explicit
  • devtools verify — full PR gate remains explicit
  • devtools build-package — deployment readiness gate; run when packaging or release confidence matters
  • nix flake check — deployment readiness gate; run when packaging or release confidence matters

Known Gaps

  • none for affected domains

Oracle / Cost

  • oracle mix: {}
  • cost tier: {}
  • stale evidence: 0
  • manual review cells: 0

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Moves embedding helper functionality out of polylogue.lib into polylogue.storage.embeddings, aligning “embedding execution” and “status/readiness payload” code with the storage layer that owns the underlying SQLite tables and stats.

Changes:

  • Introduce storage-owned embedding modules: materialization.py (execution/pending selection) and status_payload.py (operator payload builder).
  • Update pipeline/CLI/tests and artifact/operation code_refs to import the storage-owned helpers.
  • Remove the old polylogue.lib.embeddings package entries from the topology plan and docs.

Reviewed changes

Copilot reviewed 10 out of 12 changed files in this pull request and generated no comments.

Show a summary per file
File Description
tests/unit/pipeline/test_run_stages_runtime.py Updates patch/import paths to the new storage-owned embedding helpers.
polylogue/storage/embeddings/status_payload.py Adds storage-level embedding status payload builder.
polylogue/storage/embeddings/materialization.py Adds storage-level embedding materialization primitives (pending listing + sync embed).
polylogue/storage/embeddings/init.py Exposes new embedding helper API from the storage package.
polylogue/pipeline/run_stages.py Switches embed stage imports from lib.embeddings to storage.embeddings.
polylogue/operations/specs.py Updates embed-status code_refs to point at the storage-owned payload builder.
polylogue/lib/embeddings/init.py Removes the old lib.embeddings surface exports.
polylogue/cli/shared/embed_stats.py Switches embed stats import to the storage-owned payload builder.
polylogue/cli/shared/embed_runtime.py Switches embed runtime imports/types to the storage-owned materialization helpers.
polylogue/artifacts/init.py Updates artifact readiness code_refs to the storage-owned payload builder.
docs/topology-status.md Updates generated topology counts after file moves.
docs/plans/topology-target.yaml Removes old lib/embeddings/* entries and adds new storage/embeddings/* entries.

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

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

Move the remaining `polylogue.lib.embeddings` helpers into
`polylogue.storage.embeddings` and give the files storage-specific
names: `materialization.py` and `status_payload.py`.

## Problem

The embedding helpers were not generic library code. They read/write
embedding storage state, materialize message vectors, and build
storage-derived readiness payloads, while `polylogue/storage/embeddings`
already owned the underlying stats, SQL, and support code.

## Solution

Delete `polylogue/lib/embeddings`, move execution helpers to
`storage/embeddings/materialization.py`, move status payload
construction to `storage/embeddings/status_payload.py`, update
CLI/pipeline/test imports, and point artifact/operation code references
at the storage-owned payload builder rather than the CLI wrapper.

## Verification

- `devtools build-topology-projection && devtools verify-topology` —
realized=696 declared=696 blocking=False
- `pytest -q tests/unit/cli/test_embed.py tests/unit/cli/test_run.py
tests/unit/pipeline/test_run_stages_runtime.py` — 72 passed
- `pytest -q tests/unit/storage/test_embedding_stats.py
tests/unit/storage/test_derived_status.py tests/unit/storage/test_vec.py
tests/unit/storage/test_backend.py` — 71 passed
- `pytest -q tests/unit/core/test_artifact_graph.py
tests/unit/operations/test_specs.py
tests/unit/devtools/test_validation_lanes.py
tests/unit/devtools/test_scenario_coverage.py` — 154 passed
- `devtools render-all --check` — sync OK
- pre-push `devtools verify --quick` — all checks passed

Ref #635
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants