Skip to content

fix: close significant gaps — FTS safety, detection populate, canonical filter, backfill (#817/#844/#864) - #925

Merged
Sinity merged 1 commit into
masterfrom
feature/fix/significant-gaps
May 7, 2026
Merged

Sinity merged 1 commit into
masterfrom
feature/fix/significant-gaps

Conversation

@Sinity

@Sinity Sinity commented May 7, 2026

Copy link
Copy Markdown
Owner

#817: FTS trigger safety regression test. #844: detection_warnings populated during parse errors. #864: canonical cwd filter + working_directories backfill.

…ulate, canonical cwd filter, backfill (#817/#844/#864)

- #817: add FTS trigger safety regression test proving triggers restore after exception
- #844: populate detection_warnings during parse error handling
- #864: route cwd_prefix filter through working_directories_json with JSON fallback,
  add working_directories backfill migration from provider_meta

Co-Authored-By: Claude Opus 4.7 <[email protected]>
Copilot AI review requested due to automatic review settings May 7, 2026 16:39
@coderabbitai

coderabbitai Bot commented May 7, 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 30 minutes and 55 seconds before requesting another review.

To continue reviewing without waiting, purchase usage credits in the billing tab.

⌛ 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: d5b338c7-b01d-425f-9ec8-5c5f74275cbd

📥 Commits

Reviewing files that changed from the base of the PR and between 94440a9 and d573877.

📒 Files selected for processing (7)
  • polylogue/daemon/convergence_stages.py
  • polylogue/daemon/status.py
  • polylogue/pipeline/services/ingest_batch/_core.py
  • polylogue/storage/search_providers/sqlite_vec_runtime.py
  • polylogue/storage/sqlite/queries/filter_builder.py
  • polylogue/storage/sqlite/schema_bootstrap.py
  • tests/unit/storage/test_fts5.py
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/fix/significant-gaps

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 15a2838 into master May 7, 2026
4 checks passed
@Sinity
Sinity deleted the feature/fix/significant-gaps branch May 7, 2026 16:39

@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: d5738775ae

ℹ️ 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 on lines 1246 to 1248
parse_error=outcome.parse_error,
detection_warnings=outcome.parse_error[:500] if outcome.parse_error else None,
payload_provider=outcome.payload_provider,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Clear detection warnings after a successful reparse

Setting detection_warnings on failed ingests here introduces sticky warning state: when the same raw_id is retried successfully, _successful_raw_state_update does not set detection_warnings, so update_raw_state leaves the previous non-null warning in place. In practice, any transient parse failure will keep that row counted as a detection warning forever, even after parse recovery, which makes status metrics and triage output inaccurate.

Useful? React with 👍 / 👎.

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

This PR targets three operational gaps: ensuring FTS trigger lifecycle safety during ingest failures (#817), improving visibility into provider detection/parse failures by persisting detection_warnings (#844), and moving --cwd-prefix filtering toward a canonical working_directories_json column with provider-meta fallback plus schema backfill scaffolding (#864).

Changes:

  • Add a regression test intended to validate FTS trigger restoration behavior after ingest exceptions.
  • Populate RawConversationStateUpdate.detection_warnings during failure-state updates in the ingest batch pipeline.
  • Update the SQLite filter builder to prefer conversations.working_directories_json for cwd_prefix filtering (falling back to provider_meta), plus add schema bootstrap backfill SQL constants for working directories.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
tests/unit/storage/test_fts5.py Adds a regression test around FTS trigger restoration after an ingest exception.
polylogue/storage/sqlite/schema_bootstrap.py Adds SQL strings intended for backfilling working_directories_json from provider_meta.
polylogue/storage/sqlite/queries/filter_builder.py Switches cwd_prefix filtering to use working_directories_json first, with provider_meta fallback.
polylogue/storage/search_providers/sqlite_vec_runtime.py Formatting-only tweaks in embedding dimension queries/regex parsing.
polylogue/pipeline/services/ingest_batch/_core.py Persists detection_warnings (derived from parse errors) when building failed raw-state updates.
polylogue/daemon/status.py Formatting-only tweaks in embedding readiness/status line formatting.
polylogue/daemon/convergence_stages.py Formatting-only tweak in embeddings meta dimension query.

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

Comment on lines +1530 to +1537
# Insert another message — FTS should pick it up since triggers are active
conn.execute(
"INSERT INTO messages(message_id, conversation_id, role, text, provider_name) VALUES(?,?,?,?,?)",
("m2", "c1", "assistant", "another message", "test"),
)
conn.commit()
count = conn.execute("SELECT COUNT(*) FROM messages_fts").fetchone()[0]
assert count == 2, f"Expected 2 FTS entries after exception recovery, got {count}"
Comment on lines +912 to +928
_PROVIDER_META_BACKFILL_WORKING_DIRS_JSON = """
UPDATE conversations SET working_directories_json = (
SELECT json_extract(provider_meta, '$.working_directories')
FROM conversations AS c2 WHERE c2.conversation_id = conversations.conversation_id
)
WHERE working_directories_json IS NULL
AND provider_meta IS NOT NULL
AND json_extract(provider_meta, '$.working_directories') IS NOT NULL
"""

_PROVIDER_META_BACKFILL_CWD = """
UPDATE conversations SET working_directories_json = json_array(json_extract(provider_meta, '$.cwd'))
WHERE working_directories_json IS NULL
AND provider_meta IS NOT NULL
AND json_extract(provider_meta, '$.cwd') IS NOT NULL
"""

Sinity added a commit that referenced this pull request May 7, 2026
Three follow-up fixes after the larger schema/daemon waves
landed, each tied to a distinct issue but sharing files in the
ingest_batch and convergence layers.

- #817 (FTS safety): adds a regression test pinning that the FTS
  trigger restore runs before commit so a SIGKILL during
  trigger-suspend cannot leave the index permanently desynced
  (the original ordering bug from PR #882).
- #844 (detection visibility): populates `detection_warnings`
  during parse-error handling in `pipeline/services/
  ingest_batch/_core.py` and surfaces them through
  `daemon/status.py` so silently dropped artifacts become
  visible.
- #864 (provider_meta graduation): adds the canonical `cwd_path`
  filter in `storage/sqlite/queries/filter_builder.py` and a
  `working_directories` backfill in `schema_bootstrap.py`,
  finishing the move off `provider_meta` JSON paths for the
  cwd-based filter.

Refs #817, #844, #864
Sinity added a commit that referenced this pull request May 7, 2026
Three follow-up fixes after the larger schema/daemon waves
landed, each tied to a distinct issue but sharing files in the
ingest_batch and convergence layers.

- #817 (FTS safety): adds a regression test pinning that the FTS
  trigger restore runs before commit so a SIGKILL during
  trigger-suspend cannot leave the index permanently desynced
  (the original ordering bug from PR #882).
- #844 (detection visibility): populates `detection_warnings`
  during parse-error handling in `pipeline/services/
  ingest_batch/_core.py` and surfaces them through
  `daemon/status.py` so silently dropped artifacts become
  visible.
- #864 (provider_meta graduation): adds the canonical `cwd_path`
  filter in `storage/sqlite/queries/filter_builder.py` and a
  `working_directories` backfill in `schema_bootstrap.py`,
  finishing the move off `provider_meta` JSON paths for the
  cwd-based filter.

Refs #817, #844, #864
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