Skip to content

feat: detection tracking, canonical column population (#844/#864) - #909

Merged
Sinity merged 2 commits into
masterfrom
feature/fix/finish-closeable-all
May 7, 2026
Merged

Sinity merged 2 commits into
masterfrom
feature/fix/finish-closeable-all

Conversation

@Sinity

@Sinity Sinity commented May 7, 2026

Copy link
Copy Markdown
Owner

#844: detection_warnings schema + status. #864 Slice 2: populate working_directories, git_branch, git_repository_url, attachment identity from provider_meta.

Sinity and others added 2 commits May 7, 2026 15:07
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]>
Copilot AI review requested due to automatic review settings May 7, 2026 13:15
@Sinity
Sinity merged commit fb9ee8d into master May 7, 2026
@Sinity
Sinity deleted the feature/fix/finish-closeable-all branch May 7, 2026 13:15
@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 28 minutes and 24 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: c54b4442-8ac6-41b3-8396-4d400064f858

📥 Commits

Reviewing files that changed from the base of the PR and between 2a04fe6 and 503132a.

📒 Files selected for processing (6)
  • polylogue/core/common.py
  • polylogue/daemon/status.py
  • polylogue/pipeline/prepare_enrichment.py
  • polylogue/pipeline/services/ingest_worker.py
  • polylogue/storage/sqlite/schema_bootstrap.py
  • polylogue/storage/sqlite/schema_ddl_archive.py
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/fix/finish-closeable-all

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.

@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: 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".

Comment thread polylogue/core/common.py Resolved

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 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_warnings to the target schema and surface a count on DaemonStatus.
  • 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 from provider_meta during 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.

Comment on lines 293 to 303
@@ -302,6 +303,16 @@ def _raw_failure_info() -> dict[str, object]:
).fetchone()[0]
Comment on lines +927 to +928
_DETECTION_WARNINGS_COLUMN_DDL = "ALTER TABLE raw_conversations ADD COLUMN detection_warnings TEXT"

Comment on lines 91 to 105
@@ -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,
Comment on lines +88 to +89
git_branch = git_branch or git_obj.get("branch")
git_repository_url = git_obj.get("repository_url")
Comment thread polylogue/core/common.py
Comment on lines 133 to 154
_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
"""
Comment on lines 921 to +925
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
Sinity added a commit that referenced this pull request May 7, 2026
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
Sinity added a commit that referenced this pull request May 7, 2026
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
Sinity added a commit that referenced this pull request May 7, 2026
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
Sinity added a commit that referenced this pull request May 7, 2026
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
@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.

  • 62.F007 / P1: fixed-already at the checked revision: The retired async attachment SQL constants are no longer the write route. The split-tier writer supplies ten values for ten attachment-reference placeholders at polylogue/storage/sqlite/archive_tiers/write.py:7012,7027-7036 and six values for six attachment placeholders at lines 7130,7141-7146, so attachment persistence no longer has the reported binding-count mismatch.

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

@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.

  • 69.F085 / P2: stale at the checked revision: polylogue/pipeline/prepare_enrichment.py was deleted in ac9cfeb (refactor: current split-file archive as the sole storage architecture (refactor: current split-file archive as the sole storage architecture #1787)); the cited code no longer exists at 5ebcfe5.
  • 69.F100 / P2: fixed-already at the checked revision: The current ingest writer receives ParsedAttachment with explicit native identity fields, not the retired MaterializedAttachment shape. polylogue/storage/sqlite/archive_tiers/write.py:14521-14523 reads the attachment/file/Drive IDs and lines 14535-14542 persist them into attachment_native_ids.

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.

2 participants