Skip to content

test(frontend): render the hub workflow detail with its real children - #7535

Merged
aglinxinyuan merged 1 commit into
apache:mainfrom
aglinxinyuan:cov/hub-detail-destub
Aug 11, 2026
Merged

aglinxinyuan merged 1 commit into
apache:mainfrom
aglinxinyuan:cov/hub-detail-destub

Conversation

@aglinxinyuan

Copy link
Copy Markdown
Contributor

What changes were proposed in this PR?

hub-workflow-detail.component.html reported 0 of 46 lines while its own .ts sat at 98% — the
attribution loss from #7458, not a testing gap. The spec stubs its three children out through
TestBed.overrideComponent, and any override re-JITs the component from its decorator metadata; the
re-compiled template has no source map back to the .html, so the bindings execute uncounted.

Adds a describe block that renders the component with its real children. That restores
attribution:

Before After
lines 0/46 (0.0%) 45/46 (97.8%)
branches — 3/3

Three tests: the real editor and mini-map resolving rather than the stub selectors, and the
*ngIf="isHub" back button appearing and not appearing. It keeps its own TestBed so the 32 tests
above retain their mocked WorkflowActionService and the ten assertions they make on it — the real
service is needed here only because the real editor injects DynamicSchemaService, which reads the
graph's operator streams.

Verification

Both *ngIf mutations were applied to the template and reverted (production diff empty):

Mutation Result
back button always rendered (*ngIf="true") red
back button never rendered (*ngIf="false") red

Two assertions in the first test are honestly guards, not behaviour pins: renaming the child
elements only breaks the template build rather than producing a clean behavioural failure, so they
are there to stop the override creeping back in, and the coverage measurement above is their real
evidence. Saying so rather than listing them as killed mutations.

One assertion was dropped during review of my own work: the clone button's
[disabled]="!isLogin || !isHub || !isActivatedUser" does not reflect to the DOM disabled
property under this fixture (it stays false with isHub === false), so asserting on it would have
been either vacuous or wrong. The back button discriminates cleanly and is what the tests use.

No production file is touched.

Any related issues, documentation, discussions?

Closes #7534

How was this PR tested?

npx ng test --watch=false --include="**/hub-workflow-detail.component.spec.ts"
 Test Files  1 passed (1)
      Tests  35 passed (35)

3 new on top of the existing 32. yarn format:ci passes.

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

Generated-by: Claude Code (Opus 5)

hub-workflow-detail.component.html reported 0 of 46 lines covered while
its own .ts sat at 98%, which is not an undertested template - it is the
attribution loss recorded in apache#7458. The existing spec stubs the three
child components out through TestBed.overrideComponent, and any override
makes Angular re-JIT the component from its retained decorator metadata;
the re-compiled template has no source map back to the .html, so every
binding still executes and none is counted.

Adds a describe block that renders the component with its real children,
which restores attribution: the template goes from 0/46 to 45/46 lines
and 3/3 branches. It keeps its own TestBed so the 32 tests above retain
their mocked WorkflowActionService and the ten assertions they make on
it; the real service is needed here only because the real editor injects
DynamicSchemaService, which reads the graph's operator streams.

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

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 11, 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: @Ma77Ball
    You can notify them by mentioning @Ma77Ball 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 87.52%. Comparing base (561cd0e) to head (99b8056).

Additional details and impacted files
@@             Coverage Diff              @@
##               main    #7535      +/-   ##
============================================
+ Coverage     87.42%   87.52%   +0.10%     
  Complexity     4253     4253              
============================================
  Files          1176     1176              
  Lines         46986    46986              
  Branches       5245     5245              
============================================
+ Hits          41077    41126      +49     
+ Misses         4178     4131      -47     
+ Partials       1731     1729       -2     
Flag Coverage Δ *Carryforward flag
access-control-service 70.00% <ø> (ø) Carriedforward from 561cd0e
agent-service 98.62% <ø> (ø) Carriedforward from 561cd0e
amber 82.20% <ø> (ø) Carriedforward from 561cd0e
computing-unit-managing-service 60.38% <ø> (ø) Carriedforward from 561cd0e
config-service 65.97% <ø> (ø) Carriedforward from 561cd0e
file-service 69.05% <ø> (ø) Carriedforward from 561cd0e
frontend 89.70% <ø> (+0.23%) ⬆️
notebook-migration-service 78.89% <ø> (ø) Carriedforward from 561cd0e
pyamber 97.52% <ø> (ø) Carriedforward from 561cd0e
workflow-compiling-service 26.31% <ø> (ø) Carriedforward from 561cd0e

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

