You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@texera.apache.org by "aglinxinyuan (via GitHub)" <gi...@apache.org> on 2026/08/09 12:04:43 UTC

[I] Template coverage does not register for components whose spec calls TestBed.overrideComponent [texera]

aglinxinyuan opened a new issue, #7458:
URL: https://github.com/apache/texera/issues/7458

   ### Task Summary
   
   Six component templates report **0% coverage** despite having substantial, passing specs, and adding tests to them does not change the number. Together they account for roughly 230 uncovered lines that no amount of test writing can reach.
   
   | Template | Spec size | Reported |
   |---|---|---|
   | `hub-workflow-detail.component.html` | 442-line spec, 7 `detectChanges` | 0% |
   | `user-project.component.html` | 262-line spec | 0% |
   | `search.component.html` | 242-line spec | 0% |
   | `workspace.component.html` | — | 0% |
   | `hub-search-result.component.html` | — | 0% |
   | `search-results.component.html` | — | 75.8% (partial) |
   
   The common factor is `TestBed.overrideComponent`. Across the repo, templates whose spec calls it average **18%** coverage with 6 of 8 at zero; templates whose spec does not average **76.7%**, with only 2 of 73 at zero. Every one of these specs uses the additive `remove`/`add: { imports }` form to swap heavyweight child components for stubs — they do **not** override the template itself, so the real template genuinely renders and is genuinely exercised. It simply is not attributed.
   
   Two counterexamples (`search-results`, `operator-property-edit-frame`) also call `overrideComponent` and do report coverage, so `overrideComponent` alone is not a sufficient explanation and the precise trigger is still unidentified.
   
   ### Why this matters
   
   These files look like the largest remaining coverage gaps in the frontend, so they attract effort that cannot pay off. Two separate coverage sweeps ranked `hub-workflow-detail` (46 lines) and `user-project` (38 lines) near the top of the backlog before the pattern was spotted. Anyone working from the Codecov file list will keep rediscovering them.
   
   ### Suggested next steps
   
   - Confirm the mechanism — most likely the component recompilation `overrideComponent` triggers produces a template with a different identity than the one the coverage remapper knows about.
   - If it cannot be fixed, exclude these templates from the coverage denominator so the reported figure reflects what is actually testable, and note the reason.
   - Either way, record it somewhere discoverable so the next person ranking targets does not spend the effort again.
   
   ### Task Type
   
   - [ ] Refactor / Cleanup
   - [x] DevOps / Deployment / CI
   - [ ] Testing / QA
   - [ ] Documentation
   - [ ] Performance
   - [ ] Other
   


-- 
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.apache.org

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


Re: [I] Template coverage does not register for components whose spec calls TestBed.overrideComponent [texera]

Posted by "aglinxinyuan (via GitHub)" <gi...@apache.org>.
aglinxinyuan commented on issue #7458:
URL: https://github.com/apache/texera/issues/7458#issuecomment-5249279104

   Root cause found, and measured rather than inferred.
   
   **The mechanism.** `TestBed.overrideComponent` makes Angular re-JIT the component from its retained decorator metadata (`pendingComponents` → `compileComponent` → `jitExpression`). The re-compiled template function carries no source map back to the `.component.html`, so every binding still executes and none of it is attributed. That is why the affected components show a healthy `.ts` next to a `.html` at exactly zero — `agent-panel.component.ts` is 98.5% with 0 of 133 lines missed while `agent-panel.component.html` is 0/49. Nothing but attribution loss produces that pair.
   
   **All eight zero-coverage templates are now accounted for**, by correlating every one of the 98 `.html` files in the live Codecov report:
   
   | Template | Lines | Cause |
   |---|---:|---|
   | `agent-panel` | 49 | overridden in its only rendering spec |
   | `hub-workflow-detail` | 46 | same |
   | `user-project` | 38 | same |
   | `search` | 35 | same |
   | `workspace` | 28 | same |
   | `hub-search-result` | 25 | same |
   | `ui-udf-parameters` | — | spec never uses TestBed (`new UiUdfParametersComponent()`) |
   | `collab-wrapper` | 67 | no spec (and #7351 deletes it) |
   
   The two overridden specs whose templates *are* covered confirm the mechanism from the other direction: `search-results.component.html` (75.8%) and `operator-property-edit-frame.component.html` (68.2%) each have a **sibling** spec that renders the real component un-overridden.
   
   **The remedy works.** #7535 applies it to `hub-workflow-detail`:
   
   | | Before | After |
   |---|---|---|
   | lines | 0/46 (0.0%) | **45/46 (97.8%)** |
   | branches | — | 3/3 |
   
   Three tests, and the existing 32 are untouched — the new block keeps its own `TestBed` so those tests keep their mocked `WorkflowActionService` and the ten assertions they make on it. Wholesale de-stubbing would mean rewriting those ten, which is a worse trade than adding a render block.
   
   **One thing that should change regardless of whether anyone picks up the remaining five.** `frontend/.eslintrc.json` currently prescribes the pattern that causes this, in three separate messages — the `NO_ERRORS_SCHEMA` rule and both `overrideComponent` rules all tell authors to "stub it via `overrideComponent({ remove: { imports: [Real] }, add: { imports: [Stub] } })`". The `set: { template }` message is right that substituting a template zeroes coverage, but the additive `remove`/`add` form it recommends instead does the same thing, for the same reason. Accurate guidance would be: any override zeroes the template's coverage, so prefer expanding the child's service stubs so the real child can instantiate, and if a child genuinely cannot be, add a sibling block that renders the real component.
   
   Happy to send that eslintrc wording as its own small PR if that is wanted — I kept it out of #7535 so the test change stays spec-only.
   


-- 
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: [I] Template coverage does not register for components whose spec calls TestBed.overrideComponent [texera]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on issue #7458:
URL: https://github.com/apache/texera/issues/7458#issuecomment-5231421975

   <!-- texera:template-compliance -->
   👋 Thanks for opening this issue, @aglinxinyuan!
   
   It looks like the issue description doesn't quite follow our template yet:
   
   - This issue doesn't appear to use one of our templates (Bug, Feature, or Task). Please open it using a template so the required details are captured.
   
   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