semantics: complete DEF-to-region migration, fix regressions
- Convert legacy [DEF🆔Type] anchors to #region/#endregion across 329 files
- Reinstate _normalize_timestamp_value in sql_generator.py
- Fix MarkerLogger→logger migration in events.py (molecular CoT markers)
- Fix dataset_review orchestrator dependencies (_build_execution_snapshot)
- Fix config_manager stale-record deletion (moved to save path only)
- Add 77 missing [/DEF:] closers in 5 unbalanced test files
- Update assistant_chat.integration.test.js for #region format
- Apply molecular-cot-logging markers (REASON/REFLECT/EXPLORE) via logger.* methods
This commit is contained in:
@@ -1,12 +1,14 @@
|
||||
# #region backend/src/plugins/llm_analysis/plugin.py [C:3] [TYPE Module] [SEMANTICS plugin, llm, analysis, documentation]
|
||||
# [DEF:backend/src/plugins/llm_analysis/plugin.py:Module]
|
||||
# @COMPLEXITY: 3
|
||||
# @SEMANTICS: plugin, llm, analysis, documentation
|
||||
# @BRIEF Implements DashboardValidationPlugin and DocumentationPlugin.
|
||||
# @LAYER Domain
|
||||
# @INVARIANT All LLM interactions must be executed as asynchronous tasks.
|
||||
# @LAYER: Domain
|
||||
# @RELATION INHERITS -> [PluginBase]
|
||||
# @RELATION CALLS -> [ScreenshotService]
|
||||
# @RELATION CALLS -> [LLMClient]
|
||||
# @RELATION CALLS -> [LLMProviderService]
|
||||
# @RELATION USES -> [TaskContext]
|
||||
# @RELATION USES -> TaskContext
|
||||
# @INVARIANT: All LLM interactions must be executed as asynchronous tasks.
|
||||
|
||||
from typing import Dict, Any, Optional
|
||||
import os
|
||||
@@ -31,8 +33,8 @@ from ...services.llm_prompt_templates import (
|
||||
|
||||
# #region _is_masked_or_invalid_api_key [TYPE Function]
|
||||
# @BRIEF Guards against placeholder or malformed API keys in runtime.
|
||||
# @PRE value may be None.
|
||||
# @POST Returns True when value cannot be used for authenticated provider calls.
|
||||
# @PRE: value may be None.
|
||||
# @POST: Returns True when value cannot be used for authenticated provider calls.
|
||||
def _is_masked_or_invalid_api_key(value: Optional[str]) -> bool:
|
||||
key = (value or "").strip()
|
||||
if not key:
|
||||
@@ -45,8 +47,8 @@ def _is_masked_or_invalid_api_key(value: Optional[str]) -> bool:
|
||||
|
||||
# #region _json_safe_value [TYPE Function]
|
||||
# @BRIEF Recursively normalize payload values for JSON serialization.
|
||||
# @PRE value may be nested dict/list with datetime values.
|
||||
# @POST datetime values are converted to ISO strings.
|
||||
# @PRE: value may be nested dict/list with datetime values.
|
||||
# @POST: datetime values are converted to ISO strings.
|
||||
def _json_safe_value(value: Any):
|
||||
if isinstance(value, datetime):
|
||||
return value.isoformat()
|
||||
@@ -59,7 +61,7 @@ def _json_safe_value(value: Any):
|
||||
|
||||
# #region DashboardValidationPlugin [TYPE Class]
|
||||
# @BRIEF Plugin for automated dashboard health analysis using LLMs.
|
||||
# @RELATION IMPLEMENTS -> [backend.src.core.plugin_base.PluginBase]
|
||||
# @RELATION IMPLEMENTS -> backend.src.core.plugin_base.PluginBase
|
||||
class DashboardValidationPlugin(PluginBase):
|
||||
@property
|
||||
def id(self) -> str:
|
||||
@@ -88,8 +90,8 @@ class DashboardValidationPlugin(PluginBase):
|
||||
"required": ["dashboard_id", "environment_id", "provider_id"]
|
||||
}
|
||||
|
||||
# #region DashboardValidationPlugin.execute [TYPE Function]
|
||||
# @BRIEF Executes the dashboard validation task with TaskContext support.
|
||||
# [DEF:DashboardValidationPlugin.execute:Function]
|
||||
# @PURPOSE: Executes the dashboard validation task with TaskContext support.
|
||||
# @PARAM: params (Dict[str, Any]) - Validation parameters.
|
||||
# @PARAM: context (Optional[TaskContext]) - Task context for logging with source attribution.
|
||||
# @PRE: params contains dashboard_id, environment_id, and provider_id.
|
||||
@@ -317,12 +319,12 @@ class DashboardValidationPlugin(PluginBase):
|
||||
|
||||
finally:
|
||||
db.close()
|
||||
# #endregion DashboardValidationPlugin.execute
|
||||
# [/DEF:DashboardValidationPlugin.execute:Function]
|
||||
# #endregion DashboardValidationPlugin
|
||||
|
||||
# #region DocumentationPlugin [TYPE Class]
|
||||
# @BRIEF Plugin for automated dataset documentation using LLMs.
|
||||
# @RELATION IMPLEMENTS -> [backend.src.core.plugin_base.PluginBase]
|
||||
# @RELATION IMPLEMENTS -> backend.src.core.plugin_base.PluginBase
|
||||
class DocumentationPlugin(PluginBase):
|
||||
@property
|
||||
def id(self) -> str:
|
||||
@@ -351,8 +353,8 @@ class DocumentationPlugin(PluginBase):
|
||||
"required": ["dataset_id", "environment_id", "provider_id"]
|
||||
}
|
||||
|
||||
# #region DocumentationPlugin.execute [TYPE Function]
|
||||
# @BRIEF Executes the dataset documentation task with TaskContext support.
|
||||
# [DEF:DocumentationPlugin.execute:Function]
|
||||
# @PURPOSE: Executes the dataset documentation task with TaskContext support.
|
||||
# @PARAM: params (Dict[str, Any]) - Documentation parameters.
|
||||
# @PARAM: context (Optional[TaskContext]) - Task context for logging with source attribution.
|
||||
# @PRE: params contains dataset_id, environment_id, and provider_id.
|
||||
@@ -473,7 +475,7 @@ class DocumentationPlugin(PluginBase):
|
||||
|
||||
finally:
|
||||
db.close()
|
||||
# #endregion DocumentationPlugin.execute
|
||||
# [/DEF:DocumentationPlugin.execute:Function]
|
||||
# #endregion DocumentationPlugin
|
||||
|
||||
# #endregion backend/src/plugins/llm_analysis/plugin.py
|
||||
# [/DEF:backend/src/plugins/llm_analysis/plugin.py:Module]
|
||||
|
||||
Reference in New Issue
Block a user