chore(contracts): keep compat DTOs out of `thrust-contracts`; add the `check-deps.sh` rule
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức phù hợp với người mới
- 39/100
- Loại issue
- Tái cấu trúc
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- rust
- Lĩnh vực
- backend, build-system, developer-experience
Hướng nghiên cứu
Read scripts/check-deps.sh and the cited crate manifests, then trace the DTO and use case references in crates/thrust-contracts/src/lib.rs, crates/thrust-core/src/lib.rs and crates/thrust-api/src/lib.rs. The issue is blocked by #44, so first check that work's status. Done means the DTOs move to the API surface, dependency checks reject compat crates in contracts, ports and core, the docs are updated, and the listed test and control cases pass.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Context
thrust-contracts is the bottom crate of the graph: ids, domain records, the event envelope, the test fixtures, and the slice's HTTP DTOs CreateWorkItemRequest, ApiErrorBody and ApiErrorDetail (crates/thrust-contracts/src/lib.rs:206-230). thrust-ports, thrust-core and thrust-api all depend on it (crates/thrust-ports/Cargo.toml:10, crates/thrust-core/Cargo.toml:10, crates/thrust-api/Cargo.toml:10). The use-case takes the HTTP DTO as its input (crates/thrust-core/src/lib.rs:227-232), and the core tests build it (crates/thrust-core/tests/attachments.rs:23, model.rs:90, outbox.rs:18); the error DTOs are used only by the router (crates/thrust-api/src/lib.rs:47-48). The docs endorse the placement: docs/src/contributing/crates.md:10 puts "a request or error body" in thrust-contracts, and ARCHITECTURE §2a lists "API types" there (ARCHITECTURE.md:148).
Problem
When compat-plane is built (#44), its Plane-shaped types (the 12-key issue-list envelope, per_page:page:is_prev cursors, the "None" group, Plane's error strings) have an obvious home next to the existing DTOs, and from there thrust-core and thrust-ports can import them with no check failing. scripts/check-deps.sh:13-14 forbids runtime and platform crates for CLEAN_CRATES; nothing says which internal crate may depend on which. ADR-0034's Confirmation (lines 45-48) requires the compat crate to be removable when the Dioxus UI lands, and its decision drivers say not to freeze Django-era response shapes into the Rust design (line 21). A core type shaped by Plane's serializers breaks both. ARCHITECTURE line 167 describes the surfaces as route groups composed into thrust-api; if compat-plane is only a module there, no graph check can see it at all.
Proposal
- compat-plane is its own crate,
crates/thrust-compat-plane(ARCHITECTURE §2a, line 151), exporting aRouterthatthrust-apimounts. Every Plane-shaped request and response type lives in it, or in athrust-compat-typescrate if/api/v1shares them (the home of theplane_500()helper from #51). - Move
CreateWorkItemRequest,ApiErrorBodyandApiErrorDetailintothrust-api. The use-case takes a domain input (for exampleNewWorkItem) and the handler maps the DTO onto it; the JSON on the wire does not change. - Add a section to
scripts/check-deps.shin the shape of lines 44-51: forthrust-contracts,thrust-portsandthrust-core,cargo tree -p <crate> -e normal --target all -i thrust-compat-plane(and-i thrust-compat-types) must print nothing. Before trusting an empty answer, the script asserts the compat crate is a workspace member, so a renamed or missing crate fails the check instead of passing it. - Update
docs/src/contributing/crates.md:10andARCHITECTURE.md:148to say HTTP DTOs live with their surface, not inthrust-contracts.
Acceptance criteria
-
grep -nE "struct (CreateWorkItemRequest|ApiErrorBody|ApiErrorDetail)" crates/thrust-contracts/src/lib.rsreturns nothing;cargo nextest run -p thrust-coreis green. -
scripts/check-deps.shexits 0. With a temporarythrust-compat-plane = { workspace = true }line incrates/thrust-core/Cargo.tomlit printsFORBIDDEN: thrust-core depends on thrust-compat-planeand exits 1 (control, shown in the PR). - With the compat crate removed from the workspace members, the new section exits non-zero instead of reporting "absent" (control for the vacuous pass).
- The contract suite is green on all four targets with no change to its assertions.
-
docs/src/contributing/crates.mdandARCHITECTURE.md§2a name the new rule.
References
- Review: .agents/plans/contrail/reviews/2026-10-19-fable-architecture-review.md (FR-20)
crates/thrust-contracts/src/lib.rs:206-230;crates/thrust-core/src/lib.rs:227-232;crates/thrust-api/src/lib.rs:47-48,183scripts/check-deps.sh:13-14,44-51- ADR-0034 (decision drivers line 21, Confirmation lines 45-48), ADR-0032
.agents/plans/contrail/ARCHITECTURE.md:148,151,167;docs/src/contributing/crates.md:10,23-24
Blocked by: #44
Finding: FR-20
- Ngôn ngữ chính
- Rust
- Star
- 0
- Fork
- 0
- Merge trung bình
- 1 giờ 35 phút
- Pull request đã merge (30 ngày)
- 67
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của aRustyDev/thrust
-
area:process prio:p1 type:security
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 48/100
Maintainer thường phản hồi trong vòng 1 ngày
-
area:process bug prio:p1
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 38/100
Maintainer thường phản hồi trong vòng 1 ngày
-
area:process prio:p1
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 55/100
Maintainer thường phản hồi trong vòng 1 ngày
-
area:process prio:p1
Độ khó 4/5 1-2 ngày Mức phù hợp với người mới 55/100
Maintainer thường phản hồi trong vòng 1 ngày
-
area:process prio:p1
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 56/100
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của aRustyDev/thrust
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
-
Clean master build fails in zune-jpeg error conversion and zero-IV array construction (patch)Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
CakeRepository/agentshangout#995 ·
-
area:frontend kind:bug priority:p3 ready
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
Maintainer thường phản hồi trong vòng 1 ngày