Skip to content

feat: lighthouse integration, pnpm workspace setup, and CI optimization - #243

Draft
Tarektouati wants to merge 20 commits into
mainfrom
feat/add-core-web-vitals
Draft

feat: lighthouse integration, pnpm workspace setup, and CI optimization#243
Tarektouati wants to merge 20 commits into
mainfrom
feat/add-core-web-vitals

Conversation

@Tarektouati

@Tarektouati Tarektouati commented Jan 21, 2026

Copy link
Copy Markdown
Collaborator

1️⃣ First

🔇 Problem

  • Missing Core Web Vitals measurements during user journey in E2E
  • Need of shared pnpm-lock.yml between app and e2e (node.js apps) for consolidation
  • CI/CD optimization around moon setup
  • Health check of our application.

🎹 Proposal

Lighthouse & E2E:

  • Usage of lighthouse integration in Playwright tests.
  • Added "Black Box" testing black-box-test.yml to run e2e tests against arbitrary URLs.
  • Added helper utilities (computeJourneyScore, runLighthouseStep) with full unit test coverage using vitest.

Workspace & Architecture:

  • pnpm Workspace: Initialized root pnpm-workspace.yaml and package.json to manage app and e2e packages.
  • Shared Formatting: Created base.prettier.mjs for consistent code style across the monorepo and applied it to the e2e package.
  • Lockfile Consolidation: Migrated to a centralized pnpm-lock.yaml.

CI/CD:

  • Workflow Optimization: Updated all GitHub Actions workflows to leverage moonsetup with auto-install and caching for faster builds.

Testing Strategy:

  • Unit Tests: Run moon run e2e:test to verify new Lighthouse helpers.
  • E2E Tests: Run moon run e2e:run to verify the user journey and performance scoring.
  • CI Verification: Validated via the new black-box-test GH workflow and existing build/deploy pipelines.

🎶 Comments

This PR address multiple problems, it could be split in multiple stacked PRs

github-actions Bot pushed a commit that referenced this pull request Jan 21, 2026
@github-actions

github-actions Bot commented Jan 21, 2026

Copy link
Copy Markdown
PR Preview Action v1.8.1

QR code for preview link

🚀 View preview at
https://Gudsfile.github.io/tracksy/pr-preview/pr-243/

Built to branch gh-pages at 2026-02-07 16:59 UTC.
Preview will be ready when the GitHub Pages deployment is complete.

@Tarektouati
Tarektouati force-pushed the feat/add-core-web-vitals branch from 8524702 to ed3a649 Compare February 2, 2026 17:25
github-actions Bot pushed a commit that referenced this pull request Feb 2, 2026
@Tarektouati
Tarektouati force-pushed the feat/add-core-web-vitals branch from ed3a649 to cb9977b Compare February 3, 2026 15:59
Comment thread .github/workflows/black-box-test.yml Fixed
@Tarektouati
Tarektouati force-pushed the feat/add-core-web-vitals branch 2 times, most recently from 9e9cfe2 to eac49bc Compare February 3, 2026 18:48
github-actions Bot pushed a commit that referenced this pull request Feb 3, 2026
@Tarektouati
Tarektouati force-pushed the feat/add-core-web-vitals branch from 7f41196 to cac80d1 Compare February 3, 2026 19:21
@Tarektouati Tarektouati changed the title feat: introduce Core Web Vitals in E2E feat: lighthouse integration, pnpm workspace setup, and CI optimization Feb 3, 2026
@Tarektouati
Tarektouati force-pushed the feat/add-core-web-vitals branch from ed9388e to e20354d Compare February 3, 2026 20:18
@Tarektouati
Tarektouati marked this pull request as ready for review February 3, 2026 20:19
@Tarektouati
Tarektouati force-pushed the feat/add-core-web-vitals branch 3 times, most recently from e793398 to 60ed862 Compare February 3, 2026 21:12
Comment thread e2e/tests/main.spec.ts
STEP_WEIGHTS
)

console.log({ globalScore })

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

next step is to publish this score in PRs

@Tarektouati
Tarektouati force-pushed the feat/add-core-web-vitals branch from 60ed862 to 6826ef3 Compare February 3, 2026 21:16
Comment thread .moon/workspace.yml
defaultBranch: "main"
syncHooks: true
hooks:
# HACK: unset GIT_INDEX_FILE is needed to prevent git from locking the index file during a commit before running the moon tasks. This forces moon to use the standard repository index, which prevents the conflict.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

important: this why git-hooks weren't working since moon migration from husky

import lighthouse from 'lighthouse'

// HACK: we rely on mock instead of spy as this is the only way to spy on the default export https://vitest.dev/guide/browser/#spying-on-module-exports
vi.mock('lighthouse', { spy: true })

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

important: This ain't mock it's a more of spy for packages that have default export

https://vitest.dev/guide/browser/#spying-on-module-exports

@Tarektouati Tarektouati added enhancement New feature or request ci/cd Impacts continuous integration and continuous delivery [ app ] Concerns the front-end e2e Concerns the E2E tests performance Concerns performance (Front-end, synthetics, ...) labels Feb 4, 2026
Comment thread e2e/vitest.config.ts Outdated
Comment on lines +4 to +18
const config = {
test: {
environment: "node",
setupFiles: "./vitest.setupFiles.ts",
include: ["**/*.test.?(c|m)[jt]s?(x)"],
exclude: ["**/node_modules/**", "**/tests/**"],
sequence: { shuffle: true },
passWithNoTests: false,
coverage: {
reporter: ["text"],
exclude: [...coverageConfigDefaults.exclude],
},
restoreMocks: true,
},
};

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Config could be common with app

Comment thread .github/workflows/black-box-test.yml Outdated
Comment on lines +6 to +8
on:
schedule:
- cron: "0 8 * * *"

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

remove cron, usless as we run e2e on new commits on main + PR

@Tarektouati
Tarektouati force-pushed the feat/add-core-web-vitals branch from 6826ef3 to b114178 Compare February 7, 2026 16:58
Gudsfile
Gudsfile previously approved these changes Feb 7, 2026

@Gudsfile Gudsfile left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

LGTM 🚀 Many thanks!

bengeois
bengeois previously approved these changes Feb 8, 2026

@bengeois bengeois left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

suggestion: should we rename commit to keep conventional commit ?

Comment thread .moon/workspace.yml
syncHooks: true
hooks:
# HACK: unset GIT_INDEX_FILE is needed to prevent git from locking the index file during a commit before running the moon tasks. This forces moon to use the standard repository index, which prevents the conflict.
pre-commit:

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

question: I'm wondering why there are theses two commands here and also in .moon/hooks/pre-commit.sh ? Can we have it in one place ?

Comment thread package.json
@@ -0,0 +1,14 @@
{
"name": "tracksy",
"version": "0.0.0",

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Suggested change
"version": "0.0.0",
"version": "0.4.0",

Maybe ? 🎉

@Tarektouati
Tarektouati dismissed stale reviews from bengeois and Gudsfile via 96adc35 May 10, 2026 20:36
@Tarektouati
Tarektouati force-pushed the feat/add-core-web-vitals branch from b114178 to 96adc35 Compare May 10, 2026 20:36
@Tarektouati
Tarektouati force-pushed the feat/add-core-web-vitals branch from 96adc35 to b06fb39 Compare May 11, 2026 12:53
Tarektouati and others added 8 commits May 11, 2026 15:07
setup-toolchain's auto-install runs pnpm outside of moon's task context,
where moon's managed pnpm isn't in PATH yet. Disabling it lets moon inject
pnpm into PATH properly when tasks run.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
auto-setup: true runs moon setup inside the action's Node.js process
which does not update $GITHUB_PATH, so moon can't find its managed pnpm
when tasks run. Running moon setup as an explicit shell step correctly
exports the tool paths to the environment.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
moon setup installs pnpm via proto to ~/.proto/tools/ and creates shims
in ~/.proto/shims/, but this directory is never added to $GITHUB_PATH.
Subsequent steps (including moon's own auto-install before tasks) can't
resolve pnpm by name. Exporting the shims and bin dirs keeps pnpm
coming from moon's toolchain without any external action.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
moon setup installs Node but does not create the pnpm shim at
~/.proto/shims/pnpm. Adding the shims dir to PATH is useless if
the shim file never exists. proto install pnpm 9 explicitly
downloads pnpm and writes the shim, which moon then finds when
auto-installing project deps before tasks run.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
proto refuses to install pnpm if it cannot confirm node is installed.
When moon setup skips toolchains due to cache hits, the proto store may
have no record of node, causing proto install pnpm to fail with
requirements_not_met. Installing node first satisfies the check.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
proto's pnpm installer requires node to be declared in .prototools,
not just present in the binary store. Without it, proto install pnpm
fails with requirements_not_met even after proto install node.
Adding .prototools with node=24/pnpm=9 and running proto use lets
proto resolve the dependency chain and create the pnpm shim.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
In pnpm workspace mode, overrides in member package.json files are
silently ignored — they must be in the root package.json. The yaml
override (yaml@>=2.0.0 <2.8.3: >=2.8.3) was in app/package.json only,
leaving yaml@2.7.1 vulnerable in the astrojs/check dep chain.

Moves both overrides (lodash, yaml) to root package.json and removes
the now-redundant pnpm.overrides block from app/package.json.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The untracked .npmrc was lost, leaving no explicit config for
autoInstallPeers. pnpm 9 in CI defaults to true while the lockfile
recorded false, causing ERR_PNPM_LOCKFILE_CONFIG_MISMATCH on frozen
installs. Commits .npmrc with auto-install-peers=true and regenerates
the lockfile to match.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@Tarektouati
Tarektouati marked this pull request as draft May 21, 2026 12:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[ app ] Concerns the front-end ci/cd Impacts continuous integration and continuous delivery e2e Concerns the E2E tests enhancement New feature or request performance Concerns performance (Front-end, synthetics, ...)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants