Skip to content

test(frontend): cover the build-version script, user config and agent registration - #8066

Merged
aglinxinyuan merged 1 commit into
apache:mainfrom
aglinxinyuan:cov/frontend-config-and-build-version
Aug 29, 2026
Merged

test(frontend): cover the build-version script, user config and agent registration#8066
aglinxinyuan merged 1 commit into
apache:mainfrom
aglinxinyuan:cov/frontend-config-and-build-version

Conversation

@aglinxinyuan

Copy link
Copy Markdown
Contributor

What changes were proposed in this PR?

Five existing frontend specs extended. +16 fully-covered lines and +8 branch arms.

File Codecov lines Branch arms
build-version.js 8/15 → 15/15 2/3 → 4/4
user-config.service.ts 60/63 → 63/63 31/33 → 33/33
agent-registration.component.html 46/48 → 48/48 7/10 → 10/10
code-editor.service.ts + 1 line + 1 arm
notebook-migration.service.ts + 1 line

build-version.js carries most of it: lines 42–46 and 53 were never executed and 52 was partial. Its arm total rises from 3 to 4 rather than staying fixed, because loading the script as raw CJS also records the buildNumber = generate(version) default-parameter branch that the transformed import never emitted — worth stating, since a reader comparing arm totals would otherwise think the denominator moved for no reason.

agent-registration.component.html gains zero on plain line-hit (48/48 both before and after) and moves only on Codecov's metric, by completing three branch arms. The two numbers are not interchangeable and both are given.

Deliberately excluded: every stub-*.service.ts. Those six files hold 29 further missed lines — more than this whole PR — but they are test doubles, not production code, so covering them would be padding. One of them (stub-user-project.service.ts, 18 missed lines) is being deleted outright by the open project-removal work.

Verification

21 mutations, no survivors. Every one was re-derived from scratch on the shipping tree: snapshot first, anchor asserted to occur exactly once, one mutant at a time, hash-equality plus an empty non-spec diff verified immediately before each run, reverted from the snapshot rather than from git.

19 of the 21 die to exactly one test with the rest of the file green. The other two are named rather than rounded up: the writeFileSync payload exchange also kills "announces the build number it produced" (the manifest stops being parseable JSON), and the error-ternary exchange at agent-registration.component.ts:104 also kills a sibling.

The baseline was re-measured rather than inherited: specs backed up to a scratch dir, each restored by exact single file path (never a directory), git status --porcelain --untracked-files=all confirmed empty, then the literal CI command body run — nx test --watch=false --progress=false --coverage --coverage-reporters=lcovonly from frontend/, which is what yarn --cwd frontend run test:ci executes and whose lcov is uploaded under the frontend flag. Specs were then restored and the restored diff byte-verified against the saved patch before the second run. Both lcovs were parsed with a script implementing Codecov's rule directly: a line counts only if its DA hit is non-zero and every BRDA arm on it is taken.

Whole suite: 5208 passed + 1 skipped → 5220 passed + 1 skipped, 204/204 files both times. The single skip is pre-existing and untouched.

One correction to an earlier draft of this bundle: it implied the agent-registration spec started from a different test count than it did. The real per-spec counts are 7→10, 20→22, 4→5, 37→39, 15→19.

yarn format:ci passes. frontend/junit.xml and frontend/coverage/ are regenerated by every run and are not committed. No production file is touched.

Any related issues, documentation, discussions?

Closes #8064

How was this PR tested?

npx ng test --watch=false --include="**/build-version.spec.ts" --include="**/user-config.service.spec.ts" --include="**/code-editor.service.spec.ts" --include="**/notebook-migration.service.spec.ts" --include="**/agent-registration.component.spec.ts"
 Test Files  5 passed (5)
      Tests  95 passed (95)

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 28, 2026 04:26

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

@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.54%. Comparing base (bdc6d2a) to head (cc2efb6).

Additional details and impacted files
@@             Coverage Diff              @@
##               main    #8066      +/-   ##
============================================
+ Coverage     93.51%   93.54%   +0.03%     
  Complexity     4709     4709              
============================================
  Files          1181     1181              
  Lines         47809    47809              
  Branches       5327     5327              
============================================
+ Hits          44708    44723      +15     
+ Misses         1663     1653      -10     
+ Partials       1438     1433       -5     
Flag Coverage Δ *Carryforward flag
access-control-service 81.00% <ø> (ø) Carriedforward from bdc6d2a
agent-service 99.32% <ø> (ø) Carriedforward from bdc6d2a
amber 89.59% <ø> (ø) Carriedforward from bdc6d2a
computing-unit-managing-service 73.67% <ø> (ø) Carriedforward from bdc6d2a
config-service 86.73% <ø> (ø) Carriedforward from bdc6d2a
file-service 87.89% <ø> (ø) Carriedforward from bdc6d2a
frontend 96.00% <ø> (+0.07%) ⬆️
notebook-migration-service 79.31% <ø> (ø) Carriedforward from bdc6d2a
pyamber 98.50% <ø> (ø) Carriedforward from bdc6d2a
workflow-compiling-service 77.19% <ø> (ø) Carriedforward from bdc6d2a

*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 29, 2026 06:28
@mengw15
mengw15 requested a lite review from Copilot August 29, 2026 06:50

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

@aglinxinyuan
aglinxinyuan added this pull request to the merge queue Aug 29, 2026
Merged via the queue into apache:main with commit bb56bba Aug 29, 2026
25 checks passed
@aglinxinyuan
aglinxinyuan deleted the cov/frontend-config-and-build-version branch August 29, 2026 07:07
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.

Add unit test coverage for the frontend build-version script and four small service gaps

4 participants