Implement diagnostic notes emission plan with shared renderer (6.4.2)#167
Implement diagnostic notes emission plan with shared renderer (6.4.2)#167
Conversation
…4.2) Add comprehensive ExecPlan document for roadmap item 6.4.2 that outlines the purpose, constraints, tolerances, risks, progress stages, design decisions, and implementation plan for emitting decomposition diagnostic notes in brain-trust lints. This living document details the approach to rendering concise developer-facing diagnostic notes, cap policies, test plans, integration strategies, and retrospective tracking to guide the implementation and validation stages. Co-authored-by: devboxerhub[bot] <devboxerhub[bot]@users.noreply.github.com>
Reviewer's GuideAdds a new living ExecPlan document for roadmap item 6.4.2 that specifies how to implement and validate decomposition diagnostic notes for brain-trust lints, including constraints, staged work plan, testing and documentation strategy, risk management, and acceptance criteria, without yet changing any code or behavior. Sequence diagram for formatting decomposition diagnostic notes (6.4.2)sequenceDiagram
actor Developer
participant BrainTypeLintDriver
participant BrainTypeDecompositionWrapper
participant DecompositionNoteRenderer
Developer->>BrainTypeLintDriver: run_brain_type_analysis()
BrainTypeLintDriver->>BrainTypeLintDriver: compute DecompositionSuggestion[]
BrainTypeLintDriver->>BrainTypeDecompositionWrapper: format_decomposition_note(diagnostic, suggestions)
BrainTypeDecompositionWrapper->>BrainTypeDecompositionWrapper: build DecompositionContext from diagnostic
BrainTypeDecompositionWrapper->>DecompositionNoteRenderer: format_diagnostic_note(context, suggestions)
alt suggestions is empty
DecompositionNoteRenderer-->>BrainTypeDecompositionWrapper: None
else suggestions present
DecompositionNoteRenderer->>DecompositionNoteRenderer: apply caps and ordering
DecompositionNoteRenderer-->>BrainTypeDecompositionWrapper: Some(note_text)
end
BrainTypeDecompositionWrapper-->>BrainTypeLintDriver: Option<String>
BrainTypeLintDriver->>BrainTypeLintDriver: attach note to diagnostic output
BrainTypeLintDriver-->>Developer: diagnostics with optional decomposition note
Class diagram for planned decomposition diagnostic note rendering (6.4.2)classDiagram
class DecompositionContext {
}
class DecompositionSuggestion {
}
class DecompositionNoteRenderer {
+format_diagnostic_note(context: DecompositionContext, suggestions: DecompositionSuggestion[]) Option~String~
-render_suggestion_line(label: String, extraction_kind: String, method_names: String[]) String
-apply_method_caps(method_names: String[]) String
-apply_suggestion_caps(lines: String[]) String
}
class BrainTypeDiagnostic {
}
class BrainTraitDiagnostic {
}
class BrainTypeDecompositionWrapper {
+format_decomposition_note(diagnostic: BrainTypeDiagnostic, suggestions: DecompositionSuggestion[]) Option~String~
}
class BrainTraitDecompositionWrapper {
+format_decomposition_note(diagnostic: BrainTraitDiagnostic, suggestions: DecompositionSuggestion[]) Option~String~
}
DecompositionNoteRenderer --> DecompositionContext : uses
DecompositionNoteRenderer --> DecompositionSuggestion : uses
BrainTypeDecompositionWrapper --> BrainTypeDiagnostic : uses
BrainTraitDecompositionWrapper --> BrainTraitDiagnostic : uses
BrainTypeDecompositionWrapper --> DecompositionNoteRenderer : delegates
BrainTraitDecompositionWrapper --> DecompositionNoteRenderer : delegates
DecompositionSuggestion --> DecompositionContext : contextual_data
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
📝 Coding Plan
Comment |
…tion diagnostic notes - Implemented `format_diagnostic_note` to render decomposition suggestions as concise multi-line notes - Added thin wrappers in `brain_type_metrics` and `brain_trait_metrics` to expose this renderer - Created new module `decomposition_advice::note` for diagnostic note rendering logic with hard caps on suggestions and method counts - Added extensive unit and BDD tests for the new rendering behavior - Updated documentation and examples to illustrate emitted notes format - Marked roadmap item 6.4.2 as completed This enables emitting focused decomposition advice as separate diagnostic notes, improving clarity and consistency across brain-type and brain-trait diagnostics. Co-authored-by: devboxerhub[bot] <devboxerhub[bot]@users.noreply.github.com>
There was a problem hiding this comment.
Gates Failed
Enforce advisory code health rules
(1 file with Code Duplication)
Gates Passed
5 Quality Gates Passed
See analysis details in CodeScene
Reason for failure
| Enforce advisory code health rules | Violations | Code Health Impact | |
|---|---|---|---|
| note_tests.rs | 1 advisory rule | 9.39 | Suppress |
Quality Gate Profile: Pay Down Tech Debt
Install CodeScene MCP: safeguard and uplift AI-generated code. Catch issues early with our IDE extension and CLI tool.
| fn format_diagnostic_note_caps_methods_per_suggestion() { | ||
| let context = DecompositionContext::new("Reporter", SubjectKind::Type); | ||
| let methods = vec![ | ||
| profile(MethodInput { | ||
| name: "report_alpha", | ||
| fields: &["report"], | ||
| signature_types: &[], | ||
| local_types: &[], | ||
| domains: &[], | ||
| }), | ||
| profile(MethodInput { | ||
| name: "report_beta", | ||
| fields: &["report"], | ||
| signature_types: &[], | ||
| local_types: &[], | ||
| domains: &[], | ||
| }), | ||
| profile(MethodInput { | ||
| name: "report_delta", | ||
| fields: &["report"], | ||
| signature_types: &[], | ||
| local_types: &[], | ||
| domains: &[], | ||
| }), | ||
| profile(MethodInput { | ||
| name: "report_epsilon", | ||
| fields: &["report"], | ||
| signature_types: &[], | ||
| local_types: &[], | ||
| domains: &[], | ||
| }), | ||
| profile(MethodInput { | ||
| name: "report_gamma", | ||
| fields: &["report"], | ||
| signature_types: &[], | ||
| local_types: &[], | ||
| domains: &[], | ||
| }), | ||
| profile(MethodInput { | ||
| name: "io_alpha", | ||
| fields: &[], | ||
| signature_types: &[], | ||
| local_types: &[], | ||
| domains: &["std::io"], | ||
| }), | ||
| profile(MethodInput { | ||
| name: "io_beta", | ||
| fields: &[], | ||
| signature_types: &[], | ||
| local_types: &[], | ||
| domains: &["std::io"], | ||
| }), | ||
| ]; | ||
| let suggestions = suggest_decomposition(&context, &methods); | ||
|
|
||
| let rendered = format_diagnostic_note(&context, &suggestions).unwrap_or_default(); | ||
|
|
||
| assert!(rendered.contains( | ||
| "- [report] helper struct for `report_alpha`, `report_beta`, `report_delta`, +2 more methods" | ||
| )); | ||
| } |
There was a problem hiding this comment.
❌ New issue: Code Duplication
The module contains 2 functions with similar structure: format_diagnostic_note_caps_methods_per_suggestion,format_diagnostic_note_caps_rendered_suggestions
Summary
Implements the diagnostic notes emission plan for roadmap 6.4.2 by delivering a shared, deterministic note renderer and per-lint wrappers, along with tests and docs updates. The ExecPlan document is now implemented and the plan is completed.
◳ Generated by DevBoxer ◰
ℹ️ Tag @devboxerhub to ask questions and address PR feedback
📎 Task: https://www.devboxer.com/task/de50db5f-1067-4f83-acb2-8217ac07abec
Changes
Rationale and goals
Changes and design overview
Plan of work (Stage-oriented)
Validation and acceptance criteria
Testing plan
Documentation impact
Risks and mitigations
Validation and acceptance criteria (detailed)
Next steps after approval
◳ Generated by DevBoxer ◰
📎 Task: https://www.devboxer.com/task/2a2e8239-cbad-4ff0-acf0-ae6e70ed8143