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