fix: preserve bigint batch identities in news AI queries
Development CI / check-and-build (push) Successful in 2m28s
GitHub Git mirror / mirror (push) Successful in 6s
Development CI / deploy-development (push) Successful in 2m30s

Use BIGINT casts for JSON batch references in queue filters, retries and legacy job reconciliation. Cover real large batch references and absent 64-bit IDs in isolated PostgreSQL acceptance.
This commit is contained in:
eezd committed 2026-11-01 15:13:44 +08:00
1 parent b45981ec30
commit 0a150eca0f
4 files changed
+29 -8

No files matched your search

@@ -1,5 +1,5 @@
"""Explicit bounded historical jobs, sharing the normal news pipeline."""
from sqlalchemy import select, text, update
from sqlalchemy import select, text, update, BigInteger
from alphapulse.core.db import SessionLocal
from alphapulse.models import NewsItem
from alphapulse.models.risk import RiskSettings, ReprocessJob, ReprocessItem, ArticleAnalysis, NewsSummary, EventMember
@@ -68,7 +68,7 @@ async def process_job(item_index=None):
inputs = await reading_inputs(session, datetime.now(UTC)-timedelta(hours=72))
key = briefing.fingerprint(briefing.semantic_packages(inputs), job.settings['configurations']['outlook']['rules'])
snapshot = await session.scalar(select(RiskSnapshot).where(
RiskSnapshot.quotes['job_id'].as_integer() == job.id,
RiskSnapshot.quotes['job_id'].astext.cast(BigInteger) == job.id,
RiskSnapshot.quotes['fingerprint'].as_string() == key).order_by(RiskSnapshot.id.desc()).limit(1))
if snapshot is None or snapshot.state == 'processing' or snapshot.quotes.get('retry_requested'): return
if snapshot.state == 'failed':