MAINT: Refactor `dsc-lib` for consistency, library API usage, and maintainability
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
- 25/100
- Loại issue
- Tái cấu trúc
- Độ rõ ràng
- Cần làm rõ
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- rust
- Lĩnh vực
- backend-api-design, developer-experience
Hướng nghiên cứu
Bắt đầu bằng việc xem xét bố cục crate dsc-lib, đặc biệt là các module types và functions, module dscresources và các test hiện có. So sánh vị trí của các test công khai và riêng tư với tests/integration và src/tests, sau đó xác định một tập con tập trung của công việc nhất quán được đề xuất. Done cần được định nghĩa là một phạm vi đã được thống nhất, trong đó các thay đổi tương ứng về API, tài liệu, cách đặt tên và test đã hoàn tất mà không làm hỏng dsc CLI hoặc các bên sử dụng thư viện.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Summary of the new feature / enhancement
As a maintainer of the
dsc-libcrate and integrating developer of the same crate,
I want to be able to more quickly navigate, contribute, test, document, and reference the types and functions in the library
So that I can contribute and integrate more quickly and reliably.
The layout and library API for dsc-lib has grown organically from the beginning of the project. Along the way, we've learned a lot about writing idiomatic and performant Rust code that differs from the current structure.
Additionally, when we first began work on dsc-lib, we worked under the assumption that the only Rust projects that would take a dependency on the library are the dsc CLI and a limited set of crates developed in this monorepo. Now that the Bicep local extension depends on dsc-lib and we plan to develop a Development Kit in Rust for DSC resources and extensions, we should carefully consider updating the library to follow more consistent conventions for the library APIs and structure.
Proposed technical implementation details (optional)
There are a few different areas we can pursue as part of this overall effort:
-
Decomposing large rust files into submodules with the re-export pattern.
We're currently using this pattern to various degrees with the
typesmodule. We're almost using this pattern for thefunctions, except that the submodules are public, so you reference a function type asdsc_lib::functions::<snake_case_name>::<PascalCaseName>. Making this change would enable a simpler access for these types, likedsc_lib::functions::CreateArrayinstead ofdsc_lib::functions::create_array::CreateArray.This would also enable decomposing larger files with numerous types into smaller files that are easier to read, maintain, and reason about.
[!NOTE]
While out of scope for this issue, it will also make it easier for us to extract subsets of functionality into separate crates to improve compile time performance (for Rust, the crate is a compilation unit). For example, if we decomposed thedscresourcesmodule into adsc-lib-resourcescrate and re-exported it from withindsc-lib, any compilation for local development that doesn't affect the decomposed crate is able to reuse prior compilation. I'm not sure the performance benefits are worth this more drastic move, but we might find that to be the case in the future. -
Reviewing the naming for structs, functions, and other items for consistency and clarity.
Currently, we have a mix of naming conventions that have organically grown with the project. We should be more consistent in the naming for types, traits, and functions both to ease general cognitive load for maintainers and to provide a consistent model for integrating developers to rely on.
-
Standardize reference documentation for items in the library.
Currently, the reference documentation (triple slash docs above a definition) for the library is in a mixed state. Some definitions have extensive documentation, some have a single line, some are lacking documentation entirely. We should ensure we have coverage of every public item and that the structure we use is consistent. This is critical for integrating developers but also helpful for contributors and maintainers, since reference documentation is surfaced by the Rust Analyzer extension when working on the project.
We should also consider documenting private items to the same standard, though this only affects maintainers.
-
Moving shared type definitions into the
typesmodule.As we move forward with the schema canonicalization effort and adopting the "parse, don't validate" design pattern to improve reliability and coherence for the library, we should consider moving shared type definitions to that module. Not every type should be defined there - manifests belong in their relevant module, for example.
But some types are defined in a given module and reused across multiple modules as generic types, like
ExecutionType. -
Moving all Rust tests for public items into the
tests/integrationsuite.The primary motivating factor here is build and test timings. When integration tests are colocated with module code, any changes to either the tests or the implementation requires recompilation because the file changed.
Moving the tests and following the current pattern that mirrors the
srcdirectory structure can also help us quickly identify where we are lacking integration tests for the library. Currently, given the existing layout, we need to carefully check every implementation file for test coverage. -
Moving all Rust tests for private items into the
src/testsfolder.We don't seem to have many tests that validate the behavior of private items. The vast majority of the tests I reviewed are only validating public items. However, moving the tests to a dedicated unit tests folder will also improve compile times for local development similarly to moving integration tests.
In the process of moving tests out of the implementation files and into dedicated test files, we should consider whether the unit tests are providing any value over the integration tests.
-
Enhancing integration tests for faster feedback and improved reliability.
Currently, we use Pester tests in the
dscfolder as acceptance tests for the DSC CLI. We should continue to do so, as the CLI is its own fully separate boundary for users. However, given the need to make thedsc-libcrate available itself, we should provide integration tests that ensure correctness and reliability for the underlying APIs themselves.Rust integration tests are also much faster than repeatedly invoking
dscthrough Pester, so this can improve the local development feedback loop for contributors and maintainers. We can continue to rely on the acceptance tests in thedscfolder for CI.
- Ngôn ngữ chính
- Rust
- Star
- 536
- Fork
- 76
- Merge trung bình
- 1 ngày 11 giờ
- Pull request đã merge (30 ngày)
- 15
Chuẩn bị môi trường
Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.
- 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 PowerShell/DSC
-
Issue-Enhancement Needs Triage
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 30/100
PowerShell/DSC#1750 · 3 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Issue-Bug Need-Review
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 45/100
PowerShell/DSC#1749 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Issue-Bug Need-Review
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 40/100
PowerShell/DSC#1748 · 4 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
"apt install dsc" will install the preview release instead of stableCó thể đã có người làm @SteveL-MSFT đã nhận 2 ngày trước. Đang mởIssue-Bug Need-Review
PowerShell/DSC#1746 · 1 bình luận · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Issue-Enhancement
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 35/100
PowerShell/DSC#1737 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của PowerShell/DSC
Issue tương tự
-
C-bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
rust-lang/rust-analyzer#23501 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Streamable HTTP client: a 401 or 403 with a JSON-RPC error body and no WWW-Authenticate loses its HTTP statusCó thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mởbug P2 ready for work T-security T-transport
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
modelcontextprotocol/rust-sdk#1339 ·
Maintainer thường phản hồi trong vòng 3 ngày
-
French BIP39 wordlist starts with a UTF-8 BOM, so generated French mnemonics carry U+FEFF and derive a non-canonical seedCó thể đã có người làm @Kshot3000 đã nhận hôm nay. Đang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 91/100
ergoplatform/sigma-rust#976 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
Maintainer thường phản hồi trong vòng 1 ngày
-
[Bug]: Web chat input doesn't regain focus after a reply finishesCó thể đã có người làm @GaijinSystems đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
zeroclaw-labs/zeroclaw#11658 ·
Maintainer thường phản hồi trong vòng 2 ngày