Skip to content

Remove two pieces of unreachable code found by mutation testing #7459

Description

@aglinxinyuan

Task Summary

Two small pieces of unreachable code, each found by a mutation that survived while testing the surrounding behaviour — i.e. each was demonstrated to have no observable effect, not merely suspected.

1. hugging-face-image-upload.component.html — an unreachable fallback.

<span>{{ displayFileName || "Selected image" }}</span>

The enclosing block is *ngIf="previewSrc", and previewSrc is non-empty only when hasImage is true. displayFileName already returns "Uploaded image" in exactly that case, so it is never empty where this renders and the right-hand side of the || can never be evaluated.

2. drag-drop.service.ts — a guard subsumed by the next one.

const jointLink = paper.getModelById(link.linkID) as joint.dia.Link;
if (!jointLink) { continue; }

const linkView = paper.findViewByModel(jointLink) as joint.dia.LinkView;
if (!linkView) { continue; }

paper.findViewByModel(undefined) returns undefined, so the second guard already catches everything the first one does. Removing the first changes no observable behaviour — confirmed by mutation.

Suggested next steps

Delete both. Neither is load-bearing, and both are the kind of thing that reads as a meaningful guard to the next person.

Note the second one is genuinely defensive in intent, so if the preference is to keep belt-and-braces null handling that is a reasonable call — but it should be a deliberate one rather than an accident.

Task Type

  • Refactor / Cleanup
  • DevOps / Deployment / CI
  • Testing / QA
  • Documentation
  • Performance
  • Other

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions