Skip to content

Commit b191871

Browse files
committed
fix(ci): pin ruff and make the lint rule set explicit
CI installs ruff unpinned, so it drifted to a newer default rule set (BLE001, S110, B008, ...) and failed a build that passed the day before. Pin ruff to 0.16.0 and declare [tool.ruff.lint] select/ignore explicitly, so linting is deterministic regardless of the ruff version installed. Intentional patterns are ignored with a documented reason: broad except (Atlas integrations degrade gracefully by design), FastAPI's File() default idiom, the JSON-serializable str-Enum, and em/en dashes in prose. The genuine findings are fixed: import order, datetime.UTC, enumerate, contextlib.suppress, sorted __all__, explicit zip(strict=), and wrapped long lines.
1 parent ead3fc8 commit b191871

19 files changed

Lines changed: 66 additions & 34 deletions

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,3 +43,4 @@ Thumbs.db
4343
.coverage.*
4444
htmlcov/
4545
coverage.xml
46+
How Top lead generation systems generate Quotes and how we can generate.md

apps/api/atlas/core/agents/synthesizer.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,9 @@ def synthesize_node(state: ResearchState) -> dict:
6464
)
6565

6666
meta = chat(
67-
f"Given this brief, output ONLY JSON with an overall confidence (0..1) and a list "
68-
f'of uncertainties: {{"confidence": 0.0, "uncertainties": ["..."]}}\n\nBrief:\n{report[:3000]}',
67+
"Given this brief, output ONLY JSON with an overall confidence (0..1) and a list "
68+
'of uncertainties: {"confidence": 0.0, "uncertainties": ["..."]}\n\n'
69+
f"Brief:\n{report[:3000]}",
6970
temperature=0.0, run_name="synthesizer.meta",
7071
)
7172
parsed = extract_json(meta, default={})

apps/api/atlas/core/llmops/__init__.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,12 @@
1414
from .registry import PromptRegistry, get_registry
1515

1616
__all__ = [
17-
"PromptRegistry", "get_registry", "run_gate", "GateResult", "optimize",
18-
"evaluate_agents", "score_agent", "weakest_agent",
17+
"GateResult",
18+
"PromptRegistry",
19+
"evaluate_agents",
20+
"get_registry",
21+
"optimize",
22+
"run_gate",
23+
"score_agent",
24+
"weakest_agent",
1925
]

apps/api/atlas/core/llmops/optimizer.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,9 @@ def optimize(query: str, *, max_iters: int = 1) -> dict:
7575

7676
for i in range(1, max_iters + 1):
7777
diagnosis = "; ".join(g.reasons) or "low overall score"
78-
candidate = propose_improved_prompt(reg.effective(_PROMPT_NAME), diagnosis, result.get("report", ""))
78+
candidate = propose_improved_prompt(
79+
reg.effective(_PROMPT_NAME), diagnosis, result.get("report", "")
80+
)
7981
reg.set_candidate(_PROMPT_NAME, candidate)
8082

8183
result_i = research(query, thread_id=f"ops-{i}")
@@ -89,7 +91,9 @@ def optimize(query: str, *, max_iters: int = 1) -> dict:
8991
if scores_i["overall"] > baseline_overall:
9092
best_result = result_i
9193
if g_i.passed and scores_i["overall"] >= baseline_overall:
92-
new_version = reg.release_candidate(_PROMPT_NAME, scores_i, notes=f"auto-improve: {diagnosis}")
94+
new_version = reg.release_candidate(
95+
_PROMPT_NAME, scores_i, notes=f"auto-improve: {diagnosis}"
96+
)
9397
released = True
9498
best_result = result_i
9599
break

apps/api/atlas/core/llmops/registry.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
import json
1313
import logging
1414
from dataclasses import asdict, dataclass, field
15-
from datetime import datetime, timezone
15+
from datetime import UTC, datetime
1616
from pathlib import Path
1717

1818
from ...paths import cache_dir
@@ -135,7 +135,7 @@ def release_candidate(self, name: str, scores: dict, notes: str = "") -> int:
135135

