DriftSweepCapable

The store-side operations a host needs to act on a drift check: find the propositions a schema change could have stranded, quarantine them, and let them back out again.

Why this is a separate interface

A PropositionStore is a general persistence port, and most of what it offers — read everything, read one context, save — is enough to look like a sweep while being wrong at any real size. Sweeping by reading every proposition materialises every tenant's data in one JVM heap and filters mention types afterwards, which works on a laptop and falls over in production. So the sweep asks for something narrower and states it as a requirement: a query bounded by a page size, confined to one context, and filtered on mention type by the backend.

A store implements this when its backend can honour that, exactly the way DICE's other opt-in store capabilities work. A store that can't keeps the plain persistence contract and its host sweeps through PropositionStoreDriftSweep, the reference implementation, which is honest about doing the filtering in the JVM.

Nothing calls this on its own

DICE runs drift checks. It never sweeps. DriftCheckRunner reports what it found and moves nothing, and every method here runs because a host called it, at a moment a host chose. There is no timer, no scheduler and no autoconfiguration that reaches these methods.

The usual shape is: run a check, read its DriftCheckResult.quarantineDiff, decide, then call sweep once per context you meant to reconcile, then — and only after every context is done — call SweptBaselineStore.markSwept so the next check compares against what you actually swept.

val result = runner.run()
if (result.hasAnyChange) {
val swept = sweepStore.sweep(result.quarantineDiff, policy, contextId)
log.info("quarantined {} proposition(s)", swept.quarantined.size)
}

Releasing is a real operation

Quarantine is reversible, and releaseFromQuarantine is the only thing that reverses it. PropositionStatus.QUARANTINED is a status of its own that every lifecycle policy in DICE leaves alone, so a quarantined proposition stays put until a host says otherwise: no decay sweep revives it, no consolidation pass moves it, and editing its metadata by hand changes nothing. Release restores the status the proposition carried before quarantine and clears both quarantine keys in one write.

Inheritors

Types

Link copied to clipboard
object Companion

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.

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

The propositions in contextId that could be affected by a schema change, restricted to those mentioning at least one type in mentionTypes.

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

Let a quarantined proposition back out: restore the status it carried before quarantine and clear its quarantine metadata, in one write.

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.