PropositionStoreDriftSweep

class PropositionStoreDriftSweep constructor(propositions: PropositionStore, listener: DiceEventListener = DiceEventListener.DEV_NULL) : DriftSweepCapable

The reference DriftSweepCapable: a working sweep over any PropositionStore, and the executable statement of what the contract means.

It is correct for every backend, so a host can sweep on day one, and a durable store can be held to the same suite of tests once it implements DriftSweepCapable natively. It is honest about the cost: a plain PropositionStore can filter by context and nothing else, so this class reads one context's propositions and applies the mention-type filter, the ordering and the page bound in the JVM. The context bound is real — the read never leaves the context, so no other tenant's data is ever materialised — and the rest is the part a backend should push down.

Because it does its own paging over a store read, a context whose propositions change underneath a long sweep can shift between pages. That is inherent to paging a live store, and it is safe here: a proposition the sweep misses is caught by the next check, and one it sees twice comes back as already quarantined.

Parameters

propositions

Where candidates are read from and quarantined copies are saved back to. The base persistence port: a sweep reads by context and saves, so requiring vector search, graph traversal and temporal query alongside would shut a plain store-and-retrieve backend out of drift work over capabilities it never uses.

listener

Told about each real status transition as a PropositionStatusChanged, so a consumer like ProjectionLineageStaleCascade hears about a quarantine, and about a release, without depending on whichever concrete propositions store happens to be wired in. Defaults to a no-op: everything else here holds with nobody listening.

Constructors

Link copied to clipboard
constructor(propositions: PropositionStore, listener: DiceEventListener = DiceEventListener.DEV_NULL)

Functions

Link copied to clipboard

Persist one quarantine decision.

Link copied to clipboard
open fun quarantineCandidates(contextId: <Error class: unknown class>, mentionTypes: Set<String>, limit: Int): List<Proposition>

The same read from the beginning.

open override fun quarantineCandidates(contextId: <Error class: unknown class>, mentionTypes: Set<String>, limit: Int, afterId: String?): List<Proposition>

Reads the one context through PropositionStore.findByContextId, then filters, sorts and pages in the JVM.

Link copied to clipboard
open override fun releaseFromQuarantine(propositionId: String): Proposition?

Restores the status recorded under DriftQuarantineKeys.PREVIOUS_STATUS and drops both quarantine keys in one save.

Link copied to clipboard
open fun sweep(diff: <Error class: unknown class>, policy: DriftQuarantinePolicy, contextId: <Error class: unknown class>, batchSize: Int = DEFAULT_BATCH_SIZE): QuarantineResult

Sweep one context against diff: page through the candidates, evaluate them, and persist every quarantine policy decides on.