quilltap 4.9.0-dev.93 → 4.9.0-dev.95
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/bin/quilltap.js
CHANGED
|
@@ -529,8 +529,8 @@ function handleLockCommand(dataDir, opts) {
|
|
|
529
529
|
} else if (alive && !isNode) {
|
|
530
530
|
status = '\x1b[33mSUSPECT\x1b[0m (PID alive but does not look like Quilltap — possible PID reuse)';
|
|
531
531
|
} else if (!sameHost) {
|
|
532
|
-
// Different hostname — could be a
|
|
533
|
-
const isVMOrContainer =
|
|
532
|
+
// Different hostname — could be a container on this machine
|
|
533
|
+
const isVMOrContainer = lock.environment === 'docker';
|
|
534
534
|
const heartbeatAgeMs = lock.lastHeartbeat
|
|
535
535
|
? Date.now() - new Date(lock.lastHeartbeat).getTime()
|
|
536
536
|
: Infinity;
|
|
@@ -613,8 +613,8 @@ function handleLockCommand(dataDir, opts) {
|
|
|
613
613
|
console.log('This is likely a stale lock with a reused PID. Removing.');
|
|
614
614
|
}
|
|
615
615
|
} else if (!sameHost) {
|
|
616
|
-
// Different hostname — check if it's a
|
|
617
|
-
const isVMOrContainer =
|
|
616
|
+
// Different hostname — check if it's a container with a recent heartbeat
|
|
617
|
+
const isVMOrContainer = lock.environment === 'docker';
|
|
618
618
|
const heartbeatAgeMs = lock.lastHeartbeat
|
|
619
619
|
? Date.now() - new Date(lock.lastHeartbeat).getTime()
|
|
620
620
|
: Infinity;
|
|
@@ -23,9 +23,20 @@ const PKG_ROOT = path.join(__dirname, '..', '..');
|
|
|
23
23
|
// The root jest config maps both driver names onto __mocks__/better-sqlite3.ts,
|
|
24
24
|
// which accepts any key. Point them back at the real binding by absolute path
|
|
25
25
|
// so a wrong pepper actually fails to decrypt.
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
26
|
+
//
|
|
27
|
+
// Two copies can back this: the per-package install used in local development,
|
|
28
|
+
// and — in CI, where only the root `npm ci` runs — the root alias, where
|
|
29
|
+
// package.json installs better-sqlite3-multiple-ciphers under the name
|
|
30
|
+
// `better-sqlite3`. Same fallback chain as the __tests__/unit/packages/quilltap
|
|
31
|
+
// integration suites.
|
|
32
|
+
jest.mock('better-sqlite3-multiple-ciphers', () => {
|
|
33
|
+
const join = require('path').join;
|
|
34
|
+
try {
|
|
35
|
+
return require(join(PKG_ROOT, 'node_modules', 'better-sqlite3-multiple-ciphers'));
|
|
36
|
+
} catch {
|
|
37
|
+
return require(join(PKG_ROOT, '..', '..', 'node_modules', 'better-sqlite3'));
|
|
38
|
+
}
|
|
39
|
+
});
|
|
29
40
|
|
|
30
41
|
const Database = require('better-sqlite3-multiple-ciphers');
|
|
31
42
|
const { provePepper, databaseState } = require('../dbkey-restore');
|
package/lib/lock-helpers.js
CHANGED
|
@@ -6,7 +6,7 @@ const path = require('path');
|
|
|
6
6
|
const { execSync } = require('child_process');
|
|
7
7
|
|
|
8
8
|
const HEARTBEAT_FRESH_MS = 5 * 60 * 1000;
|
|
9
|
-
const VM_ENVIRONMENTS = new Set(['docker'
|
|
9
|
+
const VM_ENVIRONMENTS = new Set(['docker']);
|
|
10
10
|
|
|
11
11
|
function isPidAlive(pid) {
|
|
12
12
|
try {
|
|
@@ -136,14 +136,12 @@ let exitHandlersRegistered = false;
|
|
|
136
136
|
|
|
137
137
|
/**
|
|
138
138
|
* Detect the runtime environment for lock metadata. JS port of the server's
|
|
139
|
-
* detectEnvironmentType() so a CLI run inside Docker
|
|
139
|
+
* detectEnvironmentType() so a CLI run inside Docker writes the right
|
|
140
140
|
* environment and the cross-host heartbeat semantics keep working.
|
|
141
141
|
*/
|
|
142
142
|
function detectEnvironmentType() {
|
|
143
143
|
if (process.versions && process.versions.electron) return 'electron';
|
|
144
144
|
if (process.env.ELECTRON_DEV) return 'electron';
|
|
145
|
-
if (process.env.LIMA_CONTAINER === 'true') return 'lima'; // before Docker — Lima rootfs has Docker markers
|
|
146
|
-
if (process.env.WSL_DISTRO_NAME) return 'wsl2';
|
|
147
145
|
if (process.env.DOCKER_CONTAINER === 'true') return 'docker';
|
|
148
146
|
try {
|
|
149
147
|
if (fs.existsSync('/.dockerenv')) return 'docker';
|