@aglinxinyuan
aglinxinyuan requested a review from mengw15 August 11, 2026 05:27

@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

@aglinxinyuan
aglinxinyuan added this pull request to the merge queue Aug 11, 2026
Merged via the queue into apache:main with commit dcecfa6 Aug 11, 2026
25 checks passed
@aglinxinyuan
aglinxinyuan deleted the cov/hub-detail-destub branch August 11, 2026 06:54
renovate-bot pushed a commit to renovate-bot/apache-_-texera that referenced this pull request Aug 14, 2026
…#7629)

### What changes were proposed in this PR?

`agent-panel.component.html` reported **0 of 49 lines** while its own
`.ts` sat at **133/133 with nothing missed**. That pairing can only be
attribution loss — this template is one of the better-tested in the
frontend. The cause is apache#7458: the spec stubs its children out with
`TestBed.overrideComponent`, and any override re-JITs the component from
its decorator metadata, leaving the re-compiled template with no source
map back to the `.html`.

Adds a `describe` block that renders the component with its **real**
children:

| | Before | After |
|---|---|---|
| `agent-panel.component.html` | 0/49 | **49/49** |
| `agent-panel.component.ts` | 133/133 | 133/133 |

The block keeps its own `TestBed`, so the 42 existing tests keep their
stubs and assertions untouched. Same remedy as merged PR apache#7535.
Rendering the real children also incidentally lifts the child templates'
own coverage.

### Verification

18 mutations applied and reverted, production diff empty each time.

**Two of my new tests then turned out to claim more than they could
observe, and both are fixed:**

| Test | Why it could not fail | Fix |
|---|---|---|
| "force-renders every tab body: the registration form and one chat per
agent" | the registration tab **is** the selected tab, so its body
renders whether or not `[nzForceRender]` is set — flipping it to `false`
left the suite green | select an agent tab first, so the registration
body is present only if force-rendered; the tautological
`selectedTabIndex` assertion was dropped |
| "the close button ... deletes that agent without selecting its tab" |
`selectedTabIndex` was already 0 and `activateAgent` already un-called,
so both assertions held with `event.stopPropagation()` deleted | start
on the first agent's tab and assert the click does not activate the
neighbour |

Both exposing mutations — the registration tab losing `nzForceRender`,
and the close handler losing `stopPropagation` — are now red.

That second one is worth spelling out: the mutation *did* turn the suite
red before the fix, but the failure came from a **pre-existing** test
elsewhere in the file, while the new test stayed green. A red suite is
not evidence that the test under discussion pins anything.

### Deliberately not included

Nothing in this PR pins the child components' internals; the assertions
stay on this template's own structure and branches.

No production file is touched.

### Any related issues, documentation, discussions?

Closes apache#7628

### How was this PR tested?

```
npx ng test --watch=false --include="**/agent-panel.component.spec.ts"
```

```
 Test Files  1 passed (1)
      Tests  51 passed (51)
```

9 new on top of the existing 42. Coverage re-measured by reverting the
spec, running with `--coverage`, and restoring. `yarn format:ci` passes.

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

Generated-by: Claude Code (Opus 5)

Co-authored-by: Meng Wang <[email protected]>
renovate-bot pushed a commit to renovate-bot/apache-_-texera that referenced this pull request Aug 14, 2026
…pache#7627)

### What changes were proposed in this PR?

`search.component.html` reported **0 of 35 lines** covered while its own
`.ts` sat at 93%. That is the attribution loss from apache#7458, not an
untested template: the spec stubs its children out through
`TestBed.overrideComponent`, and any override re-JITs the component from
its decorator metadata, so the re-compiled template has no source map
back to the `.html` and its bindings execute uncounted.

Adds a `describe` block that renders the component with its **real**
children, which restores attribution:

