Skip to content

test(frontend): cover the joint graph wrapper's layout and co-editor paths - #7509

Merged
mengw15 merged 2 commits into
apache:mainfrom
aglinxinyuan:cov/joint-graph-wrapper
Aug 10, 2026
Merged

test(frontend): cover the joint graph wrapper's layout and co-editor paths#7509
mengw15 merged 2 commits into
apache:mainfrom
aglinxinyuan:cov/joint-graph-wrapper

Conversation

@aglinxinyuan

Copy link
Copy Markdown
Contributor

What changes were proposed in this PR?

joint-graph-wrapper.ts sat at 76.4% lines and 50.6% branches. The branch number is the one
that mattered — half its conditions had only ever been taken one way.

Adds 20 tests to the existing spec, appended as new blocks rather than edits so a rebase stays
cheap (#6489 also touches this file). Covered: absolute positioning, the link-cell change stream,
auto layout, the co-editor presence rings including re-padding when one is deleted, the editing
banner, and the guard clauses for missing and wrong-typed cells.

Before After
Lines 220/288 (76.4%) 282/288 (97.91%)
Branches 43/85 (50.6%) 82/85 (96.47%)
Functions 98/111 (88.3%) 107/111 (96.39%)

Verification

46 mutations were applied and reverted, 45 red on the first pass. One survived — the
currentStrokeIds.includes(highlightIdToDelete) guard — and the test was strengthened to assert
ring order after a ghost delete, which kills it.

Review then found two more problems, both fixed:

  • A test whose name outran its assertions. "removeCurrentEditing hides the banner and stops the animation" could not fail on the second half: removeCurrentEditing blanks the banner text
    first, so the interval body's ownership check is permanently false and advancing the timers is a
    no-op whether or not the interval was cleared. clearInterval is already pinned by a
    pre-existing test, so the unfalsifiable half was removed rather than propped up.
  • A comment that misdescribed its own branch. It claimed a link exercised the || 0 fallback in
    getCellLayer; a link's z is explicitly 0, so it only proves a present zero survives.

Deliberately not included

getCellLayer's || 0 fallback (line 752) is unreachable, and no test pins it. Mutating it to
?? -1 survives, and the reason is structural rather than a missing test: joint's Graph.addCell
sets z = maxZIndex() + 1 on any cell that arrives without one, and getCellLayer throws for a
cell that is not in the graph — so attributes.z is never undefined where it is read. Deleting
the || 0 outright does not compile (z is number | undefined), so it is load-bearing for typing
only. That is recorded in the spec so the next reader does not re-derive it.

Also left alone: the link-breakpoint members. jointLinkBreakpointShowStream and
jointLinkBreakpointHideStream are private Subjects never .next()-ed anywhere in frontend/src,
and linksWithBreakpoints is declared and read but never written.

No production file is touched.

Any related issues, documentation, discussions?

Closes #7508

How was this PR tested?

npx ng test --watch=false --include="**/joint-graph-wrapper.spec.ts"
 Test Files  1 passed (1)
      Tests  67 passed (67)

20 new on top of the existing 47. yarn format:ci passes.

Was this PR authored or co-authored using generative AI tooling?

Generated-by: Claude Code (Opus 5)

…paths

joint-graph-wrapper.ts sat at 76.4% lines and 50.6% branches - the branch
figure being the real gap, since a line counts as covered with one side of
its condition never taken.

Adds 20 tests covering absolute positioning, the link cell change stream,
auto layout, the co-editor presence rings and their re-padding on delete,
the editing banner, and the guard clauses for missing and wrong-typed
cells. Lines go to 97.91% and branches to 96.47%.

Everything runs under jsdom with no extra infrastructure: a real
joint.dia.Paper constructs and renders, findViewByModel returns a real
view, the mask highlighters apply, and DirectedGraph.layout runs.

No production file is touched.
Copilot AI lite review requested due to automatic review settings August 10, 2026 05:34

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@github-actions github-actions Bot added the frontend Changes related to the frontend GUI label Aug 10, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Automated Reviewer Suggestions

Based on the git blame history of the changed files, we recommend the following reviewers:

  • Contributors with relevant context: @mengw15
    You can notify them by mentioning @mengw15 in a comment.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.

@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 86.07%. Comparing base (42d08a3) to head (3dd6d7b).

Additional details and impacted files
@@             Coverage Diff              @@
##               main    #7509      +/-   ##
============================================
- Coverage     86.38%   86.07%   -0.32%     
+ Complexity     4211     4152      -59     
============================================
  Files          1169     1169              
  Lines         46750    46733      -17     
  Branches       5203     5202       -1     
============================================
- Hits          40387    40224     -163     
- Misses         4641     4821     +180     
+ Partials       1722     1688      -34     
Flag Coverage Δ *Carryforward flag
access-control-service 70.00% <ø> (ø) Carriedforward from 307dfc4
agent-service 85.50% <ø> (-1.38%) ⬇️ Carriedforward from 307dfc4
amber 80.88% <ø> (-0.99%) ⬇️ Carriedforward from 307dfc4
computing-unit-managing-service 50.72% <ø> (ø) Carriedforward from 307dfc4
config-service 65.97% <ø> (ø) Carriedforward from 307dfc4
file-service 69.05% <ø> (ø) Carriedforward from 307dfc4
frontend 89.53% <ø> (+0.30%) ⬆️
notebook-migration-service 78.89% <ø> (ø) Carriedforward from 307dfc4
pyamber 97.55% <ø> (-0.01%) ⬇️ Carriedforward from 307dfc4
workflow-compiling-service 26.31% <ø> (ø) Carriedforward from 307dfc4

*This pull request uses carry forward flags. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@mengw15 mengw15 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@mengw15
mengw15 enabled auto-merge August 10, 2026 16:49
@mengw15
mengw15 added this pull request to the merge queue Aug 10, 2026
Merged via the queue into apache:main with commit 29d7cd6 Aug 10, 2026
22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

frontend Changes related to the frontend GUI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Cover the joint graph wrapper's layout and co-editor paths

4 participants