Skip to content

Commit d6a9a1c

Browse files
Remove stale search mode deprecation deadline (#130)
* Remove stale search mode deprecation deadline * Clarify deprecated search mode aliases
1 parent e50fc08 commit d6a9a1c

2 files changed

Lines changed: 24 additions & 23 deletions

File tree

parallel_web_tools/cli/commands.py

Lines changed: 13 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1088,19 +1088,13 @@ def memory_clear(memory_scope_key: str | None, confirm_clear: bool, output_json:
10881088
# Search Command
10891089
# =============================================================================
10901090

1091-
# Search mode translation. V1 accepts turbo/fast/basic/advanced natively; the
1092-
# Beta-only values stay accepted CLI inputs and are translated so existing
1093-
# scripts keep working. Beta's `fast` used to downgrade to basic, but V1 now has
1094-
# a native fast mode of its own, so the name passes through.
1095-
_SEARCH_MODE_MAP = {
1096-
"turbo": "turbo",
1097-
"fast": "fast",
1098-
"basic": "basic",
1099-
"advanced": "advanced",
1091+
# V1 modes are listed first in CLI help; fast is now native and passes through.
1092+
# Beta-only names remain deprecated aliases so existing scripts keep working.
1093+
_SEARCH_MODES = ("turbo", "fast", "basic", "advanced")
1094+
_DEPRECATED_SEARCH_MODE_ALIASES = {
11001095
"one-shot": "basic",
11011096
"agentic": "advanced",
11021097
}
1103-
_DEPRECATED_SEARCH_MODES = {"one-shot", "agentic"}
11041098

11051099

11061100
def _emit_deprecation(message: str) -> None:
@@ -1135,7 +1129,7 @@ def build_search_v1_kwargs(
11351129
if objective:
11361130
kwargs["objective"] = objective
11371131
if mode:
1138-
kwargs["mode"] = _SEARCH_MODE_MAP.get(mode, mode)
1132+
kwargs["mode"] = _DEPRECATED_SEARCH_MODE_ALIASES.get(mode, mode)
11391133
if excerpt_max_chars_total is not None:
11401134
kwargs["max_chars_total"] = excerpt_max_chars_total
11411135
if session_id:
@@ -1165,10 +1159,12 @@ def build_search_v1_kwargs(
11651159
@click.option("-q", "--query", multiple=True, help="Keyword search query (can be repeated)")
11661160
@click.option(
11671161
"--mode",
1168-
type=click.Choice(list(_SEARCH_MODE_MAP.keys())),
1162+
type=click.Choice([*_SEARCH_MODES, *_DEPRECATED_SEARCH_MODE_ALIASES]),
11691163
default="basic",
1170-
help="Search mode: turbo (fastest), fast (high quality within ~1s), basic, "
1171-
"or advanced (highest quality; one-shot → basic, agentic → advanced)",
1164+
help=(
1165+
"Search mode: turbo (fastest), fast (high quality within ~1s), basic, "
1166+
"or advanced (highest quality). Deprecated aliases: one-shot → basic, agentic → advanced"
1167+
),
11721168
show_default=True,
11731169
)
11741170
@click.option("--max-results", type=int, help="Maximum results (defaults to server-side default of 10)")
@@ -1222,12 +1218,9 @@ def search(
12221218
if not objective and not query:
12231219
raise click.UsageError("Provide an OBJECTIVE argument or at least one --query option.")
12241220

1225-
if mode in _DEPRECATED_SEARCH_MODES:
1226-
new_mode = _SEARCH_MODE_MAP[mode]
1227-
_emit_deprecation(
1228-
f"--mode {mode} is a Beta value and will stop working after the Beta API sunset (June 2026). "
1229-
f"Use --mode {new_mode} instead."
1230-
)
1221+
if mode in _DEPRECATED_SEARCH_MODE_ALIASES:
1222+
new_mode = _DEPRECATED_SEARCH_MODE_ALIASES[mode]
1223+
_emit_deprecation(f"--mode {mode} is a deprecated alias. Use --mode {new_mode} instead.")
12311224

12321225
source_policy: dict[str, Any] = {}
12331226
if include_domains:

tests/test_cli.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -358,6 +358,13 @@ def test_search_help_shows_comma_separated(self, runner):
358358
assert "--exclude-domains" in result.output
359359
assert "comma-separated" in result.output
360360

361+
def test_search_help_prioritizes_native_modes(self, runner):
362+
"""Should list V1-native modes before deprecated aliases."""
363+
result = runner.invoke(main, ["search", "--help"])
364+
assert result.exit_code == 0
365+
assert "--mode [turbo|fast|basic|advanced|one-shot|agentic]" in result.output
366+
assert "Deprecated aliases" in result.output
367+
361368
def test_search_no_args(self, runner):
362369
"""Should error without objective or query."""
363370
result = runner.invoke(main, ["search"])
@@ -1620,9 +1627,9 @@ def test_deprecated_modes_emit_warning_to_stderr(self, runner, mock_cli_client,
16201627
)
16211628

16221629
assert result.exit_code == 0
1623-
assert "[deprecated]" in result.stderr
1624-
assert deprecated_mode in result.stderr
1625-
assert expected_new in result.stderr
1630+
assert result.stderr.strip() == (
1631+
f"[deprecated] --mode {deprecated_mode} is a deprecated alias. Use --mode {expected_new} instead."
1632+
)
16261633
# JSON stdout must remain clean
16271634
json.loads(result.stdout)
16281635
# SDK call uses translated mode
@@ -1640,6 +1647,7 @@ def test_new_modes_do_not_emit_warning(self, runner, mock_cli_client, new_mode):
16401647

16411648
assert result.exit_code == 0
16421649
assert "[deprecated]" not in result.stderr
1650+
assert mock_cli_client.search.call_args.kwargs["mode"] == new_mode
16431651

16441652

16451653
class TestExtractDeprecationWarnings:

0 commit comments

Comments
 (0)