@volter/supercode-orchestrator 0.5.126 → 0.5.127

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.
Files changed (2) hide show
  1. package/board/ci.mjs +11 -3
  2. package/package.json +1 -1
package/board/ci.mjs CHANGED
@@ -411,12 +411,20 @@ export async function inspectCompletionEvidence(board, id, entry, payload = {},
411
411
  // Merged source is immutable and needs no surviving workspace. Resolve an
412
412
  // unmerged candidate's checkout as before; a broken legacy path never
413
413
  // prevents a verdict on already merged commits.
414
- const mergedOnly = urls.length && (await Promise.all(urls.map(readPullRequest))).every(pr => pr.state === 'MERGED');
414
+ const read = await Promise.all(urls.map(readPullRequest));
415
+ const mergedOnly = urls.length && read.every(pr => pr.state === 'MERGED');
415
416
  const own = mergedOnly ? null : await repositoryWorkspace(board, id);
416
417
  if (!own && !urls.length) {
417
418
  return state;
418
419
  }
419
- if (!own && !mergedOnly) throw new Error('An unmerged PR candidate needs a resolved repository workspace.');
420
+ // A card with no repository of its own (scratch) is reviewed through the branches it registered: each unmerged PR
421
+ // on one of them (or on its wt/<card> branch) is read at its pushed head, and needs no checkout to exist here.
422
+ if (!own && !mergedOnly) {
423
+ const registered = registeredBranches(board, id);
424
+ const declared = (pr) => namedWorkBranch(id, pr.headRefName) || registered.some((r) => r.branch === pr.headRefName && r.repository.toLowerCase() === repositoryOf(pr.url).toLowerCase());
425
+ const stray = read.find((pr) => pr.state !== 'MERGED' && !declared(pr));
426
+ if (stray) throw new Error(`An unmerged PR candidate needs a repository workspace: ${stray.url} (${stray.headRefName}) is on no branch the card or its tasks declare; register it with create "<what>" --subtask-of ${id} --workspace worktree:${repositoryOf(stray.url)} --branch ${stray.headRefName}`);
427
+ }
420
428
  // A verdict with no requested PR (a scratch arc) keeps its own contract. An arc's review
421
429
  // always names every opened PR it changed, independent of completion_ci.
422
430
  if (stage === 'review_verdict' && !asked && !urls.length) return state;
@@ -452,7 +460,7 @@ async function verifyPullRequest(board, id, entry, own, url, supplied, stage) {
452
460
  // card's own checkout, and this machine's checkout of the PR's branch when it keeps one, must also hold that head
453
461
  // with nothing uncommitted. A card on another machine is reviewed at its pushed head: its checkout is not read from here.
454
462
  const observed = await readPullRequest(url);
455
- const path = !own?.here || observed.state === 'MERGED' ? null : await originOf(own.path) === repository && await run('git', ['branch', '--show-current'], own.path) === observed.headRefName ? own.path : await branchCheckout(board, id, repository, observed.headRefName);
463
+ const path = observed.state === 'MERGED' || (own && !own.here) ? null : !own ? await branchCheckout(board, id, repository, observed.headRefName) : await originOf(own.path) === repository && await run('git', ['branch', '--show-current'], own.path) === observed.headRefName ? own.path : await branchCheckout(board, id, repository, observed.headRefName);
456
464
  // A PR merged before its review (an outage fix landed first) is still reviewed: its head is fixed for good, so the
457
465
  // verdict is recorded on that head, and nothing about a worktree or its base can move under it any more.
458
466
  const merged = observed.state === 'MERGED';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@volter/supercode-orchestrator",
3
- "version": "0.5.126",
3
+ "version": "0.5.127",
4
4
  "type": "module",
5
5
  "description": "The orchestrator runtime over the Volter Harness ontology: one typed operational model whose folder is its serialization, read and written through the harness orchestration doors (docs/ORCHESTRATOR-IR.md)",
6
6
  "exports": {