microsoft / microsoft/lage

Cache invalidation issue for test files

Open
#690 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
816
Forks
88
PR merge metrics
No merged PRs in 30d

Description

Describe the bug
For the very first time when I run the test command lage is triggering the test scripts. But when I add/update test file without change in any source file lage is not triggering the test case and return the cached state.

I have to manually pass --no-cache options which is a pain as it triggers script in all the packages.

Below is my lage config:

module.exports = {
  pipeline: {
    build: ['^build'],
    lint: ['^build'],
    test: ['^build'],
  },
  ignore: ['*.md', '.vscode/**'],

  cacheOptions: {
    // These are the subset of files in the package directories that will be saved into the cache
    outputGlob: ['dist/**/*', '!node_modules'],

    // These are relative to the git root, and affects the hash of the cache
    // Any of these file changes will invalidate cache
    environmentGlob: ['*.js', '*.json', '*.yml'],
  },
  npmClient: 'yarn',
};

To Reproduce
Steps to reproduce the behavior:

  1. Create a mono repo with above lage config file.
  2. Run lage test
  3. Update any test file
  4. Run lage test
  5. Check the lage output

Expected behavior
Lage should run the test case of the updated package but it return the cached result

Environment/Troubleshooting

System:
    OS: Windows 10 10.0.19045
    CPU: (16) x64 11th Gen Intel(R) Core(TM) i7-11850H @ 2.50GHz
    Memory: 38.57 GB / 63.20 GB
  Binaries:
    Node: 18.15.0 - C:\Program Files\nodejs\node.EXE
    Yarn: 3.6.1 - C:\Program Files\nodejs\yarn.CMD
    npm: 9.5.0 - C:\Program Files\nodejs\npm.CMD
    pnpm: 8.6.0 - C:\Program Files\nodejs\pnpm.CMD
  Managers:
    pip3: 21.1.1 - ~\AppData\Local\Programs\Python\Python38\Scripts\pip3.EXE
  Utilities:
    Git: 2.41.0. - /mingw64/bin/git
    Curl: 8.1.2 - C:\Program Files\Git\mingw64\bin\curl.EXE
  Virtualization:
    Docker: 24.0.2 - C:\Program Files\Docker\Docker\resources\bin\docker.EXE
  IDEs:
    VSCode: 1.81.0 - C:\Users\soumtr\AppData\Local\Programs\Microsoft VS Code\bin\code.CMD
  Languages:
    Bash: 5.2.15 - C:\Program Files\Git\usr\bin\bash.EXE
    Go: 1.20.2 - C:\Program Files\Go\bin\go.EXE
    Java: 11.0.18 - /c/Program Files/Amazon Corretto/jdk11.0.18_10/bin/javac
    Perl: 5.36.1 - C:\Program Files\Git\usr\bin\perl.EXE
    Python: 3.8.10 - /c/Users/soumtr/AppData/Local/Programs/Python/Python38/python
    Python3: 3.8.10 - /c/Users/soumtr/.pyenv/pyenv-win/shims/python3
  Browsers:
    Chrome: master_preferences
    Edge: Spartan (44.19041.1266.0), Chromium (114.0.1823.86)
    Internet Explorer: 11.0.19041.1566
  Monorepos:
    Yarn Workspaces: 3.6.1

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the issue with the reported lage configuration: run lage test, modify a test file, and run it again. Trace the cache invalidation behavior around cacheOptions, especially environmentGlob, and verify that changing a package test file reruns that package without requiring --no-cache.

Written by the indexing model from the issue text.

Assessment

Tech stack
node.js, typescript
Domain
build-system, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.