aeat.core._config_storage_route module

Storage route derivation helpers for core settings.

This module implements the public classify_storage_route() and settings_for_active_profile_bucket() facades. It classifies Settings into a StorageRouteClassification whose StorageRouteKind distinguishes explicit database URLs, root-fallback SQLite databases, and active-profile bucket databases.

Application write guards such as inspect_storage_write_policy() consume that route classification rather than re-parsing database URLs.

classify_storage_route_for_settings(settings)[source]

Classify the effective primary SQL route.

Parameters:

settings (Settings) – The Settings instance whose aeat_database_url and aeat_local_storage_root define the route.

Return type:

StorageRouteClassification

Returns:

A StorageRouteClassification carrying the effective StorageRouteKind, database URL, filesystem path when SQLite-backed, and active bucket id when present.

settings_for_bucket_route(bucket_id, source)[source]

Return settings routed to bucket_id’s active-profile database.

Parameters:
  • bucket_id (str) – Active-profile bucket id to embed in the returned Settings.

  • source (Settings) – Source Settings whose non-route fields are preserved.

Return type:

Settings

Returns:

A Settings instance equivalent to source but deriving aeat_database_url from bucket_id.

Raises:

CoreValidationError – When bucket_id is blank or source already carries an explicit database URL.