fix: resolve startup NameError in vector-sync metrics task
The Starlette lifespan started `vector_sync_metrics_task` with undefined
names `task_producer` and `receive_stream`. Those locals only exist inside
the `_wire_vector_sync_state` helper; in the lifespan the transport is bound
as `ingest_transport`. The undefined reference raised `NameError`, which
aborted the background-sync task group and crashed startup in every
deployment mode ("Application startup failed. Exiting.").
Introduced by fbe70ecd ("feat: backend-agnostic vector-sync gauges").
Pass `ingest_transport.producer` / `ingest_transport.receive_stream` at both
call sites (single-user app.py:1791, OAuth/login-flow app.py:2012).
Also fix 10 pre-existing `ty` possibly-missing-attribute diagnostics: the
deck indexing code in scanner.py, processor.py and search/context.py reads
full-DeckCard-only fields (description, type, owner, etag, lastModified) off
`stack.cards`, typed `list[DeckCard | DeckCardSummary]`. Freshly-fetched
stacks from `get_stacks()` always hold full DeckCards (the summary
projection only happens in the tool layer), so narrow with
`cast(list[DeckCard], ...)` — matching the existing pattern in
server/deck.py.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
c47467f769
commit
1f8b3ba95e
@@ -6,12 +6,14 @@ position markers for better visualization and understanding of search results.
|
||||
|
||||
import logging
|
||||
from dataclasses import dataclass
|
||||
from typing import cast
|
||||
|
||||
from httpx import HTTPStatusError
|
||||
from qdrant_client.models import FieldCondition, Filter, MatchValue
|
||||
|
||||
from nextcloud_mcp_server.client import NextcloudClient
|
||||
from nextcloud_mcp_server.config import get_settings
|
||||
from nextcloud_mcp_server.models.deck import DeckCard
|
||||
from nextcloud_mcp_server.search.access_filter import build_ownership_filter
|
||||
from nextcloud_mcp_server.utils.validation import is_valid_nextcloud_doc_id
|
||||
from nextcloud_mcp_server.vector.html_processor import html_to_markdown
|
||||
@@ -792,7 +794,10 @@ async def _fetch_document_text(
|
||||
if card_found:
|
||||
break
|
||||
if stack.cards:
|
||||
for c in stack.cards:
|
||||
# get_stacks() always yields full DeckCard objects;
|
||||
# the DeckCardSummary projection only happens in the
|
||||
# tool layer, never on freshly-fetched stacks.
|
||||
for c in cast(list[DeckCard], stack.cards):
|
||||
if c.id == int(doc_id):
|
||||
card = c
|
||||
card_found = True
|
||||
|
||||
Reference in New Issue
Block a user