Stop the source-fact drilldown fanning out per pinned value
ci/woodpecker/pr/build Pipeline was successful
ci/woodpecker/pr/test Pipeline was successful
ci/woodpecker/pr/pre-commit Pipeline was canceled

The <value> path segment is client-supplied and reached a full unfiltered
/facts fan-out, keyed per value, so every distinct value was a fresh
whole-estate query and a fresh cache entry.

- validate <value> against the configured backend names, answering [] with
  no fan-out when it names none
- key the drilldown's fetch on the fact name alone and apply <value> to the
  shared record set, so all values share one entry and one fan-out
- report every configured backend on the no-fan-out empty response, which is
  complete rather than partial
This commit is contained in:
2026-09-06 16:51:00 +10:00
parent b6e190f1f2
commit abf565b0f6
4 changed files with 153 additions and 16 deletions
+12
View File
@@ -96,6 +96,18 @@ func (cb *countingBackend) hitCount(path string) int {
return cb.hits[path]
}
// totalHits counts requests across every path, so a test can assert a route
// reached no backend at all.
func (cb *countingBackend) totalHits() int {
cb.mu.Lock()
defer cb.mu.Unlock()
n := 0
for _, c := range cb.hits {
n += c
}
return n
}
func (cb *countingBackend) setFail(v bool) {
cb.mu.Lock()
defer cb.mu.Unlock()