Repository navigation
Lift the Layered Dependency View's rules into a tested module - #1243
Merged
Merged
Conversation
The view's node, edge and canvas components decided their colours, borders, badges, handle visibility, click-versus-drag, label width and placement, stroke width, click actions and paint order inline, where only a React Flow render could reach them. Those rules now live in ldvViewModel.ts with literal, rule-by-rule tests; the component renders what the module answers. The plain and aggregate layouts built arrowheads, the severed check and the route fields three times over; they share flowMarkers, relationSevered and routeEdgeData in ldvLayoutShared.ts, and the arrow colours are named once. The unused computeAbsPos is gone. New tests also pin the router's label spread (0.2 / 0.5 / 0.8 within 80 px, the nudge off a card and its five-step cap), the obstruction clearance, each builder's arrowheads, and key the demo-landscape guard on the physical handle point so a mirrored handle cannot hide a shared point. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014eZ98kaESE7YBa84fT1msc
log2(7) is just over the 2.8 cap, so seven relations already draw the capped width; the test now checks six (under) and seven (capped). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014eZ98kaESE7YBa84fT1msc
# Conflicts: # CHANGELOG.md # VERSION
Deploying turbo-ea-docs with
|
| Latest commit: |
a43ec71
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://30f62aea.turbo-ea.pages.dev |
| Branch Preview URL: | https://claude-mutation-lift-ldv.turbo-ea.pages.dev |
CI's Frontend Mutation Tests scored the new module at 93.8 % (317 of 338 mutants); the floor sits two points under, as the other module floors do. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014eZ98kaESE7YBa84fT1msc
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
The Layered Dependency View (Dependencies report, a card's dependency section, TurboLens assessments) decided how its cards and lines look and behave inline in components that only a React Flow render can reach, so the nightly scores ~1,100 survivors in
LayeredDependencyView.tsx. Those rules move intoldvViewModel.tswith literal, rule-by-rule tests, and the two layouts' triplicated edge assembly collapses onto shared helpers. Nothing a user sees changes. Fourth of the four approved PRs (after #1240, #1241, #1242, all merged); main is merged in, so it carries 2.158.12 above 2.158.11.Type
Changes
frontend/src/features/reports/ldvViewModel.ts(no React at runtime), taking from the view:ts-/bt-handles share their base's), the handle's position along its edge, and the 5 px click-versus-drag slop;pointAt(t)function instead of an SVG element);cardClickAction), whether a line touches the hovered card, and paint order.LayeredDependencyView.tsxrenders from those answers; markup,sx, i18n keys and the export filter are unchanged.ldvLayoutShared.tsgainsflowMarkers,relationSeveredandrouteEdgeData, replacing three copies of the same arrowhead, severed and route-field code inbuildLdvFlowand both passes of the aggregate builder. The arrow colours are named once (ARROW_COLOR,SEVERED_ARROW_COLOR, same values).ldvEdgeRouting.computeAbsPosis deleted: it had no caller and no test.scripts/mutation/floors.toml: a[modules]floor of 91 forldvViewModel.ts(CI score − 2).Test Plan
ldvViewModel.test.ts(new). Every expectation is a literal, never the module's own constant, and test data is built inside each test. It covers:ldvLayoutShared.test.ts:flowMarkersfor each direction,bothWaysand severed;relationSeveredfor each change state;routeEdgeDatawith no centre line, a centre line of 0, and a channel route.layeredDependencyLayout.test.tsandldvAggregate.test.ts: the first tests of each builder's arrowheads. They cover a reverse, an unset-to-retired and a bidirectional line, plus three connector cases: one merging both directions, one carrying a single type's reverse flow, and one whose relations are all severed.ldvEdgeRouting.test.ts:The demo-landscape guard (
never lets two connectors leave one node from the same point) now keys on the physical point (ts-N=t-N), so a mirrored handle can no longer hide a shared point. I checked it holds on all six level and centre combinations.The suspected
spreadOverflowgap (toptandtsbucketed apart) did not reproduce: the aggregate layout puts a box's incoming and outgoing connectors on opposite borders. No fix; the tightened guard above would catch it.The view test's React Flow fake is unchanged. Its header leaves edge geometry to the browser suite (jsdom has no
getTotalLength), and the edge component's decisions are now unit-tested in the model.Locally:
tsc -band eslint on the touched files only. Their one warning (react-refreshon thereadableTypeColorre-export) predates this PR. The floors file is validated bybackend/tests/core/test_mutation_scripts.py -k floors. As agreed, the tests run in CI.Mutation score (CI's Frontend Mutation Tests on
903c02ecc): 88.0 % of 442 changed-line mutants;ldvViewModel.ts93.8 % (317 of 338),ldvLayoutShared.ts95.3 % (41 of 43),LayeredDependencyView.tsx50.8 % (31 of 61, the view'ssxand render wiring). Survivors kept in the two modules, none pragma'd: the colour constants (FALLBACK_TYPE_COLOR, the fivePHASE_DOTentries,ARROW_COLOR,SEVERED_ARROW_COLOR, theBACKGROUND_CYCLEliterals — presentation values the tests read back rather than pin one by one); the pixel arithmetic inDOT_BOXandTYPE_ICON_RIGHT_BESIDE_DOT(layout constants); and three label-search mutants that are equivalent on the sample grid —i < steps→<=addst = 1, which the end skip drops anyway,t < 0.08/t > 0.92→<=/>=on a grid no sample of which lands on either bound, and the preferred-spot early return, since the preferred point is also the first clear sample. The[modules]floor of 91 forldvViewModel.ts(score − 2) is infloors.toml.All CI checks pass (backend lint, backend tests, frontend lint, frontend build, frontend tests, mutation tests)
Manually tested the affected feature
Added/updated tests for new or changed behavior
Mutation gate: my tests kill the mutants on the lines I changed (
make mutation-diff). Score: 88.0 % (floor 60 %); survivors listed above, no pragma added.Checklist
CLAUDE.mdasync deffor all new route handlers and DB operations/VERSIONand added aCHANGELOG.mdentry (if user-facing change)docs/(if UI or feature change)VERSION 2.158.12, one CHANGELOG Changed line. No backend, schema, permission, UI-string or docs change.
🤖 Generated with Claude Code
https://claude.ai/code/session_014eZ98kaESE7YBa84fT1msc
Generated by Claude Code