Files
wehub-resource-sync a06f331eb8
CI / benchmark (push) Has been skipped
install-script / posix-syntax (push) Successful in 6m1s
CI / build-onnx (push) Failing after 6m43s
init-smoke / dry-run (push) Failing after 15m57s
security / govulncheck (push) Has been cancelled
security / trivy-fs (push) Has been cancelled
CI / test (1.26, ubuntu-latest) (push) Has been cancelled
Scorecard supply-chain security / Scorecard analysis (push) Has been cancelled
CI / test (1.26, macos-latest) (push) Has been cancelled
CI / build-windows (push) Has been cancelled
CI / lint (push) Has been cancelled
install-script / powershell-syntax (push) Has been cancelled
install-script / install (macos-14) (push) Has been cancelled
install-script / install (ubuntu-latest) (push) Has been cancelled
chore: import upstream snapshot with attribution
2026-07-13 12:33:42 +08:00

39 lines
1.6 KiB
Go

package store_sqlite
import (
"iter"
"github.com/zzet/gortex/internal/graph"
)
// Compile-time assertion: *Store serves the fn-value placeholder scan.
var _ graph.FnValuePlaceholderScanner = (*Store)(nil)
// FnValuePlaceholderEdges implements graph.FnValuePlaceholderScanner: it yields
// only the fn-value gate's placeholder edges, the exact inverse of the
// fn-value exclusion EdgesWithUnresolvedTarget applies. The predicate is the
// SAME two-form filter the v2 migration's dedupeFnValuePlaceholderEdges uses:
// the bare `unresolved::fnvalue::` range rides edges_by_to(to_id) (the ':;'
// range end is ':'+1, one past the marker); the multi-repo COPY-rewrite infix
// form is caught by is_unresolved = 1 + LIKE. Full column set incl. meta — the
// gate reads Meta["via"] and the captured fn_value_name off each placeholder.
//
// The whole point is that the gate no longer has to scan the entire
// EdgeReferences kind (placeholders + every real reference) and Go-filter on
// every whole-graph synthesizer pass; it pulls the handful of placeholders
// straight off the index instead.
func (s *Store) FnValuePlaceholderEdges() iter.Seq[*graph.Edge] {
return func(yield func(*graph.Edge) bool) {
out := s.queryEdgesSQL(`
SELECT from_id, to_id, kind, file_path, line, confidence, confidence_label, origin, tier, cross_repo, meta, resolve_terminal, resolve_terminal_reason
FROM edges
WHERE (to_id >= 'unresolved::fnvalue::' AND to_id < 'unresolved::fnvalue:;')
OR (is_unresolved = 1 AND to_id LIKE '%::unresolved::fnvalue::%')`)
for _, e := range out {
if !yield(e) {
return
}
}
}
}