app.source_config

Validation of the sources section of catalog.yaml.

Part of the configuration loader (app.catalog_config, which re-exports the public names). Common registration fields are validated here; type-specific settings are handed to the source type registry (app.sources.registry). Push tokens are resolved from env var names and kept as pydantic.SecretStr; the stored config is secret-free (secret-looking keys are redacted defensively).

Public API: NonEmptyStr, ConfigProblem, ConfigContext, SourceRegistration, parse_sources().

type app.source_config.NonEmptyStr = Annotated[str, StringConstraints(strip_whitespace=True, to_upper=None, to_lower=None, strict=None, min_length=1, max_length=None, pattern=None, ascii_only=None)]

A string that is not blank (surrounding whitespace stripped).

class app.source_config.ConfigProblem(severity, location, message)

Bases: object

One configuration finding.

Parameters:
  • severity (Severity) – error (something is disabled) or warning.

  • location (str) – Where in the file, e.g. sources[1] (central).

  • message (str) – Readable, secret-free description.

severity: Severity
location: str
message: str
class app.source_config.SourceRegistration(*, id, type, position, config, enabled, config_error=None, config_error_code=None, path='doc/decisions', published_ref='', intake=frozenset({}), push_tokens=(), binding=None, warnings=())

Bases: object

One configured source registration.

Parameters:
  • id (str) – Stable registration id.

  • type (str) – Source type name.

  • position (int) – Index in the configuration (ownership order).

  • config (JsonObject) – Non-secret settings as stored in the database.

  • enabled (bool) – False when the entry is invalid.

  • config_error (str | None) – Why the entry is disabled.

  • config_error_code (ConfigErrorCode | None) – Stable code of config_error.

  • path (str) – ADR path inside each project.

  • published_ref (str) – Configured published ref.

  • intake (frozenset[IntakeKind]) – Enabled intake mechanisms.

  • push_tokens (tuple[SecretStr, ...]) – Resolved CI push tokens (never logged).

  • binding (SourceBinding | None) – Adapter factory; None when disabled.

  • warnings (tuple[str, ...]) – Non-fatal findings for this registration.

id: str
type: str
position: int
config: JsonObject
enabled: bool
config_error: str | None
config_error_code: ConfigErrorCode | None
path: str
published_ref: str
intake: frozenset[IntakeKind]
push_tokens: tuple[SecretStr, ...]
binding: SourceBinding | None
warnings: tuple[str, ...]
property pollable: bool

Tell whether polling may run for this registration.

Returns:

True if enabled with poll intake.

to_storage()

Convert to the value synced into source_registration.

Return type:

RegistrationConfig

Returns:

The registration config (no secrets).

class app.source_config.ConfigContext(env, registry, base_dir, problems=list())

Bases: object

Shared state while parsing one file.

Parameters:
  • env (Mapping[str, str]) – Environment used to resolve secret env var names.

  • registry (SourceTypeRegistry) – Source type registry.

  • base_dir (Path) – Directory for relative paths in source settings.

  • problems (list[ConfigProblem]) – Findings collected so far.

env: Mapping[str, str]
registry: SourceTypeRegistry
base_dir: Path
problems: list[ConfigProblem]
error(location, message)

Record an error.

Parameters:
  • location (str) – Where in the file.

  • message (str) – Description.

Return type:

None

warning(location, message)

Record a warning.

Parameters:
  • location (str) – Where in the file.

  • message (str) – Description.

Return type:

None

app.source_config.parse_sources(raw, ctx)

Validate the sources section.

Entries without a usable or with a duplicate id are reported and skipped; invalid entries become disabled registrations.

Parameters:
Return type:

tuple[SourceRegistration, ...]

Returns:

Registrations in file order.