Skip to content

Commit 8547599

Browse files
committed
fix(ci): seal 10th fix-forward — migrate 5 fragile-path test offenders to repo_root helper
W588 drift-guard caught 5 tests added this session using `Path(__file__).parents` walk instead of the canonical `tests._helpers.repo_root.repo_root()` (W572). Migrate all 5 mechanically — same `Path(__file__).resolve().parent.parent` → `repo_root()` shape established by W587/W594: - test_sarif_tag_coverage.py:60 - test_w675_example_smells_suppress.py:24 - test_w676_followup_example_files.py:40 - test_compound_recipe_registry.py:85 - test_w1083_followup_adopters.py:156 cli.py count refresh (208→241) is the session baseline, folded in.
1 parent 803b7b1 commit 8547599

6 files changed

Lines changed: 13 additions & 8 deletions

src/roam/cli.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
# Lazy-loading command group: imports command modules only when invoked.
1616
# This avoids importing networkx (~500ms) on every CLI call.
17-
# Total: 208 invokable command names (201 canonical commands + 7 alias names).
17+
# Total: 241 invokable command names (234 canonical commands + 7 alias names).
1818
# If this changes, update README.md, CLAUDE.md, llms-install.md, and docs copy.
1919
# Deprecated commands map to a structured record. When a user invokes a
2020
# deprecated name we still resolve it (no breaking change) and print a

tests/test_compound_recipe_registry.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,9 @@
8282
# lint scoped and gives reviewers a deterministic blast radius for the lint.
8383
# ---------------------------------------------------------------------------
8484

85-
_REPO_ROOT = pathlib.Path(__file__).resolve().parent.parent
85+
from tests._helpers.repo_root import repo_root
86+
87+
_REPO_ROOT = repo_root()
8688
_SRC = _REPO_ROOT / "src" / "roam"
8789

8890
# Modules that issue compound-recipe subprocess / in-process invocations

tests/test_sarif_tag_coverage.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,13 +51,14 @@
5151
import ast
5252
import inspect
5353
import re
54-
from pathlib import Path
54+
55+
from tests._helpers.repo_root import repo_root
5556

5657
# ---------------------------------------------------------------------------
5758
# Source locations the lint scans.
5859
# ---------------------------------------------------------------------------
5960

60-
_REPO_ROOT = Path(__file__).resolve().parent.parent
61+
_REPO_ROOT = repo_root()
6162
_SARIF_PY = _REPO_ROOT / "src" / "roam" / "output" / "sarif.py"
6263
# cmd_*.py modules that define their own SARIF projection rather than
6364
# routing through src/roam/output/sarif.py. The W1062-followup-4 audit

tests/test_w1083_followup_adopters.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,9 +151,9 @@ def test_cmd_math_task_filter_close_match_knobs_documented():
151151
typos). The inline ``W1083-followup`` marker must remain so the
152152
next audit doesn't flag the divergence from the canonical
153153
helper's 0.6/2."""
154-
from pathlib import Path
154+
from tests._helpers.repo_root import repo_root
155155

156-
src = Path(__file__).parent.parent / "src" / "roam" / "commands" / "cmd_math.py"
156+
src = repo_root() / "src" / "roam" / "commands" / "cmd_math.py"
157157
text = src.read_text(encoding="utf-8")
158158
# The call signature stays at the chosen knobs.
159159
assert "n=3, cutoff=0.4" in text

tests/test_w675_example_smells_suppress.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,9 @@
2020
load_smells_suppressions_typed,
2121
)
2222
from roam.policy.suppression_v2 import KindSymbolSuppression
23+
from tests._helpers.repo_root import repo_root
2324

24-
EXAMPLE_PATH = Path(__file__).resolve().parent.parent / "templates" / "examples" / "smells.suppress.yml"
25+
EXAMPLE_PATH = repo_root() / "templates" / "examples" / "smells.suppress.yml"
2526

2627

2728
def _stage_example(tmp_path: Path) -> Path:

tests/test_w676_followup_example_files.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,9 @@
3636
FindingIdSuppression,
3737
RuleFileSuppression,
3838
)
39+
from tests._helpers.repo_root import repo_root
3940

40-
EXAMPLES_DIR = Path(__file__).resolve().parent.parent / "templates" / "examples"
41+
EXAMPLES_DIR = repo_root() / "templates" / "examples"
4142

4243

4344
def test_ignore_findings_example_exists() -> None:

0 commit comments

Comments
 (0)