docs: add DomainBaseModel API reference and CI template DB changelog entry
CI / helm (push) Successful in 23s
CI / lint (push) Successful in 25s
CI / build (push) Successful in 28s
CI / quality (push) Successful in 3m41s
CI / typecheck (push) Successful in 3m56s
CI / security (push) Successful in 4m6s
CI / benchmark-regression (push) Has been skipped
CI / unit_tests (push) Failing after 6m19s
CI / docker (push) Has been skipped
CI / e2e_tests (push) Failing after 14m13s
CI / coverage (push) Successful in 10m24s
CI / integration_tests (push) Failing after 21m19s
CI / status-check (push) Failing after 2s
CI / benchmark-publish (push) Has been cancelled

Add DomainBaseModel section to docs/api/core.md documenting the shared Pydantic base class from PR #2014 (issue #1941), and add CHANGELOG entry for the CI template DB extension from PR #2399 (issue #2334).

ISSUES CLOSED: #1941

Co-authored-by: Jeffrey Phillips Freeman <jeffrey.freeman@cleverthis.com>
Co-committed-by: Jeffrey Phillips Freeman <jeffrey.freeman@cleverthis.com>
This commit was merged in pull request #2608.
This commit is contained in:
2026-04-03 20:41:23 +00:00
committed by Forgejo
parent 5601142447
commit 5c0016c79d
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