Skip to content

Commit fcefa22

Browse files
northdpoleclaude
andcommitted
style: format files flagged by CI (black, prettier)
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
1 parent bc13dc6 commit fcefa22

10 files changed

Lines changed: 58 additions & 78 deletions

File tree

‎application/frontend/src/pages/Admin/Admin.tsx‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -714,8 +714,8 @@ function PipelineTab({ origin }: { origin: string }) {
714714
<p className="admin-help">
715715
Look for <code>oie</code>/<code>started</code> (flags + skip_reason) and <code>oie_trace</code>{' '}
716716
(engine, graph_path, visited). The admin default runs Module B, C, and C.1 (graph filer). Skipped
717-
stages mean the run passed the matching <code>skip_*</code> flag true. Module A with chunks=0
718-
usually means harvester checkpoints were already at HEAD (no file diffs).
717+
stages mean the run passed the matching <code>skip_*</code> flag true. Module A with chunks=0 usually
718+
means harvester checkpoints were already at HEAD (no file diffs).
719719
</p>
720720
<table className="admin-table">
721721
<thead>
@@ -1058,8 +1058,8 @@ function ConfigTab({ origin }: { origin: string }) {
10581058
<p className="admin-help">
10591059
CRE explorer graph comes from upstream at <code>make install</code> / <code>make dev</code> (skip with{' '}
10601060
<code>SKIP_UPSTREAM_SYNC=1</code>). Golden-set harvest runs A → B → C → C.1. C.1 only auto-files
1061-
high-confidence links when the toggle below is on (default off — review{' '}
1062-
<code>decision_queue</code> first). OWASP agent sync is separate — progress shows under Pipeline.
1061+
high-confidence links when the toggle below is on (default off — review <code>decision_queue</code>{' '}
1062+
first). OWASP agent sync is separate — progress shows under Pipeline.
10631063
</p>
10641064
<p>
10651065
<Checkbox

‎application/tests/librarian/pipeline_test.py‎

Lines changed: 30 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -126,9 +126,8 @@ def retrieve(self, text):
126126
_Scaler(0.95),
127127
threshold=0.8,
128128
pipeline_run_id=RUN,
129-
130-
safety_guard=PassThroughSafetyGuard(),
131-
)
129+
safety_guard=PassThroughSafetyGuard(),
130+
)
132131
env = pipeline.run(at=AT).envelopes[0]
133132
self.assertIsInstance(env, ReviewItem)
134133
# Empty cage → CRE_GAP (coverage proposal), not a silent no_candidates.
@@ -165,9 +164,8 @@ def retrieve(self, text):
165164
known_cre_ids=frozenset({"616-305"}),
166165
cre_id_map={"616-305": "uuid-616"},
167166
cre_membership=frozenset({"uuid-616", "616-305"}),
168-
169-
safety_guard=PassThroughSafetyGuard(),
170-
)
167+
safety_guard=PassThroughSafetyGuard(),
168+
)
171169
result = pipeline.run(at=AT)
172170
self.assertEqual(result.stats.linked, 1)
173171
env = result.envelopes[0]
@@ -195,9 +193,8 @@ def retrieve(self, text):
195193
pipeline_run_id=RUN,
196194
known_cre_ids=frozenset({"616-305", "177-260"}),
197195
cre_membership=frozenset({"616-305", "177-260"}),
198-
199-
safety_guard=PassThroughSafetyGuard(),
200-
)
196+
safety_guard=PassThroughSafetyGuard(),
197+
)
201198
result = pipeline.run(at=AT)
202199
self.assertEqual(result.stats.review, 1)
203200
env = result.envelopes[0]
@@ -225,9 +222,8 @@ def test_bogus_cre_id_cannot_produce_link_proposal(self):
225222
threshold=0.8,
226223
pipeline_run_id=RUN,
227224
cre_membership=frozenset({"616-305"}),
228-
229-
safety_guard=PassThroughSafetyGuard(),
230-
)
225+
safety_guard=PassThroughSafetyGuard(),
226+
)
231227
result = pipeline.run(at=AT)
232228
self.assertEqual(result.stats.linked, 0)
233229
self.assertEqual(result.stats.review, 1)
@@ -245,9 +241,8 @@ def test_valid_membership_still_auto_links(self):
245241
threshold=0.8,
246242
pipeline_run_id=RUN,
247243
cre_membership=frozenset({"616-305"}),
248-
249-
safety_guard=PassThroughSafetyGuard(),
250-
)
244+
safety_guard=PassThroughSafetyGuard(),
245+
)
251246
result = pipeline.run(at=AT)
252247
self.assertEqual(result.stats.linked, 1)
253248
env = result.envelopes[0]
@@ -267,9 +262,8 @@ def test_review_suggested_links_drop_invalid_ids(self):
267262
threshold=0.8,
268263
pipeline_run_id=RUN,
269264
cre_membership=frozenset({"616-305"}),
270-
271-
safety_guard=PassThroughSafetyGuard(),
272-
)
265+
safety_guard=PassThroughSafetyGuard(),
266+
)
273267
result = pipeline.run(at=AT)
274268
env = result.envelopes[0]
275269
self.assertIsInstance(env, ReviewItem)
@@ -300,9 +294,8 @@ def _run_with(self, failing_component, rows):
300294
parts["scaler"],
301295
threshold=0.8,
302296
pipeline_run_id=RUN,
303-
304-
safety_guard=PassThroughSafetyGuard(),
305-
).run(at=AT)
297+
safety_guard=PassThroughSafetyGuard(),
298+
).run(at=AT)
306299