136136

137137
def _now() -> str:
138-
return datetime.now(timezone.utc).isoformat()
138+
return datetime.now(UTC).isoformat()
139139

140140

141141
_registry: PromptRegistry | None = None

apps/api/atlas/core/memory/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
A Summarizer agent periodically distills episodic memory into semantic facts.
99
"""
1010

11-
from .episodic import EpisodicMemory, Episode
11+
from .episodic import Episode, EpisodicMemory
1212
from .procedural import ProceduralMemory
1313

14-
__all__ = ["EpisodicMemory", "Episode", "ProceduralMemory"]
14+
__all__ = ["Episode", "EpisodicMemory", "ProceduralMemory"]

apps/api/atlas/core/memory/episodic.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
import sqlite3
2424
from contextlib import closing
2525
from dataclasses import dataclass, field
26-
from datetime import datetime, timezone
26+
from datetime import UTC, datetime
2727
from pathlib import Path
2828

2929
import numpy as np
@@ -98,7 +98,7 @@ def _unpack(blob: bytes | None):
9898
# ---- write ----
9999
def save(self, query: str, report: str, confidence: float | None,
100100
findings: list[dict], target: str = "") -> int:
101-
created_at = datetime.now(timezone.utc).isoformat()
101+
created_at = datetime.now(UTC).isoformat()
102102
# Embed once, here — recall then reads the vector instead of recomputing it.
103103
try:
104104
blob = self._pack(self._embed().embed_query(query))
@@ -139,7 +139,7 @@ def relevant(self, query: str, limit: int = 3) -> list[Episode]:
139139
if missing:
140140
emb = self._embed()
141141
fresh = emb.embed_documents([ep.query for ep, _ in missing])
142-
for (ep, idx), vec in zip((m for m in missing), fresh):
142+
for (ep, idx), vec in zip(missing, fresh, strict=False):
143143
rows[idx] = (ep, np.asarray(vec, dtype=np.float32))
144144
self._backfill({ep.id: rows[idx][1] for ep, idx in missing})
145145

apps/api/atlas/core/rag/__init__.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@
1212
from .types import Chunk, Document, RetrievedChunk
1313

1414
__all__ = [
15-
"HybridIndex",
16-
"build_index",
17-
"ingest_documents",
18-
"corrective_retrieve",
19-
"CragResult",
20-
"Grade",
2115
"Chunk",
16+
"CragResult",
2217
"Document",
18+
"Grade",
19+
"HybridIndex",
2320
"RetrievedChunk",
21+
"build_index",
22+
"corrective_retrieve",
23+
"ingest_documents",
2424
]

apps/api/atlas/core/rag/chunking.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,7 @@ def chunk_document(
3131

3232
step = max(1, chunk_words - overlap_words)
3333
chunks: list[Chunk] = []
34-
ordinal = 0
35-
for start in range(0, len(words), step):
34+
for ordinal, start in enumerate(range(0, len(words), step)):
3635
window = words[start : start + chunk_words]
3736
if not window:
3837
break
@@ -50,7 +49,6 @@ def chunk_document(
5049
metadata=dict(doc.metadata),
5150
)
5251
)
53-
ordinal += 1
5452
if start + chunk_words >= len(words):
5553
break
5654
return chunks

apps/api/atlas/core/rag/index.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ def save(self, base: Path = DEFAULT_CACHE) -> None:
174174
log.info("Saved index (%d chunks) → %s.json", len(self.chunks), base)
175175

176176
@classmethod
177-
def load(cls, base: Path = DEFAULT_CACHE, offline: bool = False) -> "HybridIndex":
177+
def load(cls, base: Path = DEFAULT_CACHE, offline: bool = False) -> HybridIndex:
178178
idx = build_index(offline=offline)
179179
payload = json.loads(base.with_suffix(".json").read_text(encoding="utf-8"))
180180
idx.add_chunks([Chunk(**c) for c in payload["chunks"].values()])

0 commit comments

Comments
 (0)