@adhdev/daemon-core 0.9.82-rc.65 → 0.9.82-rc.66
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/dist/index.js +106 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +106 -0
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/commands/router.ts +139 -0
package/dist/index.js
CHANGED
|
@@ -26193,6 +26193,81 @@ async function runMeshRefinePatchEquivalenceGate(repoRoot, baseHead, branchHead)
|
|
|
26193
26193
|
};
|
|
26194
26194
|
}
|
|
26195
26195
|
}
|
|
26196
|
+
async function runMeshRefineSubmoduleReachabilityGate(repoRoot, mergedTree) {
|
|
26197
|
+
const startedAt = Date.now();
|
|
26198
|
+
const entries = [];
|
|
26199
|
+
try {
|
|
26200
|
+
const { execFile: execFile3 } = await import("child_process");
|
|
26201
|
+
const { promisify: promisify3 } = await import("util");
|
|
26202
|
+
const execFileAsync3 = promisify3(execFile3);
|
|
26203
|
+
const runGit2 = async (cwd, args) => {
|
|
26204
|
+
const { stdout } = await execFileAsync3("git", args, {
|
|
26205
|
+
cwd,
|
|
26206
|
+
encoding: "utf8",
|
|
26207
|
+
timeout: 3e4,
|
|
26208
|
+
maxBuffer: REFINE_PATCH_EQUIVALENCE_OUTPUT_LIMIT_BYTES,
|
|
26209
|
+
windowsHide: true
|
|
26210
|
+
});
|
|
26211
|
+
return String(stdout || "");
|
|
26212
|
+
};
|
|
26213
|
+
const treeOutput = await runGit2(repoRoot, ["ls-tree", "-r", "-z", mergedTree]);
|
|
26214
|
+
const gitlinks = treeOutput.split("\0").filter(Boolean).map((record) => {
|
|
26215
|
+
const match = /^160000\s+commit\s+([0-9a-f]{40})\t(.+)$/.exec(record);
|
|
26216
|
+
return match ? { commit: match[1], path: match[2] } : null;
|
|
26217
|
+
}).filter((entry) => !!entry);
|
|
26218
|
+
for (const gitlink of gitlinks) {
|
|
26219
|
+
const submodulePath = (0, import_path8.resolve)(repoRoot, gitlink.path);
|
|
26220
|
+
const entry = {
|
|
26221
|
+
path: gitlink.path,
|
|
26222
|
+
commit: gitlink.commit,
|
|
26223
|
+
reachable: false
|
|
26224
|
+
};
|
|
26225
|
+
try {
|
|
26226
|
+
if (!fs10.existsSync(submodulePath)) {
|
|
26227
|
+
entry.error = `Submodule checkout missing at ${gitlink.path}`;
|
|
26228
|
+
entries.push(entry);
|
|
26229
|
+
continue;
|
|
26230
|
+
}
|
|
26231
|
+
entry.checkedLocal = true;
|
|
26232
|
+
try {
|
|
26233
|
+
await runGit2(submodulePath, ["cat-file", "-e", `${gitlink.commit}^{commit}`]);
|
|
26234
|
+
entry.reachable = true;
|
|
26235
|
+
entries.push(entry);
|
|
26236
|
+
continue;
|
|
26237
|
+
} catch {
|
|
26238
|
+
}
|
|
26239
|
+
try {
|
|
26240
|
+
await runGit2(submodulePath, ["fetch", "origin", gitlink.commit]);
|
|
26241
|
+
entry.fetchedFromOrigin = true;
|
|
26242
|
+
await runGit2(submodulePath, ["cat-file", "-e", `${gitlink.commit}^{commit}`]);
|
|
26243
|
+
entry.reachable = true;
|
|
26244
|
+
} catch (e) {
|
|
26245
|
+
entry.error = truncateValidationOutput(e?.stderr || e?.message || String(e));
|
|
26246
|
+
}
|
|
26247
|
+
} catch (e) {
|
|
26248
|
+
entry.error = truncateValidationOutput(e?.message || String(e));
|
|
26249
|
+
}
|
|
26250
|
+
entries.push(entry);
|
|
26251
|
+
}
|
|
26252
|
+
const unreachable = entries.filter((entry) => !entry.reachable);
|
|
26253
|
+
return {
|
|
26254
|
+
status: unreachable.length ? "failed" : "passed",
|
|
26255
|
+
checked: entries.length,
|
|
26256
|
+
unreachable,
|
|
26257
|
+
entries,
|
|
26258
|
+
durationMs: Date.now() - startedAt
|
|
26259
|
+
};
|
|
26260
|
+
} catch (e) {
|
|
26261
|
+
return {
|
|
26262
|
+
status: "failed",
|
|
26263
|
+
checked: entries.length,
|
|
26264
|
+
unreachable: entries.filter((entry) => !entry.reachable),
|
|
26265
|
+
entries,
|
|
26266
|
+
durationMs: Date.now() - startedAt,
|
|
26267
|
+
error: truncateValidationOutput(e?.message || String(e))
|
|
26268
|
+
};
|
|
26269
|
+
}
|
|
26270
|
+
}
|
|
26196
26271
|
function buildMeshRefineValidationPlan(mesh, workspace) {
|
|
26197
26272
|
const plan = resolveMeshRefineValidationPlan(mesh, workspace);
|
|
26198
26273
|
return {
|
|
@@ -27301,6 +27376,37 @@ var DaemonCommandRouter = class {
|
|
|
27301
27376
|
}
|
|
27302
27377
|
};
|
|
27303
27378
|
}
|
|
27379
|
+
const submoduleReachabilityStarted = Date.now();
|
|
27380
|
+
const submoduleReachability = await runMeshRefineSubmoduleReachabilityGate(repoRoot, patchEquivalence.mergedTree || branchHead);
|
|
27381
|
+
recordMeshRefineStage(refineStages, "submodule_reachability", submoduleReachability.status, submoduleReachabilityStarted, {
|
|
27382
|
+
checked: submoduleReachability.checked,
|
|
27383
|
+
unreachable: submoduleReachability.unreachable.map((entry) => ({ path: entry.path, commit: entry.commit, error: entry.error })),
|
|
27384
|
+
error: submoduleReachability.error
|
|
27385
|
+
});
|
|
27386
|
+
if (submoduleReachability.status === "failed") {
|
|
27387
|
+
return {
|
|
27388
|
+
success: false,
|
|
27389
|
+
code: "submodule_reachability_failed",
|
|
27390
|
+
convergenceStatus: "blocked_review",
|
|
27391
|
+
error: "Refinery submodule reachability preflight failed; merge/refine cleanup was not attempted.",
|
|
27392
|
+
branch,
|
|
27393
|
+
into: baseBranch,
|
|
27394
|
+
validationSummary,
|
|
27395
|
+
patchEquivalence,
|
|
27396
|
+
submoduleReachability,
|
|
27397
|
+
refineStages,
|
|
27398
|
+
finalBranchConvergenceState: {
|
|
27399
|
+
branch,
|
|
27400
|
+
baseBranch,
|
|
27401
|
+
merged: false,
|
|
27402
|
+
removed: false,
|
|
27403
|
+
validation: "passed",
|
|
27404
|
+
patchEquivalence: "passed",
|
|
27405
|
+
submoduleReachability: "failed",
|
|
27406
|
+
status: "blocked_review"
|
|
27407
|
+
}
|
|
27408
|
+
};
|
|
27409
|
+
}
|
|
27304
27410
|
let mergeResult;
|
|
27305
27411
|
const mergeStarted = Date.now();
|
|
27306
27412
|
try {
|