307300
def test_retriever_failure_is_contained(self):
308301
result = self._run_with("retriever", [_row()])
@@ -336,9 +329,8 @@ def rerank(self, text, audit):
336329
_Scaler(0.95),
337330
threshold=0.8,
338331
pipeline_run_id=RUN,
339-
340-
safety_guard=PassThroughSafetyGuard(),
341-
).run(at=AT)
332+
safety_guard=PassThroughSafetyGuard(),
333+
).run(at=AT)
342334

343335
self.assertEqual(result.stats.total, 3)
344336
self.assertEqual(result.stats.errored, 1)
@@ -368,9 +360,8 @@ def _run(self, rows, scaler_confidence=0.95):
368360
_Scaler(scaler_confidence),
369361
threshold=0.8,
370362
pipeline_run_id=RUN,
371-
372-
safety_guard=PassThroughSafetyGuard(),
373-
).run(at=AT)
363+
safety_guard=PassThroughSafetyGuard(),
364+
).run(at=AT)
374365

375366
def test_outcome_per_row_carries_the_queue_id(self):
376367
result = self._run([_row(row_id="a"), _row(row_id="b")])
@@ -392,9 +383,8 @@ def test_errored_row_is_not_finished(self):
392383
_Scaler(0.95),
393384
threshold=0.8,
394385
pipeline_run_id=RUN,
395-
396-
safety_guard=PassThroughSafetyGuard(),
397-
).run(at=AT)
386+
safety_guard=PassThroughSafetyGuard(),
387+
).run(at=AT)
398388
self.assertEqual([o.status.value for o in result.outcomes], ["errored"])
399389
self.assertEqual(result.finished_row_ids(), [])
400390

@@ -455,9 +445,8 @@ def llm(system: str, user: str) -> str:
455445
threshold=0.8,
456446
pipeline_run_id=RUN,
457447
shortlist_llm_fn=llm,
458-
459-
safety_guard=PassThroughSafetyGuard(),
460-
)
448+
safety_guard=PassThroughSafetyGuard(),
449+
)
461450
result = pipeline.run(at=AT)
462451
env = result.envelopes[0]
463452
self.assertIsInstance(env, ReviewItem)
@@ -479,9 +468,8 @@ def llm(system: str, user: str) -> str:
479468
threshold=0.8,
480469
pipeline_run_id=RUN,
481470
shortlist_llm_fn=llm,
482-
483-
safety_guard=PassThroughSafetyGuard(),
484-
).run(at=AT)
471+
safety_guard=PassThroughSafetyGuard(),
472+
).run(at=AT)
485473
self.assertEqual(result.stats.linked, 1)
486474
self.assertNotIn("shortlist-judge", result.envelopes[0].retrieval.retriever)
487475

@@ -538,9 +526,8 @@ def _score_fn(pairs):
538526
leaf_drilldown_resources=("asvs", "aisvs"),
539527
leaf_drilldown_min_children=3,
540528
leaf_drilldown_min_sections=0,
541-
542-
safety_guard=PassThroughSafetyGuard(),
543-
).run(at=AT)
529+
safety_guard=PassThroughSafetyGuard(),
530+
).run(at=AT)
544531
env = result.envelopes[0]
545532
ids = [c.cre_id for c in env.retrieval.reranked]
546533
self.assertEqual(ids[:2], [hub, "noise"])
@@ -596,9 +583,8 @@ def _score_fn(pairs):
596583
leaf_drilldown_force_resources=("api",),
597584
leaf_drilldown_min_children=3,
598585
leaf_drilldown_min_sections=20,
599-
600-
safety_guard=PassThroughSafetyGuard(),
601-
).run(at=AT)
586+
safety_guard=PassThroughSafetyGuard(),
587+
).run(at=AT)
602588
env = result.envelopes[0]
603589
ids = [c.cre_id for c in env.retrieval.reranked]
604590
self.assertEqual(ids[0], leaf)
@@ -658,9 +644,8 @@ def _score_fn(pairs):
658644
leaf_drilldown_resources=(),
659645
leaf_drilldown_min_children=3,
660646
leaf_drilldown_min_sections=20,
661-
662-
safety_guard=PassThroughSafetyGuard(),
663-
).run(at=AT)
647+
safety_guard=PassThroughSafetyGuard(),
648+
).run(at=AT)
664649
env = result.envelopes[0]
665650
ids = [c.cre_id for c in env.retrieval.reranked]
666651
self.assertEqual(ids[0], leaf)

‎application/tests/owasp_agent/owasp_agent_test.py‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -969,9 +969,6 @@ def test_clarify_followup_uses_history(self) -> None:
969969
self.assertIn("morocco", resp["response"].lower())
970970

971971

972-
973-
974-
975972
class TestIndexStoreDefaults(unittest.TestCase):
976973
def test_override_env_wins_over_app_db(self) -> None:
977974
with patch.dict(

‎application/utils/librarian/factory.py‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ class LibrarianComponents:
5454
shortlist_llm_fn: Optional[Callable[[str, str], str]] = None
5555
#: C.4 safety guard (None → pipeline keeps NullSafetyGuard).
5656
safety_guard: Optional[Any] = None
57-
#: Contains parent→children index for leaf drill-down (None = skip).
57+
#: Contains parent→children index for leaf drill-down (None = skip).
5858
parent_index: Optional[Any] = None
5959
#: When True, promote better Contains children over hub umbrellas after C.2.
6060
leaf_drilldown: bool = True
@@ -72,6 +72,7 @@ class LibrarianComponents:
7272
shortlist_judge_max_picks: int = 3
7373
margin_gamma: Optional[float] = None
7474

75+
7576
def build_scaler(config: Optional[LibrarianConfig] = None) -> Scaler:
7677
"""The C.3 calibrator at the configured temperature.
7778
@@ -343,7 +344,7 @@ def build_components(
343344
cre_prior=cre_prior,
344345
shortlist_llm_fn=shortlist_llm,
345346
safety_guard=safety_guard,
346-
parent_index=parent_index,
347+
parent_index=parent_index,
347348
leaf_drilldown=config.leaf_drilldown,
348349
leaf_drilldown_resources=config.leaf_drilldown_resources,
349350
leaf_drilldown_force_resources=config.leaf_drilldown_force_resources,

‎application/utils/librarian/llm_safety_guard.py‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,9 @@ def default_safety_litellm_fn(model: Optional[str] = None) -> LlmFn:
7171
"CRE_LIBRARIAN_SAFETY_GUARD_MODEL",
7272
os.environ.get(
7373
"CRE_LIBRARIAN_SHORTLIST_JUDGE_MODEL",
74-
os.environ.get("CRE_NOISE_FILTER_LLM_MODEL", "gemini/gemini-2.5-flash-lite"),
74+
os.environ.get(
75+
"CRE_NOISE_FILTER_LLM_MODEL", "gemini/gemini-2.5-flash-lite"
76+
),
7577
),
7678
)
7779
return system_user_fn(model_name, temperature=0.0)

‎application/utils/oie_orchestrator/pipeline.py‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,6 @@ def _refuse_c1_for_safety_gap(c_stage: "StageResult") -> Optional[str]:
158158
return None
159159

160160

161-
162161
def _connect(cache_file: str) -> Any:
163162
from application import sqla
164163
from application.cmd.cre_main import db_connect

‎scripts/owasp_agent_adversarial_asker.py‎

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -614,10 +614,9 @@ def ask_inprocess(q: str) -> str:
614614
os.environ.setdefault("OWASP_AGENT_ENABLED", "1")
615615
sys.path.insert(0, str(_REPO))
616616
if _INPROCESS_APP is None:
617-
db_url = (
618-
(os.environ.get("DATABASE_URL") or "").strip()
619-
or (os.environ.get("DEV_DATABASE_URL") or "").strip()
620-
)
617+
db_url = (os.environ.get("DATABASE_URL") or "").strip() or (
618+
os.environ.get("DEV_DATABASE_URL") or ""
619+
).strip()
621620
if db_url and not (os.environ.get("SQLALCHEMY_DATABASE_URI") or "").strip():
622621
try:
623622
from application.utils.postgres_url import (
@@ -773,9 +772,7 @@ async def _start_async(self) -> None:
773772
from mcp.client.stdio import stdio_client
774773

775774
transport = (os.environ.get("OWASP_ADV_MCP_TRANSPORT") or "staging_ssh").strip()
776-
params = (
777-
_local_mcp_params() if transport == "local" else _staging_ssh_params()
778-
)
775+
params = _local_mcp_params() if transport == "local" else _staging_ssh_params()
779776
self._cm_stdio = stdio_client(params)
780777
read, write = await self._cm_stdio.__aenter__()
781778
self._cm_session = ClientSession(read, write)
@@ -796,9 +793,7 @@ def ask(self, q: str) -> str:
796793

797794
async def _ask_async(self, q: str) -> str:
798795
corpus = (os.environ.get("OWASP_ADV_CORPUS") or "auto").strip()
799-
result = await self._session.call_tool(
800-
"ask", {"prompt": q, "corpus": corpus}
801-
)
796+
result = await self._session.call_tool("ask", {"prompt": q, "corpus": corpus})
802797
if getattr(result, "isError", False):
803798
texts = []
804799
for c in result.content or []:
@@ -955,7 +950,12 @@ def main() -> int:
955950
bank = [c for c in bank if c.cat in allow]
956951
if not bank:
957952
print(
958-
json.dumps({"error": "empty bank after OWASP_ADV_CATS filter", "cats": sorted(allow)}),
953+
json.dumps(
954+
{
955+
"error": "empty bank after OWASP_ADV_CATS filter",
956+
"cats": sorted(allow),
957+
}
958+
),
959959
flush=True,
960960
)
961961
return 2

‎scripts/owasp_agent_adversarial_batch_run.py‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,7 @@ def main() -> int:
8282
log.flush()
8383
print(done, end="", flush=True)
8484
t = batch_end + 1
85-
log.write(
86-
f"ALL_BATCHES_DONE {time.strftime('%H:%M:%S', time.gmtime())}\n"
87-
)
85+
log.write(f"ALL_BATCHES_DONE {time.strftime('%H:%M:%S', time.gmtime())}\n")
8886
log.flush()
8987
print("ALL_BATCHES_DONE", flush=True)
9088
return 0

‎scripts/owasp_agent_embed_meta.py‎

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,9 @@
2323

2424

2525
def _db_url() -> str:
26-
raw = (
27-
(os.environ.get("DATABASE_URL") or "").strip()
28-
or (os.environ.get("DEV_DATABASE_URL") or "").strip()
29-
)
26+
raw = (os.environ.get("DATABASE_URL") or "").strip() or (
27+
os.environ.get("DEV_DATABASE_URL") or ""
28+
).strip()
3029
if not raw:
3130
raise SystemExit("DATABASE_URL / DEV_DATABASE_URL required")
3231
try:

‎scripts/owasp_agent_synth_eval.py‎

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -175,10 +175,9 @@ def ask_completion_inprocess(
175175
os.environ["NO_LOGIN"] = "1"
176176
os.environ.setdefault("OWASP_AGENT_ENABLED", "1")
177177
# Prefer Postgres URL from the container env for SQLAlchemy (psycopg2 pin).
178-
db_url = (
179-
(os.environ.get("DATABASE_URL") or "").strip()
180-
or (os.environ.get("DEV_DATABASE_URL") or "").strip()
181-
)
178+
db_url = (os.environ.get("DATABASE_URL") or "").strip() or (
179+
os.environ.get("DEV_DATABASE_URL") or ""
180+
).strip()
182181
if db_url and not (os.environ.get("SQLALCHEMY_DATABASE_URI") or "").strip():
183182
try:
184183
from application.utils.postgres_url import (

0 commit comments

Comments
 (0)