Skip to content

fix(git-diff): fall back when a package's jest, vitest or Babel config changes - #121

Merged
adityankale190895 merged 1 commit into
DiffCI:mainfrom
sarankumar1325:fix/nested-test-config-fallback
Nov 11, 2026
Merged

adityankale190895 merged 1 commit into
DiffCI:mainfrom
sarankumar1325:fix/nested-test-config-fallback

Conversation

@sarankumar1325

Copy link
Copy Markdown
Contributor

Fixes #117

What DiffCI did before this PR

I built the fixture from step 1 of the issue: a workspace with packages/web (Jest, babel-jest, two sources, two tests). The head commit changes one config file in packages/web. Then I ran analyzeCheckout on it.

Changed file Before After
packages/web/babel.config.js SELECTIVE, 0 tests selected, no fallback reason FULL, "Configuration file(s) changed; full validation required: packages/web/babel.config.js"
packages/web/.babelrc.js SELECTIVE, 0 tests selected FULL (config reason names the file)
packages/web/jest.config.js SELECTIVE, 0 tests selected FULL (config reason names the file)
packages/web/vitest.config.js SELECTIVE, 0 tests selected FULL (config reason names the file)

So the issue is confirmed. isConfigFile classifies these files as config at any depth, and the config branch in impact.ts only records CONFIG_GLOBAL evidence. The fallback comes from configChanged, and CONFIG_PATTERNS only matches at the root. vitest.config.* has the same gap, so I included it.

Fix

src/git/git-diff.ts: a new isNestedTestConfig(path) matches jest.config.*, vitest.config.*, babel.config.* and .babelrc* below the root, and skips anything under node_modules. computeAnalysis adds those paths to the config signal, so the existing CONFIG_GLOBAL fallback fires and its reason names the file. Root behaviour is unchanged, because root files are still matched by CONFIG_PATTERNS.

I kept the list to test-runner and transform configs, which apply to every test in their directory. I left out other basenames that isConfigFile knows (eslint, prettier, tailwind, postcss, next, a nested package.json or tsconfig.json): they don't decide which tests run or how they are transformed, and nested package.json already has its own handling. I picked a full run over selecting only the owning package's tests. It is the conservative choice, it matches the root behaviour, and it stays correct when the root test command runs the package through --workspaces. Happy to narrow it to the package if you prefer.

Tests

  • New tests/repo/subdirectory-config-change.test.ts (registered in release-files.json):
    • The fixture above, for babel.config.js, .babelrc.js, jest.config.js and vitest.config.js. It asserts mode FULL, fallbackRequired, both packages/web tests selected, and a fallback reason that names the file. All four cases fail on main.
    • isNestedTestConfig cases: nested forms match. Root files, node_modules copies, jest.setup.js and my-babel.config.js don't.
    • computeAnalysis: a nested jest.config.js sets configChanged and signalPaths.config, and a nested source file does not.
  • docs/using-diffci.md: the Configuration file(s) changed row now lists a package's jest.config.js as an example.

npm test: 950 passed, 0 failed. npm run typecheck and npm run audit:boundary are clean.

AI assistance: I used an AI coding assistant to help write this change. I reviewed and ran everything above myself.

…g changes (DiffCI#117)

CONFIG_PATTERNS is anchored at the repository root, so a lone change to
packages/web/jest.config.js, vitest.config.* or babel.config.*/.babelrc*
gave a SELECTIVE plan with no tests, while the same file at the root
fell back. These configurations apply to every test of the directory
that holds them, so a copy below the root now sets the config signal and
the fallback reason names it. node_modules copies are ignored.

Fixes DiffCI#117

Signed-off-by: sarankumar1325 <[email protected]>
@chatgpt-codex-connector

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-11T10:55:05.656050Z 3b3c521 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@adityankale190895
adityankale190895 merged commit f05b721 into DiffCI:main Nov 11, 2026
11 checks passed
adityankale190895 added a commit that referenced this pull request Nov 12, 2026
Engine pin moves from 8b8c5f5 to 93f4e6e, picking up the Core engine
changes since 0.3.39, found on paperclipai/paperclip where every change
planned FULL:

- Go modules without a root go.mod are confined to their directories
  instead of blocking every change (a9f8b73).
- A Vitest root or Jest rootDir that names the config's own directory
  (__dirname, import.meta.dirname, dirname(fileURLToPath(import.meta.url)),
  ...) is supported (6e93d73).
- Relative imports into an installed package's node_modules are recorded
  as that external package, not as unresolved imports (ff2a671).
- import(new URL(literal, import.meta.url).href) folds to its target
  (93f4e6e).
- A package's jest, vitest or Babel config change falls back (#117, #121).

Records the Muse marketplace digest for the 0.3.40 package tree, computed
by the pinned Muse 1.4.11-R6667.1 build from an LF archive (the same
method reproduces 0.3.39's recorded digest).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: adityankale190895 <[email protected]>
adityankale190895 added a commit that referenced this pull request Nov 14, 2026
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: adityankale190895 <[email protected]>
@adityankale190895

Copy link
Copy Markdown
Member

Hi @sarankumar1325, thank you for your ten merged PRs, #105 to #121, all merged on 11 November. Your shared lockfile list replaced the hand-written copies across the engine, and #121 closed a real gap: a package's own test config changing used to select no tests.

We have just added contributor tiers to DiffCI (CONTRIBUTING.md), and I would like to invite you to be the area maintainer for lockfile and config-file signals: the code that decides what a lockfile, babel.config, vite.config or similar change affects. That means your name on that area in the README, a say in its design, review requests on PRs that touch it, and co-authorship of the write-up when the next round of narrowing ships.

There is no obligation. If you would like it, you have already done most of #97. Three copies are left (src/ci-inference/evidence.ts, src/repo/analyzer.ts and the CONFIG_FILE_NAMES set in src/repo/impact.ts), and finishing them would close it.

You are also on our new contributors page, diffci.com/contributors. Tell me if you would rather not be listed there, or would like a different name or link.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Config files in subdirectories (babel.config, jest.config) may get no fallback

2 participants