Skip to content

CI: fall back to npm install when lockfile is missing or out of sync - #9

Merged
allocsys merged 10 commits into
mainfrom
ci-lockfile-fallback
Jul 25, 2026
Merged

CI: fall back to npm install when lockfile is missing or out of sync#9
allocsys merged 10 commits into
mainfrom
ci-lockfile-fallback

Conversation

@allocsys

Copy link
Copy Markdown
Owner

Makes CI resilient to a missing or drifted package-lock.json instead of hard-failing.

What changed in ci.yml:

  • Install step now tries npm ci first. If it fails (lockfile missing or out of sync with package.json), it logs a ::warning:: explaining why, then falls back to npm install so the rest of CI (syntax check, lint, tests, smoke test) can still run.
  • Replaced setup-node's built-in cache: npm with a manual actions/cache step keyed on hashFiles('package-lock.json', 'package.json'). The built-in cache option errors out at setup time if it can't find a lockfile at all -- which would defeat the point of this PR, since a missing lockfile is exactly the case we want to survive.

Verified both failure modes directly on this branch before opening the PR (commits reverted after each check):

  • Lockfile present but out of sync (package.json had an unsatisfiable version bump) → npm ci failed, warning fired, fell back to npm install → CI still ran through to completion for everything npm install could resolve.
  • package-lock.json deleted entirely → same fallback path, same result.

Note the fallback can only save you from a stale/missing lockfile, not from a genuinely broken dependency spec (e.g. a version that doesn't exist on the registry) -- in that case npm install fails too, which is correct: that's not something CI should paper over.

Either fallback path still leaves a ::warning:: on the run and a stale-lockfile situation that should get fixed via the generate-lockfile.yml workflow -- this just stops it from blocking the rest of the pipeline in the meantime.

@vercel

vercel Bot commented Jul 25, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
madmcp Ready Ready Preview, Comment Jul 25, 2026 9:49am

package.json and eslint.config.js are already identical to main -- the
only divergence was two independent npm-generated lockfiles resolving
the same deps into different transitive layouts (debug/ms hoisting).
Taking main's lockfile as-is since it's already valid for this
branch's package.json.
@allocsys
allocsys merged commit 9fa23c5 into main Jul 25, 2026
4 checks passed
@allocsys
allocsys deleted the ci-lockfile-fallback branch July 25, 2026 09:49
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.

1 participant