From d4626b0805144cf5e044822152b1dbead39f96ea Mon Sep 17 00:00:00 2001 From: HarryHe <2496583567@qq.com> Date: Tue, 24 Nov 2026 10:55:21 +0800 Subject: [PATCH 1/2] test: pin default preview versus explicit thread selection R15 found no ambiguity write bug on the current main. These tests pin that an ambiguous CLI/bridge preview carries ambiguity markers but no selection-shaped fields, while an explicit --thread still returns selected_thread and thread_requested. --- CHANGELOG.md | 4 ++++ tests/test_cli_preview.py | 22 +++++++++++++++++++--- tests/test_thread_ambiguity.py | 4 ++++ 3 files changed, 27 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2e48626..c242877 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,10 @@ All notable changes to Voyager are documented here. Format loosely follows - `voyager demo --db PATH` now honours the global database override on either side of the subcommand. The demo seeds exactly the requested index and prints commands pointing at it, instead of silently writing the default `demo.db` under the real home directory. +### Tests + +- Ambiguous WorkThread previews are now pinned to expose `thread_ambiguous`, every candidate and an explicit default reason while carrying neither `selected_thread` nor `thread`; an explicit `--thread` still returns `selected_thread` and `thread_requested`. This documents the existing JSON contract only: no field, Bridge op or schema version changed, and no new user capability was added. + ## [1.6.0] — 2026-11-22 ### Added diff --git a/tests/test_cli_preview.py b/tests/test_cli_preview.py index 6ef131a..5f74962 100644 --- a/tests/test_cli_preview.py +++ b/tests/test_cli_preview.py @@ -66,6 +66,8 @@ def test_preview_json_is_read_only_and_shows_the_selected_work(tmp_path, capsys) assert payload["read_only"] is True assert payload["selected_thread"]["id"] == tid assert payload["selected_thread"]["goal"] == "finish strict=True" + assert payload["thread_requested"] == tid + assert "thread_ambiguous" not in payload assert payload["budget"] == 20000 assert "TODO" in payload["bundle"] assert "pytest -q" in payload["bundle"] @@ -77,9 +79,9 @@ def test_preview_marks_ambiguous_threads_without_pretending_to_choose(tmp_path, db, tid = _fixture(tmp_path) store = Store(db) _seed(store, "codex:b1", "codex", "unrelated task", "done", 3000.0) - store.thread_create(repo_root="E:/proj/demo", title="other work", - goal="unrelated", ) - store.thread_attach(store.thread_find_by_members({"codex:b1"}), "codex:b1") + other = store.thread_create(repo_root="E:/proj/demo", title="other work", + goal="unrelated") + store.thread_attach(other, "codex:b1") store.close() rc = main(["preview", "--db", str(db), "--repo", "E:/proj/demo", "--json"]) @@ -92,6 +94,20 @@ def test_preview_marks_ambiguous_threads_without_pretending_to_choose(tmp_path, assert len(candidates) >= 2 assert "default" in payload["thread_default_reason"] assert "not a choice" in payload["thread_default_reason"] + # A default preview is not an explicit selection. The JSON must not grow a + # selection-shaped field merely because the newest candidate was compiled. + assert "selected_thread" not in payload + assert "thread" not in payload + + # Naming a thread among the candidates is an explicit choice: the ambiguity + # markers disappear and the chooser metadata is added instead. + rc = main(["preview", "--db", str(db), "--repo", "E:/proj/demo", + "--thread", other, "--json"]) + chosen = json.loads(capsys.readouterr().out) + assert rc == 0 + assert chosen["thread_requested"] == other + assert chosen["selected_thread"]["id"] == other + assert "thread_ambiguous" not in chosen def test_preview_human_output_states_that_nothing_was_written(tmp_path, capsys): diff --git a/tests/test_thread_ambiguity.py b/tests/test_thread_ambiguity.py index 0dec436..394ed94 100644 --- a/tests/test_thread_ambiguity.py +++ b/tests/test_thread_ambiguity.py @@ -278,6 +278,10 @@ def test_continue_context_reports_ambiguity(two): assert out["thread_ambiguous"] is True assert len(out["thread_candidates"]) == 2 assert "default" in out["thread_default_reason"] + # The read-only bundle has a default scope, but no field may claim that a + # thread was chosen by the caller. + assert "selected_thread" not in out + assert "thread" not in out def test_continue_context_with_a_bad_thread_is_an_error(two): From 617a67c8f461ff0d9a36f6d4e06770d81685da73 Mon Sep 17 00:00:00 2001 From: HarryHe <2496583567@qq.com> Date: Tue, 24 Nov 2026 11:05:17 +0800 Subject: [PATCH 2/2] docs: use an allowed changelog subsection The Unreleased block only accepts Keep a Changelog headings; Tests was rejected by test_docs.py in CI. --- CHANGELOG.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c242877..63c0d3c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,9 +11,9 @@ All notable changes to Voyager are documented here. Format loosely follows - `voyager demo --db PATH` now honours the global database override on either side of the subcommand. The demo seeds exactly the requested index and prints commands pointing at it, instead of silently writing the default `demo.db` under the real home directory. -### Tests +### Changed -- Ambiguous WorkThread previews are now pinned to expose `thread_ambiguous`, every candidate and an explicit default reason while carrying neither `selected_thread` nor `thread`; an explicit `--thread` still returns `selected_thread` and `thread_requested`. This documents the existing JSON contract only: no field, Bridge op or schema version changed, and no new user capability was added. +- Contract tests now pin ambiguous WorkThread previews to expose `thread_ambiguous`, every candidate and an explicit default reason while carrying neither `selected_thread` nor `thread`; an explicit `--thread` still returns `selected_thread` and `thread_requested`. This documents the existing JSON contract only: no field, Bridge op or schema version changed, and no new user capability was added. ## [1.6.0] — 2026-11-22