Skip to content

test(frontend): cover the missing branches in SharedModel, staged objects, UDF parameters and landing page - #7687

Merged
mengw15 merged 2 commits into
apache:mainfrom
mengw15:chore/7684-four-branch-coverage
Aug 15, 2026
Merged

mengw15 merged 2 commits into
apache:mainfrom
mengw15:chore/7684-four-branch-coverage

Conversation

@mengw15

@mengw15 mengw15 commented Aug 15, 2026

Copy link
Copy Markdown
Contributor

What changes were proposed in this PR?

Takes the untaken branch on each conditional in four small files (15 new tests):

File Before After
user-dataset-staged-objects-list.component.ts 31/32 lines, 17/22 branches 32/32, 22/22
shared-model.ts 26/28 lines, 6/10 branches 28/28, 10/10
ui-udf-parameters.component.ts 47/49 lines, 29/36 branches 49/49, 36/36
landing-page.component.ts 45/45 lines, 16/21 branches 45/45, 20/21
  • UserDatasetStagedObjectsList — a missing userMakeChangesEvent, reverting
    with no dataset id, the delete-failure notification, and the three
    getFileUploadTime guards (no map, a path whose last segment is empty so the
    || filePath fallback runs, and a filename absent from the map).
  • SharedModel — this file had no spec of its own, so this adds one: the room
    suffix with and without a workflow id, the local CoeditorState published for
    a signed-in user versus an anonymous one, updateAwareness in both modes,
    transact, and each combination of shouldConnect/wsconnected in destroy.
    The spec substitutes a WebsocketProvider double — the real one opens a socket
    and schedules reconnects, which would put the network and a leaked timer inside
    the test.
  • UiUdfParameters — a parse error alongside the already-covered edit error and
    an unrelated error that must be rethrown, a fieldArray supplied as a factory
    function, a generated row that declares none of the expected columns (both
    if (!field) return guards), a repeat populate that re-applies the disabled
    state instead of re-wrapping the hook, and trackByParameterName's ?? index.
  • LandingPage — a hub response without the requested action buckets plus an
    enrichment that yields nothing, so all four || [] fallbacks run, and a
    construction with no signed-in user.

landing-page.component.ts ends at 20/21: the remaining entry is a synthetic
branch the compiler/instrumenter attributes to the class-declaration line. The
behaviour behind it is covered — the new test drives the no-user path and asserts
currentUid stays undefined — but neither stubbing getCurrentUser nor clearing
the stub's user moves that counter.

No production code was changed.

Any related issues, documentation, discussions?

Closes #7684.

How was this PR tested?

ng test --watch=false over the four specs — 47 passed; the per-file line/branch numbers above come from the local lcov report. eslint and prettier --check clean. Failure path verified by breaking one new assertion in each of the four files: 4 failed / 43 passed, non-zero exit, then restored to green.

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

Generated-by: Claude Code (Opus 5)

@github-actions github-actions Bot added the frontend Changes related to the frontend GUI label Aug 15, 2026
@mengw15
mengw15 requested a lite review from Copilot August 15, 2026 04:20
@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: @kunwp1, @Ma77Ball, @carloea2
    You can notify them by mentioning @kunwp1, @Ma77Ball, @carloea2 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

Adds Vitest unit tests to exercise previously unhit conditional branches in a few small frontend modules, improving per-file branch/line coverage without changing production code.

Changes:

  • Added a new SharedModel spec that mocks y-websocket to avoid real sockets/timers while covering constructor/awareness/transaction/destroy branches.
  • Extended UiUdfParametersComponent spec to cover parse-error handling, fieldArray factory handling, missing-column guards, and trackBy fallbacks.
  • Extended LandingPageComponent and UserDatasetStagedObjectsListComponent specs to cover remaining conditional fallbacks and failure paths.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
frontend/src/app/workspace/service/workflow-graph/model/shared-model.spec.ts New unit tests for SharedModel using a mocked websocket provider to cover branch cases safely.
frontend/src/app/workspace/component/ui-udf-parameters/ui-udf-parameters.component.spec.ts Adds tests to hit missing error-handling and template/column-guard branches.
frontend/src/app/hub/component/landing-page/landing-page.component.spec.ts Adds tests for no-user construction and empty-bucket hub responses; includes a case that currently violates a real service contract.
frontend/src/app/dashboard/component/user/user-dataset/user-dataset-explorer/user-dataset-staged-objects-list/user-dataset-staged-objects-list.component.spec.ts Adds tests for missing-input guards, revert failure notification, and upload-time fallbacks.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@codecov-commenter

codecov-commenter commented Aug 15, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.49%. Comparing base (2b66f1a) to head (7fbd07b).
⚠️ Report is 3 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff              @@
##               main    #7687      +/-   ##
============================================
+ Coverage     90.44%   90.49%   +0.05%     
  Complexity     4426     4426              
============================================
  Files          1175     1175              
  Lines         47131    47131              
  Branches       5285     5285              
============================================
+ Hits          42626    42653      +27     
+ Misses         2746     2740       -6     
+ Partials       1759     1738      -21     
Flag Coverage Δ *Carryforward flag
access-control-service 70.00% <ø> (ø) Carriedforward from 2b66f1a
agent-service 98.62% <ø> (ø) Carriedforward from 2b66f1a
amber 87.04% <ø> (ø) Carriedforward from 2b66f1a
computing-unit-managing-service 72.46% <ø> (ø) Carriedforward from 2b66f1a
config-service 77.55% <ø> (ø) Carriedforward from 2b66f1a
file-service 68.90% <ø> (ø) Carriedforward from 2b66f1a
frontend 92.00% <ø> (+0.13%) ⬆️
notebook-migration-service 79.31% <ø> (ø) Carriedforward from 2b66f1a
pyamber 97.57% <ø> (ø) Carriedforward from 2b66f1a
workflow-compiling-service 57.89% <ø> (ø) Carriedforward from 2b66f1a

*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 force-pushed the chore/7684-four-branch-coverage branch from fa9194a to 4ef73ad Compare August 15, 2026 04:50
`vi.mock("y-websocket")` is silently ignored when the whole suite is built at
once: the builder bundles the dependency into a shared chunk, so the module
specifier no longer matches and SharedModel keeps its real provider. The spec
passed on its own and failed the five double-dependent cases in CI.

Read the real provider instead — `roomname` for the room suffix and a spy on
`disconnect` for the teardown branches. No socket is opened either way; the
suite already installs an inert `WebSocket` global.
@mengw15
mengw15 requested a review from aglinxinyuan August 15, 2026 05:28
@mengw15 mengw15 changed the title test(frontend): cover the missing branches in four small files test(frontend): cover the missing branches in SharedModel, staged objects, UDF parameters and landing page Aug 15, 2026
@mengw15
mengw15 added this pull request to the merge queue Aug 15, 2026
Merged via the queue into apache:main with commit 1022c7d Aug 15, 2026
26 checks passed
@mengw15
mengw15 deleted the chore/7684-four-branch-coverage branch August 15, 2026 06:28
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 missing branches in four small frontend files

4 participants