From c0fa4247c1a7166b90a2e04e7dbcbfdc49c6aa43 Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Mon, 13 Apr 2026 01:54:15 +0000 Subject: [PATCH 1/2] =?UTF-8?q?=F0=9F=A7=AA=20Add=20unit=20tests=20for=20`?= =?UTF-8?q?is=5Fdurable=5Fsignal`=20in=20distill.py?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: masuda-so <258961222+masuda-so@users.noreply.github.com> --- scripts/tests/test_distill.py | 49 +++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 scripts/tests/test_distill.py diff --git a/scripts/tests/test_distill.py b/scripts/tests/test_distill.py new file mode 100644 index 0000000..4bd4466 --- /dev/null +++ b/scripts/tests/test_distill.py @@ -0,0 +1,49 @@ +import pytest +from scripts.distill import is_durable_signal + +@pytest.mark.parametrize( + "line,expected", + [ + # Empty or None + ("", False), + (None, False), + + # Length < 12 + ("short", False), + ("12345678901", False), + + # Starts with # or > [! + ("# A heading", False), + ("> [!info] Some info", False), + ("> [!warning] warning", False), + + # NOISE_RE matches + ("ok ", False), + ("okay.", False), + ("yes!", False), + ("understood!!!", False), + ("わかりました ", False), + + # SHELL_NOISE_RE matches + ("$ python3 script.py", False), + ("❯ git status", False), + ("> cd dir", False), # Assuming > or > is shell noise if it matches the re + ("bash(5.1)$ ", False), + ("Running test: xyz", False), + ("Traceback (most recent call last):", False), + ("Exception: Something went wrong", False), + ("FAIL: test_something", False), + ("OK", False), + ("error: must read the pane correctly", False), + ("[tmux-bridge error]", False), + + # Valid durable signals (Happy paths) + ("123456789012", True), # exactly 12 chars + ("We decided to keep distill.py dry-run and let Claude own writes.", True), + ("Organizing is the practice of linking resources to activities so all work needed for a goal is assigned.", True), + ("This is a valid durable signal that should be captured.", True), + ("Next action: implement tests for distill.py.", True), + ] +) +def test_is_durable_signal(line, expected): + assert is_durable_signal(line) is expected From f49282bf781af5ef6c1e103a229e5030ea5b4c69 Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Mon, 13 Apr 2026 02:09:40 +0000 Subject: [PATCH 2/2] =?UTF-8?q?=F0=9F=A7=AA=20Fix=20`is=5Fdurable=5Fsignal?= =?UTF-8?q?`=20test=20suite=20based=20on=20PR=20comments?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Added `pyproject.toml` to configure `pytest` pythonpath. - Padded test cases intended to test `SHELL_NOISE_RE` so that their length >= 12, ensuring they test the regex instead of the early length return. - Removed the test case for `None` to better respect the type hints. Co-authored-by: masuda-so <258961222+masuda-so@users.noreply.github.com> --- pyproject.toml | 4 ++++ scripts/tests/test_distill.py | 11 +++++------ 2 files changed, 9 insertions(+), 6 deletions(-) create mode 100644 pyproject.toml diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..5a34bea --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,4 @@ +[tool.pytest.ini_options] +pythonpath = [ + "." +] diff --git a/scripts/tests/test_distill.py b/scripts/tests/test_distill.py index 4bd4466..0def9a1 100644 --- a/scripts/tests/test_distill.py +++ b/scripts/tests/test_distill.py @@ -4,9 +4,8 @@ @pytest.mark.parametrize( "line,expected", [ - # Empty or None + # Empty ("", False), - (None, False), # Length < 12 ("short", False), @@ -26,14 +25,14 @@ # SHELL_NOISE_RE matches ("$ python3 script.py", False), - ("❯ git status", False), - ("> cd dir", False), # Assuming > or > is shell noise if it matches the re - ("bash(5.1)$ ", False), + ("❯ git status --short", False), + ("> cd dir --some-long-flag", False), + ("bash(5.1)$ echo hello world", False), ("Running test: xyz", False), ("Traceback (most recent call last):", False), ("Exception: Something went wrong", False), ("FAIL: test_something", False), - ("OK", False), + # OK matches "OK$" in regex so it strictly has to be OK at end, actually OK$ is line-level OK but len(OK) is 2 < 12 so we can't test it passing SHELL_NOISE_RE with length >= 12 easily. I will omit padding OK. ("error: must read the pane correctly", False), ("[tmux-bridge error]", False),