Skip to main content

sanitiseExtraction

@retinue/monorepo


@retinue/monorepo / backend/src / sanitiseExtraction

Function: sanitiseExtraction()

sanitiseExtraction(chunkId, raw): GraphContribution

Defined in: backend/src/knowledge/graph.ts:174

One chunk's raw extraction, turned into rows that can be trusted — or into nothing.

Total: any input produces a valid contribution, possibly empty. That is what makes AC-7 hold everywhere at once rather than at each call site.

The strict part is edges. An extractor routinely names an endpoint it did not extract — a pronoun it resolved, a thing it inferred — and the tempting fix is to create the missing entity. That invents an entity with a provenance nobody asserted, which is the exact failure provenance exists to prevent. So the edge is dropped, and the chunk keeps whatever else it gave us.

Parameters​

chunkId​

string

raw​

RawExtraction

Returns​

GraphContribution