feat(domain): add tasks/model.rs Task aggregate + Phase/Status/Priority VOs#25
Conversation
…ty VOs (task T-109) Sprint 1 / Track A — pure-domain Tasks bounded-context types. Three Copy enums (Phase, Status, Priority) deriving full Debug + Clone + Copy + PartialEq + Eq + Hash + serde, plus a Task aggregate with RFC3339-serialized timestamps. Phase::next encodes the linear pipeline progression Backlog → Spec → Plan → Code → Qa → Pr → Done with Done → None (ADR-013: agent halts at PR creation). Task::new seeds defaults: TaskId::new(), phase=Backlog, status=Pending, body/priority/github_issue_id=None, created_at == updated_at = now_utc. Domain stays import-pure (only serde + time + crate::domain::shared::ids::TaskId); no ts-rs annotation here — TS bindings come via interfaces-layer DTOs in T-117/T-118 to keep ARCHI §4.1 dependency rule. 16 unit tests cover defaults, every Phase transition, serde roundtrips for VOs and the full aggregate, Send+Sync bounds, and HashSet usability of each VO. Coverage 100% lines/regions/functions on domain/tasks/model.rs (domain target ≥90%). cargo test --workspace: 105 passed (was 90). tests/architecture.rs still green — no forbidden imports leaked.
- Collapsed three Phase/Status/Priority serde-roundtrip tests into one
table-driven test using the new json_roundtrip helper.
- Folded five task_new_* default-assertion tests into one consolidated
task_new_seeds_documented_defaults covering all defaults in a single
Task::new call.
- Dropped value_objects_are_copy_eq_hash — HashSet dedup was testing
std's contract, not ours; the derives are compile-time guaranteed.
- Trimmed module doc-comment paragraph already enforced by
tests/architecture.rs.
- Introduced domain/shared/time::now_utc() (Clock-port DI seam) and
domain/shared/test_support::{assert_send_sync, json_roundtrip}
(#[cfg(test)]-gated) so the helpers are reusable as peer modules
land.
Net cargo test --workspace 105 → 99 (six redundant tests removed).
Coverage on domain/tasks/model.rs unchanged at 100% lines/regions/
functions; new shared/time.rs and shared/test_support.rs at 100%.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
✅ Files skipped from review due to trivial changes (1)
📝 WalkthroughWalkthroughAdds a Task domain model (value objects Phase/Status/Priority and Task entity with Task::new), a shared UTC time seam ChangesTask Domain Model & Test Infrastructure
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
1 issue found across 5 files
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="CHANGELOG.md">
<violation number="1" location="CHANGELOG.md:9">
P3: This changelog bullet accidentally appends the ids.rs change details after the tasks/model.rs summary (starting with "(`new`, `from_uuid`)…"). Trim the entry so it ends after the tasks/model.rs summary to avoid duplicated/misleading release notes.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
…ntry Cubic flagged the orphan ids.rs paragraph in the T-109 /simplify entry on CHANGELOG.md:9 — the bullet duplicated content from the T-108 entry above. Trimmed at the intended end of the T-109 summary.
Summary
Implements Tasks bounded-context entity + value objects (task T-109). Unblocks T-110 (TaskRepository implementation), T-117 (TypeScript codegen), T-131 (architecture test). Phase state machine encodes ADR-013: agent halts at PR creation, leaving the final merge to humans.
Changes
domain/tasks/model.rs: Task aggregate (id, project_id, title, body, status, phase, priority, github_issue_id, created_at/updated_at with RFC3339 serde), three value objects: Phase enum (Backlog → Spec → Plan → Code → Qa → Pr → Done), Status enum (Pending/Running/Queued/Paused/Failed/Completed/Aborted), Priority enum (P0/P1/P2). Task::new(project_id, title) seeds fresh TaskId + Backlog phase + Pending status + all optional fields = None.domain/shared/time.rs: now_utc() helper as single seam for wall-clock reads (enables future Clock port DI per ARCHI §4 without touching call sites).domain/shared/test_support.rs: assert_send_sync() compile-time check (zero runtime cost, single source) + json_roundtrip(value, expected_json) helper collapsing 4-line serialize-then-deserialize boilerplate across all value-object tests.domain/shared/mod.rs: exposed test_support module.Testing
All 10 domain/tasks/model.rs tests pass at 100% coverage (lines/regions/functions):
(Plus 2 tests in shared/time.rs, 0 tests in shared/test_support.rs — it's compile-time helpers only.)
Related Issues
Notes for Reviewer
Architecture purity: No ts-rs in domain layer. TS bindings for Task come from interfaces-layer DTOs (T-117/T-118), keeping ARCHI §4.1 boundaries clean. Domain stays import-pure: only serde + time + uuid (architecture test still green).
Phase semantics: Phase::next() returns Option with Done → None per ADR-013 — agent creates PR but does not merge (merge is human action). Linear encoding (Backlog → Spec → ... → Pr → Done) is now type-level.
Clock port setup: Task::new calls shared now_utc() rather than OffsetDateTime::now_utc() inline. Future Clock port DI (ARCHI §4) can swap the implementation without touching call sites.
Test consolidation (from /simplify follow-up):
task_new_*tests merged into 1task_new_seeds_documented_defaults(single Task::new covers 8 assertions)Phase/Status/Priority_serde_roundtriptests collapsed via newjson_roundtriphelpervalue_objects_are_copy_eq_hash(runtime test of std's HashSet dedup; Copy/Eq/Hash are compile-time guaranteed by derive)Shared helpers: assert_send_sync() and json_roundtrip() are new in test_support.rs; ids.rs and error.rs still have their own copies (refactoring those to use the shared version is T-132 follow-up, not in scope here).
Checklist
Summary by CodeRabbit
New Features
Infrastructure