SonarCloud: - Resolve 6 S5332 hotspots (http→https in test fixture URLs). - S6418: hoist the unauthenticated AsyncOpenAI placeholder to a named constant + NOSONAR (genuine non-secret; gateway ignores it when unauthenticated). - Fix two reliability bugs: None-index guard in the gateway token-cache test (S2259) and float `> 0.0` instead of `!= 0.0` in the sentinel test (S1244). - status.py idle path sleeps 0.1s instead of sleep(0) (S7491); NOSONAR on the protocol-required async no-await aclose() stubs (S7503). Claude review: - Remove three leftover debug print() calls in app.py (logger.info already covers them). - payload_backfill: drop parsed_at from the backfilled-keys docstring (it is per-document state, not a deployment scalar); add a clean 404 precondition for BasicAuth deployments without an OAuth token verifier. - status.py: task_status typed TaskStatus | None (drop type: ignore). - nats.py: TODO to thread etags for file/deck/news; note etag default → None. - factory: warn on unknown INGEST_BUS_URL scheme; raise ValueError instead of assert for the external-mode preconditions. - docs/configuration.md: document the decomposition hook-point env vars + that nats-py ships core (lazy-imported) and external+bus uses two NATS connections. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
50 lines
1.7 KiB
Python
50 lines
1.7 KiB
Python
"""Postgres-queue ``TaskProducer`` — documented seam, not implemented.
|
|
|
|
The external document-processor may later drain a Postgres-backed queue instead
|
|
of NATS to limit NATS operational overhead. Processing stays *external*; only
|
|
the transport changes — so on this server it would be a drop-in producer swap.
|
|
The consume side + the queue-table migration belong to that processor-side
|
|
refactor (cross-repo), NOT here. This stub exists so the transport value and the
|
|
``TaskProducer`` Protocol conformance are testable today.
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
from types import TracebackType
|
|
from typing import TYPE_CHECKING, Any
|
|
|
|
if TYPE_CHECKING:
|
|
from ..scanner import DocumentTask
|
|
|
|
_NOT_IMPLEMENTED = (
|
|
"Postgres ingest transport is a documented seam. The external "
|
|
"document-processor owns the Postgres-drain refactor (transport swap only; "
|
|
"processing stays external). Use INGEST_BUS_URL=nats://… for now."
|
|
)
|
|
|
|
|
|
class PostgresTaskProducer:
|
|
@classmethod
|
|
async def connect(cls, settings: Any) -> PostgresTaskProducer:
|
|
raise NotImplementedError(_NOT_IMPLEMENTED)
|
|
|
|
async def send(self, task: DocumentTask) -> None: # pragma: no cover
|
|
raise NotImplementedError(_NOT_IMPLEMENTED)
|
|
|
|
def clone(self) -> PostgresTaskProducer: # pragma: no cover
|
|
return self
|
|
|
|
async def __aenter__(self) -> PostgresTaskProducer: # pragma: no cover
|
|
return self
|
|
|
|
async def __aexit__(
|
|
self,
|
|
exc_type: type[BaseException] | None,
|
|
exc: BaseException | None,
|
|
tb: TracebackType | None,
|
|
) -> None: # pragma: no cover
|
|
return None
|
|
|
|
async def aclose(self) -> None: # pragma: no cover # NOSONAR: protocol stub
|
|
return None
|