From fc9c8119a224cf7667710113fdddd00be65ebcee Mon Sep 17 00:00:00 2001 From: Bryan Van Deusen Date: Sun, 26 Jul 2026 18:28:21 -0400 Subject: [PATCH] test(snippets): fix the round-trip test's shared kwargs spread MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Run 2923: 1 failed, 408 passed. My test bug, not a code one — I spread one `fields` dict into both compose_body and compose_data, but compose_body takes no `name` (the name lives in the title). Each serializer now gets its own argument list. The migration itself was fine: the integration lane ran 0001→0070 on pgvector/pg17 green. Co-Authored-By: Claude Opus 5 (1M context) Claude-Session: https://claude.ai/code/session_01RLwAaV4DQEmVyn496HnEvt --- tests/test_services_snippets.py | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/tests/test_services_snippets.py b/tests/test_services_snippets.py index 31ad56f..e6f364b 100644 --- a/tests/test_services_snippets.py +++ b/tests/test_services_snippets.py @@ -228,19 +228,21 @@ def test_snippet_fields_falls_back_to_the_body_when_data_is_absent(): def test_data_and_body_round_trip_to_the_same_fields(): """The two representations must agree — they're written together, and a disagreement would make a snippet read one way and query another.""" - fields = dict(name="debounce", when_to_use="rate-limit a callback", - signature="debounce(fn, ms)", language="ts") + name, when, sig, lang = ("debounce", "rate-limit a callback", + "debounce(fn, ms)", "ts") locs = [{"repo": "web", "path": "src/util.ts", "symbol": "debounce"}] - from_body = s.snippet_fields(_Note( - title=s.compose_title(fields["name"], fields["when_to_use"]), - body=s.compose_body(code="const x = 1", locations=locs, **fields), - tags=s.compose_tags(fields["language"]), - )) + # compose_body takes no `name` — the name lives in the title — so the two + # serializers get their own argument lists rather than a shared spread. + title = s.compose_title(name, when) + body = s.compose_body(code="const x = 1", language=lang, signature=sig, + when_to_use=when, locations=locs) + tags = s.compose_tags(lang) + + from_body = s.snippet_fields(_Note(title=title, body=body, tags=tags)) from_data = s.snippet_fields(_Note( - title=s.compose_title(fields["name"], fields["when_to_use"]), - body=s.compose_body(code="const x = 1", locations=locs, **fields), - tags=s.compose_tags(fields["language"]), - data=s.compose_data(locations=locs, **fields), + title=title, body=body, tags=tags, + data=s.compose_data(name=name, when_to_use=when, signature=sig, + language=lang, locations=locs), )) for key in ("name", "when_to_use", "signature", "language", "locations", "repo", "path", "symbol", "code"):