Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion agents/conductors/cortex/_cortex.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ def find_script(root: Path) -> Path | None:
"""The `scripts/cortex.py` that governs the tree at `root`: in the root,
then its ancestors (a fixture tree lives inside its checkout), then the
resolved checkout — the schema that reads a tree is the one beside it."""
for candidate in (root, *root.resolve().parents):
for candidate in (root, *root.absolute().parents):
script = candidate / "scripts" / "cortex.py"
if script.is_file():
return script
Expand Down
22 changes: 22 additions & 0 deletions tests/test_cortex_conductor.py
Original file line number Diff line number Diff line change
Expand Up @@ -771,6 +771,28 @@ def test_root_resolution_order(tmp_path, monkeypatch):
assert _cortex.resolve_root().name == "PyAutoCortex"


def test_a_fixture_tree_finds_the_schema_its_checkout_ships(skeleton):
"""A data root need not be a checkout: the fixture has no `scripts/`, and
the script that governs it is the one shipped beside it."""
assert (skeleton / "scripts").exists() is False
assert _cortex.find_script(skeleton) == cortex_root() / "scripts" / "cortex.py"


def test_find_script_walks_the_symlinked_path_not_the_resolved_one(tmp_path):
"""A bundle worktree links `PyAutoCortex` to the canonical checkout: the
script found for a tree under the link is named under the link, so it
compares equal to the checkout the caller resolved (#471)."""
real = tmp_path / "real"
(real / "scripts").mkdir(parents=True)
(real / "scripts" / "cortex.py").write_text("", encoding="utf-8")
(real / "tests" / "fixtures" / "skeleton").mkdir(parents=True)
wt = tmp_path / "wt"
wt.mkdir()
(wt / "PyAutoCortex").symlink_to(real, target_is_directory=True)
tree = wt / "PyAutoCortex" / "tests" / "fixtures" / "skeleton"
assert _cortex.find_script(tree) == wt / "PyAutoCortex" / "scripts" / "cortex.py"


def test_the_conductor_is_mind_free_and_names_no_instance_path():
src = CONDUCTOR.read_text(encoding="utf-8")
assert not re.search(r"^(?:from|import) _(?:intake|sizing)\b", src, re.M)
Expand Down
Loading