Skip to content

test(frontend): cover the compiling service and the search-results template - #7727

Merged
aglinxinyuan merged 2 commits into
apache:mainfrom
aglinxinyuan:cov/compiling-service-and-search-results
Aug 17, 2026
Merged

test(frontend): cover the compiling service and the search-results template#7727
aglinxinyuan merged 2 commits into
apache:mainfrom
aglinxinyuan:cov/compiling-service-and-search-results

Conversation

@aglinxinyuan

Copy link
Copy Markdown
Contributor

What changes were proposed in this PR?

Two frontend files, bundled because one needed a proven remedy and the other was a plain gap.

File Before After
search-results.component.html 0/33 lines, 0/6 branches, 0/6 functions 33/33, 6/6, 6/6
workflow-compiling.service.ts 140/157 lines, 90/105 branches, 32/36 functions 157/157, 103/105, 36/36

Tests 50 -> 73. search-results.component.ts also rises to 42/42 lines as a side effect.

Both files reach 100% of their lines, which necessarily covers all 19 of the lines Codecov reports missed (11 + 8).

The template was not undertested — it was unattributed

This is #7458, and this instance is worth recording because it presents as the opposite. The existing describe uses TestBed.overrideComponent and does render and assert on the DOM: it checks texera-list-item counts, .card-entry nodes, and load-more visibility. The template still measured 0 of 33 lines. Rendering happened; nothing was attributed. Second fingerprint: under the override the whole template function was attributed to the .ts as one uncovered span (55,35)-(79).

The appended describe keeps its own TestBed with no override and the real ListItemComponent, so the existing tests and the StubListItemComponent are untouched.

Verification

23 mutations, 23 killed, no survivors — each applied one at a time with the production file byte-compared after every revert, and the failing test read by name.

Two mutations had to be reformulated, which is the part worth flagging:

  • Exchanging the compile response's success/failure legs is a TypeScript narrowing error, not a behaviour change. A mutation that only fails to compile proves nothing, so it was discarded and replaced with three semantic mutants: the success leg additionally requiring zero operator errors, the state stream being notified only from the failed leg, and the failed leg reusing the previous errors.
  • Dropping the && cardTemplate guard breaks strictTemplates narrowing, so that mutant carries a companion [ngTemplateOutlet]="cardTemplate!" purely to keep it compiling. The behaviour change — card view rendering with no template — is the mutation, and it died on a DOM assertion.

One survivor was found and closed during the build rather than reported: [currentUid]="this.currentUid" replaced by entry.ownerId passed, because every fixture entry shared an owner. The new test gives two entries distinguishable owners (7 and 99), asserts on the rendered .owner-badge, then re-points currentUid to 99 and asserts the badge moves — so a constant replacement dies too.

Deliberately not included

Two branches in workflow-compiling.service.ts are structurally unreachable, so it cannot exceed 103/105:

  • if (!dynamicSchema) return undefined (line 241) is dead: DynamicSchemaService.getDynamicSchema() returns a non-nullable OperatorSchema and throws on a miss. This is also the file's only uncovered statement.
  • if (schemas.length > 0) (line 285) sits inside if (linksToThisPort.length > 0), where schemas is precisely that array mapped, so the false leg cannot occur.

A production bug is reported rather than pinned: getAttrNames (line 362) tests required-ness against the root schema via operatorSchema.jsonSchema.required?.includes(attrName), while DynamicSchemaService.mutateProperty recurses into nested properties/definitions/items. So a nested property that is required in its own sub-schema still gets "" appended to its enum, and a nested optional property whose name collides with a root-level required one loses that escape hatch. The new tests exercise only root-level properties, so neither behaviour is cemented.

Also noted, not cemented: getOperatorInputSchemaMap is a getter that mutates currentCompilationStateInfo, flipping the whole compilation to Failed when two links disagree on a port schema.

No production file is touched.

Any related issues, documentation, discussions?

Closes #7726

How was this PR tested?

npx ng test --watch=false --include="**/workflow-compiling.service.spec.ts" --include="**/search-results.component.spec.ts"
 Test Files  2 passed (2)
      Tests  73 passed (73)

Coverage measured with --coverage on the same run. yarn format:ci passes, and was checked non-vacuously with a positive control: a deliberately misformatted throwaway file made it exit 1 and name the file, then was removed.

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

Generated-by: Claude Code (Opus 5)

Copilot AI lite review requested due to automatic review settings August 17, 2026 06:45

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

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

@github-actions github-actions Bot added the frontend Changes related to the frontend GUI label Aug 17, 2026
@aglinxinyuan
aglinxinyuan requested a review from mengw15 August 17, 2026 06:52
@codecov-commenter

codecov-commenter commented Aug 17, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.76%. Comparing base (16ba619) to head (d91968a).

Additional details and impacted files
@@             Coverage Diff              @@
##               main    #7727      +/-   ##
============================================
- Coverage     90.93%   90.76%   -0.17%     
+ Complexity     4450     4403      -47     
============================================
  Files          1174     1173       -1     
  Lines         47139    46961     -178     
  Branches       5284     5258      -26     
============================================
- Hits          42866    42626     -240     
- Misses         2580     2662      +82     
+ Partials       1693     1673      -20     
Flag Coverage Δ *Carryforward flag
access-control-service 70.00% <ø> (-11.00%) ⬇️ Carriedforward from 2f77d5a
agent-service 98.62% <ø> (ø) Carriedforward from 2f77d5a
amber 87.04% <ø> (-0.35%) ⬇️ Carriedforward from 2f77d5a
computing-unit-managing-service 72.81% <ø> (-0.86%) ⬇️ Carriedforward from 2f77d5a
config-service 77.08% <ø> (-9.66%) ⬇️ Carriedforward from 2f77d5a
file-service 68.90% <ø> (ø) Carriedforward from 2f77d5a
frontend 92.58% <ø> (+0.14%) ⬆️
notebook-migration-service 78.35% <ø> (-5.40%) ⬇️ Carriedforward from 2f77d5a
pyamber 97.57% <ø> (-0.01%) ⬇️ Carriedforward from 2f77d5a
workflow-compiling-service 57.89% <ø> (-19.30%) ⬇️ Carriedforward from 2f77d5a

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

@mengw15
mengw15 requested a lite review from Copilot August 17, 2026 07:05

@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

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 2 out of 2 changed files in this pull request and generated no new comments.

@aglinxinyuan
aglinxinyuan added this pull request to the merge queue Aug 17, 2026
Merged via the queue into apache:main with commit 8bcc8eb Aug 17, 2026
22 checks passed
@aglinxinyuan
aglinxinyuan deleted the cov/compiling-service-and-search-results branch August 17, 2026 08:18
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.

Cover the compiling service and recover the search-results template's coverage

4 participants