Documentation
¶
Overview ¶
Package staleness decides whether a section's content is withheld: verified older than its doc_type threshold AND making claims that rot (code paths, symbols). The advisory-vs-guarded split is deliberate — "function X at Y:Z" claims actively mislead when stale, plain learnings don't.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrGuarded = errors.New("section requires verification")
ErrGuarded signals the caller must pass force_read or verify-then-mark before reading.
Functions ¶
func ExtractVerifyHints ¶
ExtractVerifyHints returns up to `max` unique matched code paths for a verification hint.
func MentionsCodePath ¶
MentionsCodePath reports whether content references a code path likely to rot.
Types ¶
type CheckResult ¶
type CheckResult struct {
Stale bool // verified_at is older than threshold (advisory)
Guarded bool // Stale AND mentions code path — server should refuse content
ThresholdDays int
Age time.Duration
}
CheckResult describes what to do with a section relative to staleness.
func Check ¶
func Check(ctx context.Context, store *ThresholdStore, section models.Section, docType string) (CheckResult, error)
Check evaluates whether a section is guarded. NULL verified_at is treated as verified at creation (migration backfills legacy rows; model default handles new).
type ThresholdStore ¶
type ThresholdStore struct {
// contains filtered or unexported fields
}
ThresholdStore loads and caches staleness thresholds (5-min TTL to avoid a DB hit per search).
func NewThresholdStore ¶
func NewThresholdStore(db *gorm.DB) *ThresholdStore
NewThresholdStore returns a threshold cache backed by `db`.
func (*ThresholdStore) DaysFor ¶
DaysFor returns the day threshold for a doc_type, falling back to the reference threshold. Cached.
func (*ThresholdStore) Invalidate ¶
func (s *ThresholdStore) Invalidate()
Invalidate forces a reload on the next lookup (for admin tools that change thresholds).