@quolu/lattice 0.114.2 → 0.114.4
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@quolu/lattice",
|
|
3
|
-
"version": "0.114.
|
|
3
|
+
"version": "0.114.4",
|
|
4
4
|
"description": "Schedulability compiler for multi-agent development: observe real code boundaries, refactor the conflicting seam, recompile the plan for parallel execution",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Quo / クオ at kitepon.dev",
|
package/src/chart-cli.mjs
CHANGED
|
@@ -254,8 +254,10 @@ async function runSensor(command, dir) {
|
|
|
254
254
|
|
|
255
255
|
/**
|
|
256
256
|
* K7 sync. Named protection: never reset, clean, force or repoint; tracked edits make it `dirty` and a HEAD that is
|
|
257
|
-
* not the accepted baseline makes it `diverged` (nothing moves). Self-
|
|
258
|
-
* sync tries again
|
|
257
|
+
* not the accepted baseline makes it `diverged` (nothing moves). Self-exits: a failed step is reported and the next
|
|
258
|
+
* sync tries again; the one state that is not an edit, our own checkout interrupted after it wrote index and work tree
|
|
259
|
+
* but before it moved HEAD (HEAD = baseline, index and work tree = FETCH_HEAD, a descendant), is finished.
|
|
260
|
+
* HEAD moves only from the baseline. Only the first fetch is depth-1; later fetches keep the previous tip
|
|
259
261
|
* an ancestor of the new one (gate 4's merged-sha check and the structure adapter's `rev-list baseline..HEAD` need that).
|
|
260
262
|
*/
|
|
261
263
|
async function chartRepoSync({ cwd, env }) {
|
|
@@ -281,13 +283,22 @@ async function chartRepoSync({ cwd, env }) {
|
|
|
281
283
|
await mkdir(path.dirname(exclude), { recursive: true });
|
|
282
284
|
await appendFile(exclude, `${excluded === '' || excluded.endsWith('\n') ? '' : '\n'}.lattice/\n`);
|
|
283
285
|
}
|
|
284
|
-
|
|
286
|
+
// Charts moved before 0.101.0 kept the baseline in refs/remotes/origin/<branch>.
|
|
287
|
+
let accepted = meta.repo.accepted_tip ?? await optional(['rev-parse', '--verify', '--quiet', `refs/remotes/origin/${branch}`]);
|
|
288
|
+
if (await git('status', ['status', '--porcelain', '--untracked-files=no'])) {
|
|
289
|
+
const interrupted = await optional(['rev-parse', '--verify', '--quiet', 'FETCH_HEAD^{commit}']);
|
|
290
|
+
const holds = (args) => runGit('git', args, { cwd: dir }).then(() => true, () => false);
|
|
291
|
+
if (interrupted === null || accepted === null || accepted !== await optional(['rev-parse', '--verify', '--quiet', 'HEAD'])
|
|
292
|
+
|| !await holds(['merge-base', '--is-ancestor', 'HEAD', interrupted])
|
|
293
|
+
|| !await holds(['diff', '--cached', '--quiet', interrupted]) || !await holds(['diff', '--quiet'])) return result('dirty');
|
|
294
|
+
await git('checkout', ['checkout', '--quiet', '-B', branch, interrupted]);
|
|
295
|
+
accepted = interrupted;
|
|
296
|
+
await writeTodoChartMeta({ repoRoot: dir, patch: { repo: { url, branch, accepted_tip: interrupted } } });
|
|
297
|
+
}
|
|
285
298
|
// A lazily fetching (promisor) clone fetches each missing blob on every full object walk; never fetch lazily.
|
|
286
299
|
for (const key of ['remote.origin.promisor', 'remote.origin.partialclonefilter', 'extensions.partialclone']) {
|
|
287
300
|
await optional(['config', '--unset-all', key]);
|
|
288
301
|
}
|
|
289
|
-
// Charts moved before 0.101.0 kept the baseline in refs/remotes/origin/<branch>.
|
|
290
|
-
const accepted = meta.repo.accepted_tip ?? await optional(['rev-parse', '--verify', '--quiet', `refs/remotes/origin/${branch}`]);
|
|
291
302
|
const head = await optional(['rev-parse', '--verify', '--quiet', 'HEAD']);
|
|
292
303
|
await git('fetch', ['fetch', '--quiet', ...(head === null ? ['--depth=1'] : []), '--no-tags', url, branch]);
|
|
293
304
|
const tip = await git('fetch', ['rev-parse', 'FETCH_HEAD']);
|
|
@@ -53,7 +53,8 @@ export async function prepareLifecycleDirectory(root) {
|
|
|
53
53
|
if (!match) continue;
|
|
54
54
|
let alive = true;
|
|
55
55
|
try { process.kill(Number(match[1]), 0); } catch (error) {
|
|
56
|
-
|
|
56
|
+
// EPERM: the writer pid now belongs to another user, so our writer is gone.
|
|
57
|
+
if (error.code !== 'ESRCH' && error.code !== 'EPERM') throw error;
|
|
57
58
|
alive = false;
|
|
58
59
|
}
|
|
59
60
|
if (!alive) {
|
|
@@ -5,11 +5,14 @@ import { fileURLToPath } from 'node:url';
|
|
|
5
5
|
|
|
6
6
|
const execute = promisify(execFile);
|
|
7
7
|
|
|
8
|
-
/**
|
|
8
|
+
/**
|
|
9
|
+
* A missing process and an unavailable birth observation are different. EPERM on the kill-zero probe means the pid
|
|
10
|
+
* now belongs to another user; our dashboard processes run as us, so that pid is not ours = missing (BugHub 92b367ad).
|
|
11
|
+
*/
|
|
9
12
|
export async function observeDashboardProcess(pid) {
|
|
10
13
|
if (!Number.isSafeInteger(pid) || pid < 1) throw new TypeError('invalid dashboard pid');
|
|
11
14
|
try { process.kill(pid, 0); } catch (error) {
|
|
12
|
-
if (error.code === 'ESRCH') return null;
|
|
15
|
+
if (error.code === 'ESRCH' || error.code === 'EPERM') return null;
|
|
13
16
|
throw error;
|
|
14
17
|
}
|
|
15
18
|
try {
|
|
@@ -30,7 +33,7 @@ export async function observeDashboardProcess(pid) {
|
|
|
30
33
|
} catch (error) {
|
|
31
34
|
// Recheck death after a racing exit. An observation failure never licenses a kill.
|
|
32
35
|
try { process.kill(pid, 0); } catch (probeError) {
|
|
33
|
-
if (probeError.code === 'ESRCH') return null;
|
|
36
|
+
if (probeError.code === 'ESRCH' || probeError.code === 'EPERM') return null;
|
|
34
37
|
throw probeError;
|
|
35
38
|
}
|
|
36
39
|
return { pid, birth: null, observation: 'unavailable' };
|
|
@@ -352,7 +352,8 @@ async function daemonHealthy(descriptor) {
|
|
|
352
352
|
|
|
353
353
|
function processIsAlive(pid) {
|
|
354
354
|
try { process.kill(pid, 0); return true; } catch (error) {
|
|
355
|
-
|
|
355
|
+
// EPERM: the pid belongs to another user, so it is not our daemon.
|
|
356
|
+
if (error?.code === 'ESRCH' || error?.code === 'EPERM') return false;
|
|
356
357
|
throw error;
|
|
357
358
|
}
|
|
358
359
|
}
|