-
Notifications
You must be signed in to change notification settings - Fork 0
feat: implement auxiliary tool categories -- design, communication, analytics #1152
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
26 commits
Select commit
Hold shift + click to select a range
5ce2ed0
feat: implement auxiliary tool categories -- design, communication, a…
Aureliolo d3073eb
fix: resolve mypy type errors in test fixtures and notification dispa…
Aureliolo 12ced79
fix: add design to event module discovery and new config defaults
Aureliolo b387f95
fix: address review findings -- validation, security, docs, tests
Aureliolo f030b9a
fix: address 21 PR review items from Copilot, Gemini, CodeRabbit, Cod…
Aureliolo e60fac4
fix: add smtp_conn type annotation to satisfy mypy
Aureliolo e05fe23
fix: address 10 additional review items from external reviewers
Aureliolo 799f3e4
fix: address 6 review findings -- logging, test quality, base64 valid…
Aureliolo ac6f0a3
fix: add type annotation for mypy strict mode
Aureliolo 1c4bf6f
fix: add missing logs, test assertions, and parametrize attribute tests
Aureliolo 2254c78
fix: address 13 review findings -- CLAUDE.md brevity, NaN guard, allo…
Aureliolo 50e656b
fix: input validation, DOT fix, format_report guard, from_config tests
Aureliolo 76be6bb
fix: metric action type, generic error messages, bcc privacy, Validat…
Aureliolo 409eac1
fix: generic SMTP error, schema minLength, unit validation, test rename
Aureliolo 0f884c4
fix: generic error messages, validation logging, dimension bounds, te…
Aureliolo 6f3e9f5
fix: tags type filtering, smtp_timeout tests, image validation tests,…
Aureliolo 7309eb3
fix: asset_id type check, defensive tag filtering, provider-not-calle…
Aureliolo 75109eb
fix: use Any type for parametrized kwargs to satisfy mypy
Aureliolo 29421df
fix: query strip, register_asset validation, parametrize enum and max…
Aureliolo 6e36ece
fix: remove unreachable type checks flagged by mypy
Aureliolo ee3d58e
fix: reject whitespace-only asset_id in get and delete handlers
Aureliolo 7e2c0a7
fix: docs VERSION_CONTROL wording, parametrize 6 test files, mock_sen…
Aureliolo c39dbb9
fix: add type args for mypy strict mode
Aureliolo 8871f29
fix: docs category wording, mock assertions, parametrize invalid-inpu…
Aureliolo e78aaf8
fix: date type guard, email header strings, sink call count, template…
Aureliolo 9c89c82
fix: add negative assertions for backend-gated tools in from_config t…
Aureliolo File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| """Design tool event constants.""" | ||
|
|
||
| from typing import Final | ||
|
|
||
| # Image generation | ||
| DESIGN_IMAGE_GENERATION_START: Final[str] = "design.image.generation_start" | ||
| DESIGN_IMAGE_GENERATION_SUCCESS: Final[str] = "design.image.generation_success" | ||
| DESIGN_IMAGE_GENERATION_FAILED: Final[str] = "design.image.generation_failed" | ||
| DESIGN_IMAGE_GENERATION_TIMEOUT: Final[str] = "design.image.generation_timeout" | ||
|
|
||
| # Diagram generation | ||
| DESIGN_DIAGRAM_GENERATION_START: Final[str] = "design.diagram.generation_start" | ||
| DESIGN_DIAGRAM_GENERATION_SUCCESS: Final[str] = "design.diagram.generation_success" | ||
| DESIGN_DIAGRAM_GENERATION_FAILED: Final[str] = "design.diagram.generation_failed" | ||
|
|
||
| # Asset management | ||
| DESIGN_ASSET_STORED: Final[str] = "design.asset.stored" | ||
| DESIGN_ASSET_RETRIEVED: Final[str] = "design.asset.retrieved" | ||
| DESIGN_ASSET_DELETED: Final[str] = "design.asset.deleted" | ||
| DESIGN_ASSET_LISTED: Final[str] = "design.asset.listed" | ||
| DESIGN_ASSET_SEARCHED: Final[str] = "design.asset.searched" | ||
| DESIGN_ASSET_VALIDATION_FAILED: Final[str] = "design.asset.validation_failed" | ||
|
|
||
| # Provider | ||
| DESIGN_PROVIDER_NOT_CONFIGURED: Final[str] = "design.provider.not_configured" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| """Built-in analytics tools for data aggregation, reporting, and metrics.""" | ||
|
|
||
| from synthorg.tools.analytics.base_analytics_tool import BaseAnalyticsTool | ||
| from synthorg.tools.analytics.config import AnalyticsToolsConfig | ||
| from synthorg.tools.analytics.data_aggregator import ( | ||
| AnalyticsProvider, | ||
| DataAggregatorTool, | ||
| ) | ||
| from synthorg.tools.analytics.metric_collector import ( | ||
| MetricCollectorTool, | ||
| MetricSink, | ||
| ) | ||
| from synthorg.tools.analytics.report_generator import ReportGeneratorTool | ||
|
|
||
| __all__ = [ | ||
| "AnalyticsProvider", | ||
| "AnalyticsToolsConfig", | ||
| "BaseAnalyticsTool", | ||
| "DataAggregatorTool", | ||
| "MetricCollectorTool", | ||
| "MetricSink", | ||
| "ReportGeneratorTool", | ||
| ] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,67 @@ | ||
| """Base class for analytics tools. | ||
|
|
||
| Provides the common ``ToolCategory.ANALYTICS`` category, a | ||
| shared configuration reference, and a metric-name validation | ||
| helper. | ||
| """ | ||
|
|
||
| from abc import ABC | ||
| from typing import Any | ||
|
|
||
| from synthorg.core.enums import ToolCategory | ||
| from synthorg.tools.analytics.config import AnalyticsToolsConfig | ||
| from synthorg.tools.base import BaseTool | ||
|
|
||
|
|
||
| class BaseAnalyticsTool(BaseTool, ABC): | ||
| """Abstract base for all analytics tools. | ||
|
|
||
| Sets ``category=ToolCategory.ANALYTICS`` and holds a shared | ||
| ``AnalyticsToolsConfig``. | ||
| """ | ||
|
|
||
| def __init__( | ||
| self, | ||
| *, | ||
| name: str, | ||
| description: str = "", | ||
| parameters_schema: dict[str, Any] | None = None, | ||
| action_type: str | None = None, | ||
| config: AnalyticsToolsConfig | None = None, | ||
| ) -> None: | ||
| """Initialize an analytics tool with configuration. | ||
|
|
||
| Args: | ||
| name: Tool name. | ||
| description: Human-readable description. | ||
| parameters_schema: JSON Schema for tool parameters. | ||
| action_type: Security action type override. | ||
| config: Analytics tool configuration. | ||
| """ | ||
| super().__init__( | ||
| name=name, | ||
| description=description, | ||
| category=ToolCategory.ANALYTICS, | ||
| parameters_schema=parameters_schema, | ||
| action_type=action_type, | ||
| ) | ||
| self._config = config or AnalyticsToolsConfig() | ||
|
|
||
| @property | ||
| def config(self) -> AnalyticsToolsConfig: | ||
| """The analytics tool configuration.""" | ||
| return self._config | ||
|
|
||
| def _is_metric_allowed(self, metric_name: str) -> bool: | ||
| """Check if a metric name is allowed by the whitelist. | ||
|
|
||
| Args: | ||
| metric_name: Name of the metric to check. | ||
|
|
||
| Returns: | ||
| ``True`` if the metric is allowed (or no whitelist | ||
| is configured). | ||
| """ | ||
| if self._config.allowed_metrics is None: | ||
| return True | ||
| return metric_name in self._config.allowed_metrics | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add required module logger initialization.
This business-logic module should initialize the standard module logger.
♻️ Proposed fix
As per coding guidelines:
src/synthorg/**/*.py: Every Python module with business logic MUST importfrom synthorg.observability import get_loggerand definelogger = get_logger(__name__).🤖 Prompt for AI Agents