MCPcopy Create free account
hub / github.com/ByteYellow/AgentProvenance / containing

Method containing

internal/intent/materialize.go:329–350  ·  view source on GitHub ↗

containing returns the most specific (latest-starting) window that both brackets ts AND whose program matches the effect's process comm. The comm gate is what stops a harness background thread (comm=claude/"Bun Pool") from being attributed to an unrelated tool call whose subprocess (comm=cat, python

(createdAt, comm string)

Source from the content-addressed store, hash-verified

327// is what the window is really about. When comm is unknown, no time-window
328// attribution is made -- the effect falls to an honest coverage gap.
329func (w toolCallWindows) containing(createdAt, comm string) (toolCallWindow, bool) {
330 ts, err := time.Parse(time.RFC3339Nano, createdAt)
331 if err != nil || comm == "" {
332 return toolCallWindow{}, false
333 }
334 comm = strings.ToLower(comm)
335 best := -1
336 for i, win := range w {
337 if win.program == "" || win.program != comm {
338 continue
339 }
340 if !ts.Before(win.start) && !ts.After(win.end) {
341 if best == -1 || win.start.After(w[best].start) {
342 best = i
343 }
344 }
345 }
346 if best == -1 {
347 return toolCallWindow{}, false
348 }
349 return w[best], true
350}
351
352// programName returns the lowercased basename of a command's leading token
353// ("cat /a/b" -> "cat", "/usr/bin/python3 x" -> "python3"), for matching against

Callers 2

TestContainingCommGateFunction · 0.95
normalizeEffectsFunction · 0.80

Calls

no outgoing calls

Tested by 1

TestContainingCommGateFunction · 0.76