| | Before | After |
|---|---|---|
| `search.component.html` lines | 0/35 | **35/35** |
| `search.component.html` functions | 0/6 | **6/6** |
| `search.component.ts` lines | 52/56 | 55/56 |
| `search.component.ts` branches | 19/23 | 21/23 |

The block keeps its own `TestBed`, so the 15 existing tests keep their
stubs and assertions untouched. Same remedy as merged PR apache#7535.

### Verification

16 mutations applied and reverted, production diff empty each time. Five
were then run independently, chosen against the failure modes rather
than repeating the list:

| Probe | Result |
|---|---|
| drop `[currentUid]` from the child binding | red — so the
child-instance assertion is not the "collaborator also sets it" trap |
| `(sortMethodChange)` no longer assigns | red |
| the All-type button unwired | red |
| delete the Project button's `nz-icon` span | red — which also proves
`nz-icon` really derives its `anticon-*` class under jsdom |
| `[showResourceTypes]="true"` → `"false"` | **survives**, and was
reported as such |

I ran a sixth of my own afterwards — unwiring the All-type button — and
it is red.

### Deliberately not included

`[showResourceTypes]` is reported rather than pinned: repo-wide grep
shows the consuming component never varies it, so the flag has one value
in practice and no assertion can distinguish the two.

No production file is touched.

### Any related issues, documentation, discussions?

Closes apache#7626

### How was this PR tested?

```
npx ng test --watch=false --include="**/search.component.spec.ts"
```

```
 Test Files  1 passed (1)
      Tests  22 passed (22)
```

7 new on top of the existing 15. Coverage re-measured from scratch by
reverting the spec, running with `--coverage`, then restoring. `yarn
format:ci` passes.

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

Generated-by: Claude Code (Opus 5)

Co-authored-by: Meng Wang <[email protected]>
renovate-bot pushed a commit to renovate-bot/apache-_-texera that referenced this pull request Aug 15, 2026
…pache#7661)

### What changes were proposed in this PR?

`hub-search-result.component.html` reported **0 of 23 lines, 0 of 8
branches and 0 of 3 functions** covered, behind a 17-test spec. That is
the attribution loss from apache#7458, not an untested template: the spec
swaps its four children for same-selector stubs via
`TestBed.overrideComponent`, and any override re-JITs the component from
its decorator metadata, leaving the recompiled template with no source
map back to the `.html`.

Adds a `describe` block that renders the component with its **real**
children:

| | Before | After |
|---|---|---|
| lines | 0/23 | **23/23** |
| branches | 0/8 | **8/8** |
| functions | 0/3 | **3/3** |

The block keeps its own `TestBed`, so the 17 existing tests keep their
stubs and assertions untouched. Same remedy as merged PRs apache#7535, apache#7627
and apache#7629 — this is the last of the six templates apache#7458 identified, bar
`workspace` and the `user-project` one that the project-feature removal
deletes.

Covered: the real children resolving rather than the stub selectors, the
dataset-only view toggle and its absence for workflows, which toggle
button is highlighted, the sort options shown and hidden per search
type, the sort handler's two halves, the card template and its
`viewMode` guard, and the three inputs handed to the results list.

### Verification

23 mutations applied and reverted, production diff empty each time.

**Two then turned out to survive, and the cause is worth recording.**
The view-toggle helper read each button as
`classList.contains("ant-btn-primary")`, which pins a ternary's *true*
leg only — so changing the false leg from `'default'` to `'dashed'` or
`'link'` shipped green. The build's own mutations replaced the whole
ternary with a constant, which flips the primary leg and dies, which is
exactly why the gap was missed.

The helper now reads the type by **name**, matched against the nzType
names rather than any `ant-btn-*` class, since the buttons also carry
`ant-btn-icon-only` — my first attempt at the fix picked that modifier
up and failed loudly, which is how I found it.

All three are now red, each on the intended test rather than merely
somewhere in the suite:

| Mutation | Result | Failing test |
|---|---|---|
| list button's false leg → `dashed` | red | "highlights whichever
view-toggle button matches…" |
| card button's false leg → `link` | red | same |
| list button collapsed to a constant (control) | red | same |

### Deliberately not included

