Skip to content

ci: restore lockfile before engineer bot runs - #562

Merged
vuanhphung merged 1 commit into
mainfrom
fix/engineer-bot-lockfile-cleanup
Nov 5, 2026
Merged

vuanhphung merged 1 commit into
mainfrom
fix/engineer-bot-lockfile-cleanup

Conversation

@vuanhphung

Copy link
Copy Markdown
Collaborator

JFrog setup rewrites package-lock.json for dependency installation, leaving a tracked change outside the engineer bot's touched_files. This causes publishing to fail with “Unstaged paths remain after explicit staging,” as seen in this run.

Restore the committed lockfile immediately after npm ci in both the author and follow-up workflows, before the agent makes any edits.

Validation: Prettier, YAML parsing, shell syntax, and a temporary-repository reproduction confirming the registry rewrite is removed and subsequent agent edits stage without leftover changes. A live bot run is still needed after merge.

Signed-off-by: Vu Anh Phung <vu.phung@databricks.com>

@peco-review-bot peco-review-bot Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: 1 Low

Looks good. The fix targets the only tracked file that setup-jfrog rewrites, and it runs after npm ci has consumed the JFrog-resolved lockfile and before the agent makes any edits, in both workflows. One low-severity suggestion: add a fail-fast check so the workflows fail early if setup ever leaves other tracked changes.


- name: Restore lockfile after dependency installation
# Keep setup-jfrog's registry rewrite out of the agent's changes.
run: git restore --source=HEAD --worktree -- package-lock.json

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Low — This restores only package-lock.json, which matches what setup-jfrog rewrites today (.github/actions/setup-jfrog/action.yml:51-58). If setup ever touches another tracked file (for example, a prepare/build step that writes into a tracked path, or a new rewrite in setup-jfrog), the failure will come back. It would also show up late, as the same opaque "Unstaged paths remain" error in publish, after a full agent run.

Consider adding a fail-fast check right after the restore so setup churn is caught before the agent runs, e.g.:

run: |
  git restore --source=HEAD --worktree -- package-lock.json
  git diff --exit-code || { echo "::error::setup left tracked changes"; exit 1; }

The same applies to the follow-up workflow's restore step.

@vuanhphung
vuanhphung added this pull request to the merge queue Nov 5, 2026
Merged via the queue into main with commit 9cae608 Nov 5, 2026
24 checks passed
@vuanhphung
vuanhphung deleted the fix/engineer-bot-lockfile-cleanup branch November 5, 2026 04:51

This branch was previously deployed

1 inactive deployment
azure-prod — 5cb54382 Deployed Nov 5, 2026 by vuanhphung via e2e-test (24.22.1, 24_22_1) #1736
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