From 597a11372e6d7b3fc07dafa7bad53171ece38e2e Mon Sep 17 00:00:00 2001 From: rayhpeng Date: Thu, 30 Jul 2026 11:12:31 +0800 Subject: [PATCH] fix(feedback): remove order-dependent import and stale layout pointers model.py imported its exceptions from the package __init__, which itself imports model -- a cycle that only resolved because __init__ happens to import exceptions first. Import them from the exceptions submodule directly, matching service.py, so reordering __init__ can never break collection. Also update the two module docstrings that still pointed readers at the deleted app/infra/ layout and the old deps.py wiring: adapters live in app/adapters/{context}/ and wiring happens in the composition root, app/composition.py::build_domain_services. Co-Authored-By: Claude Fable 5 --- backend/packages/harness/deerflow/domain/__init__.py | 3 ++- backend/packages/harness/deerflow/domain/feedback/model.py | 2 +- .../harness/deerflow/persistence/feedback/__init__.py | 4 ++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/backend/packages/harness/deerflow/domain/__init__.py b/backend/packages/harness/deerflow/domain/__init__.py index 75edaa1c9..eadf335e7 100644 --- a/backend/packages/harness/deerflow/domain/__init__.py +++ b/backend/packages/harness/deerflow/domain/__init__.py @@ -5,5 +5,6 @@ Every package under this namespace is one bounded context laid out as dependencies -- no sqlalchemy/fastapi/pydantic, no `app.*`, and no harness infrastructure modules (enforced in CI by `tests/test_harness_domain_purity.py`). Adapters implementing the ports -live in `app/infra/`; wiring happens only in `app/gateway/deps.py`. +live in `app/adapters/{context}/`; wiring happens only in the composition +root, `app/composition.py::build_domain_services`. """ diff --git a/backend/packages/harness/deerflow/domain/feedback/model.py b/backend/packages/harness/deerflow/domain/feedback/model.py index 0e76e4f80..b95884ad0 100644 --- a/backend/packages/harness/deerflow/domain/feedback/model.py +++ b/backend/packages/harness/deerflow/domain/feedback/model.py @@ -4,7 +4,7 @@ import uuid from dataclasses import dataclass, field from datetime import UTC, datetime -from deerflow.domain.feedback import InvalidRatingError, InvalidTagError +from deerflow.domain.feedback.exceptions import InvalidRatingError, InvalidTagError VALID_RATINGS = (-1, 1) diff --git a/backend/packages/harness/deerflow/persistence/feedback/__init__.py b/backend/packages/harness/deerflow/persistence/feedback/__init__.py index 6a1ca9f3f..2aaa359df 100644 --- a/backend/packages/harness/deerflow/persistence/feedback/__init__.py +++ b/backend/packages/harness/deerflow/persistence/feedback/__init__.py @@ -2,8 +2,8 @@ The legacy SQL repository was replaced by the hexagonal slice: port `deerflow.domain.feedback.ports.FeedbackRepository`, adapter -`app.infra.persistence.feedback.SqlFeedbackRepository`. The ORM row stays -here until PR-N moves engine/models/migrations into app/infra. +`app.adapters.feedback.feedback_repository.SqlFeedbackRepository`. The ORM +row stays here beside the harness-owned engine/models/migrations. """ from deerflow.persistence.feedback.model import FeedbackRow