Make assignment construction fallible (#137) - #226
Draft
leynos wants to merge 1 commit into
Draft
Conversation
Keep the panicking result constructor inside the CPU pipeline, where contiguous labels are guaranteed, and expose the typed fallible constructor for all external callers. Add public-surface and validation regression coverage, including the CPU-disabled build, and document the constructor contract.
Contributor
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: trueWarning Your free Security trial is over. An organization admin can activate billing to continue. Comment |
Reviewer's GuideThe PR changes manual Sequence diagram for fallible clustering result constructionsequenceDiagram
participant Caller
participant ClusteringResult
participant CpuPipeline
Caller->>ClusteringResult: try_from_assignments(assignments)
ClusteringResult-->>Caller: Ok(ClusteringResult)
ClusteringResult-->>Caller: Err(NonContiguousClusterIds)
CpuPipeline->>ClusteringResult: from_assignments(assignments)
ClusteringResult-->>CpuPipeline: ClusteringResult
File-Level Changes
Assessment against linked issues
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This branch makes manual
ClusteringResultconstruction explicitly fallible,so invalid cluster identifiers produce
NonContiguousClusterIdsrather than apublic-API panic. The CPU pipeline retains its crate-private convenience
constructor because it establishes contiguous labels by construction.
Closes #137.
Review walkthrough
try_from_assignmentsas the public API.Validation
make check-fmt: passedmake lint: passed (Rustdoc, Clippy, and Whitaker)make test: passed (1,087 tests)make markdownlint: passedmake nixie: passedcargo test --workspace --doc: passed (5 doctests)coderabbit review --agent: 0 findingsReferences
Summary by Sourcery
Make manual clustering-result construction explicitly fallible while preserving a CPU-internal convenience path for guaranteed-valid assignments.
New Features:
ClusteringResultconstruction use a public fallible API that reports invalid cluster identifiers throughNonContiguousClusterIds.Bug Fixes:
Enhancements:
Documentation:
Tests: