@treeseed/sdk 0.8.2 → 0.8.3

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.
@@ -1304,12 +1304,29 @@ function prepareFreshReleaseRun(root, branch, rootRepo, packageReports) {
1304
1304
  }
1305
1305
  return { archived, blockers };
1306
1306
  }
1307
- function findAutoResumableReleaseRun(root, branch, rootRepo, packageReports) {
1307
+ function findAutoResumableReleaseRun(root, branch, rootRepo, packageReports, options = {}) {
1308
1308
  if (branch !== STAGING_BRANCH) return null;
1309
+ const currentHeads = Object.fromEntries([
1310
+ [rootRepo.name, rootRepo.commitSha ?? null],
1311
+ ...packageReports.map((report) => [report.name, report.commitSha ?? null])
1312
+ ]);
1309
1313
  return listInterruptedWorkflowRuns(root).find((journal) => {
1310
1314
  if (journal.command !== "release" || !journal.resumable || journal.session.branchName !== STAGING_BRANCH) {
1311
1315
  return false;
1312
1316
  }
1317
+ const classification = classifyWorkflowRunJournal(journal, {
1318
+ currentBranch: branch,
1319
+ currentHeads
1320
+ });
1321
+ if (classification.state !== "resumable") {
1322
+ if (options.archiveStale && classification.state === "stale") {
1323
+ archiveWorkflowRun(root, journal.runId, {
1324
+ ...classification,
1325
+ reasons: ["release auto-resume skipped stale failed release", ...classification.reasons]
1326
+ });
1327
+ }
1328
+ return false;
1329
+ }
1313
1330
  const releasePlan = stringRecord(journal.steps.find((step) => step.id === "release-plan")?.data);
1314
1331
  const nextStep = nextPendingJournalStep(journal);
1315
1332
  if (releaseRunHasCompletedMutation(journal)) {
@@ -3714,7 +3731,7 @@ async function workflowRelease(helpers, input) {
3714
3731
  const explicitResumeRunId = helpers.context.workflow?.resumeRunId ?? null;
3715
3732
  const freshRelease = input.fresh === true && !explicitResumeRunId;
3716
3733
  const freshPreparation = freshRelease && executionMode === "execute" ? prepareFreshReleaseRun(root, session.branchName, rootRepo, packageReports) : { archived: [], blockers: [] };
3717
- const autoResumeRun = executionMode === "execute" && !explicitResumeRunId && !freshRelease ? findAutoResumableReleaseRun(root, session.branchName, rootRepo, packageReports) : null;
3734
+ const autoResumeRun = executionMode === "execute" && !explicitResumeRunId && !freshRelease ? findAutoResumableReleaseRun(root, session.branchName, rootRepo, packageReports, { archiveStale: true }) : null;
3718
3735
  const planAutoResumeRun = executionMode === "plan" && input.fresh !== true ? findAutoResumableReleaseRun(root, session.branchName, rootRepo, packageReports) : null;
3719
3736
  const effectiveInput = autoResumeRun ? {
3720
3737
  ...autoResumeRun.input,
@@ -3897,6 +3914,7 @@ async function workflowRelease(helpers, input) {
3897
3914
  onProgress: (line, stream) => helpers.write(line, stream)
3898
3915
  }).then((workflowGates) => ({ workflowGates })));
3899
3916
  const hostedDeploymentState2 = recordHostedDeploymentStatesFromRootGates(root, rootRelease2, rootWorkflowGateResult2?.workflowGates);
3917
+ ensureWorkflowWorkspaceLinks(root, helpers, effectiveInput.workspaceLinks ?? "auto");
3900
3918
  const hostingAudit2 = await runReadOnlyHostingAuditForWorkflow("release", root, helpers, "prod", {
3901
3919
  enabled: true,
3902
3920
  strict: false
@@ -4203,6 +4221,7 @@ async function workflowRelease(helpers, input) {
4203
4221
  onProgress: (line, stream) => helpers.write(line, stream)
4204
4222
  }).then((workflowGates) => ({ workflowGates })));
4205
4223
  const hostedDeploymentState = recordHostedDeploymentStatesFromRootGates(root, rootRelease, rootWorkflowGateResult?.workflowGates);
4224
+ ensureWorkflowWorkspaceLinks(root, helpers, effectiveInput.workspaceLinks ?? "auto");
4206
4225
  const hostingAudit = await runReadOnlyHostingAuditForWorkflow("release", root, helpers, "prod", {
4207
4226
  enabled: true,
4208
4227
  strict: false
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@treeseed/sdk",
3
- "version": "0.8.2",
3
+ "version": "0.8.3",
4
4
  "description": "Shared Treeseed SDK for content-backed and D1-backed object models.",
5
5
  "license": "AGPL-3.0-only",
6
6
  "repository": {