@mestreyoda/fabrica 0.2.2 → 0.2.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.
package/dist/index.js CHANGED
@@ -111324,8 +111324,8 @@ import fsSync from "node:fs";
111324
111324
  import path5 from "node:path";
111325
111325
  import { fileURLToPath as fileURLToPath3 } from "node:url";
111326
111326
  function getCurrentVersion() {
111327
- if ("0.2.2") {
111328
- return "0.2.2";
111327
+ if ("0.2.3") {
111328
+ return "0.2.3";
111329
111329
  }
111330
111330
  try {
111331
111331
  const pkgPath = path5.join(THIS_DIR, "..", "..", "package.json");
@@ -130543,30 +130543,52 @@ async function projectTick(opts) {
130543
130543
  }
130544
130544
  if (role === "reviewer" || role === "tester") {
130545
130545
  const issueRuntime = getIssueRuntime(fresh, issue2.iid);
130546
- const prSelector = getCanonicalPrSelector(fresh, issue2.iid);
130546
+ let prSelector = getCanonicalPrSelector(fresh, issue2.iid);
130547
130547
  if (!prSelector?.prNumber) {
130548
- const feedbackLabel = getFeedbackQueueLabel(workflow);
130549
- if (!dryRun && feedbackLabel && feedbackLabel !== currentLabel) {
130550
- try {
130551
- await provider.transitionLabel(issue2.iid, currentLabel, feedbackLabel);
130552
- await log(workspaceDir, "queue_pr_guard", {
130553
- project: project.name,
130554
- projectSlug,
130555
- issueId: issue2.iid,
130556
- role,
130557
- from: currentLabel,
130558
- to: feedbackLabel,
130559
- prState: issueRuntime?.currentPrState ?? null,
130560
- prUrl: issueRuntime?.currentPrUrl ?? null,
130561
- prNumber: null,
130562
- currentIssueMatch: null,
130563
- reason: "missing_canonical_pr"
130548
+ const fallbackStatus = await provider.getPrStatus(issue2.iid).catch(() => null);
130549
+ const hasFallbackPr = !!fallbackStatus?.url && !!fallbackStatus.number && fallbackStatus.state !== PrState.MERGED && fallbackStatus.state !== PrState.CLOSED && fallbackStatus.currentIssueMatch !== false;
130550
+ if (hasFallbackPr && fallbackStatus?.number) {
130551
+ if (!dryRun) {
130552
+ await updateIssueRuntime(workspaceDir, projectSlug, issue2.iid, {
130553
+ currentPrNumber: fallbackStatus.number,
130554
+ currentPrUrl: fallbackStatus.url,
130555
+ currentPrState: fallbackStatus.state ?? null
130556
+ }).catch(() => {
130564
130557
  });
130565
- } catch {
130566
130558
  }
130559
+ const runtimeKey = String(issue2.iid);
130560
+ fresh.issueRuntime = fresh.issueRuntime ?? {};
130561
+ fresh.issueRuntime[runtimeKey] = {
130562
+ ...fresh.issueRuntime[runtimeKey] ?? {},
130563
+ currentPrNumber: fallbackStatus.number,
130564
+ currentPrUrl: fallbackStatus.url ?? null,
130565
+ currentPrState: fallbackStatus.state ?? null
130566
+ };
130567
+ prSelector = { prNumber: fallbackStatus.number };
130568
+ } else {
130569
+ const feedbackLabel = getFeedbackQueueLabel(workflow);
130570
+ if (!dryRun && feedbackLabel && feedbackLabel !== currentLabel) {
130571
+ try {
130572
+ await provider.transitionLabel(issue2.iid, currentLabel, feedbackLabel);
130573
+ await log(workspaceDir, "queue_pr_guard", {
130574
+ project: project.name,
130575
+ projectSlug,
130576
+ issueId: issue2.iid,
130577
+ role,
130578
+ from: currentLabel,
130579
+ to: feedbackLabel,
130580
+ prState: issueRuntime?.currentPrState ?? null,
130581
+ prUrl: issueRuntime?.currentPrUrl ?? null,
130582
+ prNumber: null,
130583
+ currentIssueMatch: null,
130584
+ reason: "missing_canonical_pr"
130585
+ });
130586
+ } catch {
130587
+ }
130588
+ }
130589
+ skipped.push({ role, reason: "No canonical bound PR for review/test cycle" });
130590
+ continue;
130567
130591
  }
130568
- skipped.push({ role, reason: "No canonical bound PR for review/test cycle" });
130569
- continue;
130570
130592
  }
130571
130593
  const prStatus = await provider.getPrStatus(issue2.iid, prSelector);
130572
130594
  const hasReviewablePr = !!prStatus.url && prStatus.state !== PrState.MERGED && prStatus.state !== PrState.CLOSED && prStatus.currentIssueMatch !== false;