DiscoveryController

class DiscoveryController(store: PropositionStore, projectionRecordStore: ProjectionRecordStore, collectorRunner: CollectorRunner)

Opt-in REST surface exposing the discovery operations over OpenAPI-discoverable endpoints, all returning only the leak-free discovery DTOs.

This controller is NOT component-scanned: it activates only when imported via DiceRestConfiguration AND a PropositionStore bean is present (the same opt-in pattern the other DICE controllers use). It rides the existing optional Spring MVC dependency and adds no new dependency of its own — a consumer's own springdoc generates the OpenAPI spec from the plain @RestController and the leak-free DTOs.

Every operation is scoped by the {contextId} path variable: a per-request RetrievalRouter is built with that context so a caller can never read across contexts and can never override the context from a request body. Result size and traversal depth are clamped by the router.

Parameters

store

the backing proposition store; its declared fragments determine native mode support

projectionRecordStore

the inverse projection index summarized into per-target health

collectorRunner

the mark-and-sweep runner invoked in non-mutating dry-run mode

Constructors

Link copied to clipboard
constructor(store: PropositionStore, projectionRecordStore: ProjectionRecordStore, collectorRunner: CollectorRunner)

Functions

Link copied to clipboard
fun collectorDryRun(contextId: String): <Error class: unknown class><CollectorDryRunDto>

Preview what the maintenance collector would mark and sweep, without mutating anything.

Link copied to clipboard
fun handleFailure(e: Exception): <Error class: unknown class><Map<String, String>>

Sanitize any failure from a live store/driver (timeouts, query errors) into a generic 500. The cause is logged server-side; the response body carries only a fixed message so internal or driver detail never leaks to the caller, regardless of the consumer's global error config.

Link copied to clipboard
fun path(contextId: String, from: String, to: String): <Error class: unknown class><List<PathDto>>

Find how two entities are connected, as leak-free path summaries.

Link copied to clipboard
fun projectionHealth(contextId: String): <Error class: unknown class><ProjectionHealthDto>

Per-target projection lifecycle counts. Pure read; mutates nothing.

Link copied to clipboard
fun query(contextId: String, request: DiscoveryQuery): <Error class: unknown class><DiscoveryResult>

Retrieve propositions via a chosen retrieval mode. The context comes from the path only; the request body's mode/text/entity/window/bounds are honoured, never a context override.

Link copied to clipboard
fun why(contextId: String, propositionId: String): <Error class: unknown class><LineageDto>

Explain why a stored fact holds; 404 when the proposition id is unknown.