style: fix ruff lint violations across service and tests
CI / quality (push) Canceled after 0s

Wraps over-long lines, sorts imports, drops an unused local, and bumps the
agent submodule for its own import-sort fix so make check passes.
This commit is contained in:
vasily committed 2026-10-16 20:13:59 +08:00
1 parent 78033bb830
commit c492124fe1
12 files changed
+272 -68

No files matched your search

+14 -3
View File
@@ -490,7 +490,12 @@ class OnlineEvidence(StrictRecord):
def public_http_url(cls, value: str) -> str:
parsed = urlsplit(value)
hostname = parsed.hostname
if parsed.scheme not in {"http", "https"} or not hostname or parsed.username or parsed.password:
if (
parsed.scheme not in {"http", "https"}
or not hostname
or parsed.username
or parsed.password
):
raise ValueError("online evidence requires an HTTP(S) URL without embedded credentials")
if hostname.lower() == "localhost" or hostname.lower().endswith((".localhost", ".local")):
raise ValueError("web references must use a public hostname")
@@ -830,14 +835,20 @@ class KnowledgeBrowseRequest(StrictRecord):
as_of_from: date | None = None
as_of_to: date | None = None
stale_only: bool = False
order: Literal["title_asc", "title_desc", "date_newest", "date_oldest", "relevance"] = "title_asc"
order: Literal[
"title_asc", "title_desc", "date_newest", "date_oldest", "relevance"
] = "title_asc"
limit: int = Field(default=20, ge=1, le=50)
cursor: str | None = Field(default=None, max_length=512)
budget_tokens: int = Field(ge=256, le=50_000)
@model_validator(mode="after")
def validate_browse(self) -> KnowledgeBrowseRequest:
if self.as_of_from is not None and self.as_of_to is not None and self.as_of_from > self.as_of_to:
if (
self.as_of_from is not None
and self.as_of_to is not None
and self.as_of_from > self.as_of_to
):
raise ValueError("as_of_from must not be later than as_of_to")
if self.order == "relevance" and not self.query:
raise ValueError("relevance ordering requires a search query")