From 2fe306eeada0046cae8e22f60cce3a7019cbc497 Mon Sep 17 00:00:00 2001 From: Zoltan Kochan Date: Tue, 10 Nov 2026 13:23:23 +0100 Subject: [PATCH 1/6] feat: add lockfile 3-way git merge conflict benchmark across package managers --- README.md | 8 + benchmarkLockfileConflicts.js | 215 ++++++ benchmarkLockfileConflicts.test.mjs | 114 +++ lockfile-conflicts.json | 1050 +++++++++++++++++++++++++++ lockfileConflictScenarios.js | 365 ++++++++++ package.json | 3 +- 6 files changed, 1754 insertions(+), 1 deletion(-) create mode 100644 benchmarkLockfileConflicts.js create mode 100644 benchmarkLockfileConflicts.test.mjs create mode 100644 lockfile-conflicts.json create mode 100644 lockfileConflictScenarios.js diff --git a/README.md b/README.md index ac7e7e1..2de7551 100644 --- a/README.md +++ b/README.md @@ -56,3 +56,11 @@ That section times commands inside the shell with `$EPOCHREALTIME`, so it needs ``` brew install bash ``` + +## Lockfile Git merge conflicts + +`benchmarkLockfileConflicts.js` measures 3-way `git merge-file` conflicts and semantic drift across 25 concurrent-branch scenarios (`lockfileConflictScenarios.js`) for `pnpm-lock.yaml` (`13.0` and `9.0`), `package-lock.json` (npm v3), `yarn.lock` (Berry and Classic v1), `bun.lock`, and `vlt-lock.json`, and writes the results to [lockfile-conflicts.json](./lockfile-conflicts.json): + +``` +pnpm run benchmark:conflicts +``` diff --git a/benchmarkLockfileConflicts.js b/benchmarkLockfileConflicts.js new file mode 100644 index 0000000..caf7117 --- /dev/null +++ b/benchmarkLockfileConflicts.js @@ -0,0 +1,215 @@ +'use strict' +import fs from 'node:fs' +import os from 'node:os' +import path from 'node:path' +import { fileURLToPath, pathToFileURL } from 'node:url' + +import spawn from 'cross-spawn' + +import { lockfileConflictScenarios } from './lockfileConflictScenarios.js' + +const DIRNAME = path.dirname(fileURLToPath(import.meta.url)) +const OUTPUT_FILE = path.join(DIRNAME, 'lockfile-conflicts.json') + +export const CONFLICT_MANAGERS = [ + 'pnpm_v13', + 'pnpm_v9', + 'npm', + 'yarn', + 'yarn_classic', + 'bun', + 'vlt', +] + +function rootManifest (state) { + return { + name: 'root', + version: '1.0.0', + private: true, + ...(state.workspaces ? { workspaces: ['packages/*'] } : {}), + ...(state.dependencies ? { dependencies: state.dependencies } : {}), + ...(state.devDependencies ? { devDependencies: state.devDependencies } : {}), + } +} + +export function writeProjectState (dir, state, { clean = true } = {}) { + if (clean) { + fs.rmSync(dir, { recursive: true, force: true }) + fs.mkdirSync(dir, { recursive: true }) + } + fs.writeFileSync(path.join(dir, 'package.json'), `${JSON.stringify(rootManifest(state), null, 2)}\n`) + if (!state.workspaces) return + for (const [wsName, wsPkg] of Object.entries(state.workspaces)) { + const wsDir = path.join(dir, 'packages', wsName) + fs.mkdirSync(wsDir, { recursive: true }) + const manifest = { name: `@ws/${wsName}`, version: '1.0.0', ...wsPkg } + fs.writeFileSync(path.join(wsDir, 'package.json'), `${JSON.stringify(manifest, null, 2)}\n`) + } +} + +function writePnpmWorkspaceYaml (dir, state, isV13) { + const lines = state.workspaces ? ['packages:', ' - packages/*'] : [] + if (isV13) lines.push('lockfile:', ' format: v13') + if (lines.length > 0) { + fs.writeFileSync(path.join(dir, 'pnpm-workspace.yaml'), `${lines.join('\n')}\n`) + } +} + +function runCommand (command, args, opts) { + const result = spawn.sync(command, args, { stdio: 'pipe', ...opts }) + if (result.error) throw result.error + if (result.status !== 0) { + const stderr = result.stderr?.toString() ?? '' + throw new Error(`\`${command} ${args.join(' ')}\` exited with ${result.status}: ${stderr}`) + } +} + +function invokeManager (manager, dir, binaries) { + if (manager === 'pnpm_v13' || manager === 'pnpm_v9') { + runCommand(binaries.pnpm ?? 'pnpm', ['install', '--lockfile-only', '--ignore-scripts'], { cwd: dir }) + return fs.readFileSync(path.join(dir, 'pnpm-lock.yaml'), 'utf8') + } + if (manager === 'npm') { + runCommand(binaries.npm ?? 'npm', ['install', '--package-lock-only', '--ignore-scripts', '--no-audit', '--no-fund'], { cwd: dir }) + return fs.readFileSync(path.join(dir, 'package-lock.json'), 'utf8') + } + if (manager === 'bun') { + runCommand(binaries.bun ?? 'bun', ['install', '--lockfile-only', '--ignore-scripts'], { cwd: dir }) + return fs.readFileSync(path.join(dir, 'bun.lock'), 'utf8') + } + if (manager === 'vlt') { + const args = ['install', '--lockfile-only', '--registry=https://registry.npmjs.org/', '--registries=npm=https://registry.npmjs.org/'] + runCommand(binaries.vlt ?? 'vlt', args, { cwd: dir }) + return fs.readFileSync(path.join(dir, 'vlt-lock.json'), 'utf8') + } + if (manager === 'yarn') { + const env = { ...process.env, YARN_ENABLE_IMMUTABLE_INSTALLS: 'false', YARN_ENABLE_TELEMETRY: '0' } + runCommand(binaries.yarn ?? 'yarn', ['install', '--mode', 'update-lockfile'], { cwd: dir, env }) + return fs.readFileSync(path.join(dir, 'yarn.lock'), 'utf8') + } + if (manager === 'yarn_classic') { + const nmDir = path.join(dir, '.y1_nm') + const args = ['install', '--ignore-scripts', '--no-node-version-check', '--non-interactive', '--modules-folder', nmDir] + runCommand(binaries.yarnClassic ?? 'yarn', args, { cwd: dir }) + return fs.readFileSync(path.join(dir, 'yarn.lock'), 'utf8') + } + throw new Error(`Unknown package manager: ${manager}`) +} + +export function generateLockfileForState (manager, state, workDir, binaries = {}) { + if (state.seed) { + generateLockfileForState(manager, state.seed, workDir, binaries) + writeProjectState(workDir, state, { clean: false }) + } else { + writeProjectState(workDir, state, { clean: true }) + } + if (manager === 'pnpm_v13' || manager === 'pnpm_v9') { + writePnpmWorkspaceYaml(workDir, state, manager === 'pnpm_v13') + } + return invokeManager(manager, workDir, binaries) +} + +export function gitMergeLockfiles (baseText, branchAText, branchBText) { + const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'lockfile-merge-')) + try { + const baseFile = path.join(dir, 'base') + const aFile = path.join(dir, 'a') + const bFile = path.join(dir, 'b') + fs.writeFileSync(baseFile, baseText) + fs.writeFileSync(aFile, branchAText) + fs.writeFileSync(bFile, branchBText) + const result = spawn.sync('git', ['merge-file', '-p', aFile, baseFile, bFile], { encoding: 'utf8' }) + if (result.error) throw result.error + const merged = result.stdout ?? '' + const conflicts = countConflictHunks(merged) + return { conflicts, merged } + } finally { + fs.rmSync(dir, { recursive: true, force: true }) + } +} + +export function countConflictHunks (text) { + let count = 0 + for (const line of text.split('\n')) { + if (line.startsWith('<<<<<<<')) count += 1 + } + return count +} + +export function evaluateScenarioOutcome ({ base, branchA, branchB, expectedMerged }) { + const { conflicts, merged } = gitMergeLockfiles(base, branchA, branchB) + const exactMatch = conflicts === 0 && merged === expectedMerged + const semanticDrift = conflicts === 0 && !exactMatch + return { conflicts, exactMatch, semanticDrift } +} + +function summarizeManagerOutcomes (scenarios, manager) { + let clean = 0 + let conflicted = 0 + let conflictHunks = 0 + let semanticDrift = 0 + for (const scenario of Object.values(scenarios)) { + const outcome = scenario.managers[manager] + if (!outcome) continue + if (outcome.conflicts > 0) { + conflicted += 1 + conflictHunks += outcome.conflicts + } else if (outcome.exactMatch) { + clean += 1 + } else { + semanticDrift += 1 + } + } + return { clean, conflicted, conflictHunks, semanticDrift } +} + +export function summarizeConflictResults (scenarios, managers = CONFLICT_MANAGERS) { + const summary = {} + for (const manager of managers) { + summary[manager] = summarizeManagerOutcomes(scenarios, manager) + } + return summary +} + +export function runLockfileConflictsBenchmark ({ + managers = CONFLICT_MANAGERS, + binaries = {}, + outputPath = OUTPUT_FILE, +} = {}) { + const workDir = fs.mkdtempSync(path.join(os.tmpdir(), 'lockfile-bench-work-')) + const scenarios = {} + try { + for (const scenario of lockfileConflictScenarios) { + scenarios[scenario.id] = { description: scenario.description, managers: {} } + for (const manager of managers) { + const base = generateLockfileForState(manager, scenario.base, workDir, binaries) + const branchA = generateLockfileForState(manager, scenario.branchA, workDir, binaries) + const branchB = generateLockfileForState(manager, scenario.branchB, workDir, binaries) + const expectedMerged = generateLockfileForState(manager, scenario.merged, workDir, binaries) + scenarios[scenario.id].managers[manager] = evaluateScenarioOutcome({ + base, + branchA, + branchB, + expectedMerged, + }) + } + } + } finally { + fs.rmSync(workDir, { recursive: true, force: true }) + } + const report = { + measuredAt: new Date().toISOString(), + totalScenarios: lockfileConflictScenarios.length, + summary: summarizeConflictResults(scenarios, managers), + scenarios, + } + if (outputPath) { + fs.writeFileSync(outputPath, `${JSON.stringify(report, null, 2)}\n`, 'utf8') + } + return report +} + +if (process.argv[1] && pathToFileURL(path.resolve(process.argv[1])).href === import.meta.url) { + const report = runLockfileConflictsBenchmark() + console.log(JSON.stringify(report.summary, null, 2)) +} diff --git a/benchmarkLockfileConflicts.test.mjs b/benchmarkLockfileConflicts.test.mjs new file mode 100644 index 0000000..05d1faf --- /dev/null +++ b/benchmarkLockfileConflicts.test.mjs @@ -0,0 +1,114 @@ +import assert from 'node:assert/strict' +import fs from 'node:fs' +import path from 'node:path' +import test from 'node:test' + +import tempy from 'tempy' + +import { + CONFLICT_MANAGERS, + countConflictHunks, + evaluateScenarioOutcome, + gitMergeLockfiles, + summarizeConflictResults, + writeProjectState, +} from './benchmarkLockfileConflicts.js' +import { lockfileConflictScenarios } from './lockfileConflictScenarios.js' + +test('gitMergeLockfiles merges non-overlapping multi-line dependency maps cleanly', () => { + const base = [ + '{', + '\t"projects": {', + '\t\t".": {', + '\t\t\t"dependencies": {', + '\t\t\t\t"fast-copy": {', + '\t\t\t\t\t"specifier": "~3.0.0",', + '\t\t\t\t\t"version": "3.0.0",', + '\t\t\t\t},', + '\t\t\t\t"fast-redact": {', + '\t\t\t\t\t"specifier": "~3.4.0",', + '\t\t\t\t\t"version": "3.4.0",', + '\t\t\t\t},', + '\t\t\t},', + '\t\t},', + '\t},', + '}', + '', + ].join('\n') + const branchA = base + .replace('"~3.0.0"', '"^3.1.0"') + .replace('"3.0.0"', '"3.1.0"') + const branchB = base + .replace('"~3.4.0"', '"^3.5.0"') + .replace('"3.4.0"', '"3.5.0"') + const expectedMerged = branchA + .replace('"~3.4.0"', '"^3.5.0"') + .replace('"3.4.0"', '"3.5.0"') + + const outcome = evaluateScenarioOutcome({ + base, + branchA, + branchB, + expectedMerged, + }) + assert.deepEqual(outcome, { + conflicts: 0, + exactMatch: true, + semanticDrift: false, + }) +}) + +test('gitMergeLockfiles counts conflict hunks and detects semantic drift', () => { + const base = 'a: 1\nb: 2\n' + const branchA = 'a: 10\nb: 2\n' + const branchB = 'a: 1\nb: 20\n' + const conflictedMerge = gitMergeLockfiles(base, branchA, branchB) + assert.equal(conflictedMerge.conflicts, 1) + assert.equal(countConflictHunks(conflictedMerge.merged), 1) + + const driftOutcome = evaluateScenarioOutcome({ + base: 'a: 1\n\nb: 2\n', + branchA: 'a: 10\n\nb: 2\n', + branchB: 'a: 1\n\nb: 20\n', + expectedMerged: 'a: 10\n\nb: 99\n', + }) + assert.deepEqual(driftOutcome, { + conflicts: 0, + exactMatch: false, + semanticDrift: true, + }) +}) + +test('summarizeConflictResults aggregates clean, conflicted, and drift scenarios', () => { + const scenarios = { + S01: { + managers: { + pnpm_v13: { conflicts: 0, exactMatch: true, semanticDrift: false }, + npm: { conflicts: 2, exactMatch: false, semanticDrift: false }, + }, + }, + S02: { + managers: { + pnpm_v13: { conflicts: 0, exactMatch: false, semanticDrift: true }, + npm: { conflicts: 0, exactMatch: true, semanticDrift: false }, + }, + }, + } + const summary = summarizeConflictResults(scenarios, ['pnpm_v13', 'npm']) + assert.deepEqual(summary, { + pnpm_v13: { clean: 1, conflicted: 0, conflictHunks: 0, semanticDrift: 1 }, + npm: { clean: 1, conflicted: 1, conflictHunks: 2, semanticDrift: 0 }, + }) +}) + +test('writeProjectState writes root and workspace manifests and scenarios are well-formed', () => { + const dir = tempy.directory() + writeProjectState(dir, { + dependencies: { abbrev: '3.0.1' }, + workspaces: { a: { dependencies: { ini: '5.0.0' } } }, + }) + assert.ok(fs.existsSync(path.join(dir, 'package.json'))) + assert.ok(fs.existsSync(path.join(dir, 'packages/a/package.json'))) + assert.equal(lockfileConflictScenarios.length, 25) + assert.equal(CONFLICT_MANAGERS.includes('pnpm_v13'), true) +}) diff --git a/lockfile-conflicts.json b/lockfile-conflicts.json new file mode 100644 index 0000000..714832e --- /dev/null +++ b/lockfile-conflicts.json @@ -0,0 +1,1050 @@ +{ + "measuredAt": "2026-11-10T12:20:00.789Z", + "totalScenarios": 25, + "summary": { + "pnpm_v13": { + "clean": 12, + "conflicted": 11, + "conflictHunks": 16, + "semanticDrift": 2 + }, + "pnpm_v9": { + "clean": 11, + "conflicted": 11, + "conflictHunks": 23, + "semanticDrift": 3 + }, + "npm": { + "clean": 11, + "conflicted": 12, + "conflictHunks": 15, + "semanticDrift": 2 + }, + "yarn": { + "clean": 11, + "conflicted": 13, + "conflictHunks": 18, + "semanticDrift": 1 + }, + "yarn_classic": { + "clean": 15, + "conflicted": 10, + "conflictHunks": 12, + "semanticDrift": 0 + }, + "bun": { + "clean": 10, + "conflicted": 14, + "conflictHunks": 18, + "semanticDrift": 1 + }, + "vlt": { + "clean": 4, + "conflicted": 20, + "conflictHunks": 35, + "semanticDrift": 1 + } + }, + "scenarios": { + "S01_add_non_adjacent_deps": { + "description": "Add two non-adjacent direct deps (abbrev & wrappy)", + "managers": { + "pnpm_v13": { + "conflicts": 0, + "exactMatch": true, + "semanticDrift": false + }, + "pnpm_v9": { + "conflicts": 0, + "exactMatch": true, + "semanticDrift": false + }, + "npm": { + "conflicts": 0, + "exactMatch": true, + "semanticDrift": false + }, + "yarn": { + "conflicts": 0, + "exactMatch": true, + "semanticDrift": false + }, + "yarn_classic": { + "conflicts": 0, + "exactMatch": true, + "semanticDrift": false + }, + "bun": { + "conflicts": 0, + "exactMatch": true, + "semanticDrift": false + }, + "vlt": { + "conflicts": 0, + "exactMatch": true, + "semanticDrift": false + } + } + }, + "S02_add_adjacent_deps_middle": { + "description": "Add two alphabetically adjacent direct deps (fast-copy & fast-redact)", + "managers": { + "pnpm_v13": { + "conflicts": 2, + "exactMatch": false, + "semanticDrift": false + }, + "pnpm_v9": { + "conflicts": 3, + "exactMatch": false, + "semanticDrift": false + }, + "npm": { + "conflicts": 2, + "exactMatch": false, + "semanticDrift": false + }, + "yarn": { + "conflicts": 2, + "exactMatch": false, + "semanticDrift": false + }, + "yarn_classic": { + "conflicts": 1, + "exactMatch": false, + "semanticDrift": false + }, + "bun": { + "conflicts": 2, + "exactMatch": false, + "semanticDrift": false + }, + "vlt": { + "conflicts": 2, + "exactMatch": false, + "semanticDrift": false + } + } + }, + "S03_add_deps_at_end": { + "description": "Add two direct deps at the end of dependencies (once & wrappy)", + "managers": { + "pnpm_v13": { + "conflicts": 2, + "exactMatch": false, + "semanticDrift": false + }, + "pnpm_v9": { + "conflicts": 3, + "exactMatch": false, + "semanticDrift": false + }, + "npm": { + "conflicts": 2, + "exactMatch": false, + "semanticDrift": false + }, + "yarn": { + "conflicts": 1, + "exactMatch": false, + "semanticDrift": false + }, + "yarn_classic": { + "conflicts": 1, + "exactMatch": false, + "semanticDrift": false + }, + "bun": { + "conflicts": 2, + "exactMatch": false, + "semanticDrift": false + }, + "vlt": { + "conflicts": 2, + "exactMatch": false, + "semanticDrift": false + } + } + }, + "S04_bump_non_adjacent_deps": { + "description": "Bump two non-adjacent direct deps (abbrev & safe-stable-stringify)", + "managers": { + "pnpm_v13": { + "conflicts": 0, + "exactMatch": true, + "semanticDrift": false + }, + "pnpm_v9": { + "conflicts": 0, + "exactMatch": true, + "semanticDrift": false + }, + "npm": { + "conflicts": 0, + "exactMatch": true, + "semanticDrift": false + }, + "yarn": { + "conflicts": 0, + "exactMatch": true, + "semanticDrift": false + }, + "yarn_classic": { + "conflicts": 0, + "exactMatch": true, + "semanticDrift": false + }, + "bun": { + "conflicts": 0, + "exactMatch": true, + "semanticDrift": false + }, + "vlt": { + "conflicts": 0, + "exactMatch": true, + "semanticDrift": false + } + } + }, + "S05_bump_adjacent_deps_exact": { + "description": "Bump two adjacent exact direct deps (fast-copy & fast-redact)", + "managers": { + "pnpm_v13": { + "conflicts": 1, + "exactMatch": false, + "semanticDrift": false + }, + "pnpm_v9": { + "conflicts": 0, + "exactMatch": true, + "semanticDrift": false + }, + "npm": { + "conflicts": 1, + "exactMatch": false, + "semanticDrift": false + }, + "yarn": { + "conflicts": 1, + "exactMatch": false, + "semanticDrift": false + }, + "yarn_classic": { + "conflicts": 0, + "exactMatch": true, + "semanticDrift": false + }, + "bun": { + "conflicts": 1, + "exactMatch": false, + "semanticDrift": false + }, + "vlt": { + "conflicts": 2, + "exactMatch": false, + "semanticDrift": false + } + } + }, + "S06_bump_adjacent_deps_ranged": { + "description": "Bump two adjacent ranged direct deps (^3.0.0->^3.1.0, ^3.4.0->^3.5.0)", + "managers": { + "pnpm_v13": { + "conflicts": 0, + "exactMatch": true, + "semanticDrift": false + }, + "pnpm_v9": { + "conflicts": 0, + "exactMatch": true, + "semanticDrift": false + }, + "npm": { + "conflicts": 1, + "exactMatch": false, + "semanticDrift": false + }, + "yarn": { + "conflicts": 1, + "exactMatch": false, + "semanticDrift": false + }, + "yarn_classic": { + "conflicts": 0, + "exactMatch": true, + "semanticDrift": false + }, + "bun": { + "conflicts": 1, + "exactMatch": false, + "semanticDrift": false + }, + "vlt": { + "conflicts": 2, + "exactMatch": false, + "semanticDrift": false + } + } + }, + "S07_remove_and_bump_adjacent_pkg": { + "description": "Branch A removes fast-copy, Branch B bumps adjacent fast-redact", + "managers": { + "pnpm_v13": { + "conflicts": 2, + "exactMatch": false, + "semanticDrift": false + }, + "pnpm_v9": { + "conflicts": 2, + "exactMatch": false, + "semanticDrift": false + }, + "npm": { + "conflicts": 1, + "exactMatch": false, + "semanticDrift": false + }, + "yarn": { + "conflicts": 2, + "exactMatch": false, + "semanticDrift": false + }, + "yarn_classic": { + "conflicts": 1, + "exactMatch": false, + "semanticDrift": false + }, + "bun": { + "conflicts": 2, + "exactMatch": false, + "semanticDrift": false + }, + "vlt": { + "conflicts": 2, + "exactMatch": false, + "semanticDrift": false + } + } + }, + "S08_add_and_bump_adjacent_pkg": { + "description": "Branch A adds fast-copy right before fast-redact; Branch B bumps fast-redact", + "managers": { + "pnpm_v13": { + "conflicts": 2, + "exactMatch": false, + "semanticDrift": false + }, + "pnpm_v9": { + "conflicts": 2, + "exactMatch": false, + "semanticDrift": false + }, + "npm": { + "conflicts": 1, + "exactMatch": false, + "semanticDrift": false + }, + "yarn": { + "conflicts": 2, + "exactMatch": false, + "semanticDrift": false + }, + "yarn_classic": { + "conflicts": 1, + "exactMatch": false, + "semanticDrift": false + }, + "bun": { + "conflicts": 2, + "exactMatch": false, + "semanticDrift": false + }, + "vlt": { + "conflicts": 2, + "exactMatch": false, + "semanticDrift": false + } + } + }, + "S09_peer_provider_bump_and_new_consumer": { + "description": "Branch A bumps peer provider (react 18.2.0->18.3.1); Branch B adds a new peer consumer (react-is/use-sync-external-store)", + "managers": { + "pnpm_v13": { + "conflicts": 0, + "exactMatch": false, + "semanticDrift": true + }, + "pnpm_v9": { + "conflicts": 0, + "exactMatch": false, + "semanticDrift": true + }, + "npm": { + "conflicts": 0, + "exactMatch": false, + "semanticDrift": true + }, + "yarn": { + "conflicts": 0, + "exactMatch": false, + "semanticDrift": true + }, + "yarn_classic": { + "conflicts": 0, + "exactMatch": true, + "semanticDrift": false + }, + "bun": { + "conflicts": 0, + "exactMatch": false, + "semanticDrift": true + }, + "vlt": { + "conflicts": 0, + "exactMatch": false, + "semanticDrift": true + } + } + }, + "S10_peer_provider_bump_and_consumer_bump": { + "description": "Branch A bumps peer provider (react 18.2.0->18.3.1); Branch B bumps peer consumer (use-sync-external-store 1.2.0->1.2.2)", + "managers": { + "pnpm_v13": { + "conflicts": 1, + "exactMatch": false, + "semanticDrift": false + }, + "pnpm_v9": { + "conflicts": 2, + "exactMatch": false, + "semanticDrift": false + }, + "npm": { + "conflicts": 1, + "exactMatch": false, + "semanticDrift": false + }, + "yarn": { + "conflicts": 1, + "exactMatch": false, + "semanticDrift": false + }, + "yarn_classic": { + "conflicts": 0, + "exactMatch": true, + "semanticDrift": false + }, + "bun": { + "conflicts": 1, + "exactMatch": false, + "semanticDrift": false + }, + "vlt": { + "conflicts": 1, + "exactMatch": false, + "semanticDrift": false + } + } + }, + "S11_multi_peer_set_intro_vs_provider_bump": { + "description": "Branch A bumps react 18.2.0->18.3.1 in ws/a; Branch B adds second peer set (react 17.0.2 + use-sync-external-store) in ws/b", + "managers": { + "pnpm_v13": { + "conflicts": 2, + "exactMatch": false, + "semanticDrift": false + }, + "pnpm_v9": { + "conflicts": 2, + "exactMatch": false, + "semanticDrift": false + }, + "npm": { + "conflicts": 0, + "exactMatch": true, + "semanticDrift": false + }, + "yarn": { + "conflicts": 1, + "exactMatch": false, + "semanticDrift": false + }, + "yarn_classic": { + "conflicts": 1, + "exactMatch": false, + "semanticDrift": false + }, + "bun": { + "conflicts": 1, + "exactMatch": false, + "semanticDrift": false + }, + "vlt": { + "conflicts": 2, + "exactMatch": false, + "semanticDrift": false + } + } + }, + "S12_workspace_independent_projects": { + "description": "Branch A modifies packages/a; Branch B modifies packages/b", + "managers": { + "pnpm_v13": { + "conflicts": 0, + "exactMatch": true, + "semanticDrift": false + }, + "pnpm_v9": { + "conflicts": 0, + "exactMatch": true, + "semanticDrift": false + }, + "npm": { + "conflicts": 0, + "exactMatch": true, + "semanticDrift": false + }, + "yarn": { + "conflicts": 0, + "exactMatch": true, + "semanticDrift": false + }, + "yarn_classic": { + "conflicts": 0, + "exactMatch": true, + "semanticDrift": false + }, + "bun": { + "conflicts": 0, + "exactMatch": true, + "semanticDrift": false + }, + "vlt": { + "conflicts": 1, + "exactMatch": false, + "semanticDrift": false + } + } + }, + "S13_shared_transitive_dep": { + "description": "Two branches add packages that share transitive dependencies (pump & end-of-stream)", + "managers": { + "pnpm_v13": { + "conflicts": 1, + "exactMatch": false, + "semanticDrift": false + }, + "pnpm_v9": { + "conflicts": 2, + "exactMatch": false, + "semanticDrift": false + }, + "npm": { + "conflicts": 2, + "exactMatch": false, + "semanticDrift": false + }, + "yarn": { + "conflicts": 3, + "exactMatch": false, + "semanticDrift": false + }, + "yarn_classic": { + "conflicts": 3, + "exactMatch": false, + "semanticDrift": false + }, + "bun": { + "conflicts": 1, + "exactMatch": false, + "semanticDrift": false + }, + "vlt": { + "conflicts": 2, + "exactMatch": false, + "semanticDrift": false + } + } + }, + "S14_workspace_hoisting_shift": { + "description": "Branch A adds ajv@8.17.1 to ws/a; Branch B bumps root ajv 8.12.0->8.17.1 (causes hoisting shift in npm/bun)", + "managers": { + "pnpm_v13": { + "conflicts": 0, + "exactMatch": false, + "semanticDrift": true + }, + "pnpm_v9": { + "conflicts": 0, + "exactMatch": false, + "semanticDrift": true + }, + "npm": { + "conflicts": 0, + "exactMatch": false, + "semanticDrift": true + }, + "yarn": { + "conflicts": 1, + "exactMatch": false, + "semanticDrift": false + }, + "yarn_classic": { + "conflicts": 1, + "exactMatch": false, + "semanticDrift": false + }, + "bun": { + "conflicts": 1, + "exactMatch": false, + "semanticDrift": false + }, + "vlt": { + "conflicts": 2, + "exactMatch": false, + "semanticDrift": false + } + } + }, + "S15_bump_two_multi_dep_packages": { + "description": "Branch A bumps pino 8.19.0->9.0.0 in ws/a; Branch B bumps readable-stream 4.4.0->4.8.0 in ws/b", + "managers": { + "pnpm_v13": { + "conflicts": 0, + "exactMatch": true, + "semanticDrift": false + }, + "pnpm_v9": { + "conflicts": 0, + "exactMatch": true, + "semanticDrift": false + }, + "npm": { + "conflicts": 0, + "exactMatch": true, + "semanticDrift": false + }, + "yarn": { + "conflicts": 0, + "exactMatch": true, + "semanticDrift": false + }, + "yarn_classic": { + "conflicts": 0, + "exactMatch": true, + "semanticDrift": false + }, + "bun": { + "conflicts": 0, + "exactMatch": true, + "semanticDrift": false + }, + "vlt": { + "conflicts": 1, + "exactMatch": false, + "semanticDrift": false + } + } + }, + "S16_peer_provider_bump_and_distant_new_consumer": { + "description": "Branch A bumps react 18.2.0->18.3.1; Branch B adds swr@2.2.5 (peer consumer of react) in same project", + "managers": { + "pnpm_v13": { + "conflicts": 1, + "exactMatch": false, + "semanticDrift": false + }, + "pnpm_v9": { + "conflicts": 2, + "exactMatch": false, + "semanticDrift": false + }, + "npm": { + "conflicts": 1, + "exactMatch": false, + "semanticDrift": false + }, + "yarn": { + "conflicts": 1, + "exactMatch": false, + "semanticDrift": false + }, + "yarn_classic": { + "conflicts": 0, + "exactMatch": true, + "semanticDrift": false + }, + "bun": { + "conflicts": 1, + "exactMatch": false, + "semanticDrift": false + }, + "vlt": { + "conflicts": 2, + "exactMatch": false, + "semanticDrift": false + } + } + }, + "S17_lockfile_only_bump_adjacent_ranged_deps": { + "description": "Manifest ranges (^3.0.0, ^3.4.0) stay unchanged; Branch A updates fast-copy lock 3.0.0->3.1.0, Branch B updates fast-redact lock 3.4.0->3.5.0", + "managers": { + "pnpm_v13": { + "conflicts": 0, + "exactMatch": true, + "semanticDrift": false + }, + "pnpm_v9": { + "conflicts": 0, + "exactMatch": true, + "semanticDrift": false + }, + "npm": { + "conflicts": 0, + "exactMatch": true, + "semanticDrift": false + }, + "yarn": { + "conflicts": 0, + "exactMatch": true, + "semanticDrift": false + }, + "yarn_classic": { + "conflicts": 0, + "exactMatch": true, + "semanticDrift": false + }, + "bun": { + "conflicts": 0, + "exactMatch": true, + "semanticDrift": false + }, + "vlt": { + "conflicts": 2, + "exactMatch": false, + "semanticDrift": false + } + } + }, + "S18_bump_pkg_and_add_pkg_after_it": { + "description": "Branch A bumps fast-copy 3.0.0->3.1.0 (in ws/a); Branch B adds fast-redact 3.5.0 right after fast-copy (in ws/b)", + "managers": { + "pnpm_v13": { + "conflicts": 0, + "exactMatch": true, + "semanticDrift": false + }, + "pnpm_v9": { + "conflicts": 0, + "exactMatch": true, + "semanticDrift": false + }, + "npm": { + "conflicts": 0, + "exactMatch": true, + "semanticDrift": false + }, + "yarn": { + "conflicts": 0, + "exactMatch": true, + "semanticDrift": false + }, + "yarn_classic": { + "conflicts": 0, + "exactMatch": true, + "semanticDrift": false + }, + "bun": { + "conflicts": 0, + "exactMatch": true, + "semanticDrift": false + }, + "vlt": { + "conflicts": 2, + "exactMatch": false, + "semanticDrift": false + } + } + }, + "S19_add_pkg_before_and_bump_pkg_after_across_ws": { + "description": "Branch A adds fast-copy 3.1.0 (in ws/a); Branch B bumps fast-redact 3.4.0->3.5.0 (in ws/b) — isolates packages/nodes section from projects", + "managers": { + "pnpm_v13": { + "conflicts": 1, + "exactMatch": false, + "semanticDrift": false + }, + "pnpm_v9": { + "conflicts": 2, + "exactMatch": false, + "semanticDrift": false + }, + "npm": { + "conflicts": 0, + "exactMatch": true, + "semanticDrift": false + }, + "yarn": { + "conflicts": 1, + "exactMatch": false, + "semanticDrift": false + }, + "yarn_classic": { + "conflicts": 1, + "exactMatch": false, + "semanticDrift": false + }, + "bun": { + "conflicts": 1, + "exactMatch": false, + "semanticDrift": false + }, + "vlt": { + "conflicts": 2, + "exactMatch": false, + "semanticDrift": false + } + } + }, + "S20_remove_two_adjacent_pkgs_across_ws": { + "description": "Branch A removes fast-copy (from ws/a); Branch B removes fast-redact (from ws/b) — adjacent in packages/nodes", + "managers": { + "pnpm_v13": { + "conflicts": 1, + "exactMatch": false, + "semanticDrift": false + }, + "pnpm_v9": { + "conflicts": 2, + "exactMatch": false, + "semanticDrift": false + }, + "npm": { + "conflicts": 1, + "exactMatch": false, + "semanticDrift": false + }, + "yarn": { + "conflicts": 1, + "exactMatch": false, + "semanticDrift": false + }, + "yarn_classic": { + "conflicts": 1, + "exactMatch": false, + "semanticDrift": false + }, + "bun": { + "conflicts": 1, + "exactMatch": false, + "semanticDrift": false + }, + "vlt": { + "conflicts": 2, + "exactMatch": false, + "semanticDrift": false + } + } + }, + "S21_bump_two_adjacent_pkgs_across_ws": { + "description": "Branch A bumps fast-copy 3.0.0->3.1.0 (in ws/a); Branch B bumps fast-redact 3.4.0->3.5.0 (in ws/b) — adjacent in packages/nodes", + "managers": { + "pnpm_v13": { + "conflicts": 0, + "exactMatch": true, + "semanticDrift": false + }, + "pnpm_v9": { + "conflicts": 0, + "exactMatch": true, + "semanticDrift": false + }, + "npm": { + "conflicts": 0, + "exactMatch": true, + "semanticDrift": false + }, + "yarn": { + "conflicts": 0, + "exactMatch": true, + "semanticDrift": false + }, + "yarn_classic": { + "conflicts": 0, + "exactMatch": true, + "semanticDrift": false + }, + "bun": { + "conflicts": 0, + "exactMatch": true, + "semanticDrift": false + }, + "vlt": { + "conflicts": 2, + "exactMatch": false, + "semanticDrift": false + } + } + }, + "S22_bump_two_adjacent_transitive_deps": { + "description": "readable-stream@4.8.0 has adjacent deps buffer & events; Branch A updates buffer 6.0.2->6.0.3, Branch B updates events 3.2.0->3.3.0", + "managers": { + "pnpm_v13": { + "conflicts": 0, + "exactMatch": true, + "semanticDrift": false + }, + "pnpm_v9": { + "conflicts": 0, + "exactMatch": true, + "semanticDrift": false + }, + "npm": { + "conflicts": 1, + "exactMatch": false, + "semanticDrift": false + }, + "yarn": { + "conflicts": 0, + "exactMatch": true, + "semanticDrift": false + }, + "yarn_classic": { + "conflicts": 0, + "exactMatch": true, + "semanticDrift": false + }, + "bun": { + "conflicts": 0, + "exactMatch": true, + "semanticDrift": false + }, + "vlt": { + "conflicts": 0, + "exactMatch": true, + "semanticDrift": false + } + } + }, + "S23_bump_two_non_adjacent_transitive_deps": { + "description": "readable-stream@4.8.0 has non-adjacent deps abort-controller & string_decoder; Branch A updates buffer 6.0.2->6.0.3, Branch B updates string_decoder 1.2.0->1.3.0", + "managers": { + "pnpm_v13": { + "conflicts": 0, + "exactMatch": true, + "semanticDrift": false + }, + "pnpm_v9": { + "conflicts": 0, + "exactMatch": true, + "semanticDrift": false + }, + "npm": { + "conflicts": 1, + "exactMatch": false, + "semanticDrift": false + }, + "yarn": { + "conflicts": 0, + "exactMatch": true, + "semanticDrift": false + }, + "yarn_classic": { + "conflicts": 0, + "exactMatch": true, + "semanticDrift": false + }, + "bun": { + "conflicts": 0, + "exactMatch": true, + "semanticDrift": false + }, + "vlt": { + "conflicts": 0, + "exactMatch": true, + "semanticDrift": false + } + } + }, + "S24_optional_peer_bound_vs_consumer_added": { + "description": "debug@4.4.3 has optional peer supports-color; Branch A adds supports-color@8.1.1 in ws/a; Branch B adds debug@4.4.3 to ws/b", + "managers": { + "pnpm_v13": { + "conflicts": 0, + "exactMatch": true, + "semanticDrift": false + }, + "pnpm_v9": { + "conflicts": 0, + "exactMatch": false, + "semanticDrift": true + }, + "npm": { + "conflicts": 0, + "exactMatch": true, + "semanticDrift": false + }, + "yarn": { + "conflicts": 0, + "exactMatch": true, + "semanticDrift": false + }, + "yarn_classic": { + "conflicts": 0, + "exactMatch": true, + "semanticDrift": false + }, + "bun": { + "conflicts": 0, + "exactMatch": true, + "semanticDrift": false + }, + "vlt": { + "conflicts": 1, + "exactMatch": false, + "semanticDrift": false + } + } + }, + "S25_add_new_workspace_project_vs_bump_in_another": { + "description": "Branch A adds a new workspace project packages/b; Branch B bumps a dependency in packages/c", + "managers": { + "pnpm_v13": { + "conflicts": 0, + "exactMatch": true, + "semanticDrift": false + }, + "pnpm_v9": { + "conflicts": 1, + "exactMatch": false, + "semanticDrift": false + }, + "npm": { + "conflicts": 0, + "exactMatch": true, + "semanticDrift": false + }, + "yarn": { + "conflicts": 0, + "exactMatch": true, + "semanticDrift": false + }, + "yarn_classic": { + "conflicts": 1, + "exactMatch": false, + "semanticDrift": false + }, + "bun": { + "conflicts": 1, + "exactMatch": false, + "semanticDrift": false + }, + "vlt": { + "conflicts": 1, + "exactMatch": false, + "semanticDrift": false + } + } + } + } +} diff --git a/lockfileConflictScenarios.js b/lockfileConflictScenarios.js new file mode 100644 index 0000000..73b844c --- /dev/null +++ b/lockfileConflictScenarios.js @@ -0,0 +1,365 @@ +// Twenty-five 3-way Git merge scenarios covering concurrent dependency and +// workspace changes across package managers and lockfile versions. +export const lockfileConflictScenarios = [ + { + id: 'S01_add_non_adjacent_deps', + description: 'Add two non-adjacent direct dependencies (abbrev & wrappy)', + base: { dependencies: { debug: '4.4.3', ini: '5.0.0', once: '1.4.0' } }, + branchA: { dependencies: { abbrev: '^3.0.0', debug: '4.4.3', ini: '5.0.0', once: '1.4.0' } }, + branchB: { dependencies: { debug: '4.4.3', ini: '5.0.0', once: '1.4.0', wrappy: '^1.0.2' } }, + merged: { dependencies: { abbrev: '^3.0.0', debug: '4.4.3', ini: '5.0.0', once: '1.4.0', wrappy: '^1.0.2' } }, + }, + { + id: 'S02_add_adjacent_deps_middle', + description: 'Add two alphabetically adjacent direct dependencies (fast-copy & fast-redact)', + base: { dependencies: { abbrev: '^3.0.0', once: '^1.4.0', wrappy: '^1.0.2' } }, + branchA: { dependencies: { abbrev: '^3.0.0', 'fast-copy': '^3.1.0', once: '^1.4.0', wrappy: '^1.0.2' } }, + branchB: { dependencies: { abbrev: '^3.0.0', 'fast-redact': '^3.5.0', once: '^1.4.0', wrappy: '^1.0.2' } }, + merged: { dependencies: { abbrev: '^3.0.0', 'fast-copy': '^3.1.0', 'fast-redact': '^3.5.0', once: '^1.4.0', wrappy: '^1.0.2' } }, + }, + { + id: 'S03_add_deps_at_end', + description: 'Add two direct dependencies at the end of dependencies (once & wrappy)', + base: { dependencies: { abbrev: '^3.0.0', ini: '^5.0.0' } }, + branchA: { dependencies: { abbrev: '^3.0.0', ini: '^5.0.0', once: '^1.4.0' } }, + branchB: { dependencies: { abbrev: '^3.0.0', ini: '^5.0.0', wrappy: '^1.0.2' } }, + merged: { dependencies: { abbrev: '^3.0.0', ini: '^5.0.0', once: '^1.4.0', wrappy: '^1.0.2' } }, + }, + { + id: 'S04_bump_non_adjacent_deps', + description: 'Bump two non-adjacent direct dependencies (abbrev & safe-stable-stringify)', + base: { dependencies: { abbrev: '2.0.0', 'fast-copy': '3.1.0', ini: '5.0.0', 'safe-stable-stringify': '2.4.3' } }, + branchA: { dependencies: { abbrev: '3.0.1', 'fast-copy': '3.1.0', ini: '5.0.0', 'safe-stable-stringify': '2.4.3' } }, + branchB: { dependencies: { abbrev: '2.0.0', 'fast-copy': '3.1.0', ini: '5.0.0', 'safe-stable-stringify': '2.5.0' } }, + merged: { dependencies: { abbrev: '3.0.1', 'fast-copy': '3.1.0', ini: '5.0.0', 'safe-stable-stringify': '2.5.0' } }, + }, + { + id: 'S05_bump_adjacent_deps_exact', + description: 'Bump two adjacent exact direct dependencies (fast-copy & fast-redact)', + base: { dependencies: { abbrev: '3.0.1', 'fast-copy': '3.0.0', 'fast-redact': '3.4.0', ini: '5.0.0' } }, + branchA: { dependencies: { abbrev: '3.0.1', 'fast-copy': '3.1.0', 'fast-redact': '3.4.0', ini: '5.0.0' } }, + branchB: { dependencies: { abbrev: '3.0.1', 'fast-copy': '3.0.0', 'fast-redact': '3.5.0', ini: '5.0.0' } }, + merged: { dependencies: { abbrev: '3.0.1', 'fast-copy': '3.1.0', 'fast-redact': '3.5.0', ini: '5.0.0' } }, + }, + { + id: 'S06_bump_adjacent_deps_ranged', + description: 'Bump two adjacent ranged direct dependencies (~3.0.0->^3.1.0, ~3.4.0->^3.5.0)', + base: { dependencies: { abbrev: '^3.0.0', 'fast-copy': '~3.0.0', 'fast-redact': '~3.4.0', ini: '^5.0.0' } }, + branchA: { dependencies: { abbrev: '^3.0.0', 'fast-copy': '^3.1.0', 'fast-redact': '~3.4.0', ini: '^5.0.0' } }, + branchB: { dependencies: { abbrev: '^3.0.0', 'fast-copy': '~3.0.0', 'fast-redact': '^3.5.0', ini: '^5.0.0' } }, + merged: { dependencies: { abbrev: '^3.0.0', 'fast-copy': '^3.1.0', 'fast-redact': '^3.5.0', ini: '^5.0.0' } }, + }, + { + id: 'S07_remove_and_bump_adjacent_pkg', + description: 'Branch A removes fast-copy; Branch B bumps adjacent fast-redact', + base: { dependencies: { abbrev: '3.0.1', 'fast-copy': '3.0.0', 'fast-redact': '3.4.0', ini: '5.0.0' } }, + branchA: { dependencies: { abbrev: '3.0.1', 'fast-redact': '3.4.0', ini: '5.0.0' } }, + branchB: { dependencies: { abbrev: '3.0.1', 'fast-copy': '3.0.0', 'fast-redact': '3.5.0', ini: '5.0.0' } }, + merged: { dependencies: { abbrev: '3.0.1', 'fast-redact': '3.5.0', ini: '5.0.0' } }, + }, + { + id: 'S08_add_and_bump_adjacent_pkg', + description: 'Branch A adds fast-copy right before fast-redact; Branch B bumps fast-redact', + base: { dependencies: { abbrev: '3.0.1', 'fast-redact': '3.4.0', ini: '5.0.0' } }, + branchA: { dependencies: { abbrev: '3.0.1', 'fast-copy': '3.1.0', 'fast-redact': '3.4.0', ini: '5.0.0' } }, + branchB: { dependencies: { abbrev: '3.0.1', 'fast-redact': '3.5.0', ini: '5.0.0' } }, + merged: { dependencies: { abbrev: '3.0.1', 'fast-copy': '3.1.0', 'fast-redact': '3.5.0', ini: '5.0.0' } }, + }, + { + id: 'S09_peer_provider_bump_and_new_consumer', + description: 'Branch A bumps peer provider (react 18.2.0->18.3.1); Branch B adds a peer consumer in another project', + base: { workspaces: { a: { dependencies: { react: '18.2.0', 'use-sync-external-store': '1.2.0' } }, b: { dependencies: { ini: '5.0.0' } } } }, + branchA: { workspaces: { a: { dependencies: { react: '18.3.1', 'use-sync-external-store': '1.2.0' } }, b: { dependencies: { ini: '5.0.0' } } } }, + branchB: { workspaces: { a: { dependencies: { react: '18.2.0', 'use-sync-external-store': '1.2.0' } }, b: { dependencies: { ini: '5.0.0', react: '18.2.0', 'use-sync-external-store': '1.2.0' } } } }, + merged: { workspaces: { a: { dependencies: { react: '18.3.1', 'use-sync-external-store': '1.2.0' } }, b: { dependencies: { ini: '5.0.0', react: '18.3.1', 'use-sync-external-store': '1.2.0' } } } }, + }, + { + id: 'S10_peer_provider_bump_and_consumer_bump', + description: 'Branch A bumps peer provider (react 18.2.0->18.3.1); Branch B bumps peer consumer (use-sync-external-store 1.2.0->1.2.2)', + base: { dependencies: { ini: '5.0.0', react: '18.2.0', 'use-sync-external-store': '1.2.0' } }, + branchA: { dependencies: { ini: '5.0.0', react: '18.3.1', 'use-sync-external-store': '1.2.0' } }, + branchB: { dependencies: { ini: '5.0.0', react: '18.2.0', 'use-sync-external-store': '1.2.2' } }, + merged: { dependencies: { ini: '5.0.0', react: '18.3.1', 'use-sync-external-store': '1.2.2' } }, + }, + { + id: 'S11_multi_peer_set_intro_vs_provider_bump', + description: 'Branch A bumps react 18.2.0->18.3.1 in ws/a; Branch B introduces a second peer set (react 17.0.2) in ws/b', + base: { workspaces: { a: { dependencies: { react: '18.2.0', 'use-sync-external-store': '1.2.2' } }, b: { dependencies: { ini: '5.0.0' } } } }, + branchA: { workspaces: { a: { dependencies: { react: '18.3.1', 'use-sync-external-store': '1.2.2' } }, b: { dependencies: { ini: '5.0.0' } } } }, + branchB: { workspaces: { a: { dependencies: { react: '18.2.0', 'use-sync-external-store': '1.2.2' } }, b: { dependencies: { ini: '5.0.0', react: '17.0.2', 'use-sync-external-store': '1.2.2' } } } }, + merged: { workspaces: { a: { dependencies: { react: '18.3.1', 'use-sync-external-store': '1.2.2' } }, b: { dependencies: { ini: '5.0.0', react: '17.0.2', 'use-sync-external-store': '1.2.2' } } } }, + }, + { + id: 'S12_workspace_independent_projects', + description: 'Branch A adds a dependency in packages/a; Branch B adds a dependency in packages/b', + base: { workspaces: { a: { dependencies: { abbrev: '3.0.1' } }, b: { dependencies: { ini: '5.0.0' } } } }, + branchA: { workspaces: { a: { dependencies: { abbrev: '3.0.1', 'fast-copy': '3.1.0' } }, b: { dependencies: { ini: '5.0.0' } } } }, + branchB: { workspaces: { a: { dependencies: { abbrev: '3.0.1' } }, b: { dependencies: { ini: '5.0.0', wrappy: '1.0.2' } } } }, + merged: { workspaces: { a: { dependencies: { abbrev: '3.0.1', 'fast-copy': '3.1.0' } }, b: { dependencies: { ini: '5.0.0', wrappy: '1.0.2' } } } }, + }, + { + id: 'S13_shared_transitive_dep', + description: 'Two branches add packages that share transitive dependencies (pump & end-of-stream)', + base: { dependencies: { abbrev: '3.0.1', ini: '5.0.0' } }, + branchA: { dependencies: { abbrev: '3.0.1', 'end-of-stream': '1.4.5', ini: '5.0.0' } }, + branchB: { dependencies: { abbrev: '3.0.1', ini: '5.0.0', pump: '3.0.4' } }, + merged: { dependencies: { abbrev: '3.0.1', 'end-of-stream': '1.4.5', ini: '5.0.0', pump: '3.0.4' } }, + }, + { + id: 'S14_workspace_hoisting_shift', + description: 'Branch A adds ajv@8.17.1 to ws/a; Branch B bumps root ajv 8.12.0->8.17.1', + base: { dependencies: { ajv: '8.12.0' }, workspaces: { a: { dependencies: { ini: '5.0.0' } }, b: { dependencies: { ms: '2.1.3' } } } }, + branchA: { dependencies: { ajv: '8.12.0' }, workspaces: { a: { dependencies: { ajv: '8.17.1', ini: '5.0.0' } }, b: { dependencies: { ms: '2.1.3' } } } }, + branchB: { dependencies: { ajv: '8.17.1' }, workspaces: { a: { dependencies: { ini: '5.0.0' } }, b: { dependencies: { ms: '2.1.3' } } } }, + merged: { dependencies: { ajv: '8.17.1' }, workspaces: { a: { dependencies: { ajv: '8.17.1', ini: '5.0.0' } }, b: { dependencies: { ms: '2.1.3' } } } }, + }, + { + id: 'S15_bump_two_multi_dep_packages', + description: 'Branch A bumps pino 8.19.0->9.0.0 in ws/a; Branch B bumps readable-stream 4.5.2->4.8.0 in ws/b', + base: { workspaces: { a: { dependencies: { pino: '8.19.0' } }, b: { dependencies: { 'readable-stream': '4.5.2' } } } }, + branchA: { workspaces: { a: { dependencies: { pino: '9.0.0' } }, b: { dependencies: { 'readable-stream': '4.5.2' } } } }, + branchB: { workspaces: { a: { dependencies: { pino: '8.19.0' } }, b: { dependencies: { 'readable-stream': '4.8.0' } } } }, + merged: { workspaces: { a: { dependencies: { pino: '9.0.0' } }, b: { dependencies: { 'readable-stream': '4.8.0' } } } }, + }, + { + id: 'S16_peer_provider_bump_and_distant_new_consumer', + description: 'Branch A bumps react 18.2.0->18.3.1; Branch B adds swr@2.2.5 (peer consumer of react) in the same project', + base: { dependencies: { abbrev: '3.0.1', ini: '5.0.0', react: '18.2.0', 'use-sync-external-store': '1.2.2' } }, + branchA: { dependencies: { abbrev: '3.0.1', ini: '5.0.0', react: '18.3.1', 'use-sync-external-store': '1.2.2' } }, + branchB: { + seed: { dependencies: { abbrev: '3.0.1', ini: '5.0.0', react: '18.2.0', 'use-sync-external-store': '1.2.2' } }, + dependencies: { abbrev: '3.0.1', ini: '5.0.0', react: '18.2.0', swr: '2.2.5', 'use-sync-external-store': '1.2.2' }, + }, + merged: { dependencies: { abbrev: '3.0.1', ini: '5.0.0', react: '18.3.1', swr: '2.2.5', 'use-sync-external-store': '1.2.2' } }, + }, + { + id: 'S17_lockfile_only_bump_adjacent_ranged_deps', + description: 'Manifest ranges (^3.0.0, ^3.4.0) stay unchanged; Branch A updates fast-copy lock 3.0.0->3.1.0, Branch B updates fast-redact lock 3.4.0->3.5.0', + base: { + seed: { dependencies: { abbrev: '^3.0.0', 'fast-copy': '3.0.0', 'fast-redact': '3.4.0', ini: '^5.0.0' } }, + dependencies: { abbrev: '^3.0.0', 'fast-copy': '^3.0.0', 'fast-redact': '^3.4.0', ini: '^5.0.0' }, + }, + branchA: { + seed: { dependencies: { abbrev: '^3.0.0', 'fast-copy': '3.1.0', 'fast-redact': '3.4.0', ini: '^5.0.0' } }, + dependencies: { abbrev: '^3.0.0', 'fast-copy': '^3.0.0', 'fast-redact': '^3.4.0', ini: '^5.0.0' }, + }, + branchB: { + seed: { dependencies: { abbrev: '^3.0.0', 'fast-copy': '3.0.0', 'fast-redact': '3.5.0', ini: '^5.0.0' } }, + dependencies: { abbrev: '^3.0.0', 'fast-copy': '^3.0.0', 'fast-redact': '^3.4.0', ini: '^5.0.0' }, + }, + merged: { + seed: { dependencies: { abbrev: '^3.0.0', 'fast-copy': '3.1.0', 'fast-redact': '3.5.0', ini: '^5.0.0' } }, + dependencies: { abbrev: '^3.0.0', 'fast-copy': '^3.0.0', 'fast-redact': '^3.4.0', ini: '^5.0.0' }, + }, + }, + { + id: 'S18_bump_pkg_and_add_pkg_after_it', + description: 'Branch A bumps fast-copy 3.0.0->3.1.0 in ws/a; Branch B adds fast-redact 3.5.0 right after fast-copy in ws/b', + base: { + workspaces: { + a: { dependencies: { abbrev: '3.0.1', 'fast-copy': '3.0.0' } }, + b: { dependencies: { ini: '5.0.0' } }, + }, + }, + branchA: { + workspaces: { + a: { dependencies: { abbrev: '3.0.1', 'fast-copy': '3.1.0' } }, + b: { dependencies: { ini: '5.0.0' } }, + }, + }, + branchB: { + workspaces: { + a: { dependencies: { abbrev: '3.0.1', 'fast-copy': '3.0.0' } }, + b: { dependencies: { 'fast-redact': '3.5.0', ini: '5.0.0' } }, + }, + }, + merged: { + workspaces: { + a: { dependencies: { abbrev: '3.0.1', 'fast-copy': '3.1.0' } }, + b: { dependencies: { 'fast-redact': '3.5.0', ini: '5.0.0' } }, + }, + }, + }, + { + id: 'S19_add_pkg_before_and_bump_pkg_after_across_ws', + description: 'Branch A adds fast-copy 3.1.0 in ws/a; Branch B bumps fast-redact 3.4.0->3.5.0 in ws/b', + base: { + workspaces: { + a: { dependencies: { abbrev: '3.0.1' } }, + b: { dependencies: { 'fast-redact': '3.4.0', ini: '5.0.0' } }, + }, + }, + branchA: { + workspaces: { + a: { dependencies: { abbrev: '3.0.1', 'fast-copy': '3.1.0' } }, + b: { dependencies: { 'fast-redact': '3.4.0', ini: '5.0.0' } }, + }, + }, + branchB: { + workspaces: { + a: { dependencies: { abbrev: '3.0.1' } }, + b: { dependencies: { 'fast-redact': '3.5.0', ini: '5.0.0' } }, + }, + }, + merged: { + workspaces: { + a: { dependencies: { abbrev: '3.0.1', 'fast-copy': '3.1.0' } }, + b: { dependencies: { 'fast-redact': '3.5.0', ini: '5.0.0' } }, + }, + }, + }, + { + id: 'S20_remove_two_adjacent_pkgs_across_ws', + description: 'Branch A removes fast-copy from ws/a; Branch B removes fast-redact from ws/b', + base: { + workspaces: { + a: { dependencies: { abbrev: '3.0.1', 'fast-copy': '3.1.0' } }, + b: { dependencies: { 'fast-redact': '3.5.0', ini: '5.0.0' } }, + }, + }, + branchA: { + workspaces: { + a: { dependencies: { abbrev: '3.0.1' } }, + b: { dependencies: { 'fast-redact': '3.5.0', ini: '5.0.0' } }, + }, + }, + branchB: { + workspaces: { + a: { dependencies: { abbrev: '3.0.1', 'fast-copy': '3.1.0' } }, + b: { dependencies: { ini: '5.0.0' } }, + }, + }, + merged: { + workspaces: { + a: { dependencies: { abbrev: '3.0.1' } }, + b: { dependencies: { ini: '5.0.0' } }, + }, + }, + }, + { + id: 'S21_bump_two_adjacent_pkgs_across_ws', + description: 'Branch A bumps fast-copy 3.0.0->3.1.0 in ws/a; Branch B bumps fast-redact 3.4.0->3.5.0 in ws/b', + base: { + workspaces: { + a: { dependencies: { abbrev: '3.0.1', 'fast-copy': '3.0.0' } }, + b: { dependencies: { 'fast-redact': '3.4.0', ini: '5.0.0' } }, + }, + }, + branchA: { + workspaces: { + a: { dependencies: { abbrev: '3.0.1', 'fast-copy': '3.1.0' } }, + b: { dependencies: { 'fast-redact': '3.4.0', ini: '5.0.0' } }, + }, + }, + branchB: { + workspaces: { + a: { dependencies: { abbrev: '3.0.1', 'fast-copy': '3.0.0' } }, + b: { dependencies: { 'fast-redact': '3.5.0', ini: '5.0.0' } }, + }, + }, + merged: { + workspaces: { + a: { dependencies: { abbrev: '3.0.1', 'fast-copy': '3.1.0' } }, + b: { dependencies: { 'fast-redact': '3.5.0', ini: '5.0.0' } }, + }, + }, + }, + { + id: 'S22_bump_two_adjacent_transitive_deps', + description: 'readable-stream@4.8.0 has adjacent dependencies buffer & events; Branch A updates buffer 6.0.2->6.0.3, Branch B updates events 3.2.0->3.3.0', + base: { + seed: { dependencies: { buffer: '6.0.2', events: '3.2.0', 'readable-stream': '4.8.0' } }, + dependencies: { 'readable-stream': '4.8.0' }, + }, + branchA: { + seed: { dependencies: { buffer: '6.0.3', events: '3.2.0', 'readable-stream': '4.8.0' } }, + dependencies: { 'readable-stream': '4.8.0' }, + }, + branchB: { + seed: { dependencies: { buffer: '6.0.2', events: '3.3.0', 'readable-stream': '4.8.0' } }, + dependencies: { 'readable-stream': '4.8.0' }, + }, + merged: { + seed: { dependencies: { buffer: '6.0.3', events: '3.3.0', 'readable-stream': '4.8.0' } }, + dependencies: { 'readable-stream': '4.8.0' }, + }, + }, + { + id: 'S23_bump_two_non_adjacent_transitive_deps', + description: 'readable-stream@4.8.0 has non-adjacent dependencies buffer & string_decoder; Branch A updates buffer 6.0.2->6.0.3, Branch B updates string_decoder 1.2.0->1.3.0', + base: { + seed: { dependencies: { buffer: '6.0.2', 'readable-stream': '4.8.0', string_decoder: '1.2.0' } }, + dependencies: { 'readable-stream': '4.8.0' }, + }, + branchA: { + seed: { dependencies: { buffer: '6.0.3', 'readable-stream': '4.8.0', string_decoder: '1.2.0' } }, + dependencies: { 'readable-stream': '4.8.0' }, + }, + branchB: { + seed: { dependencies: { buffer: '6.0.2', 'readable-stream': '4.8.0', string_decoder: '1.3.0' } }, + dependencies: { 'readable-stream': '4.8.0' }, + }, + merged: { + seed: { dependencies: { buffer: '6.0.3', 'readable-stream': '4.8.0', string_decoder: '1.3.0' } }, + dependencies: { 'readable-stream': '4.8.0' }, + }, + }, + { + id: 'S24_optional_peer_bound_vs_consumer_added', + description: 'debug@4.4.3 has optional peer supports-color; Branch A adds supports-color@8.1.1 in ws/a; Branch B adds debug@4.4.3 in ws/b', + base: { + workspaces: { + a: { dependencies: { debug: '4.4.3', ini: '5.0.0' } }, + b: { dependencies: { abbrev: '3.0.1' } }, + }, + }, + branchA: { + workspaces: { + a: { dependencies: { debug: '4.4.3', ini: '5.0.0', 'supports-color': '8.1.1' } }, + b: { dependencies: { abbrev: '3.0.1' } }, + }, + }, + branchB: { + workspaces: { + a: { dependencies: { debug: '4.4.3', ini: '5.0.0' } }, + b: { dependencies: { abbrev: '3.0.1', debug: '4.4.3' } }, + }, + }, + merged: { + workspaces: { + a: { dependencies: { debug: '4.4.3', ini: '5.0.0', 'supports-color': '8.1.1' } }, + b: { dependencies: { abbrev: '3.0.1', debug: '4.4.3' } }, + }, + }, + }, + { + id: 'S25_add_new_workspace_project_vs_bump_in_another', + description: 'Branch A adds a new workspace project packages/b; Branch B bumps a dependency in packages/c', + base: { + workspaces: { + a: { dependencies: { abbrev: '3.0.1' } }, + c: { dependencies: { 'fast-redact': '3.4.0' } }, + }, + }, + branchA: { + workspaces: { + a: { dependencies: { abbrev: '3.0.1' } }, + b: { dependencies: { ini: '5.0.0' } }, + c: { dependencies: { 'fast-redact': '3.4.0' } }, + }, + }, + branchB: { + workspaces: { + a: { dependencies: { abbrev: '3.0.1' } }, + c: { dependencies: { 'fast-redact': '3.5.0' } }, + }, + }, + merged: { + workspaces: { + a: { dependencies: { abbrev: '3.0.1' } }, + b: { dependencies: { ini: '5.0.0' } }, + c: { dependencies: { 'fast-redact': '3.5.0' } }, + }, + }, + }, +] diff --git a/package.json b/package.json index fa81af3..0e1d5de 100644 --- a/package.json +++ b/package.json @@ -10,9 +10,10 @@ "license": "MIT", "scripts": { "benchmark": "node ./index.js", + "benchmark:conflicts": "node ./benchmarkLockfileConflicts.js", "report": "node ./index.js --report-only", "merge-results": "node ./mergeResults.js", - "test": "node --test latencyProxy.test.mjs pnprServer.test.mjs", + "test": "node --test latencyProxy.test.mjs pnprServer.test.mjs benchmarkLockfileConflicts.test.mjs", "lint": "eslint .", "populate-cache": "node ./populatePnprCache.js" }, From 7e6283e05d6d7ac973a8af680aa69dfadc986ecc Mon Sep 17 00:00:00 2001 From: Zoltan Kochan Date: Tue, 10 Nov 2026 13:40:51 +0100 Subject: [PATCH 2/6] fix: validate git merge-file status and sync scenario descriptions in report --- benchmarkLockfileConflicts.js | 3 +++ lockfile-conflicts.json | 40 +++++++++++++++++------------------ 2 files changed, 23 insertions(+), 20 deletions(-) diff --git a/benchmarkLockfileConflicts.js b/benchmarkLockfileConflicts.js index caf7117..35ce5a1 100644 --- a/benchmarkLockfileConflicts.js +++ b/benchmarkLockfileConflicts.js @@ -120,6 +120,9 @@ export function gitMergeLockfiles (baseText, branchAText, branchBText) { fs.writeFileSync(bFile, branchBText) const result = spawn.sync('git', ['merge-file', '-p', aFile, baseFile, bFile], { encoding: 'utf8' }) if (result.error) throw result.error + if (result.status == null || result.status < 0 || result.status > 127) { + throw new Error(`git merge-file failed with status ${result.status}: ${result.stderr ?? ''}`) + } const merged = result.stdout ?? '' const conflicts = countConflictHunks(merged) return { conflicts, merged } diff --git a/lockfile-conflicts.json b/lockfile-conflicts.json index 714832e..7fb6bb8 100644 --- a/lockfile-conflicts.json +++ b/lockfile-conflicts.json @@ -47,7 +47,7 @@ }, "scenarios": { "S01_add_non_adjacent_deps": { - "description": "Add two non-adjacent direct deps (abbrev & wrappy)", + "description": "Add two non-adjacent direct dependencies (abbrev & wrappy)", "managers": { "pnpm_v13": { "conflicts": 0, @@ -87,7 +87,7 @@ } }, "S02_add_adjacent_deps_middle": { - "description": "Add two alphabetically adjacent direct deps (fast-copy & fast-redact)", + "description": "Add two alphabetically adjacent direct dependencies (fast-copy & fast-redact)", "managers": { "pnpm_v13": { "conflicts": 2, @@ -127,7 +127,7 @@ } }, "S03_add_deps_at_end": { - "description": "Add two direct deps at the end of dependencies (once & wrappy)", + "description": "Add two direct dependencies at the end of dependencies (once & wrappy)", "managers": { "pnpm_v13": { "conflicts": 2, @@ -167,7 +167,7 @@ } }, "S04_bump_non_adjacent_deps": { - "description": "Bump two non-adjacent direct deps (abbrev & safe-stable-stringify)", + "description": "Bump two non-adjacent direct dependencies (abbrev & safe-stable-stringify)", "managers": { "pnpm_v13": { "conflicts": 0, @@ -207,7 +207,7 @@ } }, "S05_bump_adjacent_deps_exact": { - "description": "Bump two adjacent exact direct deps (fast-copy & fast-redact)", + "description": "Bump two adjacent exact direct dependencies (fast-copy & fast-redact)", "managers": { "pnpm_v13": { "conflicts": 1, @@ -247,7 +247,7 @@ } }, "S06_bump_adjacent_deps_ranged": { - "description": "Bump two adjacent ranged direct deps (^3.0.0->^3.1.0, ^3.4.0->^3.5.0)", + "description": "Bump two adjacent ranged direct dependencies (~3.0.0->^3.1.0, ~3.4.0->^3.5.0)", "managers": { "pnpm_v13": { "conflicts": 0, @@ -287,7 +287,7 @@ } }, "S07_remove_and_bump_adjacent_pkg": { - "description": "Branch A removes fast-copy, Branch B bumps adjacent fast-redact", + "description": "Branch A removes fast-copy; Branch B bumps adjacent fast-redact", "managers": { "pnpm_v13": { "conflicts": 2, @@ -367,7 +367,7 @@ } }, "S09_peer_provider_bump_and_new_consumer": { - "description": "Branch A bumps peer provider (react 18.2.0->18.3.1); Branch B adds a new peer consumer (react-is/use-sync-external-store)", + "description": "Branch A bumps peer provider (react 18.2.0->18.3.1); Branch B adds a peer consumer in another project", "managers": { "pnpm_v13": { "conflicts": 0, @@ -447,7 +447,7 @@ } }, "S11_multi_peer_set_intro_vs_provider_bump": { - "description": "Branch A bumps react 18.2.0->18.3.1 in ws/a; Branch B adds second peer set (react 17.0.2 + use-sync-external-store) in ws/b", + "description": "Branch A bumps react 18.2.0->18.3.1 in ws/a; Branch B introduces a second peer set (react 17.0.2) in ws/b", "managers": { "pnpm_v13": { "conflicts": 2, @@ -487,7 +487,7 @@ } }, "S12_workspace_independent_projects": { - "description": "Branch A modifies packages/a; Branch B modifies packages/b", + "description": "Branch A adds a dependency in packages/a; Branch B adds a dependency in packages/b", "managers": { "pnpm_v13": { "conflicts": 0, @@ -567,7 +567,7 @@ } }, "S14_workspace_hoisting_shift": { - "description": "Branch A adds ajv@8.17.1 to ws/a; Branch B bumps root ajv 8.12.0->8.17.1 (causes hoisting shift in npm/bun)", + "description": "Branch A adds ajv@8.17.1 to ws/a; Branch B bumps root ajv 8.12.0->8.17.1", "managers": { "pnpm_v13": { "conflicts": 0, @@ -607,7 +607,7 @@ } }, "S15_bump_two_multi_dep_packages": { - "description": "Branch A bumps pino 8.19.0->9.0.0 in ws/a; Branch B bumps readable-stream 4.4.0->4.8.0 in ws/b", + "description": "Branch A bumps pino 8.19.0->9.0.0 in ws/a; Branch B bumps readable-stream 4.5.2->4.8.0 in ws/b", "managers": { "pnpm_v13": { "conflicts": 0, @@ -647,7 +647,7 @@ } }, "S16_peer_provider_bump_and_distant_new_consumer": { - "description": "Branch A bumps react 18.2.0->18.3.1; Branch B adds swr@2.2.5 (peer consumer of react) in same project", + "description": "Branch A bumps react 18.2.0->18.3.1; Branch B adds swr@2.2.5 (peer consumer of react) in the same project", "managers": { "pnpm_v13": { "conflicts": 1, @@ -727,7 +727,7 @@ } }, "S18_bump_pkg_and_add_pkg_after_it": { - "description": "Branch A bumps fast-copy 3.0.0->3.1.0 (in ws/a); Branch B adds fast-redact 3.5.0 right after fast-copy (in ws/b)", + "description": "Branch A bumps fast-copy 3.0.0->3.1.0 in ws/a; Branch B adds fast-redact 3.5.0 right after fast-copy in ws/b", "managers": { "pnpm_v13": { "conflicts": 0, @@ -767,7 +767,7 @@ } }, "S19_add_pkg_before_and_bump_pkg_after_across_ws": { - "description": "Branch A adds fast-copy 3.1.0 (in ws/a); Branch B bumps fast-redact 3.4.0->3.5.0 (in ws/b) — isolates packages/nodes section from projects", + "description": "Branch A adds fast-copy 3.1.0 in ws/a; Branch B bumps fast-redact 3.4.0->3.5.0 in ws/b", "managers": { "pnpm_v13": { "conflicts": 1, @@ -807,7 +807,7 @@ } }, "S20_remove_two_adjacent_pkgs_across_ws": { - "description": "Branch A removes fast-copy (from ws/a); Branch B removes fast-redact (from ws/b) — adjacent in packages/nodes", + "description": "Branch A removes fast-copy from ws/a; Branch B removes fast-redact from ws/b", "managers": { "pnpm_v13": { "conflicts": 1, @@ -847,7 +847,7 @@ } }, "S21_bump_two_adjacent_pkgs_across_ws": { - "description": "Branch A bumps fast-copy 3.0.0->3.1.0 (in ws/a); Branch B bumps fast-redact 3.4.0->3.5.0 (in ws/b) — adjacent in packages/nodes", + "description": "Branch A bumps fast-copy 3.0.0->3.1.0 in ws/a; Branch B bumps fast-redact 3.4.0->3.5.0 in ws/b", "managers": { "pnpm_v13": { "conflicts": 0, @@ -887,7 +887,7 @@ } }, "S22_bump_two_adjacent_transitive_deps": { - "description": "readable-stream@4.8.0 has adjacent deps buffer & events; Branch A updates buffer 6.0.2->6.0.3, Branch B updates events 3.2.0->3.3.0", + "description": "readable-stream@4.8.0 has adjacent dependencies buffer & events; Branch A updates buffer 6.0.2->6.0.3, Branch B updates events 3.2.0->3.3.0", "managers": { "pnpm_v13": { "conflicts": 0, @@ -927,7 +927,7 @@ } }, "S23_bump_two_non_adjacent_transitive_deps": { - "description": "readable-stream@4.8.0 has non-adjacent deps abort-controller & string_decoder; Branch A updates buffer 6.0.2->6.0.3, Branch B updates string_decoder 1.2.0->1.3.0", + "description": "readable-stream@4.8.0 has non-adjacent dependencies buffer & string_decoder; Branch A updates buffer 6.0.2->6.0.3, Branch B updates string_decoder 1.2.0->1.3.0", "managers": { "pnpm_v13": { "conflicts": 0, @@ -967,7 +967,7 @@ } }, "S24_optional_peer_bound_vs_consumer_added": { - "description": "debug@4.4.3 has optional peer supports-color; Branch A adds supports-color@8.1.1 in ws/a; Branch B adds debug@4.4.3 to ws/b", + "description": "debug@4.4.3 has optional peer supports-color; Branch A adds supports-color@8.1.1 in ws/a; Branch B adds debug@4.4.3 in ws/b", "managers": { "pnpm_v13": { "conflicts": 0, From 84f9298be08167fc6d3c0816cf5dc928095abd91 Mon Sep 17 00:00:00 2001 From: Zoltan Kochan Date: Tue, 10 Nov 2026 14:51:39 +0100 Subject: [PATCH 3/6] feat: track package.json conflicts and report cleanPackageJsonSummary --- README.md | 2 +- benchmarkLockfileConflicts.js | 50 ++++++++++++++++++++- benchmarkLockfileConflicts.test.mjs | 11 +++++ lockfile-conflicts.json | 70 +++++++++++++++++++++++++++++ 4 files changed, 131 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 2de7551..2b5c25b 100644 --- a/README.md +++ b/README.md @@ -59,7 +59,7 @@ brew install bash ## Lockfile Git merge conflicts -`benchmarkLockfileConflicts.js` measures 3-way `git merge-file` conflicts and semantic drift across 25 concurrent-branch scenarios (`lockfileConflictScenarios.js`) for `pnpm-lock.yaml` (`13.0` and `9.0`), `package-lock.json` (npm v3), `yarn.lock` (Berry and Classic v1), `bun.lock`, and `vlt-lock.json`, and writes the results to [lockfile-conflicts.json](./lockfile-conflicts.json): +`benchmarkLockfileConflicts.js` measures 3-way `git merge-file` conflicts and semantic drift across 25 concurrent-branch scenarios (`lockfileConflictScenarios.js`) for `pnpm-lock.yaml` (`13.0` and `9.0`), `package-lock.json` (npm v3), `yarn.lock` (Berry and Classic v1), `bun.lock`, and `vlt-lock.json`, and writes the results (both across all scenarios and across the subset where `package.json` files merge without conflicts) to [lockfile-conflicts.json](./lockfile-conflicts.json): ``` pnpm run benchmark:conflicts diff --git a/benchmarkLockfileConflicts.js b/benchmarkLockfileConflicts.js index 35ce5a1..17cd7e6 100644 --- a/benchmarkLockfileConflicts.js +++ b/benchmarkLockfileConflicts.js @@ -32,6 +32,38 @@ function rootManifest (state) { } } +function stateManifestFiles (state) { + const files = { + 'package.json': `${JSON.stringify(rootManifest(state), null, 2)}\n`, + } + for (const [wsName, wsPkg] of Object.entries(state.workspaces ?? {})) { + const manifest = { name: `@ws/${wsName}`, version: '1.0.0', ...wsPkg } + files[`packages/${wsName}/package.json`] = `${JSON.stringify(manifest, null, 2)}\n` + } + return files +} + +export function countPackageJsonConflicts (scenario) { + const baseFiles = stateManifestFiles(scenario.base) + const aFiles = stateManifestFiles(scenario.branchA) + const bFiles = stateManifestFiles(scenario.branchB) + const allPaths = new Set([ + ...Object.keys(baseFiles), + ...Object.keys(aFiles), + ...Object.keys(bFiles), + ]) + let conflicts = 0 + for (const filePath of allPaths) { + const merged = gitMergeLockfiles( + baseFiles[filePath] ?? '', + aFiles[filePath] ?? '', + bFiles[filePath] ?? '' + ) + conflicts += merged.conflicts + } + return conflicts +} + export function writeProjectState (dir, state, { clean = true } = {}) { if (clean) { fs.rmSync(dir, { recursive: true, force: true }) @@ -174,6 +206,13 @@ export function summarizeConflictResults (scenarios, managers = CONFLICT_MANAGER return summary } +export function summarizeCleanPackageJsonResults (scenarios, managers = CONFLICT_MANAGERS) { + const cleanScenarios = Object.fromEntries( + Object.entries(scenarios).filter(([, scenario]) => (scenario.packageJsonConflicts ?? 0) === 0) + ) + return summarizeConflictResults(cleanScenarios, managers) +} + export function runLockfileConflictsBenchmark ({ managers = CONFLICT_MANAGERS, binaries = {}, @@ -183,7 +222,11 @@ export function runLockfileConflictsBenchmark ({ const scenarios = {} try { for (const scenario of lockfileConflictScenarios) { - scenarios[scenario.id] = { description: scenario.description, managers: {} } + scenarios[scenario.id] = { + description: scenario.description, + packageJsonConflicts: countPackageJsonConflicts(scenario), + managers: {}, + } for (const manager of managers) { const base = generateLockfileForState(manager, scenario.base, workDir, binaries) const branchA = generateLockfileForState(manager, scenario.branchA, workDir, binaries) @@ -200,10 +243,15 @@ export function runLockfileConflictsBenchmark ({ } finally { fs.rmSync(workDir, { recursive: true, force: true }) } + const cleanPackageJsonScenarios = Object.values(scenarios).filter( + (scenario) => scenario.packageJsonConflicts === 0 + ).length const report = { measuredAt: new Date().toISOString(), totalScenarios: lockfileConflictScenarios.length, + cleanPackageJsonScenarios, summary: summarizeConflictResults(scenarios, managers), + cleanPackageJsonSummary: summarizeCleanPackageJsonResults(scenarios, managers), scenarios, } if (outputPath) { diff --git a/benchmarkLockfileConflicts.test.mjs b/benchmarkLockfileConflicts.test.mjs index 05d1faf..8792164 100644 --- a/benchmarkLockfileConflicts.test.mjs +++ b/benchmarkLockfileConflicts.test.mjs @@ -8,8 +8,10 @@ import tempy from 'tempy' import { CONFLICT_MANAGERS, countConflictHunks, + countPackageJsonConflicts, evaluateScenarioOutcome, gitMergeLockfiles, + summarizeCleanPackageJsonResults, summarizeConflictResults, writeProjectState, } from './benchmarkLockfileConflicts.js' @@ -82,12 +84,14 @@ test('gitMergeLockfiles counts conflict hunks and detects semantic drift', () => test('summarizeConflictResults aggregates clean, conflicted, and drift scenarios', () => { const scenarios = { S01: { + packageJsonConflicts: 0, managers: { pnpm_v13: { conflicts: 0, exactMatch: true, semanticDrift: false }, npm: { conflicts: 2, exactMatch: false, semanticDrift: false }, }, }, S02: { + packageJsonConflicts: 1, managers: { pnpm_v13: { conflicts: 0, exactMatch: false, semanticDrift: true }, npm: { conflicts: 0, exactMatch: true, semanticDrift: false }, @@ -99,6 +103,11 @@ test('summarizeConflictResults aggregates clean, conflicted, and drift scenarios pnpm_v13: { clean: 1, conflicted: 0, conflictHunks: 0, semanticDrift: 1 }, npm: { clean: 1, conflicted: 1, conflictHunks: 2, semanticDrift: 0 }, }) + const cleanSummary = summarizeCleanPackageJsonResults(scenarios, ['pnpm_v13', 'npm']) + assert.deepEqual(cleanSummary, { + pnpm_v13: { clean: 1, conflicted: 0, conflictHunks: 0, semanticDrift: 0 }, + npm: { clean: 0, conflicted: 1, conflictHunks: 2, semanticDrift: 0 }, + }) }) test('writeProjectState writes root and workspace manifests and scenarios are well-formed', () => { @@ -111,4 +120,6 @@ test('writeProjectState writes root and workspace manifests and scenarios are we assert.ok(fs.existsSync(path.join(dir, 'packages/a/package.json'))) assert.equal(lockfileConflictScenarios.length, 25) assert.equal(CONFLICT_MANAGERS.includes('pnpm_v13'), true) + assert.equal(countPackageJsonConflicts(lockfileConflictScenarios[0]), 0) + assert.equal(countPackageJsonConflicts(lockfileConflictScenarios[1]), 1) }) diff --git a/lockfile-conflicts.json b/lockfile-conflicts.json index 7fb6bb8..b755a78 100644 --- a/lockfile-conflicts.json +++ b/lockfile-conflicts.json @@ -1,6 +1,7 @@ { "measuredAt": "2026-11-10T12:20:00.789Z", "totalScenarios": 25, + "cleanPackageJsonScenarios": 16, "summary": { "pnpm_v13": { "clean": 12, @@ -45,9 +46,54 @@ "semanticDrift": 1 } }, + "cleanPackageJsonSummary": { + "pnpm_v13": { + "clean": 11, + "conflicted": 3, + "conflictHunks": 4, + "semanticDrift": 2 + }, + "pnpm_v9": { + "clean": 9, + "conflicted": 4, + "conflictHunks": 7, + "semanticDrift": 3 + }, + "npm": { + "clean": 11, + "conflicted": 3, + "conflictHunks": 3, + "semanticDrift": 2 + }, + "yarn": { + "clean": 11, + "conflicted": 4, + "conflictHunks": 4, + "semanticDrift": 1 + }, + "yarn_classic": { + "clean": 11, + "conflicted": 5, + "conflictHunks": 5, + "semanticDrift": 0 + }, + "bun": { + "clean": 10, + "conflicted": 5, + "conflictHunks": 5, + "semanticDrift": 1 + }, + "vlt": { + "clean": 4, + "conflicted": 11, + "conflictHunks": 18, + "semanticDrift": 1 + } + }, "scenarios": { "S01_add_non_adjacent_deps": { "description": "Add two non-adjacent direct dependencies (abbrev & wrappy)", + "packageJsonConflicts": 0, "managers": { "pnpm_v13": { "conflicts": 0, @@ -88,6 +134,7 @@ }, "S02_add_adjacent_deps_middle": { "description": "Add two alphabetically adjacent direct dependencies (fast-copy & fast-redact)", + "packageJsonConflicts": 1, "managers": { "pnpm_v13": { "conflicts": 2, @@ -128,6 +175,7 @@ }, "S03_add_deps_at_end": { "description": "Add two direct dependencies at the end of dependencies (once & wrappy)", + "packageJsonConflicts": 1, "managers": { "pnpm_v13": { "conflicts": 2, @@ -168,6 +216,7 @@ }, "S04_bump_non_adjacent_deps": { "description": "Bump two non-adjacent direct dependencies (abbrev & safe-stable-stringify)", + "packageJsonConflicts": 0, "managers": { "pnpm_v13": { "conflicts": 0, @@ -208,6 +257,7 @@ }, "S05_bump_adjacent_deps_exact": { "description": "Bump two adjacent exact direct dependencies (fast-copy & fast-redact)", + "packageJsonConflicts": 1, "managers": { "pnpm_v13": { "conflicts": 1, @@ -248,6 +298,7 @@ }, "S06_bump_adjacent_deps_ranged": { "description": "Bump two adjacent ranged direct dependencies (~3.0.0->^3.1.0, ~3.4.0->^3.5.0)", + "packageJsonConflicts": 1, "managers": { "pnpm_v13": { "conflicts": 0, @@ -288,6 +339,7 @@ }, "S07_remove_and_bump_adjacent_pkg": { "description": "Branch A removes fast-copy; Branch B bumps adjacent fast-redact", + "packageJsonConflicts": 1, "managers": { "pnpm_v13": { "conflicts": 2, @@ -328,6 +380,7 @@ }, "S08_add_and_bump_adjacent_pkg": { "description": "Branch A adds fast-copy right before fast-redact; Branch B bumps fast-redact", + "packageJsonConflicts": 1, "managers": { "pnpm_v13": { "conflicts": 2, @@ -368,6 +421,7 @@ }, "S09_peer_provider_bump_and_new_consumer": { "description": "Branch A bumps peer provider (react 18.2.0->18.3.1); Branch B adds a peer consumer in another project", + "packageJsonConflicts": 0, "managers": { "pnpm_v13": { "conflicts": 0, @@ -408,6 +462,7 @@ }, "S10_peer_provider_bump_and_consumer_bump": { "description": "Branch A bumps peer provider (react 18.2.0->18.3.1); Branch B bumps peer consumer (use-sync-external-store 1.2.0->1.2.2)", + "packageJsonConflicts": 1, "managers": { "pnpm_v13": { "conflicts": 1, @@ -448,6 +503,7 @@ }, "S11_multi_peer_set_intro_vs_provider_bump": { "description": "Branch A bumps react 18.2.0->18.3.1 in ws/a; Branch B introduces a second peer set (react 17.0.2) in ws/b", + "packageJsonConflicts": 0, "managers": { "pnpm_v13": { "conflicts": 2, @@ -488,6 +544,7 @@ }, "S12_workspace_independent_projects": { "description": "Branch A adds a dependency in packages/a; Branch B adds a dependency in packages/b", + "packageJsonConflicts": 0, "managers": { "pnpm_v13": { "conflicts": 0, @@ -528,6 +585,7 @@ }, "S13_shared_transitive_dep": { "description": "Two branches add packages that share transitive dependencies (pump & end-of-stream)", + "packageJsonConflicts": 1, "managers": { "pnpm_v13": { "conflicts": 1, @@ -568,6 +626,7 @@ }, "S14_workspace_hoisting_shift": { "description": "Branch A adds ajv@8.17.1 to ws/a; Branch B bumps root ajv 8.12.0->8.17.1", + "packageJsonConflicts": 0, "managers": { "pnpm_v13": { "conflicts": 0, @@ -608,6 +667,7 @@ }, "S15_bump_two_multi_dep_packages": { "description": "Branch A bumps pino 8.19.0->9.0.0 in ws/a; Branch B bumps readable-stream 4.5.2->4.8.0 in ws/b", + "packageJsonConflicts": 0, "managers": { "pnpm_v13": { "conflicts": 0, @@ -648,6 +708,7 @@ }, "S16_peer_provider_bump_and_distant_new_consumer": { "description": "Branch A bumps react 18.2.0->18.3.1; Branch B adds swr@2.2.5 (peer consumer of react) in the same project", + "packageJsonConflicts": 1, "managers": { "pnpm_v13": { "conflicts": 1, @@ -688,6 +749,7 @@ }, "S17_lockfile_only_bump_adjacent_ranged_deps": { "description": "Manifest ranges (^3.0.0, ^3.4.0) stay unchanged; Branch A updates fast-copy lock 3.0.0->3.1.0, Branch B updates fast-redact lock 3.4.0->3.5.0", + "packageJsonConflicts": 0, "managers": { "pnpm_v13": { "conflicts": 0, @@ -728,6 +790,7 @@ }, "S18_bump_pkg_and_add_pkg_after_it": { "description": "Branch A bumps fast-copy 3.0.0->3.1.0 in ws/a; Branch B adds fast-redact 3.5.0 right after fast-copy in ws/b", + "packageJsonConflicts": 0, "managers": { "pnpm_v13": { "conflicts": 0, @@ -768,6 +831,7 @@ }, "S19_add_pkg_before_and_bump_pkg_after_across_ws": { "description": "Branch A adds fast-copy 3.1.0 in ws/a; Branch B bumps fast-redact 3.4.0->3.5.0 in ws/b", + "packageJsonConflicts": 0, "managers": { "pnpm_v13": { "conflicts": 1, @@ -808,6 +872,7 @@ }, "S20_remove_two_adjacent_pkgs_across_ws": { "description": "Branch A removes fast-copy from ws/a; Branch B removes fast-redact from ws/b", + "packageJsonConflicts": 0, "managers": { "pnpm_v13": { "conflicts": 1, @@ -848,6 +913,7 @@ }, "S21_bump_two_adjacent_pkgs_across_ws": { "description": "Branch A bumps fast-copy 3.0.0->3.1.0 in ws/a; Branch B bumps fast-redact 3.4.0->3.5.0 in ws/b", + "packageJsonConflicts": 0, "managers": { "pnpm_v13": { "conflicts": 0, @@ -888,6 +954,7 @@ }, "S22_bump_two_adjacent_transitive_deps": { "description": "readable-stream@4.8.0 has adjacent dependencies buffer & events; Branch A updates buffer 6.0.2->6.0.3, Branch B updates events 3.2.0->3.3.0", + "packageJsonConflicts": 0, "managers": { "pnpm_v13": { "conflicts": 0, @@ -928,6 +995,7 @@ }, "S23_bump_two_non_adjacent_transitive_deps": { "description": "readable-stream@4.8.0 has non-adjacent dependencies buffer & string_decoder; Branch A updates buffer 6.0.2->6.0.3, Branch B updates string_decoder 1.2.0->1.3.0", + "packageJsonConflicts": 0, "managers": { "pnpm_v13": { "conflicts": 0, @@ -968,6 +1036,7 @@ }, "S24_optional_peer_bound_vs_consumer_added": { "description": "debug@4.4.3 has optional peer supports-color; Branch A adds supports-color@8.1.1 in ws/a; Branch B adds debug@4.4.3 in ws/b", + "packageJsonConflicts": 0, "managers": { "pnpm_v13": { "conflicts": 0, @@ -1008,6 +1077,7 @@ }, "S25_add_new_workspace_project_vs_bump_in_another": { "description": "Branch A adds a new workspace project packages/b; Branch B bumps a dependency in packages/c", + "packageJsonConflicts": 0, "managers": { "pnpm_v13": { "conflicts": 0, From 7cc9913a641eb183588afc3005f7e28bb7e8d45b Mon Sep 17 00:00:00 2001 From: Zoltan Kochan Date: Tue, 10 Nov 2026 15:22:15 +0100 Subject: [PATCH 4/6] feat: add S26 scenario showcasing package-lock.json trailing-comma conflict --- benchmarkLockfileConflicts.test.mjs | 3 +- lockfile-conflicts.json | 97 ++++++++++++++++++++--------- lockfileConflictScenarios.js | 20 ++++++ 3 files changed, 91 insertions(+), 29 deletions(-) diff --git a/benchmarkLockfileConflicts.test.mjs b/benchmarkLockfileConflicts.test.mjs index 8792164..6ecb4ea 100644 --- a/benchmarkLockfileConflicts.test.mjs +++ b/benchmarkLockfileConflicts.test.mjs @@ -118,8 +118,9 @@ test('writeProjectState writes root and workspace manifests and scenarios are we }) assert.ok(fs.existsSync(path.join(dir, 'package.json'))) assert.ok(fs.existsSync(path.join(dir, 'packages/a/package.json'))) - assert.equal(lockfileConflictScenarios.length, 25) + assert.equal(lockfileConflictScenarios.length, 26) assert.equal(CONFLICT_MANAGERS.includes('pnpm_v13'), true) assert.equal(countPackageJsonConflicts(lockfileConflictScenarios[0]), 0) assert.equal(countPackageJsonConflicts(lockfileConflictScenarios[1]), 1) + assert.equal(countPackageJsonConflicts(lockfileConflictScenarios[25]), 0) }) diff --git a/lockfile-conflicts.json b/lockfile-conflicts.json index b755a78..3e671b3 100644 --- a/lockfile-conflicts.json +++ b/lockfile-conflicts.json @@ -1,92 +1,92 @@ { "measuredAt": "2026-11-10T12:20:00.789Z", - "totalScenarios": 25, - "cleanPackageJsonScenarios": 16, + "totalScenarios": 26, + "cleanPackageJsonScenarios": 17, "summary": { "pnpm_v13": { - "clean": 12, + "clean": 13, "conflicted": 11, "conflictHunks": 16, "semanticDrift": 2 }, "pnpm_v9": { "clean": 11, - "conflicted": 11, - "conflictHunks": 23, + "conflicted": 12, + "conflictHunks": 24, "semanticDrift": 3 }, "npm": { "clean": 11, - "conflicted": 12, - "conflictHunks": 15, + "conflicted": 13, + "conflictHunks": 16, "semanticDrift": 2 }, "yarn": { "clean": 11, - "conflicted": 13, - "conflictHunks": 18, + "conflicted": 14, + "conflictHunks": 19, "semanticDrift": 1 }, "yarn_classic": { "clean": 15, - "conflicted": 10, - "conflictHunks": 12, + "conflicted": 11, + "conflictHunks": 13, "semanticDrift": 0 }, "bun": { "clean": 10, - "conflicted": 14, - "conflictHunks": 18, + "conflicted": 15, + "conflictHunks": 19, "semanticDrift": 1 }, "vlt": { "clean": 4, - "conflicted": 20, - "conflictHunks": 35, + "conflicted": 21, + "conflictHunks": 36, "semanticDrift": 1 } }, "cleanPackageJsonSummary": { "pnpm_v13": { - "clean": 11, + "clean": 12, "conflicted": 3, "conflictHunks": 4, "semanticDrift": 2 }, "pnpm_v9": { "clean": 9, - "conflicted": 4, - "conflictHunks": 7, + "conflicted": 5, + "conflictHunks": 8, "semanticDrift": 3 }, "npm": { "clean": 11, - "conflicted": 3, - "conflictHunks": 3, + "conflicted": 4, + "conflictHunks": 4, "semanticDrift": 2 }, "yarn": { "clean": 11, - "conflicted": 4, - "conflictHunks": 4, + "conflicted": 5, + "conflictHunks": 5, "semanticDrift": 1 }, "yarn_classic": { "clean": 11, - "conflicted": 5, - "conflictHunks": 5, + "conflicted": 6, + "conflictHunks": 6, "semanticDrift": 0 }, "bun": { "clean": 10, - "conflicted": 5, - "conflictHunks": 5, + "conflicted": 6, + "conflictHunks": 6, "semanticDrift": 1 }, "vlt": { "clean": 4, - "conflicted": 11, - "conflictHunks": 18, + "conflicted": 12, + "conflictHunks": 19, "semanticDrift": 1 } }, @@ -1115,6 +1115,47 @@ "semanticDrift": false } } + }, + "S26_bump_last_pkg_vs_append_new_pkg": { + "description": "Branch A bumps ini (1.3.8 -> 5.0.0) in dependencies; Branch B adds ms in devDependencies", + "packageJsonConflicts": 0, + "managers": { + "pnpm_v13": { + "conflicts": 0, + "exactMatch": true, + "semanticDrift": false + }, + "pnpm_v9": { + "conflicts": 1, + "exactMatch": false, + "semanticDrift": false + }, + "npm": { + "conflicts": 1, + "exactMatch": false, + "semanticDrift": false + }, + "yarn": { + "conflicts": 1, + "exactMatch": false, + "semanticDrift": false + }, + "yarn_classic": { + "conflicts": 1, + "exactMatch": false, + "semanticDrift": false + }, + "bun": { + "conflicts": 1, + "exactMatch": false, + "semanticDrift": false + }, + "vlt": { + "conflicts": 1, + "exactMatch": false, + "semanticDrift": false + } + } } } } diff --git a/lockfileConflictScenarios.js b/lockfileConflictScenarios.js index 73b844c..c97f3a0 100644 --- a/lockfileConflictScenarios.js +++ b/lockfileConflictScenarios.js @@ -362,4 +362,24 @@ export const lockfileConflictScenarios = [ }, }, }, + { + id: 'S26_bump_last_pkg_vs_append_new_pkg', + description: 'Branch A bumps ini (1.3.8 -> 5.0.0) in dependencies; Branch B adds ms in devDependencies', + base: { + dependencies: { abbrev: '3.0.1', ini: '1.3.8' }, + devDependencies: { 'fast-redact': '3.5.0' }, + }, + branchA: { + dependencies: { abbrev: '3.0.1', ini: '5.0.0' }, + devDependencies: { 'fast-redact': '3.5.0' }, + }, + branchB: { + dependencies: { abbrev: '3.0.1', ini: '1.3.8' }, + devDependencies: { 'fast-redact': '3.5.0', ms: '2.1.3' }, + }, + merged: { + dependencies: { abbrev: '3.0.1', ini: '5.0.0' }, + devDependencies: { 'fast-redact': '3.5.0', ms: '2.1.3' }, + }, + }, ] From 447c82f8cae6bac641942a7f69dd64625ff4c273 Mon Sep 17 00:00:00 2001 From: Zoltan Kochan Date: Tue, 10 Nov 2026 15:55:50 +0100 Subject: [PATCH 5/6] feat: add workspace prod-vs-dev and concurrent new-workspace scenarios (S27-S29) --- benchmarkLockfileConflicts.test.mjs | 5 +- lockfile-conflicts.json | 199 ++++++++++++++++++++++------ lockfileConflictScenarios.js | 97 +++++++------- 3 files changed, 215 insertions(+), 86 deletions(-) diff --git a/benchmarkLockfileConflicts.test.mjs b/benchmarkLockfileConflicts.test.mjs index 6ecb4ea..ff6e01f 100644 --- a/benchmarkLockfileConflicts.test.mjs +++ b/benchmarkLockfileConflicts.test.mjs @@ -118,9 +118,12 @@ test('writeProjectState writes root and workspace manifests and scenarios are we }) assert.ok(fs.existsSync(path.join(dir, 'package.json'))) assert.ok(fs.existsSync(path.join(dir, 'packages/a/package.json'))) - assert.equal(lockfileConflictScenarios.length, 26) + assert.equal(lockfileConflictScenarios.length, 29) assert.equal(CONFLICT_MANAGERS.includes('pnpm_v13'), true) assert.equal(countPackageJsonConflicts(lockfileConflictScenarios[0]), 0) assert.equal(countPackageJsonConflicts(lockfileConflictScenarios[1]), 1) assert.equal(countPackageJsonConflicts(lockfileConflictScenarios[25]), 0) + assert.equal(countPackageJsonConflicts(lockfileConflictScenarios[26]), 0) + assert.equal(countPackageJsonConflicts(lockfileConflictScenarios[27]), 0) + assert.equal(countPackageJsonConflicts(lockfileConflictScenarios[28]), 0) }) diff --git a/lockfile-conflicts.json b/lockfile-conflicts.json index 3e671b3..9b5e865 100644 --- a/lockfile-conflicts.json +++ b/lockfile-conflicts.json @@ -1,92 +1,92 @@ { "measuredAt": "2026-11-10T12:20:00.789Z", - "totalScenarios": 26, - "cleanPackageJsonScenarios": 17, + "totalScenarios": 29, + "cleanPackageJsonScenarios": 20, "summary": { "pnpm_v13": { - "clean": 13, - "conflicted": 11, - "conflictHunks": 16, + "clean": 15, + "conflicted": 12, + "conflictHunks": 17, "semanticDrift": 2 }, "pnpm_v9": { - "clean": 11, - "conflicted": 12, - "conflictHunks": 24, + "clean": 13, + "conflicted": 13, + "conflictHunks": 25, "semanticDrift": 3 }, "npm": { - "clean": 11, - "conflicted": 13, - "conflictHunks": 16, + "clean": 13, + "conflicted": 14, + "conflictHunks": 18, "semanticDrift": 2 }, "yarn": { - "clean": 11, - "conflicted": 14, - "conflictHunks": 19, + "clean": 12, + "conflicted": 16, + "conflictHunks": 22, "semanticDrift": 1 }, "yarn_classic": { - "clean": 15, + "clean": 18, "conflicted": 11, "conflictHunks": 13, "semanticDrift": 0 }, "bun": { - "clean": 10, - "conflicted": 15, - "conflictHunks": 19, + "clean": 12, + "conflicted": 16, + "conflictHunks": 21, "semanticDrift": 1 }, "vlt": { "clean": 4, - "conflicted": 21, - "conflictHunks": 36, + "conflicted": 24, + "conflictHunks": 40, "semanticDrift": 1 } }, "cleanPackageJsonSummary": { "pnpm_v13": { - "clean": 12, - "conflicted": 3, - "conflictHunks": 4, + "clean": 14, + "conflicted": 4, + "conflictHunks": 5, "semanticDrift": 2 }, "pnpm_v9": { - "clean": 9, - "conflicted": 5, - "conflictHunks": 8, + "clean": 11, + "conflicted": 6, + "conflictHunks": 9, "semanticDrift": 3 }, "npm": { - "clean": 11, - "conflicted": 4, - "conflictHunks": 4, + "clean": 13, + "conflicted": 5, + "conflictHunks": 6, "semanticDrift": 2 }, "yarn": { - "clean": 11, - "conflicted": 5, - "conflictHunks": 5, + "clean": 12, + "conflicted": 7, + "conflictHunks": 8, "semanticDrift": 1 }, "yarn_classic": { - "clean": 11, + "clean": 14, "conflicted": 6, "conflictHunks": 6, "semanticDrift": 0 }, "bun": { - "clean": 10, - "conflicted": 6, - "conflictHunks": 6, + "clean": 12, + "conflicted": 7, + "conflictHunks": 8, "semanticDrift": 1 }, "vlt": { "clean": 4, - "conflicted": 12, - "conflictHunks": 19, + "conflicted": 15, + "conflictHunks": 23, "semanticDrift": 1 } }, @@ -1156,6 +1156,129 @@ "semanticDrift": false } } + }, + "S27_workspace_prod_deps_bump_vs_dev_deps_bump": { + "description": "Branch A bumps dependencies in packages/a and packages/b; Branch B bumps devDependencies in packages/a and packages/b", + "packageJsonConflicts": 0, + "managers": { + "pnpm_v13": { + "conflicts": 0, + "exactMatch": true, + "semanticDrift": false + }, + "pnpm_v9": { + "conflicts": 0, + "exactMatch": true, + "semanticDrift": false + }, + "npm": { + "conflicts": 0, + "exactMatch": true, + "semanticDrift": false + }, + "yarn": { + "conflicts": 2, + "exactMatch": false, + "semanticDrift": false + }, + "yarn_classic": { + "conflicts": 0, + "exactMatch": true, + "semanticDrift": false + }, + "bun": { + "conflicts": 0, + "exactMatch": true, + "semanticDrift": false + }, + "vlt": { + "conflicts": 1, + "exactMatch": false, + "semanticDrift": false + } + } + }, + "S28_add_two_non_adjacent_workspace_projects": { + "description": "Branch A adds workspace project packages/b; Branch B adds workspace project packages/d (separated by packages/c)", + "packageJsonConflicts": 0, + "managers": { + "pnpm_v13": { + "conflicts": 0, + "exactMatch": true, + "semanticDrift": false + }, + "pnpm_v9": { + "conflicts": 0, + "exactMatch": true, + "semanticDrift": false + }, + "npm": { + "conflicts": 0, + "exactMatch": true, + "semanticDrift": false + }, + "yarn": { + "conflicts": 0, + "exactMatch": true, + "semanticDrift": false + }, + "yarn_classic": { + "conflicts": 0, + "exactMatch": true, + "semanticDrift": false + }, + "bun": { + "conflicts": 0, + "exactMatch": true, + "semanticDrift": false + }, + "vlt": { + "conflicts": 1, + "exactMatch": false, + "semanticDrift": false + } + } + }, + "S29_add_two_adjacent_workspace_projects": { + "description": "Branch A adds workspace project packages/b; Branch B adds workspace project packages/c", + "packageJsonConflicts": 0, + "managers": { + "pnpm_v13": { + "conflicts": 1, + "exactMatch": false, + "semanticDrift": false + }, + "pnpm_v9": { + "conflicts": 1, + "exactMatch": false, + "semanticDrift": false + }, + "npm": { + "conflicts": 2, + "exactMatch": false, + "semanticDrift": false + }, + "yarn": { + "conflicts": 1, + "exactMatch": false, + "semanticDrift": false + }, + "yarn_classic": { + "conflicts": 0, + "exactMatch": true, + "semanticDrift": false + }, + "bun": { + "conflicts": 2, + "exactMatch": false, + "semanticDrift": false + }, + "vlt": { + "conflicts": 2, + "exactMatch": false, + "semanticDrift": false + } + } } } } diff --git a/lockfileConflictScenarios.js b/lockfileConflictScenarios.js index c97f3a0..07f98b6 100644 --- a/lockfileConflictScenarios.js +++ b/lockfileConflictScenarios.js @@ -1,4 +1,4 @@ -// Twenty-five 3-way Git merge scenarios covering concurrent dependency and +// Twenty-nine 3-way Git merge scenarios covering concurrent dependency and // workspace changes across package managers and lockfile versions. export const lockfileConflictScenarios = [ { @@ -307,79 +307,82 @@ export const lockfileConflictScenarios = [ { id: 'S24_optional_peer_bound_vs_consumer_added', description: 'debug@4.4.3 has optional peer supports-color; Branch A adds supports-color@8.1.1 in ws/a; Branch B adds debug@4.4.3 in ws/b', + base: { workspaces: { a: { dependencies: { debug: '4.4.3', ini: '5.0.0' } }, b: { dependencies: { abbrev: '3.0.1' } } } }, + branchA: { workspaces: { a: { dependencies: { debug: '4.4.3', ini: '5.0.0', 'supports-color': '8.1.1' } }, b: { dependencies: { abbrev: '3.0.1' } } } }, + branchB: { workspaces: { a: { dependencies: { debug: '4.4.3', ini: '5.0.0' } }, b: { dependencies: { abbrev: '3.0.1', debug: '4.4.3' } } } }, + merged: { workspaces: { a: { dependencies: { debug: '4.4.3', ini: '5.0.0', 'supports-color': '8.1.1' } }, b: { dependencies: { abbrev: '3.0.1', debug: '4.4.3' } } } }, + }, + { + id: 'S25_add_new_workspace_project_vs_bump_in_another', + description: 'Branch A adds a new workspace project packages/b; Branch B bumps a dependency in packages/c', + base: { workspaces: { a: { dependencies: { abbrev: '3.0.1' } }, c: { dependencies: { 'fast-redact': '3.4.0' } } } }, + branchA: { workspaces: { a: { dependencies: { abbrev: '3.0.1' } }, b: { dependencies: { ini: '5.0.0' } }, c: { dependencies: { 'fast-redact': '3.4.0' } } } }, + branchB: { workspaces: { a: { dependencies: { abbrev: '3.0.1' } }, c: { dependencies: { 'fast-redact': '3.5.0' } } } }, + merged: { workspaces: { a: { dependencies: { abbrev: '3.0.1' } }, b: { dependencies: { ini: '5.0.0' } }, c: { dependencies: { 'fast-redact': '3.5.0' } } } }, + }, + { + id: 'S26_bump_last_pkg_vs_append_new_pkg', + description: 'Branch A bumps ini (1.3.8 -> 5.0.0) in dependencies; Branch B adds ms in devDependencies', + base: { dependencies: { abbrev: '3.0.1', ini: '1.3.8' }, devDependencies: { 'fast-redact': '3.5.0' } }, + branchA: { dependencies: { abbrev: '3.0.1', ini: '5.0.0' }, devDependencies: { 'fast-redact': '3.5.0' } }, + branchB: { dependencies: { abbrev: '3.0.1', ini: '1.3.8' }, devDependencies: { 'fast-redact': '3.5.0', ms: '2.1.3' } }, + merged: { dependencies: { abbrev: '3.0.1', ini: '5.0.0' }, devDependencies: { 'fast-redact': '3.5.0', ms: '2.1.3' } }, + }, + { + id: 'S27_workspace_prod_deps_bump_vs_dev_deps_bump', + description: 'Branch A bumps dependencies in packages/a and packages/b; Branch B bumps devDependencies in packages/a and packages/b', base: { workspaces: { - a: { dependencies: { debug: '4.4.3', ini: '5.0.0' } }, - b: { dependencies: { abbrev: '3.0.1' } }, + a: { dependencies: { abbrev: '2.0.0' }, devDependencies: { 'fast-redact': '3.4.0' } }, + b: { dependencies: { ini: '4.1.2' }, devDependencies: { semver: '7.6.3' } }, }, }, branchA: { workspaces: { - a: { dependencies: { debug: '4.4.3', ini: '5.0.0', 'supports-color': '8.1.1' } }, - b: { dependencies: { abbrev: '3.0.1' } }, + a: { dependencies: { abbrev: '3.0.1' }, devDependencies: { 'fast-redact': '3.4.0' } }, + b: { dependencies: { ini: '5.0.0' }, devDependencies: { semver: '7.6.3' } }, }, }, branchB: { workspaces: { - a: { dependencies: { debug: '4.4.3', ini: '5.0.0' } }, - b: { dependencies: { abbrev: '3.0.1', debug: '4.4.3' } }, + a: { dependencies: { abbrev: '2.0.0' }, devDependencies: { 'fast-redact': '3.5.0' } }, + b: { dependencies: { ini: '4.1.2' }, devDependencies: { semver: '7.7.4' } }, }, }, merged: { workspaces: { - a: { dependencies: { debug: '4.4.3', ini: '5.0.0', 'supports-color': '8.1.1' } }, - b: { dependencies: { abbrev: '3.0.1', debug: '4.4.3' } }, + a: { dependencies: { abbrev: '3.0.1' }, devDependencies: { 'fast-redact': '3.5.0' } }, + b: { dependencies: { ini: '5.0.0' }, devDependencies: { semver: '7.7.4' } }, }, }, }, { - id: 'S25_add_new_workspace_project_vs_bump_in_another', - description: 'Branch A adds a new workspace project packages/b; Branch B bumps a dependency in packages/c', - base: { - workspaces: { - a: { dependencies: { abbrev: '3.0.1' } }, - c: { dependencies: { 'fast-redact': '3.4.0' } }, - }, - }, - branchA: { - workspaces: { - a: { dependencies: { abbrev: '3.0.1' } }, - b: { dependencies: { ini: '5.0.0' } }, - c: { dependencies: { 'fast-redact': '3.4.0' } }, - }, - }, - branchB: { - workspaces: { - a: { dependencies: { abbrev: '3.0.1' } }, - c: { dependencies: { 'fast-redact': '3.5.0' } }, - }, - }, + id: 'S28_add_two_non_adjacent_workspace_projects', + description: 'Branch A adds workspace project packages/b; Branch B adds workspace project packages/d (separated by packages/c)', + base: { workspaces: { a: { dependencies: { abbrev: '3.0.1' } }, c: { dependencies: { 'fast-redact': '3.5.0' } } } }, + branchA: { workspaces: { a: { dependencies: { abbrev: '3.0.1' } }, b: { dependencies: { 'fast-copy': '3.0.0' } }, c: { dependencies: { 'fast-redact': '3.5.0' } } } }, + branchB: { workspaces: { a: { dependencies: { abbrev: '3.0.1' } }, c: { dependencies: { 'fast-redact': '3.5.0' } }, d: { dependencies: { 'safe-stable-stringify': '2.5.0' } } } }, merged: { workspaces: { a: { dependencies: { abbrev: '3.0.1' } }, - b: { dependencies: { ini: '5.0.0' } }, + b: { dependencies: { 'fast-copy': '3.0.0' } }, c: { dependencies: { 'fast-redact': '3.5.0' } }, + d: { dependencies: { 'safe-stable-stringify': '2.5.0' } }, }, }, }, { - id: 'S26_bump_last_pkg_vs_append_new_pkg', - description: 'Branch A bumps ini (1.3.8 -> 5.0.0) in dependencies; Branch B adds ms in devDependencies', - base: { - dependencies: { abbrev: '3.0.1', ini: '1.3.8' }, - devDependencies: { 'fast-redact': '3.5.0' }, - }, - branchA: { - dependencies: { abbrev: '3.0.1', ini: '5.0.0' }, - devDependencies: { 'fast-redact': '3.5.0' }, - }, - branchB: { - dependencies: { abbrev: '3.0.1', ini: '1.3.8' }, - devDependencies: { 'fast-redact': '3.5.0', ms: '2.1.3' }, - }, + id: 'S29_add_two_adjacent_workspace_projects', + description: 'Branch A adds workspace project packages/b; Branch B adds workspace project packages/c', + base: { workspaces: { a: { dependencies: { abbrev: '3.0.1', 'fast-redact': '3.5.0' } } } }, + branchA: { workspaces: { a: { dependencies: { abbrev: '3.0.1', 'fast-redact': '3.5.0' } }, b: { dependencies: { 'fast-copy': '3.0.0' } } } }, + branchB: { workspaces: { a: { dependencies: { abbrev: '3.0.1', 'fast-redact': '3.5.0' } }, c: { dependencies: { 'safe-stable-stringify': '2.5.0' } } } }, merged: { - dependencies: { abbrev: '3.0.1', ini: '5.0.0' }, - devDependencies: { 'fast-redact': '3.5.0', ms: '2.1.3' }, + workspaces: { + a: { dependencies: { abbrev: '3.0.1', 'fast-redact': '3.5.0' } }, + b: { dependencies: { 'fast-copy': '3.0.0' } }, + c: { dependencies: { 'safe-stable-stringify': '2.5.0' } }, + }, }, }, ] From bbf8422cb8681b145d7fbe8a6d60631315bfad01 Mon Sep 17 00:00:00 2001 From: Zoltan Kochan Date: Tue, 10 Nov 2026 16:07:46 +0100 Subject: [PATCH 6/6] fix: address CodeRabbit review feedback --- README.md | 2 +- benchmarkLockfileConflicts.js | 89 ++++++++++++++++++++++++++++- benchmarkLockfileConflicts.test.mjs | 8 ++- lockfile-conflicts.json | 12 ++-- lockfileConflictScenarios.js | 2 +- 5 files changed, 101 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 2b5c25b..d65b4dc 100644 --- a/README.md +++ b/README.md @@ -59,7 +59,7 @@ brew install bash ## Lockfile Git merge conflicts -`benchmarkLockfileConflicts.js` measures 3-way `git merge-file` conflicts and semantic drift across 25 concurrent-branch scenarios (`lockfileConflictScenarios.js`) for `pnpm-lock.yaml` (`13.0` and `9.0`), `package-lock.json` (npm v3), `yarn.lock` (Berry and Classic v1), `bun.lock`, and `vlt-lock.json`, and writes the results (both across all scenarios and across the subset where `package.json` files merge without conflicts) to [lockfile-conflicts.json](./lockfile-conflicts.json): +`benchmarkLockfileConflicts.js` measures 3-way `git merge-file` conflicts and semantic drift across 29 concurrent-branch scenarios (`lockfileConflictScenarios.js`) for `pnpm-lock.yaml` (`13.0` and `9.0`), `package-lock.json` (npm v3), `yarn.lock` (Berry and Classic v1), `bun.lock`, and `vlt-lock.json`, and writes the results (both across all scenarios and across the subset where `package.json` files merge without conflicts) to [lockfile-conflicts.json](./lockfile-conflicts.json): ``` pnpm run benchmark:conflicts diff --git a/benchmarkLockfileConflicts.js b/benchmarkLockfileConflicts.js index 17cd7e6..610d007 100644 --- a/benchmarkLockfileConflicts.js +++ b/benchmarkLockfileConflicts.js @@ -21,6 +21,9 @@ export const CONFLICT_MANAGERS = [ 'vlt', ] +/** + * Builds the root `package.json` manifest object for a scenario state. + */ function rootManifest (state) { return { name: 'root', @@ -32,6 +35,9 @@ function rootManifest (state) { } } +/** + * Serializes all `package.json` manifests (root and workspaces) for a state. + */ function stateManifestFiles (state) { const files = { 'package.json': `${JSON.stringify(rootManifest(state), null, 2)}\n`, @@ -43,6 +49,9 @@ function stateManifestFiles (state) { return files } +/** + * Counts 3-way `git merge-file` conflict hunks across all `package.json` files in a scenario. + */ export function countPackageJsonConflicts (scenario) { const baseFiles = stateManifestFiles(scenario.base) const aFiles = stateManifestFiles(scenario.branchA) @@ -64,10 +73,33 @@ export function countPackageJsonConflicts (scenario) { return conflicts } +/** + * Removes workspace directories under `packages/` that are not present in `workspaces`. + */ +function pruneStaleWorkspaceDirs (dir, workspaces) { + const packagesDir = path.join(dir, 'packages') + if (!fs.existsSync(packagesDir)) return + if (!workspaces) { + fs.rmSync(packagesDir, { recursive: true, force: true }) + return + } + const activeNames = new Set(Object.keys(workspaces)) + for (const entry of fs.readdirSync(packagesDir)) { + if (!activeNames.has(entry)) { + fs.rmSync(path.join(packagesDir, entry), { recursive: true, force: true }) + } + } +} + +/** + * Writes root and workspace `package.json` manifests for `state` into `dir`. + */ export function writeProjectState (dir, state, { clean = true } = {}) { if (clean) { fs.rmSync(dir, { recursive: true, force: true }) fs.mkdirSync(dir, { recursive: true }) + } else { + pruneStaleWorkspaceDirs(dir, state.workspaces) } fs.writeFileSync(path.join(dir, 'package.json'), `${JSON.stringify(rootManifest(state), null, 2)}\n`) if (!state.workspaces) return @@ -79,14 +111,23 @@ export function writeProjectState (dir, state, { clean = true } = {}) { } } +/** + * Writes `pnpm-workspace.yaml` with workspace globs and optional `lockfile.format: v13`. + */ function writePnpmWorkspaceYaml (dir, state, isV13) { const lines = state.workspaces ? ['packages:', ' - packages/*'] : [] if (isV13) lines.push('lockfile:', ' format: v13') + const wsYamlPath = path.join(dir, 'pnpm-workspace.yaml') if (lines.length > 0) { - fs.writeFileSync(path.join(dir, 'pnpm-workspace.yaml'), `${lines.join('\n')}\n`) + fs.writeFileSync(wsYamlPath, `${lines.join('\n')}\n`) + } else { + fs.rmSync(wsYamlPath, { force: true }) } } +/** + * Executes a package manager command synchronously and throws on non-zero exit status. + */ function runCommand (command, args, opts) { const result = spawn.sync(command, args, { stdio: 'pipe', ...opts }) if (result.error) throw result.error @@ -96,10 +137,28 @@ function runCommand (command, args, opts) { } } +/** + * Runs `pnpm` in lockfile-only mode and validates the resulting lockfile version header. + */ +function invokePnpm (manager, dir, binaries) { + const pnpmBin = binaries.pnpm ?? process.env.PNPM_BIN ?? 'pnpm' + runCommand(pnpmBin, ['install', '--lockfile-only', '--ignore-scripts'], { cwd: dir }) + const lockfile = fs.readFileSync(path.join(dir, 'pnpm-lock.yaml'), 'utf8') + if (manager === 'pnpm_v13' && !lockfile.includes('"lockfileVersion": "13.0"')) { + throw new Error('Expected pnpm_v13 to emit lockfileVersion 13.0 (set PNPM_BIN to a v13-capable pnpm binary)') + } + if (manager === 'pnpm_v9' && !lockfile.includes("lockfileVersion: '9.0'")) { + throw new Error('Expected pnpm_v9 to emit lockfileVersion 9.0') + } + return lockfile +} + +/** + * Invokes the specified package manager to generate and return its lockfile text. + */ function invokeManager (manager, dir, binaries) { if (manager === 'pnpm_v13' || manager === 'pnpm_v9') { - runCommand(binaries.pnpm ?? 'pnpm', ['install', '--lockfile-only', '--ignore-scripts'], { cwd: dir }) - return fs.readFileSync(path.join(dir, 'pnpm-lock.yaml'), 'utf8') + return invokePnpm(manager, dir, binaries) } if (manager === 'npm') { runCommand(binaries.npm ?? 'npm', ['install', '--package-lock-only', '--ignore-scripts', '--no-audit', '--no-fund'], { cwd: dir }) @@ -128,6 +187,9 @@ function invokeManager (manager, dir, binaries) { throw new Error(`Unknown package manager: ${manager}`) } +/** + * Generates a lockfile for `state` (applying `state.seed` first when present). + */ export function generateLockfileForState (manager, state, workDir, binaries = {}) { if (state.seed) { generateLockfileForState(manager, state.seed, workDir, binaries) @@ -141,6 +203,9 @@ export function generateLockfileForState (manager, state, workDir, binaries = {} return invokeManager(manager, workDir, binaries) } +/** + * Runs 3-way `git merge-file` on `baseText`, `branchAText`, and `branchBText`. + */ export function gitMergeLockfiles (baseText, branchAText, branchBText) { const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'lockfile-merge-')) try { @@ -163,6 +228,9 @@ export function gitMergeLockfiles (baseText, branchAText, branchBText) { } } +/** + * Counts `<<<<<<<` conflict markers in merged file output. + */ export function countConflictHunks (text) { let count = 0 for (const line of text.split('\n')) { @@ -171,6 +239,9 @@ export function countConflictHunks (text) { return count } +/** + * Evaluates 3-way merge conflict count, exact match, and semantic drift against `expectedMerged`. + */ export function evaluateScenarioOutcome ({ base, branchA, branchB, expectedMerged }) { const { conflicts, merged } = gitMergeLockfiles(base, branchA, branchB) const exactMatch = conflicts === 0 && merged === expectedMerged @@ -178,6 +249,9 @@ export function evaluateScenarioOutcome ({ base, branchA, branchB, expectedMerge return { conflicts, exactMatch, semanticDrift } } +/** + * Aggregates clean, conflicted, conflict hunk, and semantic drift counts for a single manager. + */ function summarizeManagerOutcomes (scenarios, manager) { let clean = 0 let conflicted = 0 @@ -198,6 +272,9 @@ function summarizeManagerOutcomes (scenarios, manager) { return { clean, conflicted, conflictHunks, semanticDrift } } +/** + * Summarizes merge conflict and drift totals across all scenarios for each manager. + */ export function summarizeConflictResults (scenarios, managers = CONFLICT_MANAGERS) { const summary = {} for (const manager of managers) { @@ -206,6 +283,9 @@ export function summarizeConflictResults (scenarios, managers = CONFLICT_MANAGER return summary } +/** + * Summarizes merge conflict and drift totals across scenarios where `package.json` has 0 conflicts. + */ export function summarizeCleanPackageJsonResults (scenarios, managers = CONFLICT_MANAGERS) { const cleanScenarios = Object.fromEntries( Object.entries(scenarios).filter(([, scenario]) => (scenario.packageJsonConflicts ?? 0) === 0) @@ -213,6 +293,9 @@ export function summarizeCleanPackageJsonResults (scenarios, managers = CONFLICT return summarizeConflictResults(cleanScenarios, managers) } +/** + * Runs the lockfile merge conflict benchmark suite across all scenarios and managers. + */ export function runLockfileConflictsBenchmark ({ managers = CONFLICT_MANAGERS, binaries = {}, diff --git a/benchmarkLockfileConflicts.test.mjs b/benchmarkLockfileConflicts.test.mjs index ff6e01f..3aa83c2 100644 --- a/benchmarkLockfileConflicts.test.mjs +++ b/benchmarkLockfileConflicts.test.mjs @@ -114,10 +114,16 @@ test('writeProjectState writes root and workspace manifests and scenarios are we const dir = tempy.directory() writeProjectState(dir, { dependencies: { abbrev: '3.0.1' }, - workspaces: { a: { dependencies: { ini: '5.0.0' } } }, + workspaces: { a: { dependencies: { ini: '5.0.0' } }, stale: { dependencies: { ms: '2.1.3' } } }, }) assert.ok(fs.existsSync(path.join(dir, 'package.json'))) assert.ok(fs.existsSync(path.join(dir, 'packages/a/package.json'))) + assert.ok(fs.existsSync(path.join(dir, 'packages/stale/package.json'))) + writeProjectState(dir, { + dependencies: { abbrev: '3.0.1' }, + workspaces: { a: { dependencies: { ini: '5.0.0' } } }, + }, { clean: false }) + assert.equal(fs.existsSync(path.join(dir, 'packages/stale')), false) assert.equal(lockfileConflictScenarios.length, 29) assert.equal(CONFLICT_MANAGERS.includes('pnpm_v13'), true) assert.equal(countPackageJsonConflicts(lockfileConflictScenarios[0]), 0) diff --git a/lockfile-conflicts.json b/lockfile-conflicts.json index 9b5e865..e0d6f60 100644 --- a/lockfile-conflicts.json +++ b/lockfile-conflicts.json @@ -28,10 +28,10 @@ "semanticDrift": 1 }, "yarn_classic": { - "clean": 18, + "clean": 17, "conflicted": 11, "conflictHunks": 13, - "semanticDrift": 0 + "semanticDrift": 1 }, "bun": { "clean": 12, @@ -72,10 +72,10 @@ "semanticDrift": 1 }, "yarn_classic": { - "clean": 14, + "clean": 13, "conflicted": 6, "conflictHunks": 6, - "semanticDrift": 0 + "semanticDrift": 1 }, "bun": { "clean": 12, @@ -445,8 +445,8 @@ }, "yarn_classic": { "conflicts": 0, - "exactMatch": true, - "semanticDrift": false + "exactMatch": false, + "semanticDrift": true }, "bun": { "conflicts": 0, diff --git a/lockfileConflictScenarios.js b/lockfileConflictScenarios.js index 07f98b6..94c2642 100644 --- a/lockfileConflictScenarios.js +++ b/lockfileConflictScenarios.js @@ -71,7 +71,7 @@ export const lockfileConflictScenarios = [ base: { workspaces: { a: { dependencies: { react: '18.2.0', 'use-sync-external-store': '1.2.0' } }, b: { dependencies: { ini: '5.0.0' } } } }, branchA: { workspaces: { a: { dependencies: { react: '18.3.1', 'use-sync-external-store': '1.2.0' } }, b: { dependencies: { ini: '5.0.0' } } } }, branchB: { workspaces: { a: { dependencies: { react: '18.2.0', 'use-sync-external-store': '1.2.0' } }, b: { dependencies: { ini: '5.0.0', react: '18.2.0', 'use-sync-external-store': '1.2.0' } } } }, - merged: { workspaces: { a: { dependencies: { react: '18.3.1', 'use-sync-external-store': '1.2.0' } }, b: { dependencies: { ini: '5.0.0', react: '18.3.1', 'use-sync-external-store': '1.2.0' } } } }, + merged: { workspaces: { a: { dependencies: { react: '18.3.1', 'use-sync-external-store': '1.2.0' } }, b: { dependencies: { ini: '5.0.0', react: '18.2.0', 'use-sync-external-store': '1.2.0' } } } }, }, { id: 'S10_peer_provider_bump_and_consumer_bump',