A static `nzTheme="outline"` attribute carries no lcov line and is not
asserted.

No production file is touched.

### Any related issues, documentation, discussions?

Closes apache#7660

### How was this PR tested?

```
npx ng test --watch=false --include="**/hub-search-result.component.spec.ts"
```

```
 Test Files  1 passed (1)
      Tests  27 passed (27)
```

10 new on top of the existing 17. Coverage re-measured by reverting the
spec, running with `--coverage`, and restoring. `yarn format:ci` passes.

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

Generated-by: Claude Code (Opus 5)
renovate-bot pushed a commit to renovate-bot/apache-_-texera that referenced this pull request Aug 17, 2026
…ers (apache#7717)

### What changes were proposed in this PR?

The `build / frontend (macos-latest)` leg failed 6 times between 08-14
and 08-17, each time on a **pure timeout in a different spec** — never a
failed assertion (details and per-failure table in apache#7713). The leg's own
wall time swings ~2x run to run (9m17s–16m52s), and the same test that
runs in ~400ms on ubuntu has been observed at 11s+ inside a `beforeEach`
on a loaded macOS runner — while Vitest's default limits (5s test / 10s
hook) are fixed absolute values that don't scale with runner load.
Nothing in the frontend test setup changed in that window; the margin is
simply thin enough that ordinary macOS runner variance crosses it.

- Set `testTimeout: 20000` and `hookTimeout: 30000` in
`frontend/vitest.config.ts` (which previously set neither, inheriting
the 5s/10s defaults) — roughly 4x/3x the worst observed times. Both are
needed: 4 of the 6 failures hit the test timeout, 2 hit the hook
timeout.
- The cost is that a genuinely hung test reports 15–20s later,
negligible against a 9–17 minute leg and strictly cheaper than
re-running CI and eroding the signal a red leg carries.
- `vitest.browser.config.ts` (the browser-mode leg) deliberately keeps
the defaults — no timeout failures have been observed there.
- Deliberately **not** making the individual specs cheaper: some are
expensive on purpose (`hub-search-result` / `search` stand up real child
components to work around the coverage-attribution loss in apache#7458;
undoing that would revert apache#7627 / apache#7535).

### Any related issues, documentation, discussions?

Closes apache#7713.

### How was this PR tested?

- Config-only change with no executable code; the frontend CI legs
themselves exercise it by loading `vitest.config.ts` for the full
202-spec / 4704-test suite.
- Type-checked the edited config against Vitest's `InlineConfig` typings
(`tsc --noEmit` passes — the option names and types are validated), and
`prettier --check` passes, so `format:ci` is unaffected.
- No spec sets a per-test timeout override (verified by grep), so the
global raise applies uniformly.

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

Generated-by: Claude Code (claude-opus-4-8)

---------

Signed-off-by: Meng Wang <[email protected]>
Co-authored-by: Copilot Autofix powered by AI <[email protected]>
renovate-bot pushed a commit to renovate-bot/apache-_-texera that referenced this pull request Aug 18, 2026
…rds (apache#7733)

### What changes were proposed in this PR?

Two small frontend targets. The headline is the console frame template,
whose line percentage hid the real gap:

| File | Before | After |
|---|---|---|
| `console-frame.component.html` | branches **0/8**, functions **5/9** |
**8/8 branches, 9/9 functions** |
| `console-frame.component.ts` | 96.9% lines, 95% functions | **65/65
lines (100%), 20/20 functions** |
| `preset.service.ts` | 94.8% lines, 90.5% branches | **111/115 lines,
70/74 branches** |

7 tests added. Covered: `ngOnChanges` adopting a new operator id, the
empty-list fallback, typing into the command box through a real `input`
event and submitting, narrowing the send by picking a worker in the
`nz-select` overlay, the settings dropdown's two toggles, and two
`preset.service` validation guards.

**This is 8 lines by line-count.** What earns it is the branch and
function coverage on the template — every interactive control in the
console frame was previously unexercised — and that all 8 mutations die.

### Not an apache#7458 case, and worth saying so

The obvious guess for a dark template here is the
`TestBed.overrideComponent` attribution loss behind merged PRs apache#7535,
apache#7627, apache#7629, apache#7661, apache#7681 and apache#7727. It is not: the existing spec uses
`imports: [ConsoleFrameComponent, ...]` with no override, and the
coverage map shows bindings executing counted (the `*ngFor` statement
has 124 hits). So this extends the existing TestBed rather than
appending a separate one — the opposite call from apache#7727, for a checkable
reason.

### Verification

8 mutations, **8 killed, no survivors**, each applied one at a time with
the anchor asserted unique, reverted and `git diff`-checked between
every run. All failures are assertion failures, never compile errors.

| Mutation | Killed by |
|---|---|
| **exchange** `[(ngModel)]="showTimestamp"` and `"showSource"` |
toggles the timestamp and source tags independently |
| `[(ngModel)]="targetWorker"` -> one-way | narrows the command to the
worker picked |
| `[(ngModel)]="command"` -> one-way | sends the text typed into the
command box |
| **exchange** `currentValue` and `previousValue` | `ngOnChanges` adopts
the newly bound operator id |
| remove the `\|\| []` fallback | falls back to an empty list for an
unseen operator |
| **exchange** the `"error"` and `"info"` switch bodies | refuses to
save with an 'info' severity |
| `push(replacementPreset)` -> `push(originalPreset)` | stores the
replacement when the dictionary has no entry yet |
| give `"warning"` a default toast instead of throwing | refuses to save
with a 'warning' severity |

The first one is the reason the fixture is not degenerate: the kill
lands on the *independence* assertion (timestamp off, source still on).
Turning both toggles off at once would have survived the exchange.

One mechanical note worth recording: the settings dropdown's menu is
projected into a CDK overlay wired in `ngAfterViewInit` behind an
`auditTime(150)`, so its fixture must be created **inside** `fakeAsync`.
Created in a plain `beforeEach`, the timers escape `tick()`, the overlay
never attaches, and the switch count is 0 — a test written against that
state would pass while asserting nothing.

### Deliberately not included, with evidence

- **`updatePreset` (lines 184-190) is dead *and* buggy**, so no test was
written for it. It has zero call sites repo-wide outside its own spec.
And `indexOf(presets, originalPreset)` is lodash reference-equality
against a freshly `JSON.parse`d array, so it always returns `-1`:
`splice(-1, 1)` deletes the **wrong** preset and `presets[-1] = ...` is
a silent no-op that `JSON.stringify` drops. Its sibling
`updateOrCreatePreset` carries the comment *"presets are freshly
JSON-parsed, so reference-based indexOf would miss"* and uses
`findIndex(isEqual)` — the fix was applied there and not here. Any test
would cement the bug.
- **`console-frame.component.html` lines 54 and 59 are structurally
unreachable**: `#checkedTemplate` and `#unCheckedTemplate` are each
declared **twice** (36/41 and 53/58), and both `nz-switch`es resolve to
the first pair. The coverage map proves it — statements at 37/42 have 46
hits (2 switches x 23 fixtures) while 54/59 have 0.
- Two `.ts` branch arms are guard-guaranteed: `renderConsole()`'s `if
(this.operatorId)` already forces the ternary's true leg, and
`#consoleList` is unconditional in the template so its `@ViewChild` is
always set in a rendered fixture.

A third, weaker observation, reported and not pinned: `ngOnChanges` does
`this.operatorId = changes.operatorId?.currentValue`, so an
`ngOnChanges` fired by a change to `consoleInputEnabled` alone would
wipe `operatorId` to `undefined` and silently disable the debug console.
`ResultPanelComponent` always sets both inputs together, so it is latent
rather than triggered today; the new test pins only the normal path.

No production file is touched.

### Any related issues, documentation, discussions?

Closes apache#7732

### How was this PR tested?

```
npx ng test --watch=false --include="**/preset.service.spec.ts" --include="**/console-frame.component.spec.ts"
```

```
 Test Files  2 passed (2)
```

86 tests green in the two target specs; 174 green including the consumer
specs `result-panel.component.spec.ts` and
`preset-wrapper.component.spec.ts`, checked for CDK-overlay leakage
across specs. `yarn format:ci` passes.

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

Generated-by: Claude Code (Opus 5)
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.

Recover the hub workflow detail template's coverage by rendering its real children

4 participants