@adhdev/daemon-core 0.9.82-rc.64 → 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.mjs CHANGED
@@ -25149,6 +25149,7 @@ function summarizeRepoMeshStatusDebug(status) {
25149
25149
  meshId: readStringValue(status?.meshId, status?.mesh_id) ?? null,
25150
25150
  refreshedAt: readStringValue(status?.refreshedAt, status?.refreshed_at) ?? null,
25151
25151
  sourceOfTruth: status?.sourceOfTruth ?? null,
25152
+ branchConvergenceSummary: status?.branchConvergenceSummary ?? status?.branch_convergence_summary ?? null,
25152
25153
  nodeCount: nodes.length,
25153
25154
  nodes: nodes.map((node) => ({
25154
25155
  nodeId: readStringValue(node?.nodeId, node?.id) ?? null,
@@ -25164,7 +25165,8 @@ function summarizeRepoMeshStatusDebug(status) {
25164
25165
  } : null,
25165
25166
  gitProbePending: node?.gitProbePending === true,
25166
25167
  launchReady: node?.launchReady === true,
25167
- git: summarizeRepoMeshDebugGit(node?.git)
25168
+ git: summarizeRepoMeshDebugGit(node?.git),
25169
+ branchConvergence: node?.branchConvergence ?? node?.branch_convergence ?? null
25168
25170
  }))
25169
25171
  };
25170
25172
  }
@@ -25666,7 +25668,7 @@ function finalizeMeshNodeStatus(args) {
25666
25668
  async function probeRemoteMeshGitStatus(args) {
25667
25669
  if (!args.dispatchMeshCommand) return null;
25668
25670
  const remoteResult = await Promise.race([
25669
- args.dispatchMeshCommand(args.daemonId, "git_status", { workspace: args.workspace }),
25671
+ args.dispatchMeshCommand(args.daemonId, "git_status", { workspace: args.workspace, refreshUpstream: true }),
25670
25672
  new Promise((_, reject) => setTimeout(() => reject(new Error("timeout")), args.timeoutMs))
25671
25673
  ]);
25672
25674
  const remoteGit = remoteResult?.status ?? remoteResult?.git ?? remoteResult;
@@ -25939,6 +25941,81 @@ async function runMeshRefinePatchEquivalenceGate(repoRoot, baseHead, branchHead)
25939
25941
  };
25940
25942
  }
25941
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
+ }
25942
26019
  function buildMeshRefineValidationPlan(mesh, workspace) {
25943
26020
  const plan = resolveMeshRefineValidationPlan(mesh, workspace);
25944
26021
  return {
@@ -27047,6 +27124,37 @@ var DaemonCommandRouter = class {
27047
27124
  }
27048
27125
  };
27049
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
+ }
27050
27158
  let mergeResult;
27051
27159
  const mergeStarted = Date.now();
27052
27160
  try {