fix(core): inherit relationship styles from spec in dynamic views#2864
fix(core): inherit relationship styles from spec in dynamic views#2864
Conversation
Extend dynamic view computation to inherit color, line, head, and tail properties from the relationship specification defaults, not just technology. Properties follow the precedence: step > model > spec. Fixes #2797 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
🦋 Changeset detectedLatest commit: 4046e7f The changes in this PR will be included in the next version bump. This PR includes changesets to release 21 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
📝 WalkthroughWalkthroughDynamic view computation now inherits relationship style fields ( Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
packages/core/src/compute-view/dynamic-view/__test__/step-fields.spec.ts (1)
248-250: Consider using stricter typing for relationship kinds in tests.The
as anycast forkindis repeated in multiple tests. While acceptable in test files, you could define a local type alias or use the Builder's type inference to maintain type safety.♻️ Optional: Define a type alias for the test
// At the top of the describe block or file type TestRelationKind = 'action' | 'requests' // Then use: kind: 'action' as TestRelationKind,🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@packages/core/src/compute-view/dynamic-view/__test__/step-fields.spec.ts` around lines 248 - 250, The test uses an unsafe cast ("kind: 'action' as any") when calling computeEdgeFromStep; replace the repeated any casts by introducing a local narrower type alias (e.g., TestRelationKind = 'action' | 'requests') at the top of the test file or describe block and use it for the kind field, or leverage the Builder's type inference so calls to computeEdgeFromStep(...) pass a properly typed kind value instead of using as any; update other similar test cases to use the same alias to remove duplicated any casts.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@packages/core/src/compute-view/dynamic-view/__test__/step-fields.spec.ts`:
- Around line 248-250: The test uses an unsafe cast ("kind: 'action' as any")
when calling computeEdgeFromStep; replace the repeated any casts by introducing
a local narrower type alias (e.g., TestRelationKind = 'action' | 'requests') at
the top of the test file or describe block and use it for the kind field, or
leverage the Builder's type inference so calls to computeEdgeFromStep(...) pass
a properly typed kind value instead of using as any; update other similar test
cases to use the same alias to remove duplicated any casts.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 2170903e-a3c2-4116-8905-7da54752ab17
📒 Files selected for processing (3)
.changeset/dynamic-view-spec-styles.mdpackages/core/src/compute-view/dynamic-view/__test__/step-fields.spec.tspackages/core/src/compute-view/dynamic-view/compute.ts
Remove derived.head/tail checks (findRelations doesn't return these) and inline spec defaults into the push call to avoid exact() type issues. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Inherit relationship style properties (color, line, head, tail) from specification defaults in dynamic views. Previously only
technologywas inherited when a step had akind. Now all visual style properties follow the same pattern with correct precedence: step explicit values > model relationship values > specification defaults.Fixes #2797
Checklist
mainbefore creating this PR.pnpm typecheckandpnpm test./changeset-generatorSKILL).