You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@texera.apache.org by "Raja-Hamid (via GitHub)" <gi...@apache.org> on 2026/08/10 14:02:07 UTC

[PR] refactor(frontend): remove two pieces of unreachable code [texera]

Raja-Hamid opened a new pull request, #7512:
URL: https://github.com/apache/texera/pull/7512

   ### What changes were proposed in this PR?
   
   Removes two pieces of unreachable code, each surfaced by a surviving mutation — i.e. each was *demonstrated* to have no observable effect, not merely suspected. No user-facing behavior changes, hence `refactor`.
   
   **1. `hugging-face-image-upload.component.html` — an unreachable fallback**
   
   ```diff
   -<span>{{ displayFileName || "Selected image" }}</span>
   +<span>{{ displayFileName }}</span>
   
   The enclosing block is *ngIf="previewSrc", and previewSrc returns this.hasImage ? this.formControl.value : "" — so it is non-empty exactly when hasImage is true. displayFileName returns fileName or, failing that, "Uploaded image" whenever hasImage is true. It is therefore 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;
    }
   
   findViewByModel in jointjs 3.5.4 resolves its argument with (isString(cell) || isNumber(cell)) ? cell : (cell && cell.id) and returns this._views[id]. The cell && cell.id short-circuits on undefined, so the call returns undefined rather than throwing, and the !linkView guard already catches everything !jointLink did.
   
   Worth noting for reviewers: this guard was not meaningless. findIntersectedLink iterates the Texera graph but resolves each link against the JointJS paper, and those two can genuinely diverge, so getModelById really can return undefined at runtime. That path is still handled, just one guard later. (The as joint.dia.Link cast is what hides the undefined case from the type checker.)
   
   No screenshots: neither change alters rendered output or behavior, that is precisely the claim under test.
   
   Any related issues, documentation, discussions?
   
   Closes #7459
   
   How was this PR tested?
   
   Because this is a refactor with no behavior change, the removed branches cannot be driven red by definition. Instead, two regression guards were added that pass both before and after the removals, pinning the behavior the removals must preserve:
   
   - hugging-face-image-upload.component.spec.ts, an image with no filename renders exactly Uploaded image; a known filename renders instead; and with no image the preview block does not render at all, so the label is never empty.
   - drag-drop.service.spec.ts, a link present in the Texera graph but with no model in the JointJS paper is skipped: findIntersectedLink returns null and does not throw. (Removing both guards makes this fail on linkView.el, so it genuinely pins the path.)
   
   corepack yarn ng test --watch=false \
     --include="**/hugging-face-image-upload.component.spec.ts" \
     --include="**/drag-drop.service.spec.ts"
   
   - Against unmodified source: 2 files, 56/56 passing — the new guards are green before any code is touched.
   - After both removals: 2 files, 56/56 passing, with no assertion edits.
   
   Wider sweep, adding the specs for the formly config that registers the component:
   
   corepack yarn ng test --watch=false \
     --include="**/formly*.spec.ts" \
     --include="**/hugging-face-image-upload.component.spec.ts" \
     --include="**/drag-drop.service.spec.ts"
   → 4 files, 83/83 passing
   
   yarn prettier-eslint reports all four touched files unchanged.
   
   Was this PR authored or co-authored using generative AI tooling?
   
   Generated-by: Yes alongside Claude Code.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@texera.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] refactor(frontend): remove two pieces of unreachable code [texera]

Posted by "Raja-Hamid (via GitHub)" <gi...@apache.org>.
Raja-Hamid commented on PR #7512:
URL: https://github.com/apache/texera/pull/7512#issuecomment-5379427306

   Hey @aglinxinyuan , Description has been updated.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@texera.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] refactor(frontend): remove two pieces of unreachable code [texera]

Posted by "aglinxinyuan (via GitHub)" <gi...@apache.org>.
aglinxinyuan merged PR #7512:
URL: https://github.com/apache/texera/pull/7512


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@texera.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] refactor(frontend): remove two pieces of unreachable code [texera]

Posted by "codecov-commenter (via GitHub)" <gi...@apache.org>.
codecov-commenter commented on PR #7512:
URL: https://github.com/apache/texera/pull/7512#issuecomment-5241429047

   ## [Codecov](https://app.codecov.io/gh/apache/texera/pull/7512?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
   :white_check_mark: All modified and coverable lines are covered by tests.
   :white_check_mark: Project coverage is 86.40%. Comparing base ([`42d08a3`](https://app.codecov.io/gh/apache/texera/commit/42d08a3701cd06542bcfa92728116302723b2536?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)) to head ([`8e13591`](https://app.codecov.io/gh/apache/texera/commit/8e13591e51d3d1cf1d11186b99ac861b862f6023?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)).
   
   <details><summary>Additional details and impacted files</summary>
   
   
   
   ```diff
   @@             Coverage Diff              @@
   ##               main    #7512      +/-   ##
   ============================================
   + Coverage     86.38%   86.40%   +0.01%     
     Complexity     4211     4211              
   ============================================
     Files          1169     1169              
     Lines         46750    46748       -2     
     Branches       5203     5201       -2     
   ============================================
   + Hits          40387    40391       +4     
   + Misses         4641     4635       -6     
     Partials       1722     1722              
   ```
   
   | [Flag](https://app.codecov.io/gh/apache/texera/pull/7512/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Coverage Δ | | *Carryforward flag |
   |---|---|---|---|
   | [access-control-service](https://app.codecov.io/gh/apache/texera/pull/7512/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `70.00% <ø> (ø)` | | Carriedforward from [42d08a3](https://app.codecov.io/gh/apache/texera/commit/42d08a3701cd06542bcfa92728116302723b2536?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
   | [agent-service](https://app.codecov.io/gh/apache/texera/pull/7512/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `86.87% <ø> (ø)` | | Carriedforward from [42d08a3](https://app.codecov.io/gh/apache/texera/commit/42d08a3701cd06542bcfa92728116302723b2536?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
   | [amber](https://app.codecov.io/gh/apache/texera/pull/7512/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `81.87% <ø> (ø)` | | Carriedforward from [42d08a3](https://app.codecov.io/gh/apache/texera/commit/42d08a3701cd06542bcfa92728116302723b2536?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
   | [computing-unit-managing-service](https://app.codecov.io/gh/apache/texera/pull/7512/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `50.72% <ø> (ø)` | | Carriedforward from [42d08a3](https://app.codecov.io/gh/apache/texera/commit/42d08a3701cd06542bcfa92728116302723b2536?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
   | [config-service](https://app.codecov.io/gh/apache/texera/pull/7512/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `65.97% <ø> (ø)` | | Carriedforward from [42d08a3](https://app.codecov.io/gh/apache/texera/commit/42d08a3701cd06542bcfa92728116302723b2536?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
   | [file-service](https://app.codecov.io/gh/apache/texera/pull/7512/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `69.05% <ø> (ø)` | | Carriedforward from [42d08a3](https://app.codecov.io/gh/apache/texera/commit/42d08a3701cd06542bcfa92728116302723b2536?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
   | [frontend](https://app.codecov.io/gh/apache/texera/pull/7512/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `89.26% <100.00%> (+0.02%)` | :arrow_up: | |
   | [notebook-migration-service](https://app.codecov.io/gh/apache/texera/pull/7512/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `78.89% <ø> (ø)` | | Carriedforward from [42d08a3](https://app.codecov.io/gh/apache/texera/commit/42d08a3701cd06542bcfa92728116302723b2536?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
   | [pyamber](https://app.codecov.io/gh/apache/texera/pull/7512/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `97.56% <ø> (ø)` | | Carriedforward from [42d08a3](https://app.codecov.io/gh/apache/texera/commit/42d08a3701cd06542bcfa92728116302723b2536?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
   | [workflow-compiling-service](https://app.codecov.io/gh/apache/texera/pull/7512/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `26.31% <ø> (ø)` | | Carriedforward from [42d08a3](https://app.codecov.io/gh/apache/texera/commit/42d08a3701cd06542bcfa92728116302723b2536?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
   
   *This pull request uses carry forward flags. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) to find out more.
   </details>
   
   [:umbrella: View full report in Codecov by Harness](https://app.codecov.io/gh/apache/texera/pull/7512?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).   
   :loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
   <details><summary> :rocket: New features to boost your workflow: </summary>
   
   - :package: [JS Bundle Analysis](https://docs.codecov.com/docs/javascript-bundle-analysis): Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
   </details>


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@texera.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] refactor(frontend): remove two pieces of unreachable code [texera]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #7512:
URL: https://github.com/apache/texera/pull/7512#issuecomment-5241324017

   <!-- texera:template-compliance -->
   👋 Thanks for opening this pull request, @Raja-Hamid!
   
   It looks like the pull request description doesn't quite follow our template yet:
   
   - The **How was this PR tested?** section is missing; please keep the template's headings.
   - The **Was this PR authored or co-authored using generative AI tooling?** section is missing; please keep the template's headings.
   
   Filling out the template helps reviewers understand and triage your contribution faster. Please edit the description to complete it. This message will disappear automatically once the template is followed.
   
   You can find the template prompts by editing the description, or see [CONTRIBUTING.md](https://github.com/apache/texera/blob/main/CONTRIBUTING.md) for the full contribution flow.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@texera.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] refactor(frontend): remove two pieces of unreachable code [texera]

Posted by "aglinxinyuan (via GitHub)" <gi...@apache.org>.
aglinxinyuan commented on PR #7512:
URL: https://github.com/apache/texera/pull/7512#issuecomment-5244756506

   > 👋 Thanks for opening this pull request, @Raja-Hamid!
   > 
   > It looks like the pull request description doesn't quite follow our template yet:
   > 
   > * The **How was this PR tested?** section is missing; please keep the template's headings.
   > * The **Was this PR authored or co-authored using generative AI tooling?** section is missing; please keep the template's headings.
   > 
   > Filling out the template helps reviewers understand and triage your contribution faster. Please edit the description to complete it. This message will disappear automatically once the template is followed.
   > 
   > You can find the template prompts by editing the description, or see [CONTRIBUTING.md](https://github.com/apache/texera/blob/main/CONTRIBUTING.md) for the full contribution flow.
   
   @Raja-Hamid please address this comment.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@texera.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] refactor(frontend): remove two pieces of unreachable code [texera]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #7512:
URL: https://github.com/apache/texera/pull/7512#issuecomment-5241326386

   <!-- texera-reviewer-suggestion -->
   ### Automated Reviewer Suggestions
   
   Based on the `git blame` history of the changed files, we recommend the following reviewers:
   
   - **Contributors with relevant context:** `@PG1204`, `@mengw15`, `@aglinxinyuan`
     You can notify them by mentioning `@PG1204`, `@mengw15`, `@aglinxinyuan` in a comment.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@texera.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] refactor(frontend): remove two pieces of unreachable code [texera]

Posted by "Raja-Hamid (via GitHub)" <gi...@apache.org>.
Raja-Hamid commented on PR #7512:
URL: https://github.com/apache/texera/pull/7512#issuecomment-5241358822

   Hey @aglinxinyuan, Need your review on this.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@texera.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org