paperclip-github-plugin 0.17.2 → 0.17.4
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/manifest.js +1 -1
- package/dist/worker.js +36 -23
- package/package.json +1 -1
package/dist/manifest.js
CHANGED
|
@@ -691,7 +691,7 @@ var COMPANY_METRIC_API_ROUTE_URL_PATH = `/api/plugins/${GITHUB_SYNC_PLUGIN_ID}/a
|
|
|
691
691
|
var require2 = createRequire(import.meta.url);
|
|
692
692
|
var packageJson = require2("../package.json");
|
|
693
693
|
var SCHEDULE_TICK_CRON = "* * * * *";
|
|
694
|
-
var MANIFEST_VERSION = "0.17.
|
|
694
|
+
var MANIFEST_VERSION = "0.17.4"?.trim() || typeof packageJson.version === "string" && packageJson.version.trim() || process.env.npm_package_version?.trim() || "0.0.0-dev";
|
|
695
695
|
var COMPANY_SECRET_REF_VALUE_SCHEMA = {
|
|
696
696
|
anyOf: [
|
|
697
697
|
{ type: "string" },
|
package/dist/worker.js
CHANGED
|
@@ -1075,6 +1075,7 @@ var ISSUE_INTERACTION_REASON_CODES = /* @__PURE__ */ new Set([
|
|
|
1075
1075
|
"github_sync_status_decision"
|
|
1076
1076
|
]);
|
|
1077
1077
|
var ISSUE_INTERACTION_MAX_SCAN_ROWS = 5e3;
|
|
1078
|
+
var ISSUE_INTERACTION_MAX_LIST_ROWS = 2e4;
|
|
1078
1079
|
var ISSUE_INTERACTION_MAX_REPEATED_ACTIONS = 10;
|
|
1079
1080
|
var SOURCES = /* @__PURE__ */ new Set(["agent_tool", "sync", "api_route", "operator_action", "backfill"]);
|
|
1080
1081
|
var OUTCOMES = /* @__PURE__ */ new Set(["observed", "changed", "noop", "failed"]);
|
|
@@ -11236,7 +11237,7 @@ async function synchronizePaperclipIssueStatuses(ctx, octokit, repository, mappi
|
|
|
11236
11237
|
importedIssue.remoteActionFingerprint = remoteActionFingerprint;
|
|
11237
11238
|
importedIssue.selectedPullRequestGate = effectiveGate ? { repositoryUrl: effectiveGate.repositoryUrl, number: effectiveGate.number } : void 0;
|
|
11238
11239
|
if (pendingWake2) importedIssue.pendingRemoteActionWake = pendingWake2;
|
|
11239
|
-
|
|
11240
|
+
delete importedIssue.activationPending;
|
|
11240
11241
|
await persistImportRegistry();
|
|
11241
11242
|
};
|
|
11242
11243
|
if (paperclipIssue.status === nextStatus) {
|
|
@@ -11254,24 +11255,28 @@ async function synchronizePaperclipIssueStatuses(ctx, octokit, repository, mappi
|
|
|
11254
11255
|
}, createWakeFingerprint) : void 0;
|
|
11255
11256
|
if (pendingWake2) importedIssue.pendingRemoteActionWake = pendingWake2;
|
|
11256
11257
|
if (pendingWake2 || isPendingInitialActivation) await persistImportRegistry();
|
|
11257
|
-
|
|
11258
|
-
|
|
11259
|
-
|
|
11260
|
-
|
|
11261
|
-
|
|
11262
|
-
|
|
11263
|
-
|
|
11264
|
-
|
|
11265
|
-
|
|
11266
|
-
|
|
11267
|
-
|
|
11268
|
-
|
|
11269
|
-
|
|
11270
|
-
|
|
11271
|
-
|
|
11272
|
-
|
|
11273
|
-
|
|
11274
|
-
|
|
11258
|
+
const shouldClearExecutionPolicy = (shouldPreserveMaintainerWaitRouting || shouldClearCompletedExecutionPolicy) && Boolean(paperclipIssueSyncContext.executionPolicy);
|
|
11259
|
+
const hasStatusMutation = nextAssigneeChanged || shouldClearTransitionAssignee || shouldClearExecutionPolicy;
|
|
11260
|
+
if (hasStatusMutation) {
|
|
11261
|
+
updateSyncFailureContext(syncFailureContext, {
|
|
11262
|
+
phase: "updating_paperclip_status",
|
|
11263
|
+
repositoryUrl: repository.url,
|
|
11264
|
+
githubIssueNumber: githubIssue.number
|
|
11265
|
+
});
|
|
11266
|
+
await updatePaperclipIssueState(ctx, {
|
|
11267
|
+
companyId: mapping.companyId,
|
|
11268
|
+
issueId: importedIssue.paperclipIssueId,
|
|
11269
|
+
currentStatus: paperclipIssue.status,
|
|
11270
|
+
syncContext: paperclipIssueSyncContext,
|
|
11271
|
+
nextStatus,
|
|
11272
|
+
...nextAssigneeChanged && nextTransitionAssignee ? { nextAssignee: nextTransitionAssignee.principal } : {},
|
|
11273
|
+
...shouldClearTransitionAssignee ? { clearAssignee: true } : {},
|
|
11274
|
+
...shouldClearExecutionPolicy ? { clearExecutionPolicy: true } : {},
|
|
11275
|
+
transitionComment: "",
|
|
11276
|
+
actionFingerprint: actionJournalFingerprint,
|
|
11277
|
+
paperclipApiBaseUrl
|
|
11278
|
+
});
|
|
11279
|
+
}
|
|
11275
11280
|
if (pendingWake2) {
|
|
11276
11281
|
await persistObservedRemoteState(pendingWake2);
|
|
11277
11282
|
queuedIssueWakeups.push({
|
|
@@ -11636,7 +11641,8 @@ async function synchronizePaperclipPullRequestIssueStatuses(ctx, octokit, mappin
|
|
|
11636
11641
|
await persistRemoteActionRegistry();
|
|
11637
11642
|
remoteAction = remoteActionRegistry.find((record) => record.key === remoteActionKey) ?? remoteAction;
|
|
11638
11643
|
}
|
|
11639
|
-
|
|
11644
|
+
const shouldClearExistingExecutionPolicy = (shouldPreserveMaintainerWaitRouting || shouldClearCompletedExecutionPolicy) && Boolean(paperclipIssueSyncContext.executionPolicy);
|
|
11645
|
+
if (shouldClearTransitionAssignee || shouldClearExistingExecutionPolicy || nextAssigneeChanged) {
|
|
11640
11646
|
updateSyncFailureContext(syncFailureContext, {
|
|
11641
11647
|
phase: "updating_paperclip_status",
|
|
11642
11648
|
repositoryUrl: primaryRepository?.url,
|
|
@@ -11650,7 +11656,7 @@ async function synchronizePaperclipPullRequestIssueStatuses(ctx, octokit, mappin
|
|
|
11650
11656
|
nextStatus,
|
|
11651
11657
|
...nextAssigneeChanged && nextTransitionAssignee ? { nextAssignee: nextTransitionAssignee.principal } : {},
|
|
11652
11658
|
...shouldClearTransitionAssignee ? { clearAssignee: true } : {},
|
|
11653
|
-
...
|
|
11659
|
+
...shouldClearExistingExecutionPolicy ? { clearExecutionPolicy: true } : {},
|
|
11654
11660
|
transitionComment: "",
|
|
11655
11661
|
actionFingerprint: actionJournalFingerprint,
|
|
11656
11662
|
paperclipApiBaseUrl
|
|
@@ -16731,6 +16737,7 @@ async function listIssueInteractionEvents(ctx, companyId, paperclipIssueId, rang
|
|
|
16731
16737
|
let ledgerStartedAt = null;
|
|
16732
16738
|
const fromMs = Date.parse(range.from);
|
|
16733
16739
|
const toMs = Date.parse(range.to);
|
|
16740
|
+
let listedRows = 0;
|
|
16734
16741
|
outer: for (let offset = 0; ; ) {
|
|
16735
16742
|
const page = await ctx.entities.list({
|
|
16736
16743
|
entityType: ISSUE_INTERACTION_ENTITY_TYPE,
|
|
@@ -16740,14 +16747,19 @@ async function listIssueInteractionEvents(ctx, companyId, paperclipIssueId, rang
|
|
|
16740
16747
|
offset
|
|
16741
16748
|
});
|
|
16742
16749
|
for (const entry of page) {
|
|
16743
|
-
|
|
16750
|
+
listedRows += 1;
|
|
16751
|
+
if (listedRows > ISSUE_INTERACTION_MAX_LIST_ROWS) {
|
|
16744
16752
|
scanTruncated = true;
|
|
16745
16753
|
break outer;
|
|
16746
16754
|
}
|
|
16747
|
-
scannedRows += 1;
|
|
16748
16755
|
if (entry.scopeKind !== "issue" || entry.scopeId !== paperclipIssueId) continue;
|
|
16749
16756
|
const raw = entry.data;
|
|
16750
16757
|
if (raw?.companyId !== companyId || raw?.paperclipIssueId !== paperclipIssueId) continue;
|
|
16758
|
+
if (scannedRows >= ISSUE_INTERACTION_MAX_SCAN_ROWS) {
|
|
16759
|
+
scanTruncated = true;
|
|
16760
|
+
break outer;
|
|
16761
|
+
}
|
|
16762
|
+
scannedRows += 1;
|
|
16751
16763
|
try {
|
|
16752
16764
|
const event = sanitizeIssueInteractionEvent(raw);
|
|
16753
16765
|
if (ledgerStartedAt === null || event.occurredAt < ledgerStartedAt) ledgerStartedAt = event.occurredAt;
|
|
@@ -18049,6 +18061,7 @@ function shouldStartWorkerHost(moduleUrl, entry = process.argv[1]) {
|
|
|
18049
18061
|
}
|
|
18050
18062
|
}
|
|
18051
18063
|
var __testing = {
|
|
18064
|
+
listIssueInteractionEvents,
|
|
18052
18065
|
buildDirectPullRequestActionFingerprint,
|
|
18053
18066
|
buildRemoteActionFingerprint,
|
|
18054
18067
|
canReservePendingWake,
|