Artifact cbfeedfdfd3c6933fb233c959055e823cc85f46bba235039a42b9203064c36db:
- File
internal/content/cone_reference_projection.go
— part of check-in
[a3c6ddef9a]
at
2026-10-21 01:03:53
on branch feat/submanifest-reader
— fix(content): bound and prune sparse reference facts
Use metadata preflight and fixed-size inflation for ordinary reference discovery too. Bound artifacts, parser cards, stored bytes and declared expansions before payload and parser allocations. Preserve unknown retention for corrupt compression.
Retain only classification fields and structural identities, copying kept tokens so discarded wiki/forum bodies, cluster inventories and metadata cannot be pinned. Compare empty and large-body fixtures and reject oversized expansion reservations. (user: [email protected], size: 1410) [annotate] [blame] [check-ins using] [more...]
package content import ( "strings" "github.com/danmestas/go-libfossil/internal/deck" ) // referenceDeck is a classification projection, not a serializable artifact. // In particular, W bodies and M inventories must die with the parser's result; // retaining one complete deck per wiki/forum/cluster scales with irrelevant // content instead of with the facts used by classification. func referenceDeck(d *deck.Deck) *deck.Deck { if d == nil { panic("content.referenceDeck: nil deck") } // Copy retained tokens so a substring cannot pin a discarded large card. for i := range d.F { d.F[i] = deck.FileCard{Name: strings.Clone(d.F[i].Name), UUID: strings.Clone(d.F[i].UUID)} } for i := range d.S { d.S[i] = deck.SubmanifestCard{Name: strings.Clone(d.S[i].Name), UUID: strings.Clone(d.S[i].UUID)} } for i := range d.P { d.P[i] = strings.Clone(d.P[i]) } for i := range d.Q { d.Q[i] = deck.CherryPick{ Target: strings.Clone(d.Q[i].Target), Baseline: strings.Clone(d.Q[i].Baseline), } } for i := range d.T { d.T[i] = deck.TagCard{UUID: strings.Clone(d.T[i].UUID)} } var attachment *deck.AttachmentCard if d.A != nil && d.A.Source != "" { attachment = &deck.AttachmentCard{Source: strings.Clone(d.A.Source)} } *d = deck.Deck{Type: d.Type, A: attachment, B: strings.Clone(d.B), F: d.F, G: strings.Clone(d.G), I: strings.Clone(d.I), P: d.P, Q: d.Q, S: d.S, T: d.T} return d }