From c9dd5a574e24eaba8f05c471a596a5ada17ed793 Mon Sep 17 00:00:00 2001 From: wizardchen Date: Thu, 6 Aug 2026 12:19:12 +0800 Subject: [PATCH] chore(types): pin the gorm column for SearchResult.ContentRevision The merge pipeline treats revision 0 as "never edited", so the field fails open to the position path wherever it is not carried over. Make the column explicit for direct row scans and document the remaining JSON gap. --- internal/types/search.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/internal/types/search.go b/internal/types/search.go index 2f7d9ab1..8d5c4abb 100644 --- a/internal/types/search.go +++ b/internal/types/search.go @@ -211,7 +211,13 @@ type SearchResult struct { // ContentRevision is the chunk edit revision at retrieval time. // Internal only: used by the merge pipeline to decide whether source // coordinates are still trustworthy. - ContentRevision int `json:"-"` + // + // Zero means "never edited", so any construction path that forgets to carry + // it over fails open to the position path. Results rebuilt from JSON (stored + // message references) always land on zero because the field is not + // serialized; the length invariant in chunkTrusted is the remaining guard + // there. Keep the gorm column explicit so direct row scans populate it. + ContentRevision int `gorm:"column:content_revision" json:"-"` } // SearchParams represents the search parameters