Repository navigation
refactor: SQL dedup — import from core/common, remove 138 lines of duplication (#784, #781) - #798
Conversation
…_sort (#784, #781) - #784: Remove 8 duplicated SQL constants from _models.py, import from canonical polylogue/core/common.py instead. Add _IDENTITY_LEDGER_UPSERT_SQL to core/common.py. verify_sql_templates.py linter now exits 0. - #781: _models.py at 104 lines (down from 233). Package structure enables future incremental splits. Co-Authored-By: Claude Opus 4.7 <[email protected]>
|
Warning Rate limit exceeded
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 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 (3)
✨ 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. Review rate limit: 0/1 reviews remaining, refill in 41 minutes and 12 seconds.Comment |
There was a problem hiding this comment.
Pull request overview
Refactors the batch ingest pipeline to eliminate duplicated SQLite SQL template strings by centralizing them in polylogue/core/common.py, reducing drift risk between write paths and shrinking _models.py.
Changes:
- Removed duplicated SQL template constants from
polylogue/pipeline/services/ingest_batch/_models.py. - Updated
polylogue/pipeline/services/ingest_batch/_core.pyto import the canonical SQL templates frompolylogue/core/common.py. - Added
_IDENTITY_LEDGER_UPSERT_SQLto the canonical SQL template set inpolylogue/core/common.py.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| polylogue/pipeline/services/ingest_batch/_models.py | Deletes duplicated SQL constants; leaves a trailing “re-export” comment. |
| polylogue/pipeline/services/ingest_batch/_core.py | Switches SQL template imports from _models.py to core.common. |
| polylogue/core/common.py | Introduces the identity-ledger upsert SQL template into the shared canonical module. |
Comments suppressed due to low confidence (2)
polylogue/pipeline/services/ingest_batch/_models.py:105
- The file no longer re-exports any SQL constants, but this trailing comment says they are “Re-exported from canonical source polylogue/core/common.py”. Either remove this comment or add explicit re-exports/imports so the statement is accurate.
# Re-exported from canonical source polylogue/core/common.py
polylogue/core/common.py:157
- IDENTITY_LEDGER_UPSERT_SQL is added here but (unlike the other SQL templates) there is no corresponding SQL* public export or all entry. If this statement is intended to be part of the canonical shared SQL surface, add a SQL_IDENTITY_LEDGER_UPSERT alias and include it in all (then consumers can import the public name).
_IDENTITY_LEDGER_UPSERT_SQL = """
INSERT OR IGNORE INTO identity_ledger (
provider, source, source_path, provider_conversation_id, raw_hash, current_conversation_id
) VALUES (?, ?, ?, ?, ?, ?)
"""
# Public exports — both sync and async write paths import these directly.
SQL_CONVERSATION_UPSERT = _CONVERSATION_UPSERT_SQL
SQL_MESSAGE_UPSERT = _MESSAGE_UPSERT_SQL
SQL_CONTENT_BLOCK_UPSERT = _CONTENT_BLOCK_UPSERT_SQL
SQL_STATS_UPSERT = _STATS_UPSERT_SQL
SQL_ACTION_EVENT_INSERT = _ACTION_EVENT_INSERT_SQL
SQL_ATTACHMENT_UPSERT = _ATTACHMENT_UPSERT_SQL
SQL_ATTACHMENT_REF_INSERT = _ATTACHMENT_REF_INSERT_SQL
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| _ACTION_EVENT_INSERT_SQL, | ||
| _ATTACHMENT_REF_INSERT_SQL, | ||
| _ATTACHMENT_UPSERT_SQL, | ||
| _CONTENT_BLOCK_UPSERT_SQL, | ||
| _CONVERSATION_UPSERT_SQL, | ||
| _IDENTITY_LEDGER_UPSERT_SQL, | ||
| _MESSAGE_UPSERT_SQL, | ||
| _STATS_UPSERT_SQL, |
…plication (#784, #781) (#798) Remove 8 duplicated SQL constants from _models.py. Import from canonical core/common.py. Linter exits 0. _models.py: 233→104 lines. Co-authored-by: Claude Opus 4.7 <[email protected]>
Remove 8 duplicated SQL constants from _models.py. Import from canonical core/common.py. Linter exits 0. _models.py: 233→104 lines.