Repository navigation
feat: detection tracking, canonical column population (#844/#864) - #909
Conversation
Add detection_warnings column to raw_conversations with migration. Add raw_detection_warnings to DaemonStatus with graceful handling for pre-migration databases. Co-Authored-By: Claude Opus 4.7 <[email protected]>
…ce 2) Extract and persist working_directories_json, git_branch, git_repository_url, source_name from provider_meta during materialization. Add provider attachment identity columns to attachment UPSERT and materialization pipeline. Update AttachmentTuple/AttachmentRefTuple type aliases and SQL templates to include new identity columns. Co-Authored-By: Claude Opus 4.7 <[email protected]>
|
Warning Rate limit exceeded
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 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 configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (6)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 503132af5b
ℹ️ 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".
There was a problem hiding this comment.
Pull request overview
This PR continues the schema promotion work from provider_meta into first-class columns (issue #864) and begins surfacing provider-detection warnings in daemon status (issue #844), aiming to make ingest/parse/validation issues more operationally visible and to reduce semantic dependence on JSON blobs.
Changes:
- Add
raw_conversations.detection_warningsto the target schema and surface a count onDaemonStatus. - Populate promoted attachment identifier columns (
provider_attachment_id,provider_file_id,provider_drive_id) in the ingest-worker tuple path and update shared attachment SQL templates accordingly. - Extract conversation work context (
working_directories_json,git_branch,git_repository_url) and attachment IDs fromprovider_metaduring prepare enrichment.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
polylogue/storage/sqlite/schema_ddl_archive.py |
Adds detection_warnings column to the fresh-schema raw_conversations DDL. |
polylogue/storage/sqlite/schema_bootstrap.py |
Introduces (but currently does not apply) an ALTER DDL constant for detection_warnings. |
polylogue/pipeline/services/ingest_worker.py |
Extends attachment/attachment_ref tuple shapes to carry promoted provider ID columns. |
polylogue/pipeline/prepare_enrichment.py |
Extracts canonical conversation/attachment fields from provider_meta into record models. |
polylogue/daemon/status.py |
Adds raw_detection_warnings to daemon status and counts warnings in raw DB. |
polylogue/core/common.py |
Updates shared attachment SQL templates to insert/update promoted provider ID columns. |
Comments suppressed due to low confidence (1)
polylogue/daemon/status.py:322
- The bounded samples query also filters on
validation_status = 'FAILED', which won't match the stored lowercase status values. This will omit validation-failure samples from daemon status output.
for row in conn.execute(
"SELECT raw_id, source_path, parse_error, validation_status "
"FROM raw_conversations "
"WHERE parse_error IS NOT NULL OR validation_status = 'FAILED' "
"ORDER BY acquired_at DESC LIMIT 50"
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| @@ -302,6 +303,16 @@ def _raw_failure_info() -> dict[str, object]: | |||
| ).fetchone()[0] | |||
| _DETECTION_WARNINGS_COLUMN_DDL = "ALTER TABLE raw_conversations ADD COLUMN detection_warnings TEXT" | ||
|
|
| @@ -69,6 +98,10 @@ def enrich_bundle_from_db( | |||
| sort_key=transform.bundle.conversation.sort_key, | |||
| content_hash=content_hash, | |||
| provider_meta=merged_provider_meta, | |||
| source_name=source_name, | |||
| working_directories_json=working_directories_json, | |||
| git_branch=git_branch, | |||
| git_repository_url=git_repository_url, | |||
| parent_conversation_id=parent_conversation_id, | |||
| git_branch = git_branch or git_obj.get("branch") | ||
| git_repository_url = git_obj.get("repository_url") |
| _ATTACHMENT_UPSERT_SQL = """ | ||
| INSERT INTO attachments ( | ||
| attachment_id, mime_type, size_bytes, path, ref_count, provider_meta | ||
| ) VALUES (?, ?, ?, ?, ?, ?) | ||
| attachment_id, mime_type, size_bytes, path, ref_count, provider_meta, | ||
| provider_attachment_id, provider_file_id, provider_drive_id | ||
| ) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?) | ||
| ON CONFLICT(attachment_id) DO UPDATE SET | ||
| mime_type = COALESCE(excluded.mime_type, attachments.mime_type), | ||
| size_bytes = COALESCE(excluded.size_bytes, attachments.size_bytes), | ||
| path = COALESCE(excluded.path, attachments.path), | ||
| provider_meta = COALESCE(excluded.provider_meta, attachments.provider_meta) | ||
| provider_meta = COALESCE(excluded.provider_meta, attachments.provider_meta), | ||
| provider_attachment_id = COALESCE(excluded.provider_attachment_id, attachments.provider_attachment_id), | ||
| provider_file_id = COALESCE(excluded.provider_file_id, attachments.provider_file_id), | ||
| provider_drive_id = COALESCE(excluded.provider_drive_id, attachments.provider_drive_id) | ||
| """ | ||
|
|
||
| _ATTACHMENT_REF_INSERT_SQL = """ | ||
| INSERT INTO attachment_refs ( | ||
| ref_id, attachment_id, conversation_id, message_id, provider_meta | ||
| ) VALUES (?, ?, ?, ?, ?) | ||
| ref_id, attachment_id, conversation_id, message_id, provider_meta, | ||
| provider_attachment_id, provider_file_id, provider_drive_id | ||
| ) VALUES (?, ?, ?, ?, ?, ?, ?, ?) | ||
| ON CONFLICT(ref_id) DO NOTHING | ||
| """ |
| for attachment in conversation.attachments: | ||
| meta_json = _json_or_none(attachment.provider_meta) | ||
| provider_attachment_id = getattr(attachment, "provider_attachment_id", None) or None | ||
| provider_file_id = getattr(attachment, "provider_file_id", None) or None | ||
| provider_drive_id = getattr(attachment, "provider_drive_id", None) or None |
Slice 1 of #864 (DDL only). Universal archive semantics — source identity, working directories, git context, attachment native IDs — were trapped in `provider_meta` JSON blobs with eight JSON-expression indexes. Schema v9 → v10 promotes them to first-class columns; PR #909 supplies the population. - Conversations: adds `working_directories_json`, `git_branch`, `git_repository_url`. `source_name` is now a real `TEXT` column instead of a generated `json_extract(provider_meta, '$.source')` column. - Attachments / attachment_refs: adds `provider_attachment_id`, `provider_file_id`, `provider_drive_id`. - Indexes: replaces eight JSON-expression indexes with six plain B-tree indexes. - Migration: v9 → v10 upgrade plan with `ALTER TABLE ADD COLUMN` and index replacement; rejects unknown source versions per the fresh-first policy. Refs #840, #864
Slice 2 of the schema/observability work merged together. - #844 (detection visibility): adds the `detection_warnings` column to `raw_artifacts` schema in `storage/sqlite/schema_ddl_archive.py` and exposes the count through `polylogue/daemon/status.py` so daemon status reflects artifacts that hit detection problems but were not fatally quarantined. - #864 slice 2 (provider_meta graduation): the parser/ enrichment/ingest paths populate `working_directories`, `git_branch`, `git_repository_url`, and the attachment identity columns (`provider_attachment_id`, `provider_file_id`, `provider_drive_id`) at write time instead of leaving them in `provider_meta` JSON. Pipeline prepare/ingest paths under `pipeline/prepare_enrichment.py` and `pipeline/services/ingest_worker.py` now own the canonical population. Refs #844, #864
Slice 1 of #864 (DDL only). Universal archive semantics — source identity, working directories, git context, attachment native IDs — were trapped in `provider_meta` JSON blobs with eight JSON-expression indexes. Schema v9 → v10 promotes them to first-class columns; PR #909 supplies the population. - Conversations: adds `working_directories_json`, `git_branch`, `git_repository_url`. `source_name` is now a real `TEXT` column instead of a generated `json_extract(provider_meta, '$.source')` column. - Attachments / attachment_refs: adds `provider_attachment_id`, `provider_file_id`, `provider_drive_id`. - Indexes: replaces eight JSON-expression indexes with six plain B-tree indexes. - Migration: v9 → v10 upgrade plan with `ALTER TABLE ADD COLUMN` and index replacement; rejects unknown source versions per the fresh-first policy. Refs #840, #864
Slice 2 of the schema/observability work merged together. - #844 (detection visibility): adds the `detection_warnings` column to `raw_artifacts` schema in `storage/sqlite/schema_ddl_archive.py` and exposes the count through `polylogue/daemon/status.py` so daemon status reflects artifacts that hit detection problems but were not fatally quarantined. - #864 slice 2 (provider_meta graduation): the parser/ enrichment/ingest paths populate `working_directories`, `git_branch`, `git_repository_url`, and the attachment identity columns (`provider_attachment_id`, `provider_file_id`, `provider_drive_id`) at write time instead of leaving them in `provider_meta` JSON. Pipeline prepare/ingest paths under `pipeline/prepare_enrichment.py` and `pipeline/services/ingest_worker.py` now own the canonical population. Refs #844, #864
|
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. |
|
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. |
#844: detection_warnings schema + status. #864 Slice 2: populate working_directories, git_branch, git_repository_url, attachment identity from provider_meta.