corvix.ingestion

GitHub notifications ingestion client.

Attributes

Classes

WebUrlEnricher

Resolve web URLs for notifications where the fast path returned None.

GitHubNotificationsClient

Client for GitHub notifications API.

Functions

_as_json_object(→ corvix.types.JsonObject | None)

Return value as a JSON object when it is a dict.

_coerce_json_value(→ corvix.types.JsonValue)

resolve_web_urls(→ None)

Enrich web_url in-place for notifications where the fast path returned None.

_http_error_detail(→ str)

_retry_delay_seconds(→ float)

Module Contents

corvix.ingestion.logger[source][source]
corvix.ingestion._ENRICHABLE_SUBJECT_TYPES: frozenset[str][source][source]
corvix.ingestion._CHECK_SUITE_PATH_SEGMENTS = 5[source][source]
corvix.ingestion._RELEASE_PATH_SEGMENTS = 5[source][source]
corvix.ingestion._as_json_object(value: corvix.types.JsonValue) corvix.types.JsonObject | None[source][source]

Return value as a JSON object when it is a dict.

corvix.ingestion._coerce_json_value(value: object) corvix.types.JsonValue[source][source]
class corvix.ingestion.WebUrlEnricher[source][source]

Bases: Protocol

Resolve web URLs for notifications where the fast path returned None.

enrich_web_url(notification: corvix.domain.Notification) str | None[source][source]

Return a browser URL for the notification, or None if unresolvable.

corvix.ingestion.resolve_web_urls(notifications: list[corvix.domain.Notification], enricher: WebUrlEnricher | None = None) None[source][source]

Enrich web_url in-place for notifications where the fast path returned None.

class corvix.ingestion.GitHubNotificationsClient[source][source]

Client for GitHub notifications API.

token: str[source][source]
api_base_url: str = 'https://api.github.com'[source][source]
account_id: str = 'primary'[source][source]
account_label: str = 'Primary'[source][source]
fetch_notifications(polling: corvix.config.PollingConfig) list[corvix.domain.Notification][source][source]

Fetch notifications with pagination.

_fetch_page(polling: corvix.config.PollingConfig, page: int) list[corvix.types.JsonObject][source][source]
mark_thread_read(thread_id: str) None[source][source]

Mark a notification thread as read.

dismiss_thread(thread_id: str) None[source][source]

Dismiss a notification thread (removes it from inbox permanently).

enrich_web_url(notification: corvix.domain.Notification) str | None[source][source]

Resolve a browser URL via API for notification types the fast path cannot handle.

_resolve_check_suite(subject_url: str, repository: str) str | None[source][source]
_resolve_release(subject_url: str) str | None[source][source]
fetch_json_url(url: str, timeout_seconds: float = 30.0) corvix.types.JsonValue[source][source]

Fetch JSON from a fully-qualified API URL with host validation.

_build_url(path: str, query: dict[str, str]) str[source][source]
_headers() dict[str, str][source][source]
_request_json(url: str, method: str, timeout_seconds: float = 30.0) corvix.types.JsonValue[source][source]
_request_no_content(url: str, method: str) None[source][source]
_request_no_content_with_backoff(url: str, method: str, max_attempts: int = 4) None[source][source]

Perform no-content request with retries for GitHub throttling responses.

_validate_api_host(url: str) None[source][source]
corvix.ingestion._http_error_detail(error: urllib.error.HTTPError) str[source][source]
corvix.ingestion._retry_delay_seconds(error: urllib.error.HTTPError, attempt: int) float[source][source]