corvix.enrichment

Notification enrichment package.

Submodules

Classes

EnrichmentContext

Per-cycle request budget and URL cache shared across all pipeline providers.

EnrichmentProvider

Provider that attaches optional contextual data to a Notification.

JsonFetchClient

Client capability required by data-enrichment pipelines.

EnrichmentEngine

Runs configured enrichment providers over notifications.

EnrichmentRunResult

Result of enriching one poll cycle.

GitHubLatestCommentProvider

Enriches comment notifications with the latest comment metadata.

GitHubPRStateProvider

Enriches pull-request notifications with state metadata.

Package Contents

class corvix.enrichment.EnrichmentContext[source]

Bases: corvix.pipeline.base.RequestContext

Per-cycle request budget and URL cache shared across all pipeline providers.

A single PipelineContext is created per PipelineEngine.run() call and passed to every provider, so that URL responses cached by a field-completion provider are visible to subsequent context providers in the same cycle.

get_json(client: corvix.pipeline.base.JsonFetchClient, url: str, timeout_seconds: float) corvix.types.JsonValue[source]

Fetch and cache a JSON payload; raises if the request budget is exhausted.

class corvix.enrichment.EnrichmentProvider[source]

Bases: Protocol

Provider that attaches optional contextual data to a Notification.

Context providers return a mapping that is merged under the provider’s name namespace in context.

name: str[source]
enrich(_notification: corvix.domain.Notification, _client: corvix.pipeline.base.JsonFetchClient, _ctx: PipelineContext, /) dict[str, object][source]

Return a mapping of context data to attach under this provider’s namespace.

class corvix.enrichment.JsonFetchClient[source][source]

Bases: Protocol

Client capability required by data-enrichment pipelines.

api_base_url: str[source]

Trusted base URL of the upstream API (e.g. https://api.github.com).

Providers use this to construct upstream API URLs from trusted config rather than from data received in API responses, which prevents SSRF taint flows.

fetch_json_url(url: str, timeout_seconds: float = 30.0) corvix.types.JsonValue[source][source]

Fetch JSON from a fully-qualified API URL.

class corvix.enrichment.EnrichmentEngine[source][source]

Runs configured enrichment providers over notifications.

Deprecated since version Prefer: corvix.pipeline.engine.PipelineEngine directly. This class is a thin wrapper maintained for backward compatibility.

config: corvix.config.EnrichmentConfig[source]
providers: list[corvix.enrichment.base.EnrichmentProvider][source]
run(notifications: list[corvix.domain.Notification], client: corvix.pipeline.base.JsonFetchClient, clients_by_account: dict[str, corvix.pipeline.base.JsonFetchClient] | None = None) EnrichmentRunResult[source][source]

Run enabled providers for all notifications in one cycle.

class corvix.enrichment.EnrichmentRunResult[source][source]

Result of enriching one poll cycle.

contexts_by_notification_key: dict[str, dict[str, object]][source]
errors: list[str] = [][source]
property contexts_by_thread_id: dict[str, dict[str, object]][source]

Backward-compatible thread-keyed view of contexts.

class corvix.enrichment.GitHubLatestCommentProvider[source][source]

Enriches comment notifications with the latest comment metadata.

timeout_seconds: float = 10.0[source]
name: str = 'github.latest_comment'[source]
enrich(notification: corvix.domain.Notification, client: corvix.enrichment.base.JsonFetchClient, ctx: corvix.enrichment.base.EnrichmentContext) dict[str, object][source][source]

Return latest comment metadata under the provider namespace.

class corvix.enrichment.GitHubPRStateProvider[source][source]

Enriches pull-request notifications with state metadata.

timeout_seconds: float = 10.0[source]
name: str = 'github.pr_state'[source]
enrich(notification: corvix.domain.Notification, client: corvix.enrichment.base.JsonFetchClient, ctx: corvix.enrichment.base.EnrichmentContext) dict[str, object][source][source]

Return pull-request state metadata under the provider namespace.