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

#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:
2026-10-03 08:39:11 -04:00
co-authored by Claude Opus 5.5
parent 891f375715
commit 1b973ebd13
2 changed files with 15 additions and 1 deletions
+4 -1
View File
@@ -1698,8 +1698,11 @@ def _prior_art_line(item: dict, marker: str, owner: str | None, foreign_lang: st
"""
# The NAME, not the composed title (#4364) — a snippet's title carries its
# whole trigger and ran to kilobytes on this line, again on every repeat.
# `snippet` is a snippet record's field dict — but on a search hit it is
# the matched excerpt, a string, under the same key.
fields = item.get("snippet")
title = (
item.get("name") or (item.get("snippet") or {}).get("name")
item.get("name") or (fields.get("name") if isinstance(fields, dict) else None)
or (item.get("title") or "(untitled)")
).replace("\n", " ").strip()
mark = f"{marker} · {foreign_lang}" if foreign_lang else marker