UAT: Core domain model classes do not inherit from spec-required DomainBaseModel base class #3403

Open
opened 2026-04-05 16:30:37 +00:00 by freemo · 1 comment
Owner

Metadata

  • Branch: fix/domain-models-domainbasemodel-inheritance
  • Commit Message: fix(domain): migrate core domain models to inherit from DomainBaseModel
  • Milestone: (none — backlog)
  • Parent Epic: #362

Background

The specification (docs/specification.md line 43866) explicitly requires:

"Every domain entity — Plan, Decision, Action, Resource, Actor, Tool, Skill, Session, Invariant, AutomationProfile, Checkpoint, CorrectionAttempt — is a Pydantic model subclass. Domain entities that share the canonical configuration (str_strip_whitespace, validate_assignment, arbitrary_types_allowed=False, populate_by_name, use_enum_values) inherit from the shared DomainBaseModel base class (defined in domain/models/base.py) rather than directly from pydantic.BaseModel."

DomainBaseModel is correctly defined at src/cleveragents/domain/models/base.py, but none of the core domain model files import or use it. Instead, every core entity directly subclasses pydantic.BaseModel and duplicates the canonical model_config inline.

Files Affected (src/cleveragents/domain/models/core/)

File Classes inheriting BaseModel directly
plan.py Plan, PlanIdentity, PlanTimestamps, ProjectLink, PlanInvariant, NamespacedName
decision.py Decision, ContextSnapshot, ResourceRef, ArtifactRef
action.py Action, ActionArgument
resource.py Resource, ResourceCapabilities
actor.py Actor
tool.py Tool, Validation, ToolCapability, ResourceSlot
skill.py Skill, SkillToolRef, SkillInclude, SkillInlineTool
session.py Session, SessionMessage
invariant.py Invariant, InvariantSet
automation_profile.py AutomationProfile
checkpoint.py Checkpoint
correction.py CorrectionAttempt

DomainBaseModel is currently only used in non-core subdirectories (aimodelscredentials, aimodelserrors, aimodelsproviders, auth, planconfig).

Impact

The canonical model_config (str_strip_whitespace, validate_assignment, arbitrary_types_allowed=False, populate_by_name, use_enum_values) is duplicated across every model file instead of being inherited from a single source of truth. Future changes to the canonical config must be applied to every file individually, risking inconsistency. The spec explicitly mandates DomainBaseModel to prevent this.

Steps to Reproduce

  1. Open any core domain model file (e.g., src/cleveragents/domain/models/core/plan.py)
  2. Search for DomainBaseModel — it is not imported or used
  3. Observe: class Plan(BaseModel): — should be class Plan(DomainBaseModel):
  4. Compare with spec requirement at docs/specification.md line 43866

Expected: All core domain entities inherit from DomainBaseModel
Actual: All core domain entities inherit directly from pydantic.BaseModel

Subtasks

  • Update plan.py: replace BaseModel with DomainBaseModel for Plan, PlanIdentity, PlanTimestamps, ProjectLink, PlanInvariant, NamespacedName; remove duplicated model_config
  • Update decision.py: replace BaseModel with DomainBaseModel for Decision, ContextSnapshot, ResourceRef, ArtifactRef; remove duplicated model_config
  • Update action.py: replace BaseModel with DomainBaseModel for Action, ActionArgument; remove duplicated model_config
  • Update resource.py: replace BaseModel with DomainBaseModel for Resource, ResourceCapabilities; remove duplicated model_config
  • Update actor.py: replace BaseModel with DomainBaseModel for Actor; remove duplicated model_config
  • Update tool.py: replace BaseModel with DomainBaseModel for Tool, Validation, ToolCapability, ResourceSlot; remove duplicated model_config
  • Update skill.py: replace BaseModel with DomainBaseModel for Skill, SkillToolRef, SkillInclude, SkillInlineTool; remove duplicated model_config
  • Update session.py: replace BaseModel with DomainBaseModel for Session, SessionMessage; remove duplicated model_config
  • Update invariant.py: replace BaseModel with DomainBaseModel for Invariant, InvariantSet; remove duplicated model_config
  • Update automation_profile.py: replace BaseModel with DomainBaseModel for AutomationProfile; remove duplicated model_config
  • Update checkpoint.py: replace BaseModel with DomainBaseModel for Checkpoint; remove duplicated model_config
  • Update correction.py: replace BaseModel with DomainBaseModel for CorrectionAttempt; remove duplicated model_config
  • Verify DomainBaseModel in base.py carries the full canonical model_config (no changes expected, but confirm)
  • Update Behave unit test scenarios to cover DomainBaseModel inheritance for all 12 entity types
  • Run nox -e typecheck and confirm no regressions
  • Run nox -e unit_tests and confirm all scenarios pass
  • Run nox -e coverage_report and confirm coverage ≥ 97%

Definition of Done

  • All 12 core domain entity files import DomainBaseModel from domain.models.base instead of pydantic.BaseModel
  • No duplicated model_config blocks remain in any of the 12 affected files (config is inherited from DomainBaseModel)
  • DomainBaseModel is the single source of truth for the canonical Pydantic model configuration across all core domain entities
  • Behave unit tests cover DomainBaseModel inheritance for all affected entity classes
  • All nox stages pass
  • Coverage >= 97%

Backlog note: This issue was discovered during autonomous operation
on milestone v3.3.0. It does not block milestone completion and has been
placed in the backlog for human review and future milestone assignment.


Automated by CleverAgents Bot
Supervisor: Acting on behalf of: UAT Testing | Agent: ca-new-issue-creator

## Metadata - **Branch**: `fix/domain-models-domainbasemodel-inheritance` - **Commit Message**: `fix(domain): migrate core domain models to inherit from DomainBaseModel` - **Milestone**: *(none — backlog)* - **Parent Epic**: #362 ## Background The specification (`docs/specification.md` line 43866) explicitly requires: > "Every domain entity — Plan, Decision, Action, Resource, Actor, Tool, Skill, Session, Invariant, AutomationProfile, Checkpoint, CorrectionAttempt — is a Pydantic model subclass. Domain entities that share the canonical configuration (`str_strip_whitespace`, `validate_assignment`, `arbitrary_types_allowed=False`, `populate_by_name`, `use_enum_values`) inherit from the shared `DomainBaseModel` base class (defined in `domain/models/base.py`) rather than directly from `pydantic.BaseModel`." `DomainBaseModel` is correctly defined at `src/cleveragents/domain/models/base.py`, but **none** of the core domain model files import or use it. Instead, every core entity directly subclasses `pydantic.BaseModel` and duplicates the canonical `model_config` inline. ### Files Affected (`src/cleveragents/domain/models/core/`) | File | Classes inheriting `BaseModel` directly | |---|---| | `plan.py` | `Plan`, `PlanIdentity`, `PlanTimestamps`, `ProjectLink`, `PlanInvariant`, `NamespacedName` | | `decision.py` | `Decision`, `ContextSnapshot`, `ResourceRef`, `ArtifactRef` | | `action.py` | `Action`, `ActionArgument` | | `resource.py` | `Resource`, `ResourceCapabilities` | | `actor.py` | `Actor` | | `tool.py` | `Tool`, `Validation`, `ToolCapability`, `ResourceSlot` | | `skill.py` | `Skill`, `SkillToolRef`, `SkillInclude`, `SkillInlineTool` | | `session.py` | `Session`, `SessionMessage` | | `invariant.py` | `Invariant`, `InvariantSet` | | `automation_profile.py` | `AutomationProfile` | | `checkpoint.py` | `Checkpoint` | | `correction.py` | `CorrectionAttempt` | `DomainBaseModel` is currently only used in non-core subdirectories (`aimodelscredentials`, `aimodelserrors`, `aimodelsproviders`, `auth`, `planconfig`). ### Impact The canonical `model_config` (`str_strip_whitespace`, `validate_assignment`, `arbitrary_types_allowed=False`, `populate_by_name`, `use_enum_values`) is duplicated across every model file instead of being inherited from a single source of truth. Future changes to the canonical config must be applied to every file individually, risking inconsistency. The spec explicitly mandates `DomainBaseModel` to prevent this. ### Steps to Reproduce 1. Open any core domain model file (e.g., `src/cleveragents/domain/models/core/plan.py`) 2. Search for `DomainBaseModel` — it is not imported or used 3. Observe: `class Plan(BaseModel):` — should be `class Plan(DomainBaseModel):` 4. Compare with spec requirement at `docs/specification.md` line 43866 **Expected**: All core domain entities inherit from `DomainBaseModel` **Actual**: All core domain entities inherit directly from `pydantic.BaseModel` ## Subtasks - [ ] Update `plan.py`: replace `BaseModel` with `DomainBaseModel` for `Plan`, `PlanIdentity`, `PlanTimestamps`, `ProjectLink`, `PlanInvariant`, `NamespacedName`; remove duplicated `model_config` - [ ] Update `decision.py`: replace `BaseModel` with `DomainBaseModel` for `Decision`, `ContextSnapshot`, `ResourceRef`, `ArtifactRef`; remove duplicated `model_config` - [ ] Update `action.py`: replace `BaseModel` with `DomainBaseModel` for `Action`, `ActionArgument`; remove duplicated `model_config` - [ ] Update `resource.py`: replace `BaseModel` with `DomainBaseModel` for `Resource`, `ResourceCapabilities`; remove duplicated `model_config` - [ ] Update `actor.py`: replace `BaseModel` with `DomainBaseModel` for `Actor`; remove duplicated `model_config` - [ ] Update `tool.py`: replace `BaseModel` with `DomainBaseModel` for `Tool`, `Validation`, `ToolCapability`, `ResourceSlot`; remove duplicated `model_config` - [ ] Update `skill.py`: replace `BaseModel` with `DomainBaseModel` for `Skill`, `SkillToolRef`, `SkillInclude`, `SkillInlineTool`; remove duplicated `model_config` - [ ] Update `session.py`: replace `BaseModel` with `DomainBaseModel` for `Session`, `SessionMessage`; remove duplicated `model_config` - [ ] Update `invariant.py`: replace `BaseModel` with `DomainBaseModel` for `Invariant`, `InvariantSet`; remove duplicated `model_config` - [ ] Update `automation_profile.py`: replace `BaseModel` with `DomainBaseModel` for `AutomationProfile`; remove duplicated `model_config` - [ ] Update `checkpoint.py`: replace `BaseModel` with `DomainBaseModel` for `Checkpoint`; remove duplicated `model_config` - [ ] Update `correction.py`: replace `BaseModel` with `DomainBaseModel` for `CorrectionAttempt`; remove duplicated `model_config` - [ ] Verify `DomainBaseModel` in `base.py` carries the full canonical `model_config` (no changes expected, but confirm) - [ ] Update Behave unit test scenarios to cover `DomainBaseModel` inheritance for all 12 entity types - [ ] Run `nox -e typecheck` and confirm no regressions - [ ] Run `nox -e unit_tests` and confirm all scenarios pass - [ ] Run `nox -e coverage_report` and confirm coverage ≥ 97% ## Definition of Done - [ ] All 12 core domain entity files import `DomainBaseModel` from `domain.models.base` instead of `pydantic.BaseModel` - [ ] No duplicated `model_config` blocks remain in any of the 12 affected files (config is inherited from `DomainBaseModel`) - [ ] `DomainBaseModel` is the single source of truth for the canonical Pydantic model configuration across all core domain entities - [ ] Behave unit tests cover `DomainBaseModel` inheritance for all affected entity classes - [ ] All nox stages pass - [ ] Coverage >= 97% > **Backlog note:** This issue was discovered during autonomous operation > on milestone v3.3.0. It does not block milestone completion and has been > placed in the backlog for human review and future milestone assignment. --- **Automated by CleverAgents Bot** Supervisor: Acting on behalf of: UAT Testing | Agent: ca-new-issue-creator
Author
Owner

Issue triaged by project owner:

  • State: Verified
  • Priority: Backlog (unchanged)
  • Story Points: 5 — L — Requires updating multiple domain model classes to inherit from DomainBaseModel.
  • MoSCoW: Should Have — Spec compliance for domain model architecture.

Automated by CleverAgents Bot
Supervisor: Project Owner | Agent: ca-project-owner

Issue triaged by project owner: - **State**: Verified - **Priority**: Backlog (unchanged) - **Story Points**: 5 — L — Requires updating multiple domain model classes to inherit from DomainBaseModel. - **MoSCoW**: Should Have — Spec compliance for domain model architecture. --- **Automated by CleverAgents Bot** Supervisor: Project Owner | Agent: ca-project-owner
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Blocks
#362 Epic: Security & Safety Hardening
cleveragents/cleveragents-core
Reference
cleveragents/cleveragents-core#3403
No description provided.