Skip to content

Commit 83b4b68

Browse files
committed
fix(ci): seal 13th fix-forward — ruff-format 4 files + test_w803 verdict accept
CI on f13935f failed on: 1. ruff format check — cmd_dark_matter.py, cmd_duplicates.py, cmd_laws.py, test_w937_no_mojibake_em_dashes.py needed format normalization from W805 Pattern-2 disclosure work in the 12th fix-forward. 2. test_w803::test_n1_empty_corpus_text_mode assertion drift — wave-1 A's W805 fix changed the empty-corpus verdict to "no symbols to analyze (corpus empty; ...)" but the test still asserted the legacy 3-token set. Extended the allowed-token tuple to accept the new verdict shape while keeping the legacy tokens for back-compat with any sibling detector that hasn't migrated.
1 parent f13935f commit 83b4b68

5 files changed

Lines changed: 17 additions & 16 deletions

File tree

src/roam/commands/cmd_dark_matter.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -308,9 +308,7 @@ def dark_matter(ctx, limit, min_npmi, min_cochanges, explain, category, persist)
308308
cochange_count: int
309309
if total == 0:
310310
try:
311-
cochange_count = conn.execute(
312-
"SELECT COUNT(*) FROM git_cochange"
313-
).fetchone()[0]
311+
cochange_count = conn.execute("SELECT COUNT(*) FROM git_cochange").fetchone()[0]
314312
except sqlite3.OperationalError:
315313
cochange_count = 0
316314
else:
@@ -367,9 +365,7 @@ def dark_matter(ctx, limit, min_npmi, min_cochanges, explain, category, persist)
367365
# Mirror that disclosure on the text branch so agents reading
368366
# the verdict line alone get the same lineage signal.
369367
try:
370-
cochange_count = conn.execute(
371-
"SELECT COUNT(*) FROM git_cochange"
372-
).fetchone()[0]
368+
cochange_count = conn.execute("SELECT COUNT(*) FROM git_cochange").fetchone()[0]
373369
except sqlite3.OperationalError:
374370
# git_cochange table missing (older schema) — treat as
375371
# no-cochange state per the loud-fallback rule.

src/roam/commands/cmd_duplicates.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -612,9 +612,9 @@ def duplicates(
612612
# indistinguishable from "scan ran cleanly across 1000 funcs
613613
# and found no clusters". Disclose the absent input state so
614614
# agents see that the detector ran in a degraded mode.
615-
symbol_count = conn.execute(
616-
"SELECT COUNT(*) FROM symbols WHERE kind IN ('function', 'method')"
617-
).fetchone()[0]
615+
symbol_count = conn.execute("SELECT COUNT(*) FROM symbols WHERE kind IN ('function', 'method')").fetchone()[
616+
0
617+
]
618618
if symbol_count == 0:
619619
w805_state = "empty_corpus"
620620
verdict = (

src/roam/commands/cmd_laws.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -302,8 +302,7 @@ def laws_mine(ctx, top, min_confidence, out_path, persist):
302302
symbol_count = _w805_symbol_count_laws
303303
if symbol_count == 0:
304304
verdict = (
305-
"no symbols to analyze (corpus empty; "
306-
"run `roam index --force` to populate the graph before law mining)"
305+
"no symbols to analyze (corpus empty; run `roam index --force` to populate the graph before law mining)"
307306
)
308307
summary = {
309308
"verdict": verdict,

tests/test_w803_n1_empty_corpus.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,13 @@ def test_n1_empty_corpus_text_mode(cli_runner, empty_corpus):
144144
assert result.exit_code == 0
145145
assert "VERDICT:" in result.output
146146
out_lc = result.output.lower()
147-
assert any(token in out_lc for token in ("no implicit n+1", "no n+1", "0 patterns")), (
148-
f"text-mode VERDICT does not disclose empty state: {result.output!r}"
149-
)
147+
assert any(
148+
token in out_lc
149+
for token in (
150+
"no implicit n+1",
151+
"no n+1",
152+
"0 patterns",
153+
"no symbols to analyze",
154+
"corpus empty",
155+
)
156+
), f"text-mode VERDICT does not disclose empty state: {result.output!r}"

tests/test_w937_no_mojibake_em_dashes.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,5 @@ def test_src_roam_has_no_cp1253_mojibake_em_dashes() -> None:
4949
assert hits == [], (
5050
"Found cp1253-mojibake em-dashes (the byte sequence "
5151
f"{_MOJIBAKE_EM_DASH!r} == 'β€”'). Replace with the correct UTF-8 "
52-
"em-dash (— / b'\\xe2\\x80\\x94'). Hits:\n "
53-
+ "\n ".join(f"{p}: {n} occurrences" for p, n in hits)
52+
"em-dash (— / b'\\xe2\\x80\\x94'). Hits:\n " + "\n ".join(f"{p}: {n} occurrences" for p, n in hits)
5453
)

0 commit comments

Comments
 (0)