From 98382929852b213f8dc8b1ba720cc0d1861159b6 Mon Sep 17 00:00:00 2001 From: Craig Jennings Date: Tue, 26 May 2026 01:56:14 -0500 Subject: fix(inbox-send): preserve dots in copied filenames send_file ran filenames through slugify(), which flattens dots to hyphens. That corrupts the engine.plugin.org plugin-namespace convention: triage-intake.personal-gmail.org arrived as triage-intake-personal-gmail.org, which breaks the engine's triage-intake.*.org glob and the routing that depends on the first dot. I added slugify_filename() for filename stems. It keeps dots, hyphens, underscores, and case, collapses only whitespace runs to hyphens, and truncates on a separator boundary. The prose --text path still uses slugify(). --- .ai/scripts/tests/test_inbox_send.py | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to '.ai/scripts/tests') diff --git a/.ai/scripts/tests/test_inbox_send.py b/.ai/scripts/tests/test_inbox_send.py index 597a7e9..a0094dc 100644 --- a/.ai/scripts/tests/test_inbox_send.py +++ b/.ai/scripts/tests/test_inbox_send.py @@ -248,6 +248,34 @@ class TestInboxSendFile: files = list((tmp_path / "projects" / "target" / "inbox").iterdir()) assert "branching-strategy-notes" in files[0].name + def test_inbox_send_file_preserves_dots_in_basename(self, project_root, run_script, tmp_path): + """Boundary: a dotted stem keeps its dots — the engine.plugin.org plugin namespace must survive transit.""" + project_root("target") + cwd = project_root("source") + src = tmp_path / "triage-intake.personal-gmail.org" + src.write_text("plugin") + run_script( + ["target", "--file", str(src)], + cwd=cwd, roots=[tmp_path / "projects"], + ) + files = list((tmp_path / "projects" / "target" / "inbox").iterdir()) + assert len(files) == 1 + assert _slug_from(files, "source") == "triage-intake.personal-gmail" + assert files[0].suffix == ".org" + + def test_inbox_send_file_spaces_become_hyphens(self, project_root, run_script, tmp_path): + """Normal: whitespace in a filename stem still collapses to hyphens; dots are what's preserved, not spaces.""" + project_root("target") + cwd = project_root("source") + src = tmp_path / "meeting notes draft.org" + src.write_text("x") + run_script( + ["target", "--file", str(src)], + cwd=cwd, roots=[tmp_path / "projects"], + ) + files = list((tmp_path / "projects" / "target" / "inbox").iterdir()) + assert _slug_from(files, "source") == "meeting-notes-draft" + def test_inbox_send_file_name_override(self, project_root, run_script, tmp_path): """Normal: --name overrides the basename-derived slug; extension preserved.""" project_root("target") -- cgit v1.2.3