Skip to content

Conversation

@moreal
Copy link
Contributor

@moreal moreal commented Jan 26, 2026

Summary

This pull request is inspired from 4bca460 commit. 🙏🏻

While the pnpm run -r command itself runs tasks sequentially according to dependencies, the pnpm build it calls when running tests causes unnecessary and race-condition-inducing duplicate and parallel builds.

So this pull request separates pnpm build from test script as pretest script. My intention is:

  • Run pnpm build when running for each test. For instance, cd packages/fedify && pnpm test should run pnpm build to build dependencies and itself.
  • Do not run pnpm build by mise task test, because the test task depends on prepare task which builds packages by running pnpm run -r build:self.

Related issue

I couldn't find related issue when searching with:

  • label:component/ci
  • "race"
  • "codegen"

Changes

List the specific modifications made in this PR.
Focus on what was changed without going into detail about impact.

  • Separate pnpm build script in each test script as pretest script.
  • Let mise task test ignore pre/post script by --config.enable-pre-post-scripts=false

Benefits

While it's hard to calculate precisely, it will reduce not only the time it takes to run mise tests locally but also CI execution time.

In my local environment:

  • On the current main HEAD, it takes 280s and test:bun has failed.
  • On this pull request's branch, it takes 190s.

In the GitHub Actions:

Of course, this is not precise.

Additionally, it is expected to resolve the race conditions that occurred with the existing parallel builds.

Checklist

  • Did you add a changelog entry to the CHANGES.md?
  • Did you write some relevant docs about this change (if it's a new feature)?
  • Did you write a regression test to reproduce the bug (if it's a bug fix)?
  • Did you write some tests for this change (if it's a new feature)?
  • Did you run mise test on your machine?

Additional notes

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @moreal, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly refines the project's build and test workflow by decoupling the build process from the test execution in individual packages. By leveraging pretest scripts and configuring the mise task runner to avoid redundant pre/post script execution, the changes address existing race conditions and dramatically improve the efficiency and reliability of the testing pipeline. This optimization results in faster local and CI test runs.

Highlights

  • Refactored Test Scripts: The pnpm build command has been separated from the test and test:bun scripts in package.json files across multiple packages. It is now moved into dedicated pretest and pretest:bun scripts.
  • Optimized mise Task Execution: The mise.toml configuration for test:node and test:bun tasks has been updated to include --config.enable-pre-post-scripts=false. This prevents pnpm from automatically running pretest scripts when mise is already handling the build dependency via its prepare task.
  • Performance and Stability Improvements: These changes aim to eliminate unnecessary and race-condition-inducing duplicate builds during test execution, leading to faster CI times and more reliable test runs. Initial benchmarks suggest a significant reduction in test execution time (from 280s to 190s).
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@issues-auto-labeler issues-auto-labeler bot added component/build Build system and packaging component/ci CI/CD workflows and GitHub Actions component/testing Testing utilities (@fedify/testing) labels Jan 26, 2026
@moreal moreal changed the title Separate build script from test script Avoid to repeat unnecessary build Jan 26, 2026
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request correctly separates the build and test steps to improve CI performance and prevent race conditions. By moving build commands to pretest scripts and disabling them during the recursive test run in mise.toml, the changes ensure that packages are built only once. The implementation is consistent across all packages and effectively solves the problem described. This is a great improvement for the project's development workflow.

@codecov
Copy link

codecov bot commented Jan 26, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ All tests successful. No failed tests found.
see 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Member

@dahlia dahlia left a comment

Choose a reason for hiding this comment

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

Thanks!

@dahlia dahlia merged commit 262b048 into fedify-dev:main Jan 27, 2026
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

component/build Build system and packaging component/ci CI/CD workflows and GitHub Actions component/testing Testing utilities (@fedify/testing)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants