Google Flights MCP, CLI and Python Library
chore: drop internal review-process references from comments and docstrings (#254)
Punit Arani440b11e71ce8
diff --git a/fli-js/tests/integration/search_dates_stubbed.test.ts b/fli-js/tests/integration/search_dates_stubbed.test.tsindex bf3ed2a..3fe18f2 100644--- a/fli-js/tests/integration/search_dates_stubbed.test.ts+++ b/fli-js/tests/integration/search_dates_stubbed.test.ts@@ -463,7 +463,7 @@ describe("SearchDates failure reporting", () => {});});-describe("SearchDates mostly-failed sweeps (T20)", () => {+describe("SearchDates mostly-failed sweeps", () => {// The breaker cannot catch "1 loaded, 29 timeouts": it disarms for good// the moment any page loads, empty or not. If nothing priced and at least// half the attempted dates never made it to a page, that is raised too —diff --git a/fli/cli/commands/dates.py b/fli/cli/commands/dates.pyindex 993c39e..b1fde79 100644--- a/fli/cli/commands/dates.py+++ b/fli/cli/commands/dates.py@@ -555,9 +555,10 @@ def dates(# classify_error's validation_error bucket; or a genuine# AttributeError from an unrelated bug elsewhere in the call stack# -> classify_error's unexpected_error bucket, since it isn't a- # recognized search-client or input-validation failure. T10 fix- # round 2, maintainer ruling U1: previously hardcoded- # "search_error" for both — see the report's "Behaviour changes".+ # recognized search-client or input-validation failure. Previously+ # hardcoded "search_error" for both; now routed through+ # classify_error (#248) so the JSON error_type matches what MCP+ # reports for the same input.if output_format == OutputFormat.JSON:emit_json(build_json_error_response(diff --git a/fli/cli/commands/flights.py b/fli/cli/commands/flights.pyindex 9726848..fcbff2f 100644--- a/fli/cli/commands/flights.py+++ b/fli/cli/commands/flights.py@@ -316,8 +316,9 @@ def _search_flights_core(# or a genuine AttributeError from an unrelated bug elsewhere in the# call stack -> classify_error's unexpected_error bucket, since it# isn't a recognized search-client or input-validation failure.- # T10 fix round 2, maintainer ruling U1: previously hardcoded- # "search_error" for both — see the report's "Behaviour changes".+ # Previously hardcoded "search_error" for both; now routed through+ # classify_error (#248) so the JSON error_type matches what MCP+ # reports for the same input.if output_format == OutputFormat.JSON:emit_json(build_json_error_response(diff --git a/fli/cli/errors.py b/fli/cli/errors.pyindex ce9f3df..4a24f4b 100644--- a/fli/cli/errors.py+++ b/fli/cli/errors.py@@ -106,8 +106,8 @@ def report_cli_error(class JsonErrorPayload:"""Everything a CLI ``--format json`` error path needs, from one classification.- A named structure (rather than a positional tuple) on purpose: T10 fix- round 2 added ``retryable``/``http_status`` alongside the original+ A named structure (rather than a positional tuple) on purpose:+ ``retryable``/``http_status`` were added alongside the original``message``/``error_type``/``log_path`` triple, and a wider tuple wouldhave made every call site's unpacking order a silent trap. Useattribute access (``payload.error_type``, ...) at call sites.@@ -123,8 +123,8 @@ class JsonErrorPayload:def json_error_payload(exc: BaseException, *, command: str | None = None) -> JsonErrorPayload:"""Return the classified JSON-mode error payload for ``exc``.- ``error_type`` (and, since T10 fix round 2, ``retryable``/``http_status``)- come from the shared :func:`fli.core.errors.classify_error` classifier —+ ``error_type`` (and ``retryable``/``http_status``) come from the+ shared :func:`fli.core.errors.classify_error` classifier —the same one ``fli.mcp.server`` uses for MCP tool error responses — so aCLI ``--format json`` error and an MCP error for the same exceptionalways agree. See that module's docstring for the full vocabulary tablediff --git a/tests/cli/test_dates.py b/tests/cli/test_dates.pyindex a5cc12c..1d9f90f 100644--- a/tests/cli/test_dates.py+++ b/tests/cli/test_dates.py@@ -407,13 +407,12 @@ def test_dates_over_the_cap_reports_cleanly(runner, mock_console):def test_dates_over_the_cap_json(runner, mock_console):"""The same cap error is a structured JSON error, not a crash.- T10 fix round 2, maintainer ruling U1: this is a bare ``ValueError``- raised by ``SearchDates.search()`` with no mocking involved — it used- to hit the CLI's ``except (AttributeError, ValueError)`` block and get- hardcoded ``error_type="search_error"``. It's now routed through the- shared classifier and reports ``validation_error`` (deliberate- behaviour change, see the report's "Behaviour changes" section) plus- the new ``retryable`` field.+ This is a bare ``ValueError`` raised by ``SearchDates.search()`` with+ no mocking involved — it used to hit the CLI's+ ``except (AttributeError, ValueError)`` block and get hardcoded+ ``error_type="search_error"``. It's now routed through the shared+ classifier and reports ``validation_error`` (a deliberate behaviour+ change) plus the new ``retryable`` field."""from_date = (datetime.now() + timedelta(days=1)).strftime("%Y-%m-%d")to_date = (datetime.now() + timedelta(days=200)).strftime("%Y-%m-%d")@@ -452,8 +451,8 @@ def test_dates_json_invalid_airport_code(runner, mock_search_dates, mock_console# Released v0.9.0 CLI --format json values — must not move.pytest.param(SearchTimeoutError("slow"), "timeout", True, id="timeout"),pytest.param(SearchConnectionError("no route"), "connection_error", True, id="connection"),- # Fix round 1 (I3): certificate_error is a SearchConnectionError- # subclass but, unlike its parent, deterministic — not retryable.+ # certificate_error is a SearchConnectionError subclass but, unlike+ # its parent, deterministic — not retryable.pytest.param(SearchCertificateError("bad cert"), "certificate_error", False, id="certificate"),@@ -462,10 +461,10 @@ def test_dates_json_invalid_airport_code(runner, mock_search_dates, mock_consoleSearchClientError("generic"), "search_error", False, id="generic-search-error"),pytest.param(RuntimeError("bug"), "unexpected_error", False, id="unexpected"),- # Gained in T10 fix round 2 (U1): a bare AttributeError used to be- # hardcoded to "search_error" by the (AttributeError, ValueError)- # block; it isn't a SearchClientError or input-validation failure,- # so the shared classifier now calls it unexpected_error.+ # A bare AttributeError used to be hardcoded to "search_error" by+ # the (AttributeError, ValueError) block; it isn't a+ # SearchClientError or input-validation failure, so the shared+ # classifier now calls it unexpected_error.pytest.param(AttributeError("'NoneType' object has no attribute 'name'"),"unexpected_error",diff --git a/tests/cli/test_errors.py b/tests/cli/test_errors.pyindex 59c57bc..0a3ce90 100644--- a/tests/cli/test_errors.py+++ b/tests/cli/test_errors.py@@ -64,29 +64,29 @@ def test_write_log_creates_file_with_traceback(tmp_path):"exc, expected_type, expected_retryable",[# Released values (shipped before the shared classifier existed) —- # must stay exactly as they are; see fli/core/errors.py and the- # T10 fix round 2 report's "Behaviour changes" section.+ # must stay exactly as they are; see fli/core/errors.py's+ # vocabulary table.(SearchTimeoutError("timed out"), "timeout", True),(SearchConnectionError("dns"), "connection_error", True),- # Carried forward from PR #164 (T23): a SearchConnectionError+ # Carried forward from PR #164: a SearchConnectionError# subclass, but deterministic — not retryable, unlike its parent.(SearchCertificateError("bad cert"), "certificate_error", False),(SearchHTTPError("403", status_code=403), "http_error", False),(SearchClientError("generic"), "search_error", False),(RuntimeError("boom"), "unexpected_error", False),- # Gained from the shared fli.core.errors.classify_error classifier- # (T10 fix round 1, maintainer ruling V1) — the CLI didn't- # distinguish these from "search_error"/"unexpected_error" before.+ # Gained from the shared fli.core.errors.classify_error classifier —+ # the CLI didn't distinguish these from+ # "search_error"/"unexpected_error" before.(SearchRejectedError(13), "rejected_error", False),(SearchUnsupportedError("multi-city"), "unsupported_error", False),(SearchParseError("no ds:1 payload"), "parse_error", False),(ParseError("unknown airport code 'ZZZ'"), "validation_error", False),- # T10 fix round 2, maintainer ruling U1: these two used to hit the- # CLI commands' hand-rolled `except (AttributeError, ValueError)`- # block and get hardcoded "search_error". Routed through the shared- # classifier here now covers json_error_payload itself; the command- # files' own except blocks are covered in tests/cli/test_flights.py- # and tests/cli/test_dates.py.+ # These two used to hit the CLI commands' hand-rolled+ # `except (AttributeError, ValueError)` block and get hardcoded+ # "search_error". Routed through the shared classifier here now+ # covers json_error_payload itself; the command files' own except+ # blocks are covered in tests/cli/test_flights.py and+ # tests/cli/test_dates.py.(ValueError("bad date range"), "validation_error", False),(AttributeError("'NoneType' object has no attribute 'name'"), "unexpected_error", False),],diff --git a/tests/cli/test_flights.py b/tests/cli/test_flights.pyindex 29ccae7..e272336 100644--- a/tests/cli/test_flights.py+++ b/tests/cli/test_flights.py@@ -349,8 +349,8 @@ def test_flights_json_stubbed_blocked_page(runner, mock_search_flights, mock_con# Released v0.9.0 CLI --format json values — must not move.pytest.param(SearchTimeoutError("slow"), "timeout", True, id="timeout"),pytest.param(SearchConnectionError("no route"), "connection_error", True, id="connection"),- # Fix round 1 (I3): certificate_error is a SearchConnectionError- # subclass but, unlike its parent, deterministic — not retryable.+ # certificate_error is a SearchConnectionError subclass but, unlike+ # its parent, deterministic — not retryable.pytest.param(SearchCertificateError("bad cert"), "certificate_error", False, id="certificate"),@@ -359,9 +359,8 @@ def test_flights_json_stubbed_blocked_page(runner, mock_search_flights, mock_conSearchClientError("generic"), "search_error", False, id="generic-search-error"),pytest.param(RuntimeError("bug"), "unexpected_error", False, id="unexpected"),- # Gained in T10 fix round 2 (U1): a bare ValueError used to be- # hardcoded to "search_error" by the CLI's- # except (AttributeError, ValueError) block — now validation_error.+ # A bare ValueError used to be hardcoded to "search_error" by the+ # CLI's except (AttributeError, ValueError) block — now validation_error.pytest.param(ValueError("simulated bug"), "validation_error", False, id="bare-value-error"),# A bare AttributeError isn't a SearchClientError or an# input-validation failure, so the shared classifier calls itdiff --git a/tests/cli/test_top_n.py b/tests/cli/test_top_n.pyindex 2e164ea..661db59 100644--- a/tests/cli/test_top_n.py+++ b/tests/cli/test_top_n.py@@ -146,12 +146,11 @@ class TestTopNBoundsRejectedByCli:def test_out_of_range_top_n_is_a_clean_error(self, runner, mock_console, bad_top_n):result = runner.invoke(app, _round_trip_args("--top-n", bad_top_n))assert result.exit_code == 1- # Fix round 1 (reviewer I1): assert the specific bound-check wording, not a- # bare "top_n" substring — the _guard_against_network fixture's own+ # Assert the specific bound-check wording, not a bare "top_n"+ # substring — the _guard_against_network fixture's own# AssertionError message ("_fetch_flights should not be reached for a bad- # top_n") also contains "top_n", so a loose check here stayed green even- # with the production bound check fully reverted (see the round-1 report's- # RED->GREEN evidence for this exact test).+ # top_n") also contains "top_n", so a loose check here would stay green+ # even with the production bound check fully reverted.assert "between 1 and 10" in result.output@pytest.mark.parametrize("bad_top_n", ["0", "11"])diff --git a/tests/core/test_error_type_parity.py b/tests/core/test_error_type_parity.pyindex 3b59019..f8549f0 100644--- a/tests/core/test_error_type_parity.py+++ b/tests/core/test_error_type_parity.py@@ -1,6 +1,5 @@"""CLI `--format json` and MCP tools must agree on `error_type` for every exception.-T10 fix round 1, maintainer ruling V1: a review found``fli.cli.errors.json_error_payload`` already emitted an ``error_type``field for the same exceptions with a *different* vocabulary than theMCP tools' first cut. Both now build on the single shared@@ -19,17 +18,17 @@ The ``SearchClientError`` subclass coverage reuses the same— a new subclass shows up in the parametrize list automatically and failshere until ``_INSTANCES`` is updated for it, same as it does there.-T10 fix round 2, maintainer ruling U3: ``TestCliCommandAndMcpToolAgreeOnErrorType``-below extends this to the COMMAND level — a real ``CliRunner`` invocation-of ``fli flights`` / ``fli dates --format json`` compared against the-matching MCP tool executor for the same input. This is the layer where-round 1's parity test could not have caught U1 (the CLI commands'+``TestCliCommandAndMcpToolAgreeOnErrorType`` below extends this to the+COMMAND level — a real ``CliRunner`` invocation of ``fli flights`` /+``fli dates --format json`` compared against the matching MCP tool+executor for the same input. This is the layer where the classifier-level+parity test above could not have caught the CLI commands'``except (AttributeError, ValueError)`` blocks hardcoding``error_type="search_error"`` independently of ``json_error_payload``,-which they never called for that branch).+which they never called for that branch.-T10 fix round 3: every date below is computed relative to-``datetime.now()`` at test-run time — no fixed pinned clock, no hardcoded+Every date below is computed relative to ``datetime.now()`` at test-run+time — no fixed pinned clock, no hardcodedabsolute dates. The original version of this file paired a hardcoded``PINNED_TODAY = "2026-01-01"`` clock with a hardcoded``"2026-02-01"``/``"2026-12-01"`` date-range in@@ -117,7 +116,7 @@ _INSTANCES: dict[type, BaseException] = {ValueError: ValueError("bad date range"),ValidationError: _pydantic_validation_error(),Exception: Exception("totally unclassified"),- # Carried forward from PR #164 (T23): a SearchConnectionError subclass,+ # Carried forward from PR #164: a SearchConnectionError subclass,# but deterministic for a fixed CA bundle — checked separately so CLI# and MCP agree it is certificate_error/not-retryable, not the parent's# connection_error/retryable.@@ -161,7 +160,7 @@ def test_cli_and_mcp_agree_on_error_type(exc, monkeypatch):class TestCliCommandAndMcpToolAgreeOnErrorType:- """Command-level parity (U3): a real CliRunner invocation vs. the MCP executor.+ """Command-level parity: a real CliRunner invocation vs. the MCP executor.``fli.mcp.server.SearchFlights`` / ``SearchDates`` and``fli.cli.commands.flights`` / ``dates``' ``SearchFlights`` / ``SearchDates``@@ -194,10 +193,11 @@ class TestCliCommandAndMcpToolAgreeOnErrorType:def test_date_range_over_93_day_cap(self, runner):"""A >93-date range: bare ValueError -> validation_error on both surfaces.- This is exactly the U1 regression: the CLI's dates command used to- hardcode "search_error" for this bare ValueError while the MCP tool- already said "validation_error" — the drift this whole task exists- to prevent, and the one round 1's parity test (which only compared+ This is exactly the regression the file-level docstring describes:+ the CLI's dates command used to hardcode "search_error" for this+ bare ValueError while the MCP tool already said "validation_error"+ — the drift this whole file exists to prevent, and the+ classifier-level parity test above (which only comparedjson_error_payload against the MCP executor, not the full CLIcommand) could not catch.@@ -205,12 +205,12 @@ class TestCliCommandAndMcpToolAgreeOnErrorType:150 days wide — comfortably over the 93-date cap regardless of whatday this runs. The message assertions are the important part: theyprove this hit SearchDates.search()'s cap ValueError specifically- (the except (AttributeError, ValueError) block — the actual U1 fix+ (the except (AttributeError, ValueError) block — the actual fixsite), not some other validation_error path (e.g. a pydantic "datein the past" check, which is a *different* except block that wasnever broken and would give the same top-level error_type while- testing nothing about U1). A round 3 fix: the original version of- this test used hardcoded "2026-02-01"/"2026-12-01" dates that only+ testing nothing about the regression this guards against). The+ original version of this test used hardcoded "2026-02-01"/"2026-12-01" dates that onlystayed in that intended future window because of a matchinghardcoded pinned clock — a pairing that, if either side ever driftsindependently, silently starts hitting the "in the past" branch@@ -258,7 +258,7 @@ class TestCliCommandAndMcpToolAgreeOnErrorType:assert "in the past" not in mcp_result["error"]def test_top_n_out_of_range(self, runner):- """T12 (issue #142): top_n outside 1-10 -> bare ValueError -> validation_error.+ """Issue #142: top_n outside 1-10 -> bare ValueError -> validation_error.``SearchFlights.search``'s own bound check (``fli/search/flights.py``)raises before any network call, so both the real CLI command and the@@ -299,7 +299,7 @@ class TestCliCommandAndMcpToolAgreeOnErrorType:assert mcp_result["success"] is Falseassert cli_payload["error"]["type"] == mcp_result["error_type"] == "validation_error"assert cli_payload["error"]["retryable"] == mcp_result["retryable"] is False- # Specific bound wording, not a bare "top_n" substring (fix round 1, I1 audit).+ # Specific bound wording, not a bare "top_n" substring.assert "between 1 and 10" in cli_payload["error"]["message"]assert "between 1 and 10" in mcp_result["error"]diff --git a/tests/core/test_errors.py b/tests/core/test_errors.pyindex 52096b2..285a213 100644--- a/tests/core/test_errors.py+++ b/tests/core/test_errors.py@@ -7,11 +7,10 @@ time (see TestEverySearchClientErrorSubclassIsClassified) instead ofhand-listing the classes — a new subclass shows up in the parametrizelist automatically and fails until _EXPECTED is updated for it.-classify_error moved here (from fli/mcp/errors.py) in T10 fix round 1: a-review found fli.cli.errors.json_error_payload already emitted an-error_type field with a different vocabulary for the same exceptions, so-the classifier now lives in fli.core and is shared by both fli.mcp.server-and fli.cli.errors — see fli/core/errors.py's module docstring for the+classify_error moved here (from fli/mcp/errors.py): fli.cli.errors.json_error_payload+already emitted an error_type field with a different vocabulary for the same+exceptions, so the classifier now lives in fli.core and is shared by both+fli.mcp.server and fli.cli.errors — see fli/core/errors.py's module docstring for thefull history and vocabulary table. tests/core/test_error_type_parity.pycovers the "CLI and MCP agree" half of that; this file covers theclassifier itself.diff --git a/tests/mcp/test_error_type_responses.py b/tests/mcp/test_error_type_responses.pyindex 58d115c..5dffa4c 100644--- a/tests/mcp/test_error_type_responses.py+++ b/tests/mcp/test_error_type_responses.py@@ -5,9 +5,9 @@ key (`flights` / `dates` / `options`) must be byte-identical to what theywere before this change — these tests assert the new keys are *added*, notthat the old ones changed.-T10 fix round 3: dates are computed relative to `datetime.now()` at-test-run time rather than pinned to a fixed clock, per the same fix-applied to `tests/core/test_error_type_parity.py` — see that file's+Dates are computed relative to `datetime.now()` at test-run time rather+than pinned to a fixed clock, per the same fix applied to+`tests/core/test_error_type_parity.py` — see that file'sdocstring for why a fixed pinned clock paired with fixed future dates isfragile (it can silently stop exercising the intended code path withoutany test failure to flag it).@@ -56,7 +56,7 @@ def _raiser(exc: BaseException):_SEARCH_CLIENT_ERROR_CASES = [pytest.param(SearchTimeoutError("slow"), "timeout", True, id="timeout"),pytest.param(SearchConnectionError("no route"), "connection_error", True, id="connection"),- # Carried forward from PR #164 (T23): a TLS certificate failure must be+ # Carried forward from PR #164: a TLS certificate failure must be# visible to MCP clients as its own, non-retryable error_type — not# folded into its retryable parent, connection_error.pytest.param(diff --git a/tests/mcp/test_top_n.py b/tests/mcp/test_top_n.pyindex f3341d0..3747550 100644--- a/tests/mcp/test_top_n.py+++ b/tests/mcp/test_top_n.py@@ -132,9 +132,8 @@ class TestTopNBoundsRejectedByMcpTools:``fli.core.errors.classify_error``, the same path the CLI's``--format json`` output goes through.- Fix round 1 (reviewer audit of I1's loose-substring pattern): the bound- check raising before ``_fetch_flights`` is reached is exactly the- behavior under test, not a safe assumption to lean on for test hygiene —+ The bound check raising before ``_fetch_flights`` is reached is exactly+ the behavior under test, not a safe assumption to lean on for test hygiene —an autouse guard makes a reverted bound check fail loudly here insteadof silently making a real network call. The message assertions checkthe specific bound wording ("between 1 and 10"), not a bare "top_n"diff --git a/tests/search/test_client_errors.py b/tests/search/test_client_errors.pyindex 7dbd781..c0d34d3 100644--- a/tests/search/test_client_errors.py+++ b/tests/search/test_client_errors.py@@ -25,7 +25,7 @@ def _clean_ca_bundle_env(monkeypatch):variable(s) they care about — this fixture only guarantees no ambientvalue (e.g. a developer's own ``REQUESTS_CA_BUNDLE``) leaks in.- Fix round 1 (C1) added an equivalent autouse fixture to+ An equivalent autouse fixture was later added to``tests/conftest.py`` that clears the same three variables for the*whole* suite, which makes the delenv calls here mechanicallyredundant. Kept anyway, deliberately: this file's entire subject is@@ -344,7 +344,7 @@ class TestCertificateErrorIsNotRetried:def test_bad_ca_bundle_path_raised_from_session_creation_is_attempted_once_on_get(self, monkeypatch):- """Fix round 1 (M1): the *session-creation* shape, not just the request shape.+ """The *session-creation* shape, not just the request shape.The other tests in this class fake ``_session()`` to return a stubwhose ``.get``/``.post`` raises a curl-level error — that covers adiff --git a/tests/search/test_date_sweep.py b/tests/search/test_date_sweep.pyindex f8d9367..83b7b19 100644--- a/tests/search/test_date_sweep.py+++ b/tests/search/test_date_sweep.py@@ -360,7 +360,7 @@ class TestClientSideFiltersApplyToDates:# ----------------------------------------------------------------------------# Transient pages without a ds:1 payload (fix round 1, F2)+# Transient pages without a ds:1 payload# ---------------------------------------------------------------------------@@ -430,7 +430,7 @@ class TestTransientPageRetry:# ----------------------------------------------------------------------------# Per-date processing must be total (fix round 1, R5)+# Per-date processing must be total# ---------------------------------------------------------------------------@@ -468,7 +468,7 @@ class TestPerDateProcessingIsTotal:# ----------------------------------------------------------------------------# Circuit breaker for a sweep that is failing deterministically (round 2, N4)+# Circuit breaker for a sweep that is failing deterministically# ---------------------------------------------------------------------------@@ -724,7 +724,7 @@ class TestSweepCircuitBreaker:# ----------------------------------------------------------------------------# A sweep that mostly failed to load must not read as "no flights" (T20)+# A sweep that mostly failed to load must not read as "no flights"# ---------------------------------------------------------------------------diff --git a/tests/search/test_top_n.py b/tests/search/test_top_n.pyindex 65a47d8..ca2dc42 100644--- a/tests/search/test_top_n.py+++ b/tests/search/test_top_n.py@@ -47,7 +47,7 @@ def _future(days: int) -> str:def _result(dep: Airport, arr: Airport, hour: int = 9) -> FlightResult:# hour stays well under 24 for every caller below (max 6 + 9 = 15), so a# plain ``hour + 3`` arrival never needs to roll over into the next day.- # Relative to "now" (fix round 1, I3) — this is leg metadata for a+ # Relative to "now" — this is leg metadata for a# fabricated FlightResult, not a search filter's travel_date, but the# file's own rule (never a literal calendar date) still applies to it.departure = (datetime.now() + timedelta(days=35)).replace(@@ -137,16 +137,15 @@ class TestTopNBoundsValidation:class TestTopNTypeValidation:- """Fix round 1, C1/I2: non-int top_n (and bool) must raise ValueError, not TypeError.+ """Non-int top_n (and bool) must raise ValueError, not TypeError.A bare ``if not 1 <= top_n <= 10:`` comparison against a non-comparabletype (``"5"``, ``None``) raises ``TypeError`` from Python itself, which``classify_error()`` does NOT map to ``validation_error`` (it onlymatches ``ValidationError | ValueError``) — so it would have surfaced as``unexpected_error`` instead. ``bool`` is an ``int`` subclass in Python- (``True == 1``), so it silently passed the old bound check too; the- ruling for this fix is to reject it explicitly rather than accept it as- 1.+ (``True == 1``), so it silently passed the old bound check too; this+ rejects it explicitly rather than accepting it as 1."""@pytest.mark.parametrize("bad_top_n", ["5", 5.0, None, True, False])diff --git a/tests/search/test_wire.py b/tests/search/test_wire.pyindex 7c3b36f..97038a0 100644--- a/tests/search/test_wire.py+++ b/tests/search/test_wire.py@@ -250,7 +250,7 @@ def _sparse_boundary_chunks(count: int, spacing: int | None = None) -> str:The same hazard with several regions instead of one. ``spacing``defaults to a third of the body so the *regions* grow with it: at afixed spacing the per-chunk copy is only a constant factor (the- re-reviewer measured 1.2x at 1000 chunks per region, 2.2x at 5000),+ measured 1.2x at 1000 chunks per region, 2.2x at 5000),which no ratio test can see. Only a region that grows with the bodyturns it back into a curve."""@@ -486,7 +486,7 @@ class TestScalesLinearlyOnEveryBodyShape:# A failed decode must cost O(chunk), not O(offset-into-the-body):# ``JSONDecodeError.__init__`` counts the newlines before the error# position, so handing it the whole document once per bad chunk is- # quadratic too. Measured at ~4x per doubling before round 1.+ # quadratic too. Measured at ~4x per doubling before this fix._assert_scales_linearly(_malformed_chunks, (4_000, 8_000, 16_000), "header-framed garbage")def test_crlf_framed_valid_chunks(self):