Skip to content

Conversation

@github-actions
Copy link
Contributor

@github-actions github-actions bot commented Dec 2, 2025

Overview

This PR adds the coverage steps configuration needed for the Daily Test Coverage Improver workflow to systematically improve test coverage in the React and backend.ai-ui projects.

Changes

Added .github/actions/daily-test-improver/coverage-steps/action.yml which includes:

  1. Setup: Node.js, pnpm, and dependency installation with caching
  2. React Project:
    • Generate GraphQL types using Relay compiler
    • Run tests with coverage collection
    • Output coverage to react/coverage/
  3. backend.ai-ui Project:
    • Run tests with coverage collection
    • Output coverage to packages/backend.ai-ui/coverage/
  4. Coverage Merging:
    • Install nyc for combining coverage reports
    • Merge coverage data from both projects
    • Generate combined HTML and LCOV reports
  5. Artifact Upload:
    • Upload all coverage reports as a single artifact named 'coverage'
    • Include execution log (coverage-steps.log) for debugging

Coverage Reports Generated

  • React: coverage/react/lcov-report/index.html
  • backend.ai-ui: coverage/backend-ai-ui/lcov-report/index.html
  • Combined: coverage/combined/lcov-report/index.html (merged report)

Testing Strategy

Each step logs its progress to coverage-steps.log for debugging purposes. The action handles cases where coverage generation might fail gracefully.

Review Notes

Please review carefully to ensure:

  • The build and test commands are appropriate for these projects
  • Coverage collection settings align with project needs
  • The merging strategy correctly combines coverage from both projects
  • No sensitive information is exposed in logs

What Happens Next

Once this PR is merged, the next workflow run will proceed to Phase 3, where the Daily Test Coverage Improver will:

  1. Execute these coverage steps to establish baseline coverage
  2. Analyze coverage reports to identify untested code
  3. Systematically write tests to improve coverage
  4. Create draft PRs with evidence of coverage improvements

If running in "repeat" mode, the workflow will automatically run again to proceed to Phase 3.


Related Discussion: #4760

AI generated by Daily Test Coverage Improver workflow

AI generated by Daily Test Coverage Improver

@graphite-app
Copy link

graphite-app bot commented Dec 2, 2025

How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:

  • flow:merge-queue - adds this PR to the back of the merge queue
  • flow:hotfix - for urgent hot fixes, skip the queue and merge this PR next

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has required the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

@yomybaby yomybaby self-assigned this Dec 2, 2025
@yomybaby yomybaby self-requested a review December 2, 2025 10:48
@yomybaby yomybaby marked this pull request as ready for review December 2, 2025 10:49
Copilot AI review requested due to automatic review settings December 2, 2025 10:49
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds a GitHub Actions composite action to generate test coverage reports for the Daily Test Coverage Improver workflow. The action runs tests for both the React (/react) and backend.ai-ui (/packages/backend.ai-ui) projects, generates individual coverage reports, merges them, and uploads the results as artifacts.

Key Changes

  • Adds comprehensive coverage generation workflow with setup, test execution, merging, and artifact upload
  • Implements logging to coverage-steps.log for debugging
  • Generates separate and combined coverage reports using Jest and nyc

Comment on lines +136 to +137
cd react && pnpm run test -- --coverage --coverageReporters=text-summary 2>&1 | grep -A 10 "Coverage summary" | tee -a ../coverage-steps.log || true
cd ..
Copy link

Copilot AI Dec 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This step runs the full test suite again with coverage just to extract the summary. This is inefficient and will significantly increase workflow execution time since the tests have already been run in earlier steps (lines 52-69).

Instead, use npx nyc report with the existing coverage data or parse the already generated coverage reports. For example:

cd react && npx nyc report --reporter=text-summary --temp-dir=coverage 2>&1 | grep -A 10 "Coverage summary" | tee -a ../coverage-steps.log || true

Copilot uses AI. Check for mistakes.
Comment on lines +144 to +145
cd packages/backend.ai-ui && pnpm run test -- --coverage --coverageReporters=text-summary 2>&1 | grep -A 10 "Coverage summary" | tee -a ../../coverage-steps.log || true
cd ../..
Copy link

Copilot AI Dec 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This step runs the full test suite again with coverage just to extract the summary. This is inefficient and will significantly increase workflow execution time since the tests have already been run in earlier steps (lines 62-69).

Instead, use npx nyc report with the existing coverage data or parse the already generated coverage reports. For example:

cd packages/backend.ai-ui && npx nyc report --reporter=text-summary --temp-dir=coverage 2>&1 | grep -A 10 "Coverage summary" | tee -a ../../coverage-steps.log || true

Copilot uses AI. Check for mistakes.
cp react/coverage/coverage-final.json coverage/temp/react-coverage.json
cp packages/backend.ai-ui/coverage/coverage-final.json coverage/temp/backend-ai-ui-coverage.json
npx nyc merge coverage/temp coverage/combined/coverage-final.json 2>&1 | tee -a coverage-steps.log
npx nyc report --temp-dir coverage/combined --reporter=html --reporter=lcov --reporter=text-summary --report-dir coverage/combined 2>&1 | tee -a coverage-steps.log
Copy link

Copilot AI Dec 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The npx nyc report command is using --temp-dir incorrectly. The --temp-dir option specifies where nyc should look for coverage data (typically .nyc_output/), not the final report directory.

When merging coverage, the merged coverage-final.json file should be placed in a temporary directory that nyc expects. Update the commands to:

mkdir -p .nyc_output
cp coverage/combined/coverage-final.json .nyc_output/
npx nyc report --reporter=html --reporter=lcov --reporter=text-summary --report-dir coverage/combined 2>&1 | tee -a coverage-steps.log

This ensures nyc can find the merged coverage data in its expected location.

Suggested change
npx nyc report --temp-dir coverage/combined --reporter=html --reporter=lcov --reporter=text-summary --report-dir coverage/combined 2>&1 | tee -a coverage-steps.log
mkdir -p .nyc_output
cp coverage/combined/coverage-final.json .nyc_output/
npx nyc report --reporter=html --reporter=lcov --reporter=text-summary --report-dir coverage/combined 2>&1 | tee -a coverage-steps.log

Copilot uses AI. Check for mistakes.
Comment on lines +62 to +69
- name: Run backend.ai-ui tests with coverage
shell: bash
working-directory: ./packages/backend.ai-ui
run: |
echo "Step: Running backend.ai-ui tests with coverage..." >> ../../coverage-steps.log
echo "Coverage output will be saved to: packages/backend.ai-ui/coverage/" >> ../../coverage-steps.log
pnpm run test -- --coverage --coverageDirectory=coverage 2>&1 | tee -a ../../coverage-steps.log
echo "backend.ai-ui tests completed" >> ../../coverage-steps.log
Copy link

Copilot AI Dec 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The backend.ai-ui package's jest configuration (lines 170-191 in packages/backend.ai-ui/package.json) does not include a collectCoverageFrom configuration. This means the coverage collection may include unintended files or miss important source files.

Consider adding a collectCoverageFrom configuration to the jest config in packages/backend.ai-ui/package.json similar to the React project's configuration:

"collectCoverageFrom": [
  "src/**/*.{js,jsx,ts,tsx}",
  "!src/**/*.d.ts"
]

This ensures coverage is collected only from source files and excludes type definition files.

Copilot uses AI. Check for mistakes.
@github-actions github-actions bot added the size:L 100~500 LoC label Dec 3, 2025
Copy link
Member

@yomybaby yomybaby left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Let's see it works.

@yomybaby yomybaby merged commit e6119f3 into main Dec 3, 2025
7 checks passed
@yomybaby yomybaby deleted the test/coverage-steps-config-1764671617-dda1a615f145ab18 branch December 3, 2025 01:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L 100~500 LoC

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants