semantics update

This commit is contained in:
2026-04-01 15:30:13 +03:00
parent 03d46cb32a
commit ace77ed64c
22 changed files with 438 additions and 299 deletions

View File

@@ -1,12 +1,12 @@
# [DEF:SettingsRouter:Module]
#
# @COMPLEXITY: 4
# @COMPLEXITY: 3
# @SEMANTICS: settings, api, router, fastapi
# @PURPOSE: Provides API endpoints for managing application settings and Superset environments.
# @LAYER: UI (API)
# @PURPOSE: Provides API endpoints for managing application settings and Superset environments.
# @LAYER: API
# @RELATION: [DEPENDS_ON] ->[ConfigManager]
# @RELATION: [DEPENDS_ON] ->[get_config_manager:Function]
# @RELATION: [DEPENDS_ON] ->[has_permission:Function]
# @RELATION: [DEPENDS_ON] ->[get_config_manager]
# @RELATION: [DEPENDS_ON] ->[has_permission]
#
# @INVARIANT: All settings changes must be persisted via ConfigManager.
# @PUBLIC_API: router
@@ -410,25 +410,24 @@ class ConsolidatedSettingsResponse(BaseModel):
# [DEF:get_consolidated_settings:Function]
# @COMPLEXITY: 4
# @PURPOSE: Retrieves all settings categories in a single call
# @PRE: Config manager is available.
# @POST: Returns all consolidated settings.
# @RETURN: ConsolidatedSettingsResponse - All settings categories.
# @PURPOSE: Retrieves all settings categories in a single call.
# @PRE: Config manager is available and the caller holds admin settings read permission.
# @POST: Returns consolidated settings, provider metadata, and persisted notification payload in one stable response.
# @SIDE_EFFECT: Opens one database session to read LLM providers and config-backed notification payload, then closes it.
# @DATA_CONTRACT: Input[ConfigManager] -> Output[ConsolidatedSettingsResponse]
# @RELATION: [DEPENDS_ON] ->[ConfigManager]
# @RELATION: [DEPENDS_ON] ->[LLMProviderService]
# @RELATION: [DEPENDS_ON] ->[AppConfigRecord]
# @RELATION: [DEPENDS_ON] ->[SessionLocal]
# @RELATION: [DEPENDS_ON] ->[has_permission:Function]
# @RELATION: [DEPENDS_ON] ->[normalize_llm_settings:Function]
# @RELATION: [DEPENDS_ON] ->[has_permission]
# @RELATION: [DEPENDS_ON] ->[normalize_llm_settings]
@router.get("/consolidated", response_model=ConsolidatedSettingsResponse)
async def get_consolidated_settings(
config_manager: ConfigManager = Depends(get_config_manager),
_=Depends(has_permission("admin:settings", "READ")),
):
with belief_scope("get_consolidated_settings"):
logger.info(
"[get_consolidated_settings][Entry] Fetching all consolidated settings"
)
logger.reason("Fetching consolidated settings payload")
config = config_manager.get_config()
@@ -465,7 +464,7 @@ async def get_consolidated_settings(
normalized_llm = normalize_llm_settings(config.settings.llm)
return ConsolidatedSettingsResponse(
response_payload = ConsolidatedSettingsResponse(
environments=[env.dict() for env in config.environments],
connections=config.settings.connections,
llm=normalized_llm,
@@ -474,6 +473,14 @@ async def get_consolidated_settings(
storage=config.settings.storage.dict(),
notifications=notifications_payload,
)
logger.reflect(
"Consolidated settings payload assembled",
extra={
"environment_count": len(response_payload.environments),
"provider_count": len(response_payload.llm_providers),
},
)
return response_payload
# [/DEF:get_consolidated_settings:Function]