Skip to content

fix(cli): stop daemon_client pulling storage, and seed embed-status tiers - #5478

Merged
Sinity merged 1 commit into
masterfrom
fix/master-red-tests
Sep 23, 2026
Merged

Sinity merged 1 commit into
masterfrom
fix/master-red-tests

Conversation

@Sinity

@Sinity Sinity commented Sep 23, 2026

Copy link
Copy Markdown
Owner

Summary

Master had 11 failing tests that nobody had seen. This fixes 9 and diagnoses the other 2 as a product question rather than a test bug (filed as polylogue-gqkae).

Why they were invisible

The pytest and pytest-heavy pueue groups auto-paused when a scheduled verify_all failed on 2026-09-22 and nothing resumed them. No pytest ran on master for over a day, while verify --quick stayed green throughout — it is static gates only. Both groups are resumed.

Confirmed at 5f9210b6d^: these predate the campaign waves.

1. daemon_client loaded 42 polylogue.storage modules

operations/daemon_protocol.py imported one integer — MAX_ANNOTATION_IMPORT_BYTES — from annotations.importer, which executes annotations/__init__ → annotations.write → the storage substrate.

The same constant was separately duplicated as a literal in cli/commands/annotations.py, with a comment explaining that importing that module from polylogue/cli would violate the mutation-authority layering rule. So one consumer leaked the substrate and the other hand-copied the value to avoid it.

Both now read polylogue/core/annotation_limits.py, a leaf module with no substrate imports.

import polylogue.daemon_client  ->  polylogue.storage modules: 42 -> 0

2. test_embed_status_fast seeded an archive production cannot see

The helper hand-wrote sessions/messages into archive.db. The fast path resolves ArchiveLocation.active_index_path and requires sessions in index.db — so every assertion in the file read an archive production considered empty, which is why the symptom was uniformly 'empty'/0 against seeded values of 2.

These fixtures predate the split-tier layout. Seeding is retargeted to the tier each table actually lives in (index for sessions/messages, embeddings for embedding_status, ops for embedding_catchup_runs), and seeded derived tiers are stamped with the runtime user_version — version 0 is schema skew, refused before any row is read, not an empty archive.

Verification

devtools verify --quick                              -> PASSED exit=0
devtools test tests/unit/cli/test_daemon_client.py   -> PASSED exit=0
devtools test tests/unit/cli/test_embed_status_fast.py -> 2 failed (was 10)

Residual — deliberately not fixed here

test_status_json_reports_ready_next_action and test_status_json_includes_latest_catchup_run still fail, for a structural reason:

embed.py's fast path performs no ATTACH at all. It opens index.db read-only and never attaches the sibling ops or embeddings tiers. So embedding_status (read via the attached embeddings schema) and embedding_catchup_runs (via ops_tier, which returns (None, None) when the schema is absent from PRAGMA database_list) are unreachable from that route. Correct tier files with correct versions do not help, because nothing attaches them.

That makes the status surface report unmeasured state as absent — the same defect class as polylogue-xvwpi. Either the fast path should attach those tiers, or it is index-only by design and the assertions are obsolete. Weakening the assertions to match current output would encode the bug, so I have not done that. Filed as polylogue-gqkae with the anti-vacuity condition for either route.

🤖 Generated with Claude Code

https://claude.ai/code/session_01ToWqpkXotr573DiQex5vcy

…iers

Two unrelated failures that had been red on master unseen: the pytest and
pytest-heavy pueue groups auto-paused on a verify_all failure on 2026-09-22
and nothing resumed them, so no pytest ran on master for over a day while
verify --quick stayed green (it is static-only).

1. daemon_client loaded 42 polylogue.storage modules.

operations/daemon_protocol.py imported one integer,
MAX_ANNOTATION_IMPORT_BYTES, from annotations.importer -- which executes
annotations/__init__ -> annotations.write -> the storage substrate. The
same constant was separately duplicated as a literal in
cli/commands/annotations.py, deliberately, because that package may not
import the annotation substrate under the mutation-authority layering rule.

Both now read polylogue/core/annotation_limits.py, a leaf module with no
substrate imports. One owner instead of one leak plus one copy.
Storage modules after importing daemon_client: 42 -> 0.

2. test_embed_status_fast seeded an archive production cannot see.

The helper hand-wrote sessions/messages into archive.db, but the fast path
resolves ArchiveLocation.active_index_path and requires sessions in
index.db, so every assertion read an archive it considered empty. These
fixtures predate the split-tier layout. Seeding is retargeted to the tier
each table actually lives in -- index for sessions/messages, embeddings for
embedding_status, ops for embedding_catchup_runs -- and seeded derived tiers
are stamped with the runtime user_version, since version 0 is schema skew
rather than an empty archive.

Verification:
  devtools test tests/unit/cli/test_daemon_client.py -> PASSED exit=0
  devtools test tests/unit/cli/test_embed_status_fast.py -> 2 failed (was 10)

Residual, tracked separately: test_status_json_reports_ready_next_action and
test_status_json_includes_latest_catchup_run still fail, and not for a
fixture reason. embed.py's fast path performs no ATTACH at all -- it opens
index.db read-only and never attaches the sibling ops or embeddings tiers --
so embedding_status (read through the attached embeddings schema) and
embedding_catchup_runs (read through ops_tier) are structurally unreachable
from it. Those two tests assert output the route cannot produce. Whether the
fast path should attach those tiers or the assertions are obsolete is a
product decision, not a test edit.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01ToWqpkXotr573DiQex5vcy
@coderabbitai

coderabbitai Bot commented Sep 23, 2026

Copy link
Copy Markdown

Warning

Review limit reached

Next included review available in 25 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Advanced

Run ID: 90bd4c38-572f-4b9d-9915-78b812e84d6b

📥 Commits

Reviewing files that changed from the base of the PR and between 399a0e0 and 27e2ad8.

📒 Files selected for processing (5)
  • polylogue/annotations/importer.py
  • polylogue/cli/commands/annotations.py
  • polylogue/core/annotation_limits.py
  • polylogue/operations/daemon_protocol.py
  • tests/unit/cli/test_embed_status_fast.py

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.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 23, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-23T09:25:59.325503Z 27e2ad8 PR opened
🔒 Security Review ✅ Completed 2026-09-23T09:23:02.648199Z 27e2ad8 PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@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: 27e2ad8ab6

ℹ️ 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".

@Sinity
Sinity merged commit 8a3f43b into master Sep 23, 2026
3 checks passed
@Sinity
Sinity deleted the fix/master-red-tests branch September 23, 2026 09:31
@Sinity

Sinity commented Sep 29, 2026

Copy link
Copy Markdown
Owner Author

Closing out open Codex review threads on this PR (evidence checked against master at bf68918):

Resolving every thread listed; confirmed defects are fixed under the named bead.

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.

1 participant