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

+4 -1
View File
@@ -31,7 +31,10 @@ def test_review_store_round_trips_jev_facet_arrays_and_idempotent_create(tmp_pat
{
"facet": "tags",
"value": "spatial sound",
"definition": "Audio techniques that place sound in immersive spatial configurations.",
"definition": (
"Audio techniques that place sound in immersive "
"spatial configurations."
),
},
),
)
+74 -10
View File
@@ -165,10 +165,20 @@ def test_authenticated_search_scope_through_http_and_mcp(tmp_path: Path) -> None
full_row = full_result.json()["data"][0]
assert full_row["evidence_included"] is True
assert full_row["node"]["claims"][0]["evidence"]
assert full_result.json()["citations"][0]["quote"] == NODE.claims[0].evidence[0].quote
assert (
full_result.json()["citations"][0]["quote"]
== NODE.claims[0].evidence[0].quote
)
browse = await http.post(
"/v1/knowledge/browse",
json={"scope": {"projects": ["dome-performance"], "include_projects": [], "include_shared": False}, "limit": 2},
json={
"scope": {
"projects": ["dome-performance"],
"include_projects": [],
"include_shared": False,
},
"limit": 2,
},
)
assert browse.status_code == 200, browse.text
browse_body = browse.json()
@@ -182,14 +192,29 @@ def test_authenticated_search_scope_through_http_and_mcp(tmp_path: Path) -> None
assert browse_body["facets"]["tags"]
browse_page_two = await http.post(
"/v1/knowledge/browse",
json={"scope": {"projects": ["dome-performance"], "include_projects": [], "include_shared": False}, "limit": 2, "cursor": browse_body["next_cursor"]},
json={
"scope": {
"projects": ["dome-performance"],
"include_projects": [],
"include_shared": False,
},
"limit": 2,
"cursor": browse_body["next_cursor"],
},
)
assert browse_page_two.status_code == 200
assert len(browse_page_two.json()["nodes"]) == 2
assert browse_page_two.json()["next_cursor"] is None
filtered_browse = await http.post(
"/v1/knowledge/browse",
json={"scope": {"projects": ["dome-performance"], "include_projects": [], "include_shared": False}, "node_types": ["problem"]},
json={
"scope": {
"projects": ["dome-performance"],
"include_projects": [],
"include_shared": False,
},
"node_types": ["problem"],
},
)
assert filtered_browse.status_code == 200
assert filtered_browse.json()["filtered_node_count"] == 1
@@ -197,7 +222,13 @@ def test_authenticated_search_scope_through_http_and_mcp(tmp_path: Path) -> None
assert filtered_browse.json()["project_node_count"] == 4
graph = await http.post(
"/v1/knowledge/graph",
json={"scope": {"projects": ["dome-performance"], "include_projects": [], "include_shared": False}},
json={
"scope": {
"projects": ["dome-performance"],
"include_projects": [],
"include_shared": False,
},
},
)
assert graph.status_code == 200, graph.text
assert len(graph.json()["nodes"]) == 4
@@ -205,7 +236,14 @@ def test_authenticated_search_scope_through_http_and_mcp(tmp_path: Path) -> None
assert graph.json()["truncated"] is False
neighborhood = await http.post(
"/v1/knowledge/graph",
json={"scope": {"projects": ["dome-performance"], "include_projects": [], "include_shared": False}, "center_node_id": NODE.node_id},
json={
"scope": {
"projects": ["dome-performance"],
"include_projects": [],
"include_shared": False,
},
"center_node_id": NODE.node_id,
},
)
assert neighborhood.status_code == 200, neighborhood.text
assert neighborhood.json()["center_node_id"] == NODE.node_id
@@ -213,19 +251,41 @@ def test_authenticated_search_scope_through_http_and_mcp(tmp_path: Path) -> None
assert len(neighborhood.json()["nodes"]) == 3
center_only = await http.post(
"/v1/knowledge/graph",
json={"scope": {"projects": ["dome-performance"], "include_projects": [], "include_shared": False}, "center_node_id": NODE.node_id, "max_nodes": 1},
json={
"scope": {
"projects": ["dome-performance"],
"include_projects": [],
"include_shared": False,
},
"center_node_id": NODE.node_id,
"max_nodes": 1,
},
)
assert center_only.status_code == 200
assert [item["node_id"] for item in center_only.json()["nodes"]] == [NODE.node_id]
assert center_only.json()["edges"] == []
denied_neighborhood = await http.post(
"/v1/knowledge/graph",
json={"scope": {"projects": ["other-project"], "include_projects": [], "include_shared": False}, "center_node_id": NODE.node_id},
json={
"scope": {
"projects": ["other-project"],
"include_projects": [],
"include_shared": False,
},
"center_node_id": NODE.node_id,
},
)
assert denied_neighborhood.status_code == 404
capped_graph = await http.post(
"/v1/knowledge/graph",
json={"scope": {"projects": ["dome-performance"], "include_projects": [], "include_shared": False}, "max_nodes": 1},
json={
"scope": {
"projects": ["dome-performance"],
"include_projects": [],
"include_shared": False,
},
"max_nodes": 1,
},
)
assert capped_graph.status_code == 200
assert len(capped_graph.json()["nodes"]) == 1
@@ -245,7 +305,11 @@ def test_authenticated_search_scope_through_http_and_mcp(tmp_path: Path) -> None
assert source_nodes_resp.status_code == 200, source_nodes_resp.text
source_nodes_data = source_nodes_resp.json()
assert source_nodes_data["total"] >= 1
assert source_nodes_data["nodes"][0]["relation_basis"] in ("citation", "edge", "both")
assert source_nodes_data["nodes"][0]["relation_basis"] in (
"citation",
"edge",
"both",
)
assert listed_sources.json()["filtered_count"] == 2
assert listed_sources.json()["data"][0]["source"]["revision_id"] == (
+4 -1
View File
@@ -283,7 +283,10 @@ def test_existing_node_can_gain_facets_without_replacing_its_assertion() -> None
existing = NODE
enriched = NODE.model_copy(
update={"updated": NOW + timedelta(minutes=1), "tags": (*NODE.tags, "interactive-storytelling")}
update={
"updated": NOW + timedelta(minutes=1),
"tags": (*NODE.tags, "interactive-storytelling"),
},
)
draft = ProposalRevision(
proposal_id="proposal-enrich-facets",