docs: add DomainBaseModel API reference and CI template DB changelog entry #2608

Merged
freemo merged 2 commits from docs/update-domain-base-model-api-and-ci-changelog-2026-04-03 into master 2026-04-03 20:41:23 +00:00
2 changed files with 59 additions and 0 deletions
+9
View File
@@ -77,6 +77,15 @@ The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
previously duplicated across 14 domain model classes. This is a pure
structural refactor with no behavioral changes. (#1941)
- **CI — Pre-migrated database template extended to all test suites**: The
`slow_integration_tests` and `e2e_tests` nox sessions now call
`_create_template_db()` and set `CLEVERAGENTS_TEMPLATE_DB` before running,
matching the fast-path DB copy already used by `unit_tests`, `integration_tests`,
and `coverage_report`. `slow_integration_tests` is also upgraded from `robot` to
`pabot` for parallel Robot Framework execution, consistent with `integration_tests`.
This eliminates redundant Alembic migrations across all test suites and reduces
total test suite wall-clock time. (#2334)
### Fixed
- **CLI — `agents actor add` rich output**: The `actor add` command now renders
+50
View File
@@ -6,6 +6,56 @@ the entire CleverAgents platform.
---
## Domain Base Model
**Module:** `cleveragents.domain.models.base`
### `DomainBaseModel`
```python
from cleveragents.domain.models.base import DomainBaseModel
class DomainBaseModel(BaseModel):
model_config = ConfigDict(
str_strip_whitespace=True,
validate_assignment=True,
arbitrary_types_allowed=False,
populate_by_name=True,
use_enum_values=True,
)
```
Shared Pydantic base class for all standard domain-layer models. Inherit
from `DomainBaseModel` instead of `pydantic.BaseModel` directly to get the
canonical domain-layer configuration in one place.
**Configuration semantics:**
| Setting | Effect |
|---------|--------|
| `str_strip_whitespace` | Leading/trailing whitespace stripped from all `str` fields on assignment and validation |
| `validate_assignment` | Field assignments after construction are validated like constructor arguments |
| `arbitrary_types_allowed=False` | All field types must be Pydantic-compatible — keeps the domain layer clean |
| `populate_by_name` | Models can be constructed using either the Python field name or the JSON alias |
| `use_enum_values` | Enum fields are stored and serialised as their underlying primitive values |
**Usage:**
```python
from cleveragents.domain.models.base import DomainBaseModel
from pydantic import Field
class MyDomainModel(DomainBaseModel):
name: str
count: int = Field(ge=0)
```
> **Note:** This class was introduced in v3.7.0 (PR #1941) to eliminate the
> duplicated `model_config` that previously appeared in 14 separate domain
> model files. It is a pure structural refactor with no behavioral changes.
---
## Exception Hierarchy
All exceptions inherit from `CleverAgentsError`. Catch the most specific