@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.mjs
CHANGED
|
@@ -25941,6 +25941,81 @@ async function runMeshRefinePatchEquivalenceGate(repoRoot, baseHead, branchHead)
|
|
|
25941
25941
|
};
|
|
25942
25942
|
}
|
|
25943
25943
|
}
|
|
25944
|
+
async function runMeshRefineSubmoduleReachabilityGate(repoRoot, mergedTree) {
|
|
25945
|
+
const startedAt = Date.now();
|
|
25946
|
+
const entries = [];
|
|
25947
|
+
try {
|
|
25948
|
+
const { execFile: execFile3 } = await import("child_process");
|
|
25949
|
+
const { promisify: promisify3 } = await import("util");
|
|
25950
|
+
const execFileAsync3 = promisify3(execFile3);
|
|
25951
|
+
const runGit2 = async (cwd, args) => {
|
|
25952
|
+
const { stdout } = await execFileAsync3("git", args, {
|
|
25953
|
+
cwd,
|
|
25954
|
+
encoding: "utf8",
|
|
25955
|
+
timeout: 3e4,
|
|
25956
|
+
maxBuffer: REFINE_PATCH_EQUIVALENCE_OUTPUT_LIMIT_BYTES,
|
|
25957
|
+
windowsHide: true
|
|
25958
|
+
});
|
|
25959
|
+
return String(stdout || "");
|
|
25960
|
+
};
|
|
25961
|
+
const treeOutput = await runGit2(repoRoot, ["ls-tree", "-r", "-z", mergedTree]);
|
|
25962
|
+
const gitlinks = treeOutput.split("\0").filter(Boolean).map((record) => {
|
|
25963
|
+
const match = /^160000\s+commit\s+([0-9a-f]{40})\t(.+)$/.exec(record);
|
|
25964
|
+
return match ? { commit: match[1], path: match[2] } : null;
|
|
25965
|
+
}).filter((entry) => !!entry);
|
|
25966
|
+
for (const gitlink of gitlinks) {
|
|
25967
|
+
const submodulePath = pathResolve(repoRoot, gitlink.path);
|
|
25968
|
+
const entry = {
|
|
25969
|
+
path: gitlink.path,
|
|
25970
|
+
commit: gitlink.commit,
|
|
25971
|
+
reachable: false
|
|
25972
|
+
};
|
|
25973
|
+
try {
|
|
25974
|
+
if (!fs10.existsSync(submodulePath)) {
|
|
25975
|
+
entry.error = `Submodule checkout missing at ${gitlink.path}`;
|
|
25976
|
+
entries.push(entry);
|
|
25977
|
+
continue;
|
|
25978
|
+
}
|
|
25979
|
+
entry.checkedLocal = true;
|
|
25980
|
+
try {
|
|
25981
|
+
await runGit2(submodulePath, ["cat-file", "-e", `${gitlink.commit}^{commit}`]);
|
|
25982
|
+
entry.reachable = true;
|
|
25983
|
+
entries.push(entry);
|
|
25984
|
+
continue;
|
|
25985
|
+
} catch {
|
|
25986
|
+
}
|
|
25987
|
+
try {
|
|
25988
|
+
await runGit2(submodulePath, ["fetch", "origin", gitlink.commit]);
|
|
25989
|
+
entry.fetchedFromOrigin = true;
|
|
25990
|
+
await runGit2(submodulePath, ["cat-file", "-e", `${gitlink.commit}^{commit}`]);
|
|
25991
|
+
entry.reachable = true;
|
|
25992
|
+
} catch (e) {
|
|
25993
|
+
entry.error = truncateValidationOutput(e?.stderr || e?.message || String(e));
|
|
25994
|
+
}
|
|
25995
|
+
} catch (e) {
|
|
25996
|
+
entry.error = truncateValidationOutput(e?.message || String(e));
|
|
25997
|
+
}
|
|
25998
|
+
entries.push(entry);
|
|
25999
|
+
}
|
|
26000
|
+
const unreachable = entries.filter((entry) => !entry.reachable);
|
|
26001
|
+
return {
|
|
26002
|
+
status: unreachable.length ? "failed" : "passed",
|
|
26003
|
+
checked: entries.length,
|
|
26004
|
+
unreachable,
|
|
26005
|
+
entries,
|
|
26006
|
+
durationMs: Date.now() - startedAt
|
|
26007
|
+
};
|
|
26008
|
+
} catch (e) {
|
|
26009
|
+
return {
|
|
26010
|
+
status: "failed",
|
|
26011
|
+
checked: entries.length,
|
|
26012
|
+
unreachable: entries.filter((entry) => !entry.reachable),
|
|
26013
|
+
entries,
|
|
26014
|
+
durationMs: Date.now() - startedAt,
|
|
26015
|
+
error: truncateValidationOutput(e?.message || String(e))
|
|
26016
|
+
};
|
|
26017
|
+
}
|
|
26018
|
+
}
|
|
25944
26019
|
function buildMeshRefineValidationPlan(mesh, workspace) {
|
|
25945
26020
|
const plan = resolveMeshRefineValidationPlan(mesh, workspace);
|
|
25946
26021
|
return {
|
|
@@ -27049,6 +27124,37 @@ var DaemonCommandRouter = class {
|
|
|
27049
27124
|
}
|
|
27050
27125
|
};
|
|
27051
27126
|
}
|
|
27127
|
+
const submoduleReachabilityStarted = Date.now();
|
|
27128
|
+
const submoduleReachability = await runMeshRefineSubmoduleReachabilityGate(repoRoot, patchEquivalence.mergedTree || branchHead);
|
|
27129
|
+
recordMeshRefineStage(refineStages, "submodule_reachability", submoduleReachability.status, submoduleReachabilityStarted, {
|
|
27130
|
+
checked: submoduleReachability.checked,
|
|
27131
|
+
unreachable: submoduleReachability.unreachable.map((entry) => ({ path: entry.path, commit: entry.commit, error: entry.error })),
|
|
27132
|
+
error: submoduleReachability.error
|
|
27133
|
+
});
|
|
27134
|
+
if (submoduleReachability.status === "failed") {
|
|
27135
|
+
return {
|
|
27136
|
+
success: false,
|
|
27137
|
+
code: "submodule_reachability_failed",
|
|
27138
|
+
convergenceStatus: "blocked_review",
|
|
27139
|
+
error: "Refinery submodule reachability preflight failed; merge/refine cleanup was not attempted.",
|
|
27140
|
+
branch,
|
|
27141
|
+
into: baseBranch,
|
|
27142
|
+
validationSummary,
|
|
27143
|
+
patchEquivalence,
|
|
27144
|
+
submoduleReachability,
|
|
27145
|
+
refineStages,
|
|
27146
|
+
finalBranchConvergenceState: {
|
|
27147
|
+
branch,
|
|
27148
|
+
baseBranch,
|
|
27149
|
+
merged: false,
|
|
27150
|
+
removed: false,
|
|
27151
|
+
validation: "passed",
|
|
27152
|
+
patchEquivalence: "passed",
|
|
27153
|
+
submoduleReachability: "failed",
|
|
27154
|
+
status: "blocked_review"
|
|
27155
|
+
}
|
|
27156
|
+
};
|
|
27157
|
+
}
|
|
27052
27158
|
let mergeResult;
|
|
27053
27159
|
const mergeStarted = Date.now();
|
|
27054
27160
|
try {
|