@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.js CHANGED
@@ -25401,6 +25401,7 @@ function summarizeRepoMeshStatusDebug(status) {
25401
25401
  meshId: readStringValue(status?.meshId, status?.mesh_id) ?? null,
25402
25402
  refreshedAt: readStringValue(status?.refreshedAt, status?.refreshed_at) ?? null,
25403
25403
  sourceOfTruth: status?.sourceOfTruth ?? null,
25404
+ branchConvergenceSummary: status?.branchConvergenceSummary ?? status?.branch_convergence_summary ?? null,
25404
25405
  nodeCount: nodes.length,
25405
25406
  nodes: nodes.map((node) => ({
25406
25407
  nodeId: readStringValue(node?.nodeId, node?.id) ?? null,
@@ -25416,7 +25417,8 @@ function summarizeRepoMeshStatusDebug(status) {
25416
25417
  } : null,
25417
25418
  gitProbePending: node?.gitProbePending === true,
25418
25419
  launchReady: node?.launchReady === true,
25419
- git: summarizeRepoMeshDebugGit(node?.git)
25420
+ git: summarizeRepoMeshDebugGit(node?.git),
25421
+ branchConvergence: node?.branchConvergence ?? node?.branch_convergence ?? null
25420
25422
  }))
25421
25423
  };
25422
25424
  }
@@ -25918,7 +25920,7 @@ function finalizeMeshNodeStatus(args) {
25918
25920
  async function probeRemoteMeshGitStatus(args) {
25919
25921
  if (!args.dispatchMeshCommand) return null;
25920
25922
  const remoteResult = await Promise.race([
25921
- args.dispatchMeshCommand(args.daemonId, "git_status", { workspace: args.workspace }),
25923
+ args.dispatchMeshCommand(args.daemonId, "git_status", { workspace: args.workspace, refreshUpstream: true }),
25922
25924
  new Promise((_, reject) => setTimeout(() => reject(new Error("timeout")), args.timeoutMs))
25923
25925
  ]);
25924
25926
  const remoteGit = remoteResult?.status ?? remoteResult?.git ?? remoteResult;
@@ -26191,6 +26193,81 @@ async function runMeshRefinePatchEquivalenceGate(repoRoot, baseHead, branchHead)
26191
26193
  };
26192
26194
  }
26193
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
+ }
26194
26271
  function buildMeshRefineValidationPlan(mesh, workspace) {
26195
26272
  const plan = resolveMeshRefineValidationPlan(mesh, workspace);
26196
26273
  return {
@@ -27299,6 +27376,37 @@ var DaemonCommandRouter = class {
27299
27376
  }
27300
27377
  };
27301
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
+ }
27302
27410
  let mergeResult;
27303
27411
  const mergeStarted = Date.now();
27304
27412
  try {