fix(ci): stop version-bump commits from accumulating user-agent lines in .npmrc - #10565
Conversation
…ded user-agent line to .npmrc
PR Summary by Qodofix(ci): prevent CI user-agent mutations from being committed to .npmrc
AI Description
Diagram
High-Level Assessment
Files changed (2)
|
Code Review by Qodo
1. Skip-worktree can stale .npmrc
|
| echo "user-agent=bit-repo-circleci" >> .npmrc && | ||
| git update-index --skip-worktree .npmrc && |
There was a problem hiding this comment.
1. Skip-worktree can stale .npmrc 🐞 Bug ☼ Reliability
Marking the tracked project .npmrc as skip-worktree can cause later git pull --rebase / checkout operations during bit ci merge to update the index without updating the working-tree .npmrc. If .npmrc ever changes on the default branch, CI can keep using an older (mutated) .npmrc while Git appears clean, making new .npmrc settings ineffective in CI.
Agent Prompt
## Issue description
The CircleCI job mutates the tracked `.npmrc` and then sets `git update-index --skip-worktree .npmrc`. This can leave CI using a stale working-tree `.npmrc` after `bit ci merge` performs `git pull --rebase` / checkout operations, because Git may not update skip-worktree files in the working tree.
## Issue Context
- The config intentionally persists this index flag via `persist_to_workspace`, so the merge job inherits it.
- `bit ci merge` performs Git pull/rebase and checkout operations before tagging/committing.
## Fix Focus Areas
- .circleci/config.yml[656-669]
## What to change
- Prefer setting the CI user-agent without editing the tracked `.npmrc` (e.g., provide the user-agent via environment for the install step / npm config override), so the workflow no longer needs `--skip-worktree`.
- If mutating `.npmrc` is unavoidable, ensure the workflow does not keep `.npmrc` in skip-worktree state across Git pull/checkout phases (this likely requires moving the logic closer to the staging/commit phase rather than the initial install phase).
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
|
Code review by qodo was updated up to the latest commit 8473b86 |
|
Code review by qodo was updated up to the latest commit 0c1c537 |
Since #10528, the CI install step appends
user-agent=bit-repo-circlecito the tracked.npmrc. Thebit ci mergeversion-bump commit stages all tracked changes, so every release committed one more duplicate line to master (21 so far). Since the last occurrence of an npmrc key wins, the committed file ended up overridingbit-repo-local, so local installs were mislabeled as CI too..npmrcback to the singleuser-agent=bit-repo-localline.npmrcwithgit update-index --skip-worktreeso git treats it as unchanged: installs in this and later jobs (the flag persists via the workspace) still sendbit-repo-circleci, but no commit made from the CI workspace can pick the mutation up