Repository navigation
fix(cache): hash every lockfile in the economics context - #107
adityankale190895 merged 3 commits into
Conversation
economicsContext spelled out its own lockfile list and missed npm-shrinkwrap.json, so editing it reused a stale Vue analysis. Export LOCKFILE_NAMES next to the shared LOCKFILE pattern and use it here. Part of DiffCI#97 Signed-off-by: sarankumar1325 <[email protected]>
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 71994f9b74
ℹ️ 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".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| export function economicsContext(repoPath: string): string { | ||
| const scope = readRepositoryConfig(repoPath).vue; | ||
| const paths = new Set(["diffci.json", "package.json", "tsconfig.json", "go.mod", "go.sum", "go.work", "go.work.sum", "pnpm-lock.yaml", "package-lock.json", "yarn.lock", "bun.lock", "bun.lockb", ...["ts", "js", "mts", "mjs", "cts", "cjs"].map(ext => `vitest.config.${ext}`)]); | ||
| const paths = new Set(["diffci.json", "package.json", "tsconfig.json", "go.mod", "go.sum", "go.work", "go.work.sum", ...LOCKFILE_NAMES, ...["ts", "js", "mts", "mjs", "cts", "cjs"].map(ext => `vitest.config.${ext}`)]); |
There was a problem hiding this comment.
When diffci.json points vue.packageRoot at a nested package whose dependencies are governed by a lockfile there (for example, packages/ui/pnpm-lock.yaml), this spread adds only root-relative lockfile names, so changes to the package's lockfile leave the cache namespace unchanged. analyzeVueCached can then reuse a Vue contribution after that package's resolved dependencies change. Include scoped lockfile paths and test them with a nested packageRoot.
Useful? React with 👍 / 👎.
A diffci.json vue.packageRoot can have its own lockfile (for example packages/ui/pnpm-lock.yaml). Only root lockfiles were hashed, so a change there reused a stale Vue analysis. Hash every lockfile name under the package root as well, with a test per name. Signed-off-by: sarankumar1325 <[email protected]>
Signed-off-by: adityankale190895 <[email protected]>
|
Thanks @sarankumar1325, all three are merged: #105, #106 and this one. Clear write-ups, a failing test for each fix, and quick follow-ups on the review comments made these easy to land. One thing for next time: new files under If you'd like to try DiffCI on one of your own JavaScript or TypeScript repositories, run this from the repo root: It shows which tests your current change affects, and when it falls back to the full suite, it says why. If anything looks wrong (a missed test, an unexpected fallback), we'd really like to hear about it in a community result or a new issue. And if you find the project useful, a star on the repo helps other people find it. The rest of #97 ( |
Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: adityankale190895 <[email protected]>
Part of #97 (this PR covers the
economics-context.tsfile; the issue says one PR per file is fine)economicsContextinsrc/cache/economics-context.tsbuilds the cache key for Vue analysis from a hand-written lockfile list. That list missednpm-shrinkwrap.json, so editing it kept the old context hash and reused a stale analysis.src/repo/lockfiles.tsnow exportsLOCKFILE_NAMESnext toLOCKFILE. It lists the same files as names, for code that needs names rather than a regex.economicsContextuses...LOCKFILE_NAMESin place of its own list, so it now includesnpm-shrinkwrap.json.impact.ts,file-references.tsandgit-diff.ts(PACKAGE_LOCKFILES) are not changed here and can follow in their own PRs.CONFIG_PATTERNSis not touched, as the issue asks.Tests
tests/cache/economics-context.test.ts. For each lockfile name, it checks that creating the file changes the context, and that changing its contents changes it again. Thenpm-shrinkwrap.jsoncase fails without the fix.tests/repo/lockfiles.test.ts. It checks that every name inLOCKFILE_NAMESmatchesLOCKFILE, that each name the pattern accepts is in the list, and that near-misses (bun.lockbb,pnpm-lock.yml, …) are rejected.npx tsx --test tests/repo/lockfiles.test.ts tests/cache/*.test.tspasses, andnpm run typecheckis clean.#105 also imports
LOCKFILEin a test, but it touches different files, so the two PRs don't conflict.