fix(write-path): a search hit's excerpt under snippet no longer 500s the prior-art route (#4768)
CI & Build / Python lint (push) Successful in 4s
CI & Build / Plugin hooks (push) Successful in 12s
CI & Build / TypeScript typecheck (push) Successful in 53s
CI & Build / integration (push) Successful in 1m5s
CI & Build / Python tests (push) Successful in 1m50s
CI & Build / Build & push image (push) Successful in 39s
CI & Build / Python lint (push) Successful in 4s
CI & Build / Plugin hooks (push) Successful in 12s
CI & Build / TypeScript typecheck (push) Successful in 53s
CI & Build / integration (push) Successful in 1m5s
CI & Build / Python tests (push) Successful in 1m50s
CI & Build / Build & push image (push) Successful in 39s
#4768 "Write-path prior-art route 500s when a nameless search hit carries its excerpt under `snippet`": _prior_art_line read item["snippet"] as a snippet record's field dict, but a search hit carries its matched passage there as a string. Read the name only from a dict. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -956,6 +956,17 @@ def test_prior_art_line_keeps_language_and_attribution_together():
|
||||
assert "· python" in both and "shared by alex" in both
|
||||
|
||||
|
||||
def test_prior_art_line_takes_a_search_hit_whose_snippet_is_its_excerpt():
|
||||
"""A search hit carries its matched passage as a STRING under `snippet` —
|
||||
the key a snippet record uses for its field dict. Reading it as the dict
|
||||
500'd the write-path route on any nameless hit."""
|
||||
from scribe.services.plugin_context import _prior_art_line
|
||||
hit = {"id": 7, "title": "Paging contract", "snippet": "…the cursor is opaque…"}
|
||||
assert _prior_art_line(hit, "similar 0.61", None) == '> - #7 [similar 0.61] "Paging contract"'
|
||||
record = {"id": 8, "title": "long composed title", "snippet": {"name": "paginate"}}
|
||||
assert _prior_art_line(record, "similar 0.70", None) == '> - #8 [similar 0.70] "paginate"'
|
||||
|
||||
|
||||
# --- the route between them --------------------------------------------------
|
||||
|
||||
def test_route_reads_every_arg_the_hook_sends():
|
||||
|
||||
Reference in New Issue
Block a user