Skip to content

chore(frontend): fix NG8113/NG8107 template diagnostics, add test, promote to errors#5985

Merged
Yicong-Huang merged 2 commits into
apache:mainfrom
Yicong-Huang:chore/fix-ng811x-template-diagnostics
Jun 29, 2026
Merged

chore(frontend): fix NG8113/NG8107 template diagnostics, add test, promote to errors#5985
Yicong-Huang merged 2 commits into
apache:mainfrom
Yicong-Huang:chore/fix-ng811x-template-diagnostics

Conversation

@Yicong-Huang

@Yicong-Huang Yicong-Huang commented Jun 28, 2026

Copy link
Copy Markdown
Contributor

What changes were proposed in this PR?

Fix the two remaining Angular extended-diagnostic warnings surfaced by the frontend build, add a unit test for the affected logic, and promote both checks to build errors so regressions can't silently creep back in:

  • NG8113CardItemComponent listed NzWaveDirective in its standalone imports array but never used it in the template. Removed the unused directive import.
  • NG8107computing-unit-selection.component.html used pve.name?.trim(), but PveDraft.name is a non-nullable string, so the optional chaining is redundant. Extracted the predicate into an isCreateDisabled(pve) component method bound via [disabled]="isCreateDisabled(pve)", and added unit tests covering empty / whitespace / valid / padded names (the create button stays disabled until the env name has non-whitespace content).
  • Enforcement — set unusedStandaloneImports (NG8113) and optionalChainNotNullable (NG8107) to "error" under angularCompilerOptions.extendedDiagnostics.checks. Placed in tsconfig.app.json (the prod build, build:ci) rather than the base tsconfig, because extendedDiagnostics requires strictTemplates, which the unit-test builds deliberately disable; tsconfig.test.json clears the inherited option to avoid NG4003.

No runtime behavior change.

Any related issues, documentation, discussions?

Closes #5984

How was this PR tested?

  • ng test (the affected spec): 46 passed, including the 4 new isCreateDisabled cases.
  • ng build: succeeds with 0 NG8113/NG8107 diagnostics (now configured as errors) and produces the normal bundle.

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

Generated-by: Claude Code (Claude Opus 4.8)

@github-actions github-actions Bot added the frontend Changes related to the frontend GUI label Jun 28, 2026
@github-actions

github-actions Bot commented Jun 28, 2026

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: @SarahAsad23, @xuang7, @aglinxinyuan
    You can notify them by mentioning @SarahAsad23, @xuang7, @aglinxinyuan in a comment.

@codecov-commenter

codecov-commenter commented Jun 28, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 50.00000% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 56.23%. Comparing base (0e0ec11) to head (40724c2).
⚠️ Report is 15 commits behind head on main.

Files with missing lines Patch % Lines
...wer-button/computing-unit-selection.component.html 0.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main    #5985      +/-   ##
============================================
- Coverage     56.23%   56.23%   -0.01%     
  Complexity     2987     2987              
============================================
  Files          1120     1120              
  Lines         43167    43168       +1     
  Branches       4658     4657       -1     
============================================
  Hits          24274    24274              
  Misses        17472    17472              
- Partials       1421     1422       +1     
Flag Coverage Δ *Carryforward flag
access-control-service 70.00% <ø> (ø) Carriedforward from 0e0ec11
agent-service 44.59% <ø> (ø) Carriedforward from 0e0ec11
amber 57.77% <ø> (ø) Carriedforward from 0e0ec11
computing-unit-managing-service 0.00% <ø> (ø) Carriedforward from 0e0ec11
config-service 51.56% <ø> (ø) Carriedforward from 0e0ec11
file-service 59.02% <ø> (ø) Carriedforward from 0e0ec11
frontend 49.28% <50.00%> (+<0.01%) ⬆️
notebook-migration-service 78.57% <ø> (ø) Carriedforward from 0e0ec11
pyamber 90.20% <ø> (ø) Carriedforward from 0e0ec11
python 90.76% <ø> (ø) Carriedforward from 0e0ec11
workflow-compiling-service 55.14% <ø> (ø) Carriedforward from 0e0ec11

*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.

@Yicong-Huang Yicong-Huang changed the title chore(frontend): fix NG8113/NG8107 template diagnostics chore(frontend): fix NG8113/NG8107 template diagnostics and promote them to errors Jun 28, 2026
Yicong-Huang and others added 2 commits June 28, 2026 14:49
Two Angular extended-diagnostic warnings surfaced by the build:

- NG8113: CardItemComponent listed NzWaveDirective in its standalone
  imports array but never used it in the template. Remove the unused
  import.
- NG8107: computing-unit-selection.component.html used pve.name?.trim()
  where PveDraft.name is a non-nullable string, so the optional chaining
  is redundant. Extract the predicate into an isCreateDisabled(pve)
  component method bound via [disabled]="isCreateDisabled(pve)" and unit
  test it (empty / whitespace / valid / padded names).

Closes apache#5984

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Set unusedStandaloneImports (NG8113) and optionalChainNotNullable
(NG8107) to "error" so future regressions fail the prod build (build:ci)
instead of emitting an easily-ignored warning.

Placed in tsconfig.app.json rather than the base tsconfig because
extendedDiagnostics requires strictTemplates, which the unit-test builds
deliberately disable; tsconfig.test.json clears the inherited option to
avoid NG4003.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@Yicong-Huang Yicong-Huang force-pushed the chore/fix-ng811x-template-diagnostics branch from 31cc9e7 to 40724c2 Compare June 28, 2026 21:49
@Yicong-Huang Yicong-Huang changed the title chore(frontend): fix NG8113/NG8107 template diagnostics and promote them to errors chore(frontend): fix NG8113/NG8107 template diagnostics, add test, promote to errors Jun 28, 2026
@aglinxinyuan aglinxinyuan requested a review from Copilot June 28, 2026 23:48

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

This PR cleans up two remaining Angular extended-template diagnostic warnings in the frontend, adds unit coverage for the affected UI predicate, and upgrades both diagnostics to build errors so regressions fail CI during production builds.

Changes:

  • Remove unused standalone NzWaveDirective import to resolve NG8113.
  • Replace redundant pve.name?.trim() optional chaining in the template with a component predicate isCreateDisabled(pve) and add unit tests for name/whitespace handling (NG8107).
  • Promote unusedStandaloneImports and optionalChainNotNullable extended diagnostics to "error" in the production app tsconfig, while explicitly clearing inherited diagnostics in the test build tsconfig.

Reviewed changes

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

Show a summary per file
File Description
frontend/src/tsconfig.app.json Enables/enforces the two extended diagnostics as build errors for production builds.
frontend/src/tsconfig.test.json Clears inherited extendedDiagnostics for the test build that disables strictTemplates.
frontend/src/app/workspace/component/power-button/computing-unit-selection.component.ts Introduces isCreateDisabled(pve) predicate used by the template.
frontend/src/app/workspace/component/power-button/computing-unit-selection.component.html Switches [disabled] binding to isCreateDisabled(pve) to remove redundant optional chaining.
frontend/src/app/workspace/component/power-button/computing-unit-selection.component.spec.ts Adds unit tests covering empty/whitespace/valid/padded names for isCreateDisabled.
frontend/src/app/dashboard/component/user/list-item/card-item/card-item.component.ts Removes unused NzWaveDirective import/standalone inclusion to satisfy NG8113.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@Yicong-Huang Yicong-Huang added this pull request to the merge queue Jun 29, 2026
Merged via the queue into apache:main with commit c16058b Jun 29, 2026
25 checks passed
@Yicong-Huang Yicong-Huang deleted the chore/fix-ng811x-template-diagnostics branch June 29, 2026 05:44
Mrudhulraj pushed a commit to Mrudhulraj/texera that referenced this pull request Jun 30, 2026
…omote to errors (apache#5985)

### What changes were proposed in this PR?

Fix the two remaining Angular extended-diagnostic warnings surfaced by
the frontend build, add a unit test for the affected logic, and promote
both checks to build errors so regressions can't silently creep back in:

- **NG8113** — `CardItemComponent` listed `NzWaveDirective` in its
standalone `imports` array but never used it in the template. Removed
the unused directive import.
- **NG8107** — `computing-unit-selection.component.html` used
`pve.name?.trim()`, but `PveDraft.name` is a non-nullable `string`, so
the optional chaining is redundant. Extracted the predicate into an
`isCreateDisabled(pve)` component method bound via
`[disabled]="isCreateDisabled(pve)"`, and added unit tests covering
empty / whitespace / valid / padded names (the create button stays
disabled until the env name has non-whitespace content).
- **Enforcement** — set `unusedStandaloneImports` (NG8113) and
`optionalChainNotNullable` (NG8107) to `"error"` under
`angularCompilerOptions.extendedDiagnostics.checks`. Placed in
`tsconfig.app.json` (the prod build, `build:ci`) rather than the base
tsconfig, because `extendedDiagnostics` requires `strictTemplates`,
which the unit-test builds deliberately disable; `tsconfig.test.json`
clears the inherited option to avoid `NG4003`.

No runtime behavior change.

### Any related issues, documentation, discussions?

Closes apache#5984

### How was this PR tested?

- `ng test` (the affected spec): **46 passed**, including the 4 new
`isCreateDisabled` cases.
- `ng build`: succeeds with **0** NG8113/NG8107 diagnostics (now
configured as errors) and produces the normal bundle.

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

Generated-by: Claude Code (Claude Opus 4.8)

---------

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.

Fix NG8113/NG8107 template diagnostics in card-item and computing-unit-selection

4 participants