|
8 | 8 |
|
9 | 9 | import pytest |
10 | 10 |
|
11 | | -pytestmark = pytest.mark.platform_integrations |
| 11 | +pytestmark = [pytest.mark.platform_integrations, pytest.mark.e2e] |
12 | 12 |
|
13 | 13 | _PLUGIN_ROOT = Path(__file__).parent.parent.parent / "platform-integrations/codex/plugins/evolve-lite" |
14 | 14 | SAVE_SCRIPT = _PLUGIN_ROOT / "skills/learn/scripts/save_entities.py" |
@@ -196,14 +196,15 @@ def test_publish_fails_when_public_entity_already_exists(self, temp_project_dir) |
196 | 196 | assert public_path.read_text() == existing_content |
197 | 197 | assert source.exists() |
198 | 198 |
|
199 | | - def test_publish_rejects_path_traversal_in_entity_name(self, temp_project_dir): |
| 199 | + @pytest.mark.parametrize("entity_name", ["../../etc/passwd", "subdir/tip.md", ".", ".."]) |
| 200 | + def test_publish_rejects_invalid_entity_name(self, temp_project_dir, entity_name): |
200 | 201 | guideline_dir = temp_project_dir / ".evolve" / "entities" / "guideline" |
201 | 202 | guideline_dir.mkdir(parents=True) |
202 | 203 | (guideline_dir / "tip.md").write_text("---\ntype: guideline\n---\n\nA tip.\n") |
203 | 204 | result = run_script( |
204 | 205 | PUBLISH_SCRIPT, |
205 | 206 | project_dir=temp_project_dir, |
206 | | - args=["--entity", "../../etc/passwd"], |
| 207 | + args=["--entity", entity_name], |
207 | 208 | evolve_dir=temp_project_dir / ".evolve", |
208 | 209 | expect_success=False, |
209 | 210 | ) |
@@ -390,6 +391,35 @@ def test_sync_skips_invalid_subscription_name(self, temp_project_dir): |
390 | 391 | assert ". (invalid subscription name)" in result.stdout |
391 | 392 | assert not (evolve_dir / "entities" / "subscribed").exists() |
392 | 393 |
|
| 394 | + def test_sync_uses_workspace_config_with_custom_evolve_dir(self, temp_project_dir, local_repo): |
| 395 | + evolve_dir = temp_project_dir / "custom-evolve" |
| 396 | + subscribed_dir = evolve_dir / "subscribed" |
| 397 | + subscribed_dir.mkdir(parents=True) |
| 398 | + subprocess.run( |
| 399 | + ["git", "clone", "--branch", "main", "--depth", "1", str(local_repo["bare"]), str(subscribed_dir / "alice")], |
| 400 | + check=True, |
| 401 | + env=local_repo["env"], |
| 402 | + ) |
| 403 | + (temp_project_dir / "evolve.config.yaml").write_text( |
| 404 | + f'identity:\n user: "alice"\nsubscriptions:\n - name: "alice"\n remote: "{local_repo["bare"]}"\n branch: "main"\n' |
| 405 | + ) |
| 406 | + |
| 407 | + result = run_script( |
| 408 | + SYNC_SCRIPT, |
| 409 | + project_dir=temp_project_dir, |
| 410 | + evolve_dir=evolve_dir, |
| 411 | + expect_success=False, |
| 412 | + ) |
| 413 | + |
| 414 | + assert result.returncode == 0 |
| 415 | + mirrored = evolve_dir / "entities" / "subscribed" / "alice" / "guideline" / "tip-one.md" |
| 416 | + assert mirrored.exists() |
| 417 | + audit_log = evolve_dir / ".evolve" / "audit.log" |
| 418 | + assert audit_log.exists() |
| 419 | + entry = json.loads(audit_log.read_text().strip()) |
| 420 | + assert entry["action"] == "sync" |
| 421 | + assert entry["actor"] == "alice" |
| 422 | + |
393 | 423 | def test_manual_sync_runs_even_when_on_session_start_is_false(self, temp_project_dir, local_repo): |
394 | 424 | evolve_dir = temp_project_dir / ".evolve" |
395 | 425 | run_script( |
|
0 commit comments