// Local Docker integration: no published ports or existing workspaces are used. import assert from 'node:assert/strict'; import { execFileSync } from 'node:child_process'; import { fileURLToPath } from 'node:url'; import { randomUUID } from 'node:crypto'; const volume = `dsh-lockfile-smoke-${randomUUID()}`; const docker = args => execFileSync('docker', args, { encoding: 'utf8', timeout: 180000, maxBuffer: 8 * 1024 * 1024 }); const run = (image, args, mounts = []) => docker(['run', '--rm', '--network', 'none', '-v', `${volume}:/workspace`, ...mounts, '--entrypoint', 'bash', image, '-ec', args]); docker(['volume', 'create', volume]); try { run('dsh-upgrade-test:runtime-7.8', 'node /usr/local/lib/dsh-mgr/init-profile.mjs; CI=true npm_config_offline=true dsh plugin --profile web install --ignore-scripts; test -s /workspace/profiles/web/pnpm-lock.yaml'); const mounts = ['init-profile.mjs', 'reconcile-profile.mjs'].flatMap(name => ['-v', `${fileURLToPath(new URL(name, import.meta.url))}:/usr/local/lib/dsh-mgr/${name}:ro`]); mounts.push('-v', `${fileURLToPath(new URL('entrypoint.sh', import.meta.url))}:/usr/local/bin/dsh-entrypoint:ro`); const output = run('dsh-web:runtime-7.9-amd64', 'bash /usr/local/bin/dsh-entrypoint --version; test ! -e /workspace/profiles/web/.dsh-lockfile-pending; CI=true npm_config_offline=true dsh plugin --profile web install --ignore-scripts', mounts); assert.doesNotMatch(output, /ERR_PNPM_OUTDATED_LOCKFILE/); const again = run('dsh-web:runtime-7.9-amd64', 'sha256sum /workspace/profiles/web/pnpm-lock.yaml; bash /usr/local/bin/dsh-entrypoint --version; sha256sum /workspace/profiles/web/pnpm-lock.yaml', mounts); const hashes = again.match(/^[a-f0-9]{64} .*pnpm-lock.yaml$/gm); assert.equal(hashes?.length, 2, again); assert.equal(hashes[0], hashes[1]); console.log('PASS: real 7.8 lockfile → 7.9 migration, frozen reinstall, unchanged lockfile on restart'); } finally { docker(['volume', 'rm', volume]); }