0
Fork 0
mirror of https://github.com/mastra-ai/mastra.git synced 2026-11-17 08:44:46 +00:00
mastra/scripts/affected-tests.mjs

923 lines
31 KiB

ci: cache what affected-test detection parses, so PR test selection takes ~4s instead of ~40s (#29133) ## What "Detect affected tests" decides which test files a PR runs. Today it parses ~15,000 files on every PR run: madge builds the import graph, then a second pass extracts exported names and symbol edges. That takes ~40s on the 5 vCPU runner, and almost none of those files changed since the last run. This change caches the parse results in a file, keyed by a hash of each file's content: - `scripts/affected-tests-cache.mjs` stores, per file, only what its own text decides: the import specifiers precinct finds and the exports and symbol edges the second pass extracts. Records are keyed by `sha1(extension + content)`. - Resolving those specifiers to files is **not** cached. It still runs live through filing-cabinet with madge's exact options, so a rename, a moved file or an alias change can't be hidden by a cache hit. - The cache file records its schema version and the precinct and typescript versions. If any of them differ, the run starts cold. It is never wrong. - `.github/workflows/prebuild.yml` restores the cache before detection (restore only; PRs never save). The key is `affected-graph-v1-<os>-<sha>` with the prefix restore-key `affected-graph-v1-<os>-`, so a PR gets the newest main seed. - The new `.github/workflows/affected-graph-seed.yml` refreshes the seed on every push to main. It runs detection once on core's entry point, which touches the whole graph, then saves the cache. A newer push cancels an older seed run. The detection output (selected files, graph nodes, test files) is unchanged. ## Numbers Measured on a 5 vCPU / 16 GB container like the CI runner, Node 24.22.1: | | time | |---|---| | Uncached (today) | 40.3s | | Cached, current seed | 4.0s | | Cached, seed ~300 commits old | ~13s | | Seed run on main | ~40s | The seed file is 14.8 MB raw and 1.7 MB in the actions cache. Compute: about 36s saved per PR run, against about 90s per merge to main for the seed run. ## Testing - Ran detection uncached and cached on 20 recent merged PRs (between 1 and 3,532 files selected): output identical on all 20. - Renamed `retry-after.ts`, updated its importers and added a new test file importing the renamed module: identical output (2,849 selected), the new test is selected and the old path is gone from the graph. - `packages/core/src/affected-tests-cache.test.ts` covers cold, warm and changed-import runs. It fails if records are keyed by file name instead of content. - `packages/core/src/affected-tests-resolution.test.ts` and `.github/scripts/ci-routing.test.ts` pass. oxlint and prettier are clean. Stacked on #29091 (cancelled runs stop downstream jobs). It will be retargeted to main once that merges. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> <!-- coderabbit-ai-generated:v1 --> ## ELI5 The affected-test detector checks which tests may need to run after code changes. This PR saves file-parsing results so later checks can reuse them, while still resolving file links against the current code. ## What changed - Added a content-addressed cache for file parsing. It stores import specifiers, exported names, and symbol edges, and checks a schema and extractor-version string before reusing records. - Kept file resolution live through filing-cabinet and Madge’s existing options. Updated affected-test detection to use the cache and save records used during the run. - Added a workflow to refresh the cache seed on pushes to `main`. Updated prebuild to restore the seed for affected-test detection. - Added a test for uncached, cold-cache, and warm-cache graphs, including after a file’s imports change. ## Validation Test, lint, formatting, output-comparison, runtime, and review-finding results: not available. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: remy-builder[bot] <324360501+remy-builder[bot]@users.noreply.github.com>
2026-11-05 13:02:44 -07:00
2026-08-10 10:53:46 +02:00
Make the affected-test detector see packages that import with .js specifiers (#24488) ## Summary CI picks which tests to run on a PR by building a module graph of the repo and walking it backwards from the changed files. That graph is built by madge, which resolves imports through enhanced-resolve using `scripts/madge.webpack.config.cjs`. That config had no `extensionAlias`. Packages written for TypeScript's NodeNext resolution import their own relative files as `'../tools.js'` even though the file on disk is `../tools.ts` — and without `extensionAlias` the resolver looks for a literal `.js` file, finds nothing, and silently drops the edge. `mastracode/sdk` is written entirely in that style (212 of 256 source files), so its portion of the graph was essentially empty and any PR touching SDK source was told no tests were affected. The full-suite jobs did not catch this either, so those changes shipped with no test signal at all. Two changes: teach the resolver to map `.js`/`.mjs`/`.cjs` specifiers onto their TypeScript sources, and let madge traverse `.mts`/`.cts` files, which this package uses for its child-process fixtures. Fixes #24218 ## Test plan Detector output for the same inputs, before and after: | changed file | before | after | | --- | --- | --- | | `mastracode/sdk/src/agent-connections/tools.ts` | 0 tests | 20 tests, including its own colocated `__tests__/tools.test.ts` | | `mastracode/sdk/src/index.ts` | 0 tests | 19 tests | | `packages/core/src/agent/index.ts` (control) | 1229 tests | 1470 tests | The control case was already working but was also under-selecting, since workspace packages consumed by core use the same import style; it now resolves those edges too. Graph is denser, so selection is slightly slower — 21.4s to 23.5s for the core case, about 10%. That is well worth the correctness. Note: registering the SDK's own vitest project is separate work, as the issue describes — `vitest.config.ts` points at a `mastracode/vitest.config.ts` that does not exist, and the SDK suite is currently red on main. This PR only fixes the detector. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## ELI5 This PR helps the test selector follow SDK imports correctly. It ensures source changes select the tests that depend on them. ## Changes - Added Madge aliases for `.js`, `.mjs`, and `.cjs` imports. - Added `.mts` and `.cts` files to Madge traversal. - Added a NodeNext import-resolution test. - Added a guard for missing colocated tests. - Added two retries for failed TUI E2E shard tests. ## Reported results - SDK tool changes select 20 tests instead of none. - SDK index changes select 19 tests instead of none. - A core control case selects 1,470 tests, up from 1,229. - Runtime increased from 21.4 to 23.5 seconds. - SDK Vitest project registration remains out of scope. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: tyler-mastra[bot] <331730378+tyler-mastra[bot]@users.noreply.github.com> Co-authored-by: Tyler Barnes <tylerdbarnes@gmail.com>
2026-09-21 14:58:17 -07:00
ci: cache what affected-test detection parses, so PR test selection takes ~4s instead of ~40s (#29133) ## What "Detect affected tests" decides which test files a PR runs. Today it parses ~15,000 files on every PR run: madge builds the import graph, then a second pass extracts exported names and symbol edges. That takes ~40s on the 5 vCPU runner, and almost none of those files changed since the last run. This change caches the parse results in a file, keyed by a hash of each file's content: - `scripts/affected-tests-cache.mjs` stores, per file, only what its own text decides: the import specifiers precinct finds and the exports and symbol edges the second pass extracts. Records are keyed by `sha1(extension + content)`. - Resolving those specifiers to files is **not** cached. It still runs live through filing-cabinet with madge's exact options, so a rename, a moved file or an alias change can't be hidden by a cache hit. - The cache file records its schema version and the precinct and typescript versions. If any of them differ, the run starts cold. It is never wrong. - `.github/workflows/prebuild.yml` restores the cache before detection (restore only; PRs never save). The key is `affected-graph-v1-<os>-<sha>` with the prefix restore-key `affected-graph-v1-<os>-`, so a PR gets the newest main seed. - The new `.github/workflows/affected-graph-seed.yml` refreshes the seed on every push to main. It runs detection once on core's entry point, which touches the whole graph, then saves the cache. A newer push cancels an older seed run. The detection output (selected files, graph nodes, test files) is unchanged. ## Numbers Measured on a 5 vCPU / 16 GB container like the CI runner, Node 24.22.1: | | time | |---|---| | Uncached (today) | 40.3s | | Cached, current seed | 4.0s | | Cached, seed ~300 commits old | ~13s | | Seed run on main | ~40s | The seed file is 14.8 MB raw and 1.7 MB in the actions cache. Compute: about 36s saved per PR run, against about 90s per merge to main for the seed run. ## Testing - Ran detection uncached and cached on 20 recent merged PRs (between 1 and 3,532 files selected): output identical on all 20. - Renamed `retry-after.ts`, updated its importers and added a new test file importing the renamed module: identical output (2,849 selected), the new test is selected and the old path is gone from the graph. - `packages/core/src/affected-tests-cache.test.ts` covers cold, warm and changed-import runs. It fails if records are keyed by file name instead of content. - `packages/core/src/affected-tests-resolution.test.ts` and `.github/scripts/ci-routing.test.ts` pass. oxlint and prettier are clean. Stacked on #29091 (cancelled runs stop downstream jobs). It will be retargeted to main once that merges. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> <!-- coderabbit-ai-generated:v1 --> ## ELI5 The affected-test detector checks which tests may need to run after code changes. This PR saves file-parsing results so later checks can reuse them, while still resolving file links against the current code. ## What changed - Added a content-addressed cache for file parsing. It stores import specifiers, exported names, and symbol edges, and checks a schema and extractor-version string before reusing records. - Kept file resolution live through filing-cabinet and Madge’s existing options. Updated affected-test detection to use the cache and save records used during the run. - Added a workflow to refresh the cache seed on pushes to `main`. Updated prebuild to restore the seed for affected-test detection. - Added a test for uncached, cold-cache, and warm-cache graphs, including after a file’s imports change. ## Validation Test, lint, formatting, output-comparison, runtime, and review-finding results: not available. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: remy-builder[bot] <324360501+remy-builder[bot]@users.noreply.github.com>
2026-11-05 13:02:44 -07:00
2026-08-10 10:53:46 +02:00
ci: cache what affected-test detection parses, so PR test selection takes ~4s instead of ~40s (#29133) ## What "Detect affected tests" decides which test files a PR runs. Today it parses ~15,000 files on every PR run: madge builds the import graph, then a second pass extracts exported names and symbol edges. That takes ~40s on the 5 vCPU runner, and almost none of those files changed since the last run. This change caches the parse results in a file, keyed by a hash of each file's content: - `scripts/affected-tests-cache.mjs` stores, per file, only what its own text decides: the import specifiers precinct finds and the exports and symbol edges the second pass extracts. Records are keyed by `sha1(extension + content)`. - Resolving those specifiers to files is **not** cached. It still runs live through filing-cabinet with madge's exact options, so a rename, a moved file or an alias change can't be hidden by a cache hit. - The cache file records its schema version and the precinct and typescript versions. If any of them differ, the run starts cold. It is never wrong. - `.github/workflows/prebuild.yml` restores the cache before detection (restore only; PRs never save). The key is `affected-graph-v1-<os>-<sha>` with the prefix restore-key `affected-graph-v1-<os>-`, so a PR gets the newest main seed. - The new `.github/workflows/affected-graph-seed.yml` refreshes the seed on every push to main. It runs detection once on core's entry point, which touches the whole graph, then saves the cache. A newer push cancels an older seed run. The detection output (selected files, graph nodes, test files) is unchanged. ## Numbers Measured on a 5 vCPU / 16 GB container like the CI runner, Node 24.22.1: | | time | |---|---| | Uncached (today) | 40.3s | | Cached, current seed | 4.0s | | Cached, seed ~300 commits old | ~13s | | Seed run on main | ~40s | The seed file is 14.8 MB raw and 1.7 MB in the actions cache. Compute: about 36s saved per PR run, against about 90s per merge to main for the seed run. ## Testing - Ran detection uncached and cached on 20 recent merged PRs (between 1 and 3,532 files selected): output identical on all 20. - Renamed `retry-after.ts`, updated its importers and added a new test file importing the renamed module: identical output (2,849 selected), the new test is selected and the old path is gone from the graph. - `packages/core/src/affected-tests-cache.test.ts` covers cold, warm and changed-import runs. It fails if records are keyed by file name instead of content. - `packages/core/src/affected-tests-resolution.test.ts` and `.github/scripts/ci-routing.test.ts` pass. oxlint and prettier are clean. Stacked on #29091 (cancelled runs stop downstream jobs). It will be retargeted to main once that merges. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> <!-- coderabbit-ai-generated:v1 --> ## ELI5 The affected-test detector checks which tests may need to run after code changes. This PR saves file-parsing results so later checks can reuse them, while still resolving file links against the current code. ## What changed - Added a content-addressed cache for file parsing. It stores import specifiers, exported names, and symbol edges, and checks a schema and extractor-version string before reusing records. - Kept file resolution live through filing-cabinet and Madge’s existing options. Updated affected-test detection to use the cache and save records used during the run. - Added a workflow to refresh the cache seed on pushes to `main`. Updated prebuild to restore the seed for affected-test detection. - Added a test for uncached, cold-cache, and warm-cache graphs, including after a file’s imports change. ## Validation Test, lint, formatting, output-comparison, runtime, and review-finding results: not available. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: remy-builder[bot] <324360501+remy-builder[bot]@users.noreply.github.com>
2026-11-05 13:02:44 -07:00
ci: cache what affected-test detection parses, so PR test selection takes ~4s instead of ~40s (#29133) ## What "Detect affected tests" decides which test files a PR runs. Today it parses ~15,000 files on every PR run: madge builds the import graph, then a second pass extracts exported names and symbol edges. That takes ~40s on the 5 vCPU runner, and almost none of those files changed since the last run. This change caches the parse results in a file, keyed by a hash of each file's content: - `scripts/affected-tests-cache.mjs` stores, per file, only what its own text decides: the import specifiers precinct finds and the exports and symbol edges the second pass extracts. Records are keyed by `sha1(extension + content)`. - Resolving those specifiers to files is **not** cached. It still runs live through filing-cabinet with madge's exact options, so a rename, a moved file or an alias change can't be hidden by a cache hit. - The cache file records its schema version and the precinct and typescript versions. If any of them differ, the run starts cold. It is never wrong. - `.github/workflows/prebuild.yml` restores the cache before detection (restore only; PRs never save). The key is `affected-graph-v1-<os>-<sha>` with the prefix restore-key `affected-graph-v1-<os>-`, so a PR gets the newest main seed. - The new `.github/workflows/affected-graph-seed.yml` refreshes the seed on every push to main. It runs detection once on core's entry point, which touches the whole graph, then saves the cache. A newer push cancels an older seed run. The detection output (selected files, graph nodes, test files) is unchanged. ## Numbers Measured on a 5 vCPU / 16 GB container like the CI runner, Node 24.22.1: | | time | |---|---| | Uncached (today) | 40.3s | | Cached, current seed | 4.0s | | Cached, seed ~300 commits old | ~13s | | Seed run on main | ~40s | The seed file is 14.8 MB raw and 1.7 MB in the actions cache. Compute: about 36s saved per PR run, against about 90s per merge to main for the seed run. ## Testing - Ran detection uncached and cached on 20 recent merged PRs (between 1 and 3,532 files selected): output identical on all 20. - Renamed `retry-after.ts`, updated its importers and added a new test file importing the renamed module: identical output (2,849 selected), the new test is selected and the old path is gone from the graph. - `packages/core/src/affected-tests-cache.test.ts` covers cold, warm and changed-import runs. It fails if records are keyed by file name instead of content. - `packages/core/src/affected-tests-resolution.test.ts` and `.github/scripts/ci-routing.test.ts` pass. oxlint and prettier are clean. Stacked on #29091 (cancelled runs stop downstream jobs). It will be retargeted to main once that merges. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> <!-- coderabbit-ai-generated:v1 --> ## ELI5 The affected-test detector checks which tests may need to run after code changes. This PR saves file-parsing results so later checks can reuse them, while still resolving file links against the current code. ## What changed - Added a content-addressed cache for file parsing. It stores import specifiers, exported names, and symbol edges, and checks a schema and extractor-version string before reusing records. - Kept file resolution live through filing-cabinet and Madge’s existing options. Updated affected-test detection to use the cache and save records used during the run. - Added a workflow to refresh the cache seed on pushes to `main`. Updated prebuild to restore the seed for affected-test detection. - Added a test for uncached, cold-cache, and warm-cache graphs, including after a file’s imports change. ## Validation Test, lint, formatting, output-comparison, runtime, and review-finding results: not available. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: remy-builder[bot] <324360501+remy-builder[bot]@users.noreply.github.com>
2026-11-05 13:02:44 -07:00
ci: cache what affected-test detection parses, so PR test selection takes ~4s instead of ~40s (#29133) ## What "Detect affected tests" decides which test files a PR runs. Today it parses ~15,000 files on every PR run: madge builds the import graph, then a second pass extracts exported names and symbol edges. That takes ~40s on the 5 vCPU runner, and almost none of those files changed since the last run. This change caches the parse results in a file, keyed by a hash of each file's content: - `scripts/affected-tests-cache.mjs` stores, per file, only what its own text decides: the import specifiers precinct finds and the exports and symbol edges the second pass extracts. Records are keyed by `sha1(extension + content)`. - Resolving those specifiers to files is **not** cached. It still runs live through filing-cabinet with madge's exact options, so a rename, a moved file or an alias change can't be hidden by a cache hit. - The cache file records its schema version and the precinct and typescript versions. If any of them differ, the run starts cold. It is never wrong. - `.github/workflows/prebuild.yml` restores the cache before detection (restore only; PRs never save). The key is `affected-graph-v1-<os>-<sha>` with the prefix restore-key `affected-graph-v1-<os>-`, so a PR gets the newest main seed. - The new `.github/workflows/affected-graph-seed.yml` refreshes the seed on every push to main. It runs detection once on core's entry point, which touches the whole graph, then saves the cache. A newer push cancels an older seed run. The detection output (selected files, graph nodes, test files) is unchanged. ## Numbers Measured on a 5 vCPU / 16 GB container like the CI runner, Node 24.22.1: | | time | |---|---| | Uncached (today) | 40.3s | | Cached, current seed | 4.0s | | Cached, seed ~300 commits old | ~13s | | Seed run on main | ~40s | The seed file is 14.8 MB raw and 1.7 MB in the actions cache. Compute: about 36s saved per PR run, against about 90s per merge to main for the seed run. ## Testing - Ran detection uncached and cached on 20 recent merged PRs (between 1 and 3,532 files selected): output identical on all 20. - Renamed `retry-after.ts`, updated its importers and added a new test file importing the renamed module: identical output (2,849 selected), the new test is selected and the old path is gone from the graph. - `packages/core/src/affected-tests-cache.test.ts` covers cold, warm and changed-import runs. It fails if records are keyed by file name instead of content. - `packages/core/src/affected-tests-resolution.test.ts` and `.github/scripts/ci-routing.test.ts` pass. oxlint and prettier are clean. Stacked on #29091 (cancelled runs stop downstream jobs). It will be retargeted to main once that merges. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> <!-- coderabbit-ai-generated:v1 --> ## ELI5 The affected-test detector checks which tests may need to run after code changes. This PR saves file-parsing results so later checks can reuse them, while still resolving file links against the current code. ## What changed - Added a content-addressed cache for file parsing. It stores import specifiers, exported names, and symbol edges, and checks a schema and extractor-version string before reusing records. - Kept file resolution live through filing-cabinet and Madge’s existing options. Updated affected-test detection to use the cache and save records used during the run. - Added a workflow to refresh the cache seed on pushes to `main`. Updated prebuild to restore the seed for affected-test detection. - Added a test for uncached, cold-cache, and warm-cache graphs, including after a file’s imports change. ## Validation Test, lint, formatting, output-comparison, runtime, and review-finding results: not available. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: remy-builder[bot] <324360501+remy-builder[bot]@users.noreply.github.com>
2026-11-05 13:02:44 -07:00
2026-08-10 10:53:46 +02:00
2026-08-10 10:53:46 +02:00
2026-08-10 10:53:46 +02:00
Make the affected-test detector see packages that import with .js specifiers (#24488) ## Summary CI picks which tests to run on a PR by building a module graph of the repo and walking it backwards from the changed files. That graph is built by madge, which resolves imports through enhanced-resolve using `scripts/madge.webpack.config.cjs`. That config had no `extensionAlias`. Packages written for TypeScript's NodeNext resolution import their own relative files as `'../tools.js'` even though the file on disk is `../tools.ts` — and without `extensionAlias` the resolver looks for a literal `.js` file, finds nothing, and silently drops the edge. `mastracode/sdk` is written entirely in that style (212 of 256 source files), so its portion of the graph was essentially empty and any PR touching SDK source was told no tests were affected. The full-suite jobs did not catch this either, so those changes shipped with no test signal at all. Two changes: teach the resolver to map `.js`/`.mjs`/`.cjs` specifiers onto their TypeScript sources, and let madge traverse `.mts`/`.cts` files, which this package uses for its child-process fixtures. Fixes #24218 ## Test plan Detector output for the same inputs, before and after: | changed file | before | after | | --- | --- | --- | | `mastracode/sdk/src/agent-connections/tools.ts` | 0 tests | 20 tests, including its own colocated `__tests__/tools.test.ts` | | `mastracode/sdk/src/index.ts` | 0 tests | 19 tests | | `packages/core/src/agent/index.ts` (control) | 1229 tests | 1470 tests | The control case was already working but was also under-selecting, since workspace packages consumed by core use the same import style; it now resolves those edges too. Graph is denser, so selection is slightly slower — 21.4s to 23.5s for the core case, about 10%. That is well worth the correctness. Note: registering the SDK's own vitest project is separate work, as the issue describes — `vitest.config.ts` points at a `mastracode/vitest.config.ts` that does not exist, and the SDK suite is currently red on main. This PR only fixes the detector. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## ELI5 This PR helps the test selector follow SDK imports correctly. It ensures source changes select the tests that depend on them. ## Changes - Added Madge aliases for `.js`, `.mjs`, and `.cjs` imports. - Added `.mts` and `.cts` files to Madge traversal. - Added a NodeNext import-resolution test. - Added a guard for missing colocated tests. - Added two retries for failed TUI E2E shard tests. ## Reported results - SDK tool changes select 20 tests instead of none. - SDK index changes select 19 tests instead of none. - A core control case selects 1,470 tests, up from 1,229. - Runtime increased from 21.4 to 23.5 seconds. - SDK Vitest project registration remains out of scope. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: tyler-mastra[bot] <331730378+tyler-mastra[bot]@users.noreply.github.com> Co-authored-by: Tyler Barnes <tylerdbarnes@gmail.com>
2026-09-21 14:58:17 -07:00
ci: cache what affected-test detection parses, so PR test selection takes ~4s instead of ~40s (#29133) ## What "Detect affected tests" decides which test files a PR runs. Today it parses ~15,000 files on every PR run: madge builds the import graph, then a second pass extracts exported names and symbol edges. That takes ~40s on the 5 vCPU runner, and almost none of those files changed since the last run. This change caches the parse results in a file, keyed by a hash of each file's content: - `scripts/affected-tests-cache.mjs` stores, per file, only what its own text decides: the import specifiers precinct finds and the exports and symbol edges the second pass extracts. Records are keyed by `sha1(extension + content)`. - Resolving those specifiers to files is **not** cached. It still runs live through filing-cabinet with madge's exact options, so a rename, a moved file or an alias change can't be hidden by a cache hit. - The cache file records its schema version and the precinct and typescript versions. If any of them differ, the run starts cold. It is never wrong. - `.github/workflows/prebuild.yml` restores the cache before detection (restore only; PRs never save). The key is `affected-graph-v1-<os>-<sha>` with the prefix restore-key `affected-graph-v1-<os>-`, so a PR gets the newest main seed. - The new `.github/workflows/affected-graph-seed.yml` refreshes the seed on every push to main. It runs detection once on core's entry point, which touches the whole graph, then saves the cache. A newer push cancels an older seed run. The detection output (selected files, graph nodes, test files) is unchanged. ## Numbers Measured on a 5 vCPU / 16 GB container like the CI runner, Node 24.22.1: | | time | |---|---| | Uncached (today) | 40.3s | | Cached, current seed | 4.0s | | Cached, seed ~300 commits old | ~13s | | Seed run on main | ~40s | The seed file is 14.8 MB raw and 1.7 MB in the actions cache. Compute: about 36s saved per PR run, against about 90s per merge to main for the seed run. ## Testing - Ran detection uncached and cached on 20 recent merged PRs (between 1 and 3,532 files selected): output identical on all 20. - Renamed `retry-after.ts`, updated its importers and added a new test file importing the renamed module: identical output (2,849 selected), the new test is selected and the old path is gone from the graph. - `packages/core/src/affected-tests-cache.test.ts` covers cold, warm and changed-import runs. It fails if records are keyed by file name instead of content. - `packages/core/src/affected-tests-resolution.test.ts` and `.github/scripts/ci-routing.test.ts` pass. oxlint and prettier are clean. Stacked on #29091 (cancelled runs stop downstream jobs). It will be retargeted to main once that merges. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> <!-- coderabbit-ai-generated:v1 --> ## ELI5 The affected-test detector checks which tests may need to run after code changes. This PR saves file-parsing results so later checks can reuse them, while still resolving file links against the current code. ## What changed - Added a content-addressed cache for file parsing. It stores import specifiers, exported names, and symbol edges, and checks a schema and extractor-version string before reusing records. - Kept file resolution live through filing-cabinet and Madge’s existing options. Updated affected-test detection to use the cache and save records used during the run. - Added a workflow to refresh the cache seed on pushes to `main`. Updated prebuild to restore the seed for affected-test detection. - Added a test for uncached, cold-cache, and warm-cache graphs, including after a file’s imports change. ## Validation Test, lint, formatting, output-comparison, runtime, and review-finding results: not available. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: remy-builder[bot] <324360501+remy-builder[bot]@users.noreply.github.com>
2026-11-05 13:02:44 -07:00
refactor(lint): flatten lone if statements in else branches (#28431) Enable `no-lonely-if` in the shared Oxlint config and flatten 38 lone `if` statements in `else` blocks across 35 files. For example, `else { if (condition) { ... } }` becomes `else if (condition) { ... }`. Conditions, evaluation order, statements, comments, and local bindings are preserved. No package filters or lint exceptions are added. Strengthen the existing monorepo test to execute another named export from an optimized dependency. Comparisons of TypeScript syntax, emitted JavaScript, raw template text, comments, and local bindings pass for all 35 migrated files after normalizing only the redundant else blocks. The rule clears all 15,094 scanned files. [CI lint and formatting pass](https://github.com/mastra-ai/mastra/actions/runs/40344286057/job/121647174331) for `36ca4471f9`. All 634 focused tests, four package typechecks (core, playground, connect, and deployer), 57 packaged build tasks, and two selected published-package monorepo E2E cases pass. The broader local lint run hit a Tailwind design-system precomputation timeout; CI lint succeeds. Live vendor and external-database suites were not run locally. [DuckDB CI has two existing capability-list assertion failures](https://github.com/mastra-ai/mastra/actions/runs/40344286246/job/121649643109): its implementation advertises `span-aggregate`, while the expected lists omit it. The failures reproduce locally, and the relevant implementation and tests are unchanged from the base commit. This maintenance PR intentionally contains no changeset and requests no package releases. The missing-changeset check may fail. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> <!-- coderabbit-ai-generated:v1 --> ## ELI5 This PR turns on a lint rule that asks for simpler branching in code. It updates the affected code and adds a leap-year check to an existing test. ## Changes - Enables Oxlint’s `no-lonely-if` rule in the shared configuration. - Flattens 38 lone `if` statements across 35 files. The PR description reports that the changes preserve behavior. - Extends the optimized-dependency monorepo test to check `isLeapYear`. ## Validation - The PR description reports that CI lint and formatting pass. - It also reports 634 focused tests, four package typechecks, 57 packaged build tasks, and two selected monorepo E2E cases pass. - The PR description notes two existing DuckDB CI capability-list assertion failures. It reports that the related implementation and tests are unchanged from the base commit. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-10-26 18:44:48 +01:00
refactor(lint): flatten lone if statements in else branches (#28431) Enable `no-lonely-if` in the shared Oxlint config and flatten 38 lone `if` statements in `else` blocks across 35 files. For example, `else { if (condition) { ... } }` becomes `else if (condition) { ... }`. Conditions, evaluation order, statements, comments, and local bindings are preserved. No package filters or lint exceptions are added. Strengthen the existing monorepo test to execute another named export from an optimized dependency. Comparisons of TypeScript syntax, emitted JavaScript, raw template text, comments, and local bindings pass for all 35 migrated files after normalizing only the redundant else blocks. The rule clears all 15,094 scanned files. [CI lint and formatting pass](https://github.com/mastra-ai/mastra/actions/runs/40344286057/job/121647174331) for `36ca4471f9`. All 634 focused tests, four package typechecks (core, playground, connect, and deployer), 57 packaged build tasks, and two selected published-package monorepo E2E cases pass. The broader local lint run hit a Tailwind design-system precomputation timeout; CI lint succeeds. Live vendor and external-database suites were not run locally. [DuckDB CI has two existing capability-list assertion failures](https://github.com/mastra-ai/mastra/actions/runs/40344286246/job/121649643109): its implementation advertises `span-aggregate`, while the expected lists omit it. The failures reproduce locally, and the relevant implementation and tests are unchanged from the base commit. This maintenance PR intentionally contains no changeset and requests no package releases. The missing-changeset check may fail. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> <!-- coderabbit-ai-generated:v1 --> ## ELI5 This PR turns on a lint rule that asks for simpler branching in code. It updates the affected code and adds a leap-year check to an existing test. ## Changes - Enables Oxlint’s `no-lonely-if` rule in the shared configuration. - Flattens 38 lone `if` statements across 35 files. The PR description reports that the changes preserve behavior. - Extends the optimized-dependency monorepo test to check `isLeapYear`. ## Validation - The PR description reports that CI lint and formatting pass. - It also reports 634 focused tests, four package typechecks, 57 packaged build tasks, and two selected monorepo E2E cases pass. - The PR description notes two existing DuckDB CI capability-list assertion failures. It reports that the related implementation and tests are unchanged from the base commit. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-10-26 18:44:48 +01:00