Skip to content

Build AI methods with your coding agent, then run them anywhere: as an MCP for chatbots, as a webapp for people, or via API for your software.

Answer the #1124 review threads: ensure the gitignore on the nothing-to-migrate return too

Louis Choquel75782475514c
diff --git a/.badges/tests.json b/.badges/tests.json
index 13eb9eb7b..204d9fc21 100644
--- a/.badges/tests.json
+++ b/.badges/tests.json
@@ -1,7 +1,7 @@
{
"schemaVersion": 1,
"label": "tests",
- "message": "10522",
+ "message": "10524",
"color": "blue",
"cacheSeconds": 300
}
\ No newline at end of file
diff --git a/.drift/acks/cli-docs.toml b/.drift/acks/cli-docs.toml
index 7bb5f4ba9..d463c9ec3 100644
--- a/.drift/acks/cli-docs.toml
+++ b/.drift/acks/cli-docs.toml
@@ -1,8 +1,8 @@
contract = "cli-docs"
-digest = "sha256:c9397a992e49ffb14028f68fde3587b3127f88f7928519a75c0f0f9eabc7312f"
-reviewed_by = "Claude (Opus 5 (1M context))"
-reviewed_at = "2026-08-18T14:03:11Z"
-rationale = "pipelex migrate now ensures the config-directory .gitignore on its clean early-return path, so the reach of that file changed and the account in docs/tools/cli/migrate.md was stale by omission: it read as any real migrate, when the write pass was in fact the only site, which excluded exactly the machines that have nothing to migrate. Extended that paragraph to say the rule lands on a run that finds nothing to carry forward, and that a declined migration still writes nothing. init.md needed no edit since the pipelex init path is untouched. Re-derived the agent-CLI claims from the code rather than from the previous ack: agent_migrate_cmd passes dry_run = not yes into migrate_config_directories and the ensure sits under if not dry_run, so the migrate row claim that it writes only with --yes still holds, and the new write is neither reported nor rendered, so the migrate report-contract line is unchanged. Also re-checked the claim that doctor --fix runs the same run: doctor reaches migrate_config_directories with dry_run False through apply_pending_migrations, so that stays true for the pending-migration case the sentence describes."
+digest = "sha256:75a2007c7886c8f2afa15bfa27aca73e6963371f23eb12f6a463620c9da6d609"
+reviewed_by = "Louis Choquel"
+reviewed_at = "2026-08-18T14:31:50Z"
+rationale = "pipelex migrate now ensures the config-directory .gitignore on its nothing-to-migrate return as well as its clean one, so the reach of that file changed again. Reviewed docs/tools/cli/migrate.md and found its gitignore paragraph needs no edit -- but not because nothing moved: the sentence 'you get it from any run that is allowed to write, including one that finds nothing to migrate' was already written as a universal, and it was false in exactly one reachable case that this same page devotes a section to, namely a run whose files are all blocked (When it cannot do the whole job). The code moved to meet the claim rather than the claim being weakened, so the page and the command now agree where they previously contradicted each other. Enumerated the real runs to check the universal is now exhaustive: clean writes it, all-blocked writes it, a migration you decline deliberately does not because 'nothing was written' has to stay true of the whole directory, and a run that applies writes it through migrate_config_directories. init.md needed no edit since the pipelex init path is untouched and its create-if-absent sentence still holds. Re-derived the agent-CLI claims from the code rather than from my own previous ack: agent_migrate_cmd has no early return at all, it calls migrate_config_directories with dry_run = not yes, so the new call site is unreachable from that command and the migrate row claim that it writes only with --yes is unaffected; the new write is neither reported nor rendered, so the migrate report-contract line at the top of that file is unchanged too. The doctor row reaches the dry-run scan only, so it is unaffected as well."
[trigger_files]
"pipelex/cli/__init__.py" = "blob:8b137891791fe96927ad78e64b0aad7bded08bdc"
@@ -105,7 +105,7 @@ rationale = "pipelex migrate now ensures the config-directory .gitignore on its
"pipelex/cli/commands/init/ui/types.py" = "blob:1361f29ca95bacc90bca90ea6c0e39f44b6734ab"
"pipelex/cli/commands/login/__init__.py" = "blob:e69de29bb2d1d6434b8b29ae775ad8c2e48c5391"
"pipelex/cli/commands/login/command.py" = "blob:ace1db9879626cc1722adaac12761aadaa6b24ed"
-"pipelex/cli/commands/migrate_cmd.py" = "blob:da0a6e4d2f4f730ec27a084f0a013debe10217b0"
+"pipelex/cli/commands/migrate_cmd.py" = "blob:897f9cbf93acace8f61091a9924895f0fda76443"
"pipelex/cli/commands/plugins_cmd.py" = "blob:9657b713c3650ff4a929e92ae68af453d896393e"
"pipelex/cli/commands/resolve_cmd.py" = "blob:2928a0e26eab7983367a59a78533f6618817feba"
"pipelex/cli/commands/run/__init__.py" = "blob:e69de29bb2d1d6434b8b29ae775ad8c2e48c5391"
diff --git a/.test_durations b/.test_durations
index 8ebbd9023..8d347c5ec 100644
--- a/.test_durations
+++ b/.test_durations
@@ -2457,7 +2457,9 @@
"tests/unit/pipelex/cli/test_method_resolver.py::TestResolveMethodTarget::test_resolve_method_target_dispatches_to_local_path": 0.0982,
"tests/unit/pipelex/cli/test_method_resolver.py::TestResolveMethodTarget::test_resolve_method_target_dispatches_to_url": 0.0026,
"tests/unit/pipelex/cli/test_migrate_cmd_gitignore.py::TestTheCommandEnsuresTheGitignore::test_a_declined_migration_still_writes_nothing": 0.6871,
+ "tests/unit/pipelex/cli/test_migrate_cmd_gitignore.py::TestTheCommandEnsuresTheGitignore::test_a_dry_run_over_a_blocked_machine_writes_nothing": 0.6139,
"tests/unit/pipelex/cli/test_migrate_cmd_gitignore.py::TestTheCommandEnsuresTheGitignore::test_a_dry_run_over_a_clean_machine_writes_nothing": 0.6738,
+ "tests/unit/pipelex/cli/test_migrate_cmd_gitignore.py::TestTheCommandEnsuresTheGitignore::test_a_machine_where_nothing_can_be_migrated_still_gets_the_rule": 0.6148,
"tests/unit/pipelex/cli/test_migrate_cmd_gitignore.py::TestTheCommandEnsuresTheGitignore::test_a_machine_with_nothing_to_migrate_still_gets_the_rule": 0.6718,
"tests/unit/pipelex/cli/test_migrate_cmd_summary.py::TestTheCancelPath::test_cancelling_leaves_the_files_alone_and_exits_clean_when_nothing_needs_a_person": 0.0276,
"tests/unit/pipelex/cli/test_migrate_cmd_summary.py::TestTheCancelPath::test_cancelling_still_exits_non_zero_when_the_rehearsal_left_something_for_a_person": 0.1282,
diff --git a/pipelex/cli/commands/migrate_cmd.py b/pipelex/cli/commands/migrate_cmd.py
index da0a6e4d2..897f9cbf9 100644
--- a/pipelex/cli/commands/migrate_cmd.py
+++ b/pipelex/cli/commands/migrate_cmd.py
@@ -92,6 +92,11 @@ def migrate_cmd(*, dry_run: bool = False, yes: bool = False) -> None:
return
if not rehearsal.changed_plans:
+ # The clean return's twin, and it needs the rule for the same reason: `--dry-run` has
+ # already returned above, so this run is authorized to write, and nothing was declined
+ # because nothing was asked. Unguarded on purpose — the guard would be dead code, and it
+ # is that ordering rather than a condition that a test downstairs pins.
+ ensure_config_dir_gitignores(config_dirs=config_dirs)
# Nothing this tool can do, and something for the user to do. Asking "apply these changes?"
# when there are none to apply is a prompt with one honest answer.
console.print(_panel(message="Nothing here can be migrated automatically — see the notes above.", style="yellow"))
diff --git a/tests/unit/pipelex/cli/test_migrate_cmd_gitignore.py b/tests/unit/pipelex/cli/test_migrate_cmd_gitignore.py
index bad56308d..e6b9aa419 100644
--- a/tests/unit/pipelex/cli/test_migrate_cmd_gitignore.py
+++ b/tests/unit/pipelex/cli/test_migrate_cmd_gitignore.py
@@ -46,6 +46,21 @@ def clean_machine(tmp_path: Path, mocker: MockerFixture) -> Path:
return config_dir
+def blocked_machine(tmp_path: Path, mocker: MockerFixture) -> Path:
+ """One configuration directory the ledger cannot act on at all.
+
+ An unparseable file is blocked as a whole, so its plan carries a `blocked_reason` and no steps:
+ the report is *not* clean, and yet nothing changed, which is the pair of conditions that sends
+ the command down its second early return.
+ """
+ config_dir = tmp_path / ".pipelex"
+ config_dir.mkdir()
+ (config_dir / "telemetry.toml").write_text("this is = = not toml\n", encoding="utf-8")
+ mocker.patch.object(migrate_cmd_module, "config_directories_to_migrate", return_value=[config_dir])
+ return config_dir
+
+
class TestTheCommandEnsuresTheGitignore:
def test_a_machine_with_nothing_to_migrate_still_gets_the_rule(self, clean_machine: Path, console: Console) -> None:
migrate_cmd(yes=True)
@@ -80,3 +95,32 @@ class TestTheCommandEnsuresTheGitignore:
assert "cancelled" in console.export_text().lower()
assert not (config_dir / CONFIG_DIR_GITIGNORE_NAME).exists()
+
+ def test_a_machine_where_nothing_can_be_migrated_still_gets_the_rule(self, blocked_machine: Path, console: Console) -> None:
+ """The clean path's twin: no question was put to the user, and the run is allowed to write.
+
+ A file the tool cannot process leaves the rehearsal not clean and yet with nothing to carry
+ forward, so the run returns before the write pass exactly as a clean one does. Nothing was
+ declined here — there was nothing to decline — so the directory gets its rule.
+ """
+ with pytest.raises(SystemExit) as exit_info:
+ migrate_cmd()
+
+ assert exit_info.value.code == 1
+ # Pins that this went down the nothing-to-migrate return and not the clean one above it.
+ assert "migrated automatically" in console.export_text()
+ assert (blocked_machine / CONFIG_DIR_GITIGNORE_NAME).is_file()
+
+ def test_a_dry_run_over_a_blocked_machine_writes_nothing(self, blocked_machine: Path, console: Console) -> None:
+ """What earns the absence of a `not dry_run` guard on the return above.
+
+ The rule is ensured there unguarded because `--dry-run` has already returned by then. That
+ is an ordering, not a condition, and an ordering is only as safe as the test that pins it:
+ this one reddens the moment the call is hoisted above the dry-run return.
+ """
+ with pytest.raises(SystemExit) as exit_info:
+ migrate_cmd(dry_run=True)
+
+ assert exit_info.value.code == 1
+ assert "nothing was written" in console.export_text().lower()
+ assert not (blocked_machine / CONFIG_DIR_GITIGNORE_NAME).exists()