fix(classdiagram): resolve remaining class-diagram audit Lows (§4.2 #10/#11/#13/#14 + §5.2) - #168
Merged
Merged
Conversation
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…ration Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…ndency edges Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…trings Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…ionships Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…name Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…g separator Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…ration guard Review findings: a user-defined collection container (PagedList<Order>) got the '*' cardinality on its own edge although the member holds exactly one container instance — '*' now applies only to extracted element types. Also collapses the two copy-paste enumeration try/catch blocks into EnumerateSafely. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR completes the remaining class-diagram audit items by tightening type discovery, relationship analysis, and Mermaid rendering so diagrams are more deterministic, semantically accurate, and resilient to filesystem/runtime edge cases across CLI inputs.
Changes:
- Make workspace type discovery deterministic (single root scan) and resilient to mid-enumeration IO failures.
- Improve relationship extraction (fully-qualified dedupe, semantic collection detection, preserve user generic containers, handle arrays in method signatures, correct cardinality placement).
- Prevent Mermaid node merges on sanitize collisions; preserve generic arity in external node names; fix analysis edge-cases for bare relative file inputs and trailing directory separators.
Reviewed changes
Copilot reviewed 15 out of 15 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| tests/ProjGraph.Tests.Unit.ClassDiagram/WorkspaceTypeDiscoveryTests.cs | Adds unit coverage for deterministic resolution and partial-results behavior when enumeration throws. |
| tests/ProjGraph.Tests.Unit.ClassDiagram/SymbolResolverTests.cs | Verifies unresolved external generic types keep generic arity in the rendered node name. |
| tests/ProjGraph.Tests.Unit.ClassDiagram/RelationshipAnalyzerTests.cs | Adds coverage for fq-name dedupe, semantic collection detection, user generic containers, and arrays in method signatures. |
| tests/ProjGraph.Tests.Unit.ClassDiagram/MermaidClassDiagramRendererTests.cs | Adds regression test for sanitize-collision-safe Mermaid IDs. |
| tests/ProjGraph.Tests.Unit.ClassDiagram/AnalyzeFileUseCaseTests.cs | Covers bare relative filename handling so workspace scanning has a valid start directory. |
| tests/ProjGraph.Tests.Unit.ClassDiagram/AnalyzeDirectoryUseCaseTests.cs | Covers directory title extraction when input has a trailing separator. |
| src/ProjGraph.Lib.ClassDiagram/Rendering/MermaidClassDiagramRenderer.cs | Introduces collision-aware node ID mapping so distinct types don’t merge after sanitization. |
| src/ProjGraph.Lib.ClassDiagram/Infrastructure/WorkspaceTypeDiscovery.cs | Removes optimistic pre-pass; adds defensive enumeration materialization for resilient scans. |
| src/ProjGraph.Lib.ClassDiagram/Infrastructure/TypeAnalyzer.cs | Exposes a shared short-name formatter used for consistent generic rendering. |
| src/ProjGraph.Lib.ClassDiagram/Infrastructure/SymbolResolver.cs | Uses the shared short-name formatter for external nodes (preserves generic arity). |
| src/ProjGraph.Lib.ClassDiagram/Infrastructure/RelationshipAnalyzer.cs | Updates dedupe keys to fully-qualified names, semantic collection detection, array unwrapping for methods, and user generic container retention. |
| src/ProjGraph.Lib.ClassDiagram/Application/UseCases/AnalyzeFileUseCase.cs | Resolves start directory from full path to avoid empty-string directory issues. |
| src/ProjGraph.Lib.ClassDiagram/Application/UseCases/AnalyzeDirectoryUseCase.cs | Trims trailing directory separators to preserve diagram titles. |
| docs/superpowers/specs/2026-07-17-classdiagram-lows-design.md | Adds design spec describing each finding and the chosen implementation approach. |
| docs/superpowers/plans/2026-07-17-classdiagram-lows-plan.md | Adds detailed implementation plan and verification steps for the ten findings. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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
Phase 2 themed PR: fixes the ten remaining class-diagram findings from the 2026-07-14 audit re-audit — the four deferred §4.2 Lows, both §5.2 Mediums, and the four §5.2 class-diagram Lows. This closes out the class-diagram section of the audit entirely.
Spec:
docs/superpowers/specs/2026-07-17-classdiagram-lows-design.md· Plan:docs/superpowers/plans/2026-07-17-classdiagram-lows-plan.md· One commit per finding, TDD throughout.Result<Order>now keeps an edge to the user-definedResult<T>container (BCL containers still reduced to their arguments)System.Collections.IEnumerable;Settings<T>is no longer a "collection", custom collections are. Name heuristic kept only as fallback for unresolved (error) symbolsA.OrderandB.Orderboth keep their edgesSanitizemerges distinct IDsNs.Foo_Bar/Ns.Foo.Barget distinct Mermaid IDs (_2suffix); output unchanged unless a real collision existsprojgraph class Foo.csresolves the start directory from the full path instead of passing""to the workspace walkOrder[] GetAll()/Save(Order[] batch)now yield dependency edges (residual of §4.2 #8)IOException/UnauthorizedAccessExceptiondegrades to a partial scan instead of abortingAbstractValidator<T>renders with its type parameters, matching in-source genericsprojgraph class ./src/keepssrcas the diagram titleA self-review pass (8 finder angles + verification) caught one interaction bug before this PR: the newly-kept user collection container (
PagedList<Order>) received the*cardinality on its own edge although the member holds exactly one container —*now applies only to element types (fixed in the last commit).Known accepted trade-offs (documented in the spec): multi-definition type resolution now always uses the path-sorted tie-break (previously
Models/etc. won); removing the optimistic pass means a full root scan per distinct unresolved type name (memoized per name viaTypeFileLookupCache).Test plan
Tests.Unit.ClassDiagram, TDD red→greendotnet format --verify-no-changesclean🤖 Generated with Claude Code