Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

fix(ci): hold single-language JS workflows to the lanes they test (#110187)

Georges-Antoine Assi5a63ea2f4b5a
diff --git a/.github/scripts/trunk-impacted-targets.js b/.github/scripts/trunk-impacted-targets.js
index 76eac4399e4a..2ba677d6a11b 100644
--- a/.github/scripts/trunk-impacted-targets.js
+++ b/.github/scripts/trunk-impacted-targets.js
@@ -159,6 +159,7 @@ const CARGO_LOCK = 'cargo-lock'
// these lanes already. The rust and proto rules also use it to name those lanes
// without dragging in the frontend.
const NODE = 'node'
+const FRONTEND_SUITE = 'frontend-suite'
const JS_LOCKFILE = 'js-lockfile'
// Suites that run the backend and the frontend together: E2E, Hog, and the
@@ -249,11 +250,11 @@ const TRIPWIRE_RULES = [
// language's suite can be held to that language's lanes. Everything else
// under .github/ stays universal: the list grows by decision, and a
// workflow nobody has placed here keeps the old radius.
- ['.github/workflows/ci-frontend.yml', JAVASCRIPT],
- ['.github/workflows/ci-storybook.yml', JAVASCRIPT],
- ['.github/workflows/ci-storybook-update-test-timing.yml', JAVASCRIPT],
- ['.github/workflows/ci-nodejs.yml', JAVASCRIPT],
- ['.github/workflows/ci-nodejs-container.yml', JAVASCRIPT],
+ ['.github/workflows/ci-frontend.yml', FRONTEND_SUITE],
+ ['.github/workflows/ci-storybook.yml', FRONTEND_SUITE],
+ ['.github/workflows/ci-storybook-update-test-timing.yml', FRONTEND_SUITE],
+ ['.github/workflows/ci-nodejs.yml', NODE],
+ ['.github/workflows/ci-nodejs-container.yml', NODE],
['.github/workflows/ci-mcp.yml', JAVASCRIPT],
['.github/workflows/ci-backend.yml', PYTHON],
['.github/workflows/ci-backend-update-test-timing.yml', PYTHON],
@@ -1680,6 +1681,19 @@ function addCargoLockLanes(targets, context) {
return true
}
+function addFrontendSuiteLanes(targets, context) {
+ const lanes = new Set()
+ if (!addJavaScriptLanes(lanes, context)) {
+ return false
+ }
+ for (const lane of lanes) {
+ if (!lane.startsWith('node:')) {
+ targets.add(lane)
+ }
+ }
+ return true
+}
+
function addNodeLanes(targets) {
for (const lane of NODE_LANES) {
targets.add(lane)
@@ -1849,6 +1863,7 @@ function addProtoLanes(targets, context, file) {
const DOMAIN_LANES = new Map([
[PYTHON, addPythonLanes],
[JAVASCRIPT, addJavaScriptLanes],
+ [FRONTEND_SUITE, addFrontendSuiteLanes],
[JS_LOCKFILE, addJsLockfileLanes],
[RUST, addRustLanes],
[CARGO_LOCK, addCargoLockLanes],
diff --git a/.github/scripts/trunk-impacted-targets.test.js b/.github/scripts/trunk-impacted-targets.test.js
index f6bc1dc4c2c2..7edbf89464b6 100644
--- a/.github/scripts/trunk-impacted-targets.test.js
+++ b/.github/scripts/trunk-impacted-targets.test.js
@@ -559,10 +559,25 @@ test('the cargo-dist manifest shares the cli lane', () => {
})
test('a single-language workflow claims that language rather than everything', () => {
- assert.deepEqual(
- computeTargets(['.github/workflows/ci-frontend.yml'], CONTEXT),
- computeTargets(['.oxlintrc.json'], CONTEXT)
- )
+ const javascript = computeTargets(['.oxlintrc.json'], CONTEXT)
+ for (const file of [
+ '.github/workflows/ci-frontend.yml',
+ '.github/workflows/ci-storybook.yml',
+ '.github/workflows/ci-storybook-update-test-timing.yml',
+ ]) {
+ assert.deepEqual(
+ computeTargets([file], CONTEXT),
+ javascript.filter((target) => !target.startsWith('node:')),
+ file
+ )
+ }
+ for (const file of ['.github/workflows/ci-nodejs.yml', '.github/workflows/ci-nodejs-container.yml']) {
+ assert.deepEqual(
+ computeTargets([file], CONTEXT),
+ computeTargets(['Dockerfile.ml-mirror-image-scrub'], CONTEXT),
+ file
+ )
+ }
for (const file of [
'.github/workflows/ci-backend.yml',
'.github/workflows/ci-python.yml',