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

+2 -2
View File
@@ -4,7 +4,7 @@ from enum import IntEnum
from typing import Annotated, Literal
from fastapi import APIRouter, Body, Depends, HTTPException, Query
from pydantic import BaseModel, Field, model_validator
from sqlalchemy import select, func, text
from sqlalchemy import select, func, text, BigInteger
from sqlalchemy.ext.asyncio import AsyncSession
from alphapulse.ai.llm import Effort
from alphapulse.api.response import success
@@ -437,7 +437,7 @@ async def reprocess_retry(identifier: int, session: DB):
await session.execute(update(ReprocessItem).where(ReprocessItem.job_id==job.id,ReprocessItem.state=='failed').values(state='pending',error=None))
outlook_ids = {f['id'] for f in job.failures if f['stage'] == 'outlook'}
snapshots = (await session.scalars(select(RiskSnapshot).where(RiskSnapshot.id.in_(outlook_ids), RiskSnapshot.state == 'failed',
RiskSnapshot.quotes['job_id'].as_integer() == job.id))).all()
RiskSnapshot.quotes['job_id'].astext.cast(BigInteger) == job.id))).all()
for snapshot in snapshots: snapshot.quotes = {**snapshot.quotes, 'retry_requested': True}
from alphapulse.models.risk import NewsEvent
for stage, model in (('analysis', NewsSummary), ('events', NewsEvent)):