Repository navigation
refactor(tests): share one make_dir_link from kiro_crew.testing.links - #15060
Conversation
First Principles Review (Fable 5) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS Verify one Windows CI lane ran green on this head: only there does the shared helper's real junction arm run — the new unit test fakes What this change shipsInventory (6 items) — 6 justifiedIntent: one shared
[FIRST-PRINCIPLES-REVIEWED] fa20bc9 Description read[DESCRIPTION-READ] 7c428813576d38d40f5e1a9f39702b3420d5de60de1ef484bd0b85181b9481fe That sha256 names the PR description this verdict read. Recompute it with |
GPT 5.6 Review — ✅ no blocking findingsGPT 5.6 completed its review of This comment is updated in place on each push. Review detailsNo findings. False positive or not applicable? A repository writer can comment: |
Design Review (Fable 5) — ✅ PASSDesign-level review of Design-Verdict: PASS Confirm a Windows CI lane ran green on this PR, since local verification was Linux-only and the junction arm only executes there. [DESIGN-REVIEWED] fa20bc9 Description read[DESCRIPTION-READ] fd594098fb195c3c42a7dbebcb15dbad1b172cba6a4bc8924d59d2c6179b7ed9 That sha256 names everything this verdict read: the PR description, plus the 1 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with |
Opus 5 Review — ✅ no blocking findingsReviewed Verdict parsed from the review's SHA-scoped output markers for commit False positive or not applicable? A repository writer can comment: |
4365829 to
d3068fc
Compare
d3068fc to
281e9a4
Compare
281e9a4 to
16663a9
Compare
Four private copies of the junction-staging helper (test/conftest.py plus mirrors in the auto_improvement, code_review_sage and design_critique app tests) collapse into kiro_crew.testing.links.make_dir_link. The conftest re-exports it, so its 57 importers are unchanged. Behaviour is identical: unconditional CreateJunction on Windows, a directory symlink elsewhere. Closes #10494
16663a9 to
fa20bc9
Compare
Problem / Motivation
Goal: Tests that stage a Windows directory junction share one
make_dir_linkhelper instead of four private copies.The junction-staging helper exists four times on main: the canonical
make_dir_linkintest/conftest.py, and a private_make_dir_linkmirror in each of the auto_improvement (test_pollute.py), code_review_sage (test_followup.py) and design_critique (test_backend_routes.py) app test packages. The mirrors exist because the app-embedded test packages undersrc/kiro_crew/apps/builtinsnever seetest/conftest.py. Issue #10494 was filed with three copies; PR #14595 added the fourth.Why it matters
The four copies already drift in shape (a
type: ignore, a module-levelgetattrblock, differing docstrings). A fix to one, such as the rule that the Windows arm must stay an unconditionalCreateJunctionrather thansymlink_or_junction, does not reach the others, so a Developer-Mode runner could silently test the symlink arm in one copy while still reporting green.Not a goal
make_escaping_linkand the ad-hoc inlineCreateJunctioncalls in other test files stay as they are.What changed (motivation → approach → change)
Four copies of one test helper → give it a home both test trees can import → move it to
kiro_crew.testing(src/kiro_crew/testing/links.py), the package that already ships test utilities in the runtime wheel and is importable fromtest/and the app trees alike.make_dir_link(link, target)keeps the conftest docstring and the "deliberately notplatform_compat.symlink_or_junction" rationale. On Windows it calls_winapi.CreateJunctionunconditionally, withimport _winapifunction-local so POSIX collection works, and looks it up withgetattrso mypy stays clean on Linux. Elsewhere it islink.symlink_to(target, target_is_directory=True). Behaviour is identical to every copy it replaces.test/conftest.pynow re-exports it, so its 57from conftest import make_dir_linkimporters are unchanged. The three app mirrors are deleted and import the shared helper as_make_dir_link; design_critique also drops its module-level_winapi/_create_junctionblock, which only that mirror used. Thekiro_crew/testing/__init__.pydocstring lists the new module, anddocs/system-specs/common/testing-conventions.mdsays where the helper lives.Backwards compatibility
Compatible:
from conftest import make_dir_linkstill resolves, and every call site keeps its name and signature.kiro_crew.testing.links.make_dir_linkis a new public name in the wheel.Tests
test/test_testing_links.pypins both arms of the new helper on any platform, so the Coverage Gate seeslinks.pyat 100% on Linux:IS_WINDOWSforced on and a fake_winapi, callsCreateJunction(target, link)and nothing else.Run locally on Linux, all green: the three app test files,
test/test_workflows_store_restore.pyandtest/test_workflows_run_identity.py(conftest importers), andtest/test_coverage_omit_contract.py. mypy is clean on the new module and the three app test files. The Windows CI lanes exercise the real junction arm.Manual verification
N/A — unit coverage sufficient: the helper has no runtime caller, only tests.
Related Issues
Closes #10494
Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)