@vypdev/copilot 3.9.2 → 3.10.0
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/action.yml +5 -0
- package/build/api/index.js +283 -52
- package/build/api/src/data/model/application_error.d.ts +22 -1
- package/build/api/src/domain/approval_evidence_diagnostic.d.ts +30 -0
- package/build/api/src/domain/bugbot/context.d.ts +2 -0
- package/build/api/src/domain/bugbot/finding.d.ts +11 -7
- package/build/api/src/domain/closed_issue_reconciliation.d.ts +11 -0
- package/build/cli/index.js +2451 -288
- package/build/github_action/index.js +2891 -287
- package/build/web/assets/{index-CsboG2sG.js → index-CNXf8Vmj.js} +1 -1
- package/build/web/index.html +1 -1
- package/package.json +2 -1
- package/setup/actions/copilot-verification-setup/action.yml +13 -0
- package/setup/workflows/copilot_commit.yml +2 -0
- package/setup/workflows/copilot_issue.yml +2 -0
- package/setup/workflows/copilot_issue_comment.yml +20 -106
- package/setup/workflows/copilot_pull_request.yml +2 -0
- package/setup/workflows/copilot_pull_request_comment.yml +20 -106
- package/setup/workflows/copilot_pull_request_review_state.yml +2 -0
- package/setup/workflows/hotfix_workflow.yml +1 -0
- package/setup/workflows/release_workflow.yml +1 -0
|
@@ -36897,6 +36897,7 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
36897
36897
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
36898
36898
|
exports.runGitHubAction = runGitHubAction;
|
|
36899
36899
|
exports.runGitHubActionEntry = runGitHubActionEntry;
|
|
36900
|
+
const native_verification_controller_1 = __nccwpck_require__(71046);
|
|
36900
36901
|
const issue_completion_composition_root_1 = __nccwpck_require__(63719);
|
|
36901
36902
|
const core = __importStar(__nccwpck_require__(75855));
|
|
36902
36903
|
const github = __importStar(__nccwpck_require__(78227));
|
|
@@ -37081,7 +37082,16 @@ async function runGitHubActionEntry(run = runGitHubAction) {
|
|
|
37081
37082
|
catch (cause) {
|
|
37082
37083
|
const semanticError = (0, application_error_1.toApplicationError)(cause, 'workflow.failed', 'GitHub Action execution failed.');
|
|
37083
37084
|
(0, logger_1.logError)(semanticError);
|
|
37084
|
-
|
|
37085
|
+
const message = earlyGithubActionErrorMessage();
|
|
37086
|
+
core.setFailed((0, application_error_presentation_policy_1.renderApplicationErrorText)(semanticError, message));
|
|
37087
|
+
if (semanticError.recovery?.id.startsWith('stored-configuration-')) {
|
|
37088
|
+
try {
|
|
37089
|
+
await (0, github_action_summary_composition_root_1.createGithubActionSummaryCompositionRoot)().publish((0, application_error_presentation_policy_1.renderApplicationErrorMarkdown)(semanticError, message));
|
|
37090
|
+
}
|
|
37091
|
+
catch (summaryCause) {
|
|
37092
|
+
(0, logger_1.logError)((0, application_error_1.toApplicationError)(summaryCause, 'provider.unavailable', 'Unable to publish the configuration failure summary.'));
|
|
37093
|
+
}
|
|
37094
|
+
}
|
|
37085
37095
|
}
|
|
37086
37096
|
});
|
|
37087
37097
|
}
|
|
@@ -37097,7 +37107,7 @@ function earlyGithubActionErrorMessage() {
|
|
|
37097
37107
|
// Only auto-run when executed as the action entry (not when imported by tests)
|
|
37098
37108
|
/* istanbul ignore next -- the bundled production entry is covered by the Action smoke path. */
|
|
37099
37109
|
if (typeof process.env.JEST_WORKER_ID === 'undefined') {
|
|
37100
|
-
void runGitHubActionEntry();
|
|
37110
|
+
void runGitHubActionEntry(() => (0, native_verification_controller_1.runNativeVerificationEntry)(runGitHubActionEntry));
|
|
37101
37111
|
}
|
|
37102
37112
|
|
|
37103
37113
|
|
|
@@ -37522,6 +37532,7 @@ async function buildGithubActionExecution(input) {
|
|
|
37522
37532
|
commitPrefixBuilder: getCommitPrefixBuilder(getInput),
|
|
37523
37533
|
issue: (0, configuration_builders_1.buildIssue)((0, input_boolean_policy_1.parseIssueWorkflowBoolean)(getInput(input_keys_1.INPUT_KEYS.ISSUE_MANAGED_BRANCHES), input_keys_1.INPUT_KEYS.ISSUE_MANAGED_BRANCHES, true), (0, input_boolean_policy_1.isEnabledInput)(getInput(input_keys_1.INPUT_KEYS.REOPEN_ISSUE_ON_PUSH)), (0, input_number_policy_1.parseIntegerInput)(getInput(input_keys_1.INPUT_KEYS.DESIRED_ASSIGNEES_COUNT), 0), eventInputs),
|
|
37524
37534
|
preBranchSdd: (0, input_boolean_policy_1.parseIssueWorkflowBoolean)(getInput(input_keys_1.INPUT_KEYS.PRE_BRANCH_SDD), input_keys_1.INPUT_KEYS.PRE_BRANCH_SDD, false),
|
|
37535
|
+
verificationSetup: (0, input_boolean_policy_1.parseIssueWorkflowBoolean)(getInput(input_keys_1.INPUT_KEYS.VERIFICATION_SETUP), input_keys_1.INPUT_KEYS.VERIFICATION_SETUP, false),
|
|
37525
37536
|
pullRequest: (0, configuration_builders_1.buildPullRequest)((0, input_number_policy_1.parseIntegerInput)(getInput(input_keys_1.INPUT_KEYS.PULL_REQUEST_DESIRED_ASSIGNEES_COUNT), 0), (0, input_number_policy_1.parseIntegerInput)(getInput(input_keys_1.INPUT_KEYS.PULL_REQUEST_DESIRED_REVIEWERS_COUNT), 0), eventInputs),
|
|
37526
37537
|
emoji: (0, configuration_builders_1.buildEmoji)(getInput(input_keys_1.INPUT_KEYS.EMOJI_LABELED_TITLE) === 'true', getInput(input_keys_1.INPUT_KEYS.BRANCH_MANAGEMENT_EMOJI)),
|
|
37527
37538
|
tokens: (0, configuration_builders_1.buildTokens)(token),
|
|
@@ -38189,6 +38200,8 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
38189
38200
|
})();
|
|
38190
38201
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
38191
38202
|
exports.runPullRequestApprovalAction = runPullRequestApprovalAction;
|
|
38203
|
+
const application_error_presentation_policy_1 = __nccwpck_require__(95067);
|
|
38204
|
+
const application_error_message_catalog_1 = __nccwpck_require__(64809);
|
|
38192
38205
|
const core = __importStar(__nccwpck_require__(75855));
|
|
38193
38206
|
const github = __importStar(__nccwpck_require__(78227));
|
|
38194
38207
|
const observe_pull_request_approval_use_case_1 = __nccwpck_require__(36169);
|
|
@@ -38238,15 +38251,22 @@ async function runPullRequestApprovalAction(token) {
|
|
|
38238
38251
|
});
|
|
38239
38252
|
const useCase = new observe_pull_request_approval_use_case_1.ObservePullRequestApprovalUseCase(port);
|
|
38240
38253
|
const failedPulls = [];
|
|
38254
|
+
let firstFailure;
|
|
38241
38255
|
for (const pullNumber of targetNumbers) {
|
|
38242
38256
|
const target = { owner, repository: repo, repositoryId, pullNumber };
|
|
38243
38257
|
const result = await useCase.execute(target);
|
|
38258
|
+
if (result.failure) {
|
|
38259
|
+
firstFailure ?? (firstFailure = result.failure);
|
|
38260
|
+
const diagnostic = (0, application_error_presentation_policy_1.renderApplicationErrorText)(result.failure, (0, application_error_message_catalog_1.resolveStaticApplicationErrorCatalog)(locale).message);
|
|
38261
|
+
core.info(diagnostic);
|
|
38262
|
+
core.summary.addRaw(`<pre>${diagnostic.replace(/&/gu, '&').replace(/</gu, '<').replace(/>/gu, '>')}</pre>\n`);
|
|
38263
|
+
}
|
|
38244
38264
|
const safeCode = result.decision.code.replace(/[^a-z0-9-]/gu, '').slice(0, 60);
|
|
38245
38265
|
core.info(`PR #${pullNumber}: ${result.decision.status} (${safeCode}); assessment ${result.publication}.`);
|
|
38246
38266
|
if (result.publication === 'failed' || [
|
|
38247
38267
|
'invalid-policy', 'policy-unavailable', 'evidence-unavailable', 'target-mismatch',
|
|
38248
38268
|
'pre-submit-unavailable', 'publication-unknown',
|
|
38249
|
-
].includes(result.decision.code))
|
|
38269
|
+
].includes(result.decision.code) || result.failure)
|
|
38250
38270
|
failedPulls.push(pullNumber);
|
|
38251
38271
|
if (result.evidence) {
|
|
38252
38272
|
core.summary.addRaw((0, pull_request_approval_presentation_policy_1.renderApprovalRunSummary)({
|
|
@@ -38267,6 +38287,8 @@ async function runPullRequestApprovalAction(token) {
|
|
|
38267
38287
|
}
|
|
38268
38288
|
}
|
|
38269
38289
|
await core.summary.write();
|
|
38290
|
+
if (firstFailure)
|
|
38291
|
+
throw firstFailure;
|
|
38270
38292
|
if (failedPulls.length > 0) {
|
|
38271
38293
|
throw new Error(`Approval observation needs attention for PR(s) ${failedPulls.join(', ')}; inspect the Job Summary and rerun after recovery.`);
|
|
38272
38294
|
}
|
|
@@ -38726,6 +38748,7 @@ exports.INPUT_KEYS = {
|
|
|
38726
38748
|
// Issue
|
|
38727
38749
|
ISSUE_MANAGED_BRANCHES: 'issue-managed-branches',
|
|
38728
38750
|
PRE_BRANCH_SDD: 'pre-branch-sdd',
|
|
38751
|
+
VERIFICATION_SETUP: 'verification-setup',
|
|
38729
38752
|
REOPEN_ISSUE_ON_PUSH: 'reopen-issue-on-push',
|
|
38730
38753
|
DESIRED_ASSIGNEES_COUNT: 'desired-assignees-count',
|
|
38731
38754
|
// Pull Request
|
|
@@ -38816,6 +38839,95 @@ function runAtApplicationErrorBoundary(operation) {
|
|
|
38816
38839
|
}
|
|
38817
38840
|
|
|
38818
38841
|
|
|
38842
|
+
/***/ }),
|
|
38843
|
+
|
|
38844
|
+
/***/ 50519:
|
|
38845
|
+
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
38846
|
+
|
|
38847
|
+
"use strict";
|
|
38848
|
+
|
|
38849
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
38850
|
+
exports.approvalEvidenceError = approvalEvidenceError;
|
|
38851
|
+
exports.approvalDiagnosticError = approvalDiagnosticError;
|
|
38852
|
+
const approval_evidence_diagnostic_1 = __nccwpck_require__(98205);
|
|
38853
|
+
const application_error_1 = __nccwpck_require__(75999);
|
|
38854
|
+
function approvalEvidenceError(operation, reason) {
|
|
38855
|
+
return approvalDiagnosticError({ operation, reason, permission: approval_evidence_diagnostic_1.APPROVAL_EVIDENCE_PERMISSIONS[operation] });
|
|
38856
|
+
}
|
|
38857
|
+
function approvalDiagnosticError(diagnostic) {
|
|
38858
|
+
const reason = diagnostic.reason;
|
|
38859
|
+
const code = reason === 'http-401' ? 'authorization.credential-invalid'
|
|
38860
|
+
: reason === 'http-403' ? 'authorization.denied'
|
|
38861
|
+
: reason === 'http-404' ? 'provider.not-found'
|
|
38862
|
+
: reason === 'http-429' ? 'provider.rate-limited'
|
|
38863
|
+
: reason === 'http-409' ? 'provider.conflict'
|
|
38864
|
+
: reason === 'transport-unavailable' || /^http-50[0234]$/u.test(reason) ? 'provider.unavailable'
|
|
38865
|
+
: 'provider.contract-invalid';
|
|
38866
|
+
return new application_error_1.ApplicationError(code, `Approval evidence read failed (${diagnostic.operation}, ${reason}).`, {
|
|
38867
|
+
recovery: { id: 'approval-evidence-read-failed', variables: diagnostic },
|
|
38868
|
+
});
|
|
38869
|
+
}
|
|
38870
|
+
|
|
38871
|
+
|
|
38872
|
+
/***/ }),
|
|
38873
|
+
|
|
38874
|
+
/***/ 82937:
|
|
38875
|
+
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
38876
|
+
|
|
38877
|
+
"use strict";
|
|
38878
|
+
|
|
38879
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
38880
|
+
exports.BugbotMutationError = void 0;
|
|
38881
|
+
exports.bugbotMutationError = bugbotMutationError;
|
|
38882
|
+
const application_error_1 = __nccwpck_require__(75999);
|
|
38883
|
+
const pull_request_review_errors_1 = __nccwpck_require__(46445);
|
|
38884
|
+
class BugbotMutationError extends application_error_1.ApplicationError {
|
|
38885
|
+
constructor(diagnostic) {
|
|
38886
|
+
super(diagnostic.errorCode, `Bugbot ${diagnostic.stage} failed: operation=${diagnostic.operation}; finding=${diagnostic.findingId}; affected=${diagnostic.affectedCount}; ${diagnostic.providerStatus}; provider-reference=${diagnostic.providerReference}. Completed effects are retained; correct the named cause and recheck the same target.`);
|
|
38887
|
+
this.diagnostic = diagnostic;
|
|
38888
|
+
}
|
|
38889
|
+
}
|
|
38890
|
+
exports.BugbotMutationError = BugbotMutationError;
|
|
38891
|
+
function bugbotMutationError(cause, stage, findingIds, fallback, affectedCount = findingIds.length) {
|
|
38892
|
+
if (cause instanceof BugbotMutationError)
|
|
38893
|
+
return cause;
|
|
38894
|
+
const provider = cause instanceof pull_request_review_errors_1.PullRequestReviewOperationError ? cause : undefined;
|
|
38895
|
+
const status = provider?.providerStatus;
|
|
38896
|
+
const errorCode = status === 401 ? 'authorization.credential-invalid' : status === 403 ? 'authorization.denied'
|
|
38897
|
+
: status === 404 ? 'provider.not-found' : status === 409 ? 'provider.conflict'
|
|
38898
|
+
: status === 429 ? 'provider.rate-limited'
|
|
38899
|
+
: status === 408 || status === 425 ? 'provider.unavailable'
|
|
38900
|
+
: status && status < 500 ? 'provider.contract-invalid' : 'provider.unavailable';
|
|
38901
|
+
const first = findingIds[0];
|
|
38902
|
+
return new BugbotMutationError(Object.freeze({
|
|
38903
|
+
stage, operation: provider?.operation ?? fallback,
|
|
38904
|
+
findingId: typeof first === 'string' && /^[A-Za-z0-9_./:-]{1,200}$/.test(first) ? first : 'unavailable',
|
|
38905
|
+
affectedCount: Math.min(affectedCount, 10000),
|
|
38906
|
+
providerStatus: status ? `http-${status}` : 'http-unavailable',
|
|
38907
|
+
providerReference: provider?.providerReference ?? 'unavailable', errorCode,
|
|
38908
|
+
}));
|
|
38909
|
+
}
|
|
38910
|
+
|
|
38911
|
+
|
|
38912
|
+
/***/ }),
|
|
38913
|
+
|
|
38914
|
+
/***/ 12183:
|
|
38915
|
+
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
38916
|
+
|
|
38917
|
+
"use strict";
|
|
38918
|
+
|
|
38919
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
38920
|
+
exports.closedIssueReconciliationError = closedIssueReconciliationError;
|
|
38921
|
+
const application_error_1 = __nccwpck_require__(75999);
|
|
38922
|
+
/** Public diagnostic is fixed native facts and counters, never label/card/provider text. */
|
|
38923
|
+
function closedIssueReconciliationError(cause, facts) {
|
|
38924
|
+
return new application_error_1.ApplicationError(cause instanceof application_error_1.ApplicationError ? cause.code : 'provider.unavailable', 'Closed issue reconciliation remains unverified.', {
|
|
38925
|
+
...(cause instanceof application_error_1.ApplicationError ? { correlationId: cause.correlationId, retryable: cause.retryable } : {}),
|
|
38926
|
+
recovery: { id: 'closed-issue-reconciliation-failed', variables: facts },
|
|
38927
|
+
});
|
|
38928
|
+
}
|
|
38929
|
+
|
|
38930
|
+
|
|
38819
38931
|
/***/ }),
|
|
38820
38932
|
|
|
38821
38933
|
/***/ 72594:
|
|
@@ -38854,7 +38966,7 @@ const application_error_message_catalog_1 = __nccwpck_require__(64809);
|
|
|
38854
38966
|
const SIMPLE_MESSAGE_KEYS = Object.freeze([
|
|
38855
38967
|
'heading', 'repository', 'property', 'value', 'status', 'event', 'target',
|
|
38856
38968
|
'lifecycle', 'descriptionPolicy', 'results', 'findingStates', 'bugbotReview',
|
|
38857
|
-
'inactivity', 'unavailable',
|
|
38969
|
+
'inactivity', 'unavailable', 'issueCleanup',
|
|
38858
38970
|
'sourceFreshness', 'staleSourceSuppressed',
|
|
38859
38971
|
'duplicateCleanup', 'actionNotifications', 'actionNotificationCreated',
|
|
38860
38972
|
'actionNotificationReused',
|
|
@@ -38876,6 +38988,7 @@ const TEMPLATE_MESSAGE_IDS = Object.freeze([
|
|
|
38876
38988
|
'summary.duplicateCleanup.bounded',
|
|
38877
38989
|
'summary.actionNotification.entry',
|
|
38878
38990
|
'summary.inactivityCounts',
|
|
38991
|
+
'summary.issueCleanupCounts',
|
|
38879
38992
|
]);
|
|
38880
38993
|
const FINDING_STATE_KEYS = Object.freeze([
|
|
38881
38994
|
'open', 'reopened', 'fixed', 'obsolete', 'dismissed',
|
|
@@ -38899,6 +39012,7 @@ const ENGLISH_SIMPLE = Object.freeze({
|
|
|
38899
39012
|
descriptionPolicy: 'PR description policy',
|
|
38900
39013
|
results: 'Results',
|
|
38901
39014
|
inactivity: 'Issue inactivity',
|
|
39015
|
+
issueCleanup: 'Issue cleanup',
|
|
38902
39016
|
unavailable: 'unavailable',
|
|
38903
39017
|
findingStates: 'Finding states',
|
|
38904
39018
|
bugbotReview: 'Bugbot review',
|
|
@@ -38948,6 +39062,7 @@ const SPANISH_SIMPLE = Object.freeze({
|
|
|
38948
39062
|
descriptionPolicy: 'Política de descripción de PR',
|
|
38949
39063
|
results: 'Resultados',
|
|
38950
39064
|
inactivity: 'Inactividad de issues',
|
|
39065
|
+
issueCleanup: 'Limpieza de la issue',
|
|
38951
39066
|
unavailable: 'no disponible',
|
|
38952
39067
|
findingStates: 'Estados de los hallazgos',
|
|
38953
39068
|
bugbotReview: 'Revisión de Bugbot',
|
|
@@ -38995,6 +39110,7 @@ const ENGLISH_TEMPLATES = Object.freeze({
|
|
|
38995
39110
|
'summary.duplicateCleanup.bounded': 'Deletion was forbidden; retained compact pointers for {count} comments (first {reported} IDs: {ids})',
|
|
38996
39111
|
'summary.actionNotification.entry': '{topic} on {target}: {effect} (fingerprint {fingerprint})',
|
|
38997
39112
|
'summary.inactivityCounts': 'Scanned: {scanned} · Closed: {closed} · Skipped: {skipped}',
|
|
39113
|
+
'summary.issueCleanupCounts': 'Reconciled: {reconciled} · Already converged: {converged}. Required cleanup was freshly verified.',
|
|
38998
39114
|
});
|
|
38999
39115
|
const SPANISH_TEMPLATES = Object.freeze({
|
|
39000
39116
|
'summary.target.pullRequest': 'PR n.º {number}',
|
|
@@ -39006,6 +39122,7 @@ const SPANISH_TEMPLATES = Object.freeze({
|
|
|
39006
39122
|
'summary.duplicateCleanup.bounded': 'Se denegó el borrado; se conservaron enlaces compactos para {count} comentarios (primeros {reported} ID: {ids})',
|
|
39007
39123
|
'summary.actionNotification.entry': '{topic} en {target}: {effect} (huella {fingerprint})',
|
|
39008
39124
|
'summary.inactivityCounts': 'Examinadas: {scanned} · Cerradas: {closed} · Omitidas: {skipped}',
|
|
39125
|
+
'summary.issueCleanupCounts': 'Reconciliadas: {reconciled} · Ya convergidas: {converged}. Se verificó de nuevo la limpieza necesaria.',
|
|
39009
39126
|
});
|
|
39010
39127
|
const ENGLISH_FINDING_STATES = Object.freeze({
|
|
39011
39128
|
open: 'open',
|
|
@@ -39068,6 +39185,7 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
|
39068
39185
|
exports.buildActionSummary = buildActionSummary;
|
|
39069
39186
|
exports.actionSummaryLocalizationLabels = actionSummaryLocalizationLabels;
|
|
39070
39187
|
exports.renderLocalizationSummarySection = renderLocalizationSummarySection;
|
|
39188
|
+
const closed_issue_reconciliation_outcome_policy_1 = __nccwpck_require__(85462);
|
|
39071
39189
|
const inactivity_result_counts_projection_policy_1 = __nccwpck_require__(14960);
|
|
39072
39190
|
const github_comment_publication_policy_1 = __nccwpck_require__(72712);
|
|
39073
39191
|
const bugbot_telemetry_projection_policy_1 = __nccwpck_require__(43244);
|
|
@@ -39117,6 +39235,7 @@ function buildActionSummary(context, catalog = (0, action_summary_message_catalo
|
|
|
39117
39235
|
`| ${catalogText(catalog, 'summary.descriptionPolicy')} | ${escapeTable(context.pullRequestDescriptionMode ?? '—')} |`,
|
|
39118
39236
|
`| ${catalogText(catalog, 'summary.results')} | ${formatResultCounts(context.results, catalog)} |`,
|
|
39119
39237
|
...inactivitySummaryRows(context.results, catalog),
|
|
39238
|
+
...closedIssueCleanupRows(context.results, catalog),
|
|
39120
39239
|
`| ${catalogText(catalog, 'summary.findingStates')} | ${formatFindingStates(findingStateProjection, catalog)} |`,
|
|
39121
39240
|
`| ${catalogText(catalog, 'summary.bugbotReview')} | ${formatBugbotTelemetry(telemetryProjection, catalog)} |`,
|
|
39122
39241
|
...(staleSourceSuppressed ? [
|
|
@@ -39147,6 +39266,14 @@ function buildActionSummary(context, catalog = (0, action_summary_message_catalo
|
|
|
39147
39266
|
...(localization ? ['', localization] : []),
|
|
39148
39267
|
].join('\n');
|
|
39149
39268
|
}
|
|
39269
|
+
function closedIssueCleanupRows(results, catalog) {
|
|
39270
|
+
const projection = (0, closed_issue_reconciliation_outcome_policy_1.projectClosedIssueCleanupCounts)(results);
|
|
39271
|
+
if (projection.status === 'absent')
|
|
39272
|
+
return [];
|
|
39273
|
+
const value = projection.status === 'valid' ? catalogText(catalog, 'summary.issueCleanupCounts', projection.counts)
|
|
39274
|
+
: catalogText(catalog, 'summary.unavailable');
|
|
39275
|
+
return [`| ${catalogText(catalog, 'summary.issueCleanup')} | ${value} |`];
|
|
39276
|
+
}
|
|
39150
39277
|
function inactivitySummaryRows(results, catalog) {
|
|
39151
39278
|
const projection = (0, inactivity_result_counts_projection_policy_1.projectInactivityResultCounts)(results);
|
|
39152
39279
|
if (projection.status === 'absent')
|
|
@@ -40591,12 +40718,61 @@ const SPANISH_CONTENT = Object.freeze({
|
|
|
40591
40718
|
retainedState: PRESERVED_STATE_ES,
|
|
40592
40719
|
}),
|
|
40593
40720
|
});
|
|
40721
|
+
const STORED_CONFIGURATION_ACTION_EN = 'A maintainer must review {recoveryGuide}. Preserve a copy before removing only a verified obsolete unmanaged block. If managed branch, release, hotfix or orchestration state may exist, stop and restore verified supported state with a maintainer. Do not just add a schema version or delete managed state. Correct the configuration before rerunning; retrying unchanged state will fail again.';
|
|
40722
|
+
const STORED_CONFIGURATION_ACTION_ES = 'Un mantenedor debe revisar {recoveryGuide}. Conserva una copia antes de retirar solo un bloque obsoleto confirmado como no gestionado. Si puede existir estado gestionado de ramas, releases, hotfixes u orquestación, detente y restaura estado compatible verificado con un mantenedor. No añadas simplemente una versión de esquema ni borres estado gestionado. Corrige la configuración antes de reejecutar; el mismo estado volverá a fallar.';
|
|
40723
|
+
const STORED_CONFIGURATION_RETAINED_EN = 'The issue/PR description and stored configuration were not changed by this read.';
|
|
40724
|
+
const STORED_CONFIGURATION_RETAINED_ES = 'Esta lectura no modificó la descripción de la issue/PR ni su configuración almacenada.';
|
|
40594
40725
|
const ENGLISH_RECOVERY_CONTENT = Object.freeze({
|
|
40726
|
+
'stored-configuration-schema-missing': Object.freeze({
|
|
40727
|
+
impact: 'Automation stopped for issue/PR #{issueNumber}: the stored configuration has no schema version; version {expectedVersion} is required.',
|
|
40728
|
+
action: STORED_CONFIGURATION_ACTION_EN,
|
|
40729
|
+
retainedState: STORED_CONFIGURATION_RETAINED_EN,
|
|
40730
|
+
}),
|
|
40731
|
+
'stored-configuration-schema-unsupported': Object.freeze({
|
|
40732
|
+
impact: 'Automation stopped for issue/PR #{issueNumber}: stored schema version {actualVersion} is unsupported; version {expectedVersion} is required.',
|
|
40733
|
+
action: STORED_CONFIGURATION_ACTION_EN,
|
|
40734
|
+
retainedState: STORED_CONFIGURATION_RETAINED_EN,
|
|
40735
|
+
}),
|
|
40736
|
+
'stored-configuration-invalid': Object.freeze({
|
|
40737
|
+
impact: 'Automation stopped for issue/PR #{issueNumber}: the stored configuration, markers or schema value are malformed; valid schema version {expectedVersion} is required.',
|
|
40738
|
+
action: STORED_CONFIGURATION_ACTION_EN,
|
|
40739
|
+
retainedState: STORED_CONFIGURATION_RETAINED_EN,
|
|
40740
|
+
}),
|
|
40741
|
+
'closed-issue-reconciliation-failed': Object.freeze({
|
|
40742
|
+
impact: 'Issue cleanup remains unverified: {resultId}, phase {phase}; native state {state}, reason {reason}.',
|
|
40743
|
+
action: 'Inspect the closed-issue or merged-PR run and current native state. Retry cleanup only if the issue is still closed with the intended reason; leave reopened work open. Resolve the named failure before retrying.',
|
|
40744
|
+
retainedState: 'Native state was preserved. Confirmed changes: {changed}; remaining required changes in the last verified plan: {remaining}. Unavailable reads do not establish completion.',
|
|
40745
|
+
}),
|
|
40746
|
+
'approval-evidence-read-failed': Object.freeze({
|
|
40747
|
+
impact: 'Approval evidence could not be verified: {operation} ({reason}).',
|
|
40748
|
+
action: 'Inspect {permission} access for the runtime credential and the named evidence response. Correct authorization, missing-resource or schema errors before rerunning; retry transient failures only after provider recovery or rate-limit reset.',
|
|
40749
|
+
retainedState: 'No approval is authorized by this failed read. Existing PRs, reviews and completed external effects were preserved.',
|
|
40750
|
+
}),
|
|
40595
40751
|
'workspace-changes-rejected': Object.freeze({
|
|
40596
40752
|
impact: 'The changes were rejected during workspace verification.',
|
|
40597
40753
|
action: 'Inspect the rejected paths in the workflow and correct the workspace before retrying.',
|
|
40598
40754
|
retainedState: 'The normal commit and push steps were skipped. Verify the current state before retrying.',
|
|
40599
40755
|
}),
|
|
40756
|
+
'sdd-draft-case-identity-invalid': Object.freeze({
|
|
40757
|
+
impact: 'SDD publication stopped after one automatic repair: case IDs collide with an owning SDD or are ambiguous.',
|
|
40758
|
+
action: 'Review the draft tables; use distinct fully qualified case IDs and preserve the baseline inventory. Retry the same issue workflow.',
|
|
40759
|
+
retainedState: 'Existing answers and published SDDs were preserved; no draft was published. Publication checks do not establish runtime acceptance.',
|
|
40760
|
+
}),
|
|
40761
|
+
'sdd-draft-case-budget-invalid': Object.freeze({
|
|
40762
|
+
impact: 'SDD publication stopped after one automatic repair: per-area allocations disagree with the distinct case inventory.',
|
|
40763
|
+
action: 'Review the draft tables; reconcile each area and the total with the enumerated cases. Retry the same issue workflow.',
|
|
40764
|
+
retainedState: 'Existing answers and published SDDs were preserved; no draft was published. Publication checks do not establish runtime acceptance.',
|
|
40765
|
+
}),
|
|
40766
|
+
'sdd-draft-requirement-mapping-invalid': Object.freeze({
|
|
40767
|
+
impact: 'SDD publication stopped after one automatic repair: requirements and case mappings are incomplete or inconsistent.',
|
|
40768
|
+
action: 'Review the draft tables; map every requirement to defined cases and match the reverse links. Retry the same issue workflow.',
|
|
40769
|
+
retainedState: 'Existing answers and published SDDs were preserved; no draft was published. Publication checks do not establish runtime acceptance.',
|
|
40770
|
+
}),
|
|
40771
|
+
'sdd-draft-repository-path-invalid': Object.freeze({
|
|
40772
|
+
impact: 'SDD publication stopped after one automatic repair: cited repository paths cannot be verified at the immutable base.',
|
|
40773
|
+
action: 'Review the draft tables; correct existing paths or explicitly declare intended new files. Retry the same issue workflow.',
|
|
40774
|
+
retainedState: 'Existing answers and published SDDs were preserved; no draft was published. Publication checks do not establish runtime acceptance.',
|
|
40775
|
+
}),
|
|
40600
40776
|
'sdd-draft-format-invalid': Object.freeze({
|
|
40601
40777
|
impact: 'SDD preparation stopped because the draft still lacked required headings or a numeric test budget after one automatic repair.',
|
|
40602
40778
|
action: 'Retry SDD preparation with the canonical specification template and the explicit acceptance requirements.',
|
|
@@ -40659,11 +40835,56 @@ const ENGLISH_RECOVERY_CONTENT = Object.freeze({
|
|
|
40659
40835
|
}),
|
|
40660
40836
|
});
|
|
40661
40837
|
const SPANISH_RECOVERY_CONTENT = Object.freeze({
|
|
40838
|
+
'stored-configuration-schema-missing': Object.freeze({
|
|
40839
|
+
impact: 'La automatización se detuvo para la issue/PR #{issueNumber}: la configuración almacenada no tiene versión de esquema; se requiere la versión {expectedVersion}.',
|
|
40840
|
+
action: STORED_CONFIGURATION_ACTION_ES,
|
|
40841
|
+
retainedState: STORED_CONFIGURATION_RETAINED_ES,
|
|
40842
|
+
}),
|
|
40843
|
+
'stored-configuration-schema-unsupported': Object.freeze({
|
|
40844
|
+
impact: 'La automatización se detuvo para la issue/PR #{issueNumber}: la versión de esquema almacenada {actualVersion} no es compatible; se requiere la versión {expectedVersion}.',
|
|
40845
|
+
action: STORED_CONFIGURATION_ACTION_ES,
|
|
40846
|
+
retainedState: STORED_CONFIGURATION_RETAINED_ES,
|
|
40847
|
+
}),
|
|
40848
|
+
'stored-configuration-invalid': Object.freeze({
|
|
40849
|
+
impact: 'La automatización se detuvo para la issue/PR #{issueNumber}: la configuración almacenada, sus delimitadores o el valor del esquema no son válidos; se requiere un esquema válido de versión {expectedVersion}.',
|
|
40850
|
+
action: STORED_CONFIGURATION_ACTION_ES,
|
|
40851
|
+
retainedState: STORED_CONFIGURATION_RETAINED_ES,
|
|
40852
|
+
}),
|
|
40853
|
+
'closed-issue-reconciliation-failed': Object.freeze({
|
|
40854
|
+
impact: 'La limpieza de la issue sigue sin verificarse: {resultId}, fase {phase}; estado nativo {state}, motivo {reason}.',
|
|
40855
|
+
action: 'Revisa la ejecución de cierre o de la PR fusionada y el estado nativo actual. Reintenta la limpieza solo si la issue sigue cerrada con el motivo previsto; conserva abierto el trabajo reabierto. Resuelve el fallo indicado antes de reintentar.',
|
|
40856
|
+
retainedState: 'Se conservó el estado nativo. Cambios confirmados: {changed}; cambios pendientes en el último plan verificado: {remaining}. Una lectura no disponible no demuestra que haya finalizado.',
|
|
40857
|
+
}),
|
|
40858
|
+
'approval-evidence-read-failed': Object.freeze({
|
|
40859
|
+
impact: 'No se pudo verificar la evidencia de aprobación: {operation} ({reason}).',
|
|
40860
|
+
action: 'Comprueba el acceso {permission} de la credencial de ejecución y la respuesta indicada. Corrige los errores de autorización, recurso o esquema antes de reejecutar; reintenta los fallos transitorios solo tras recuperarse el proveedor o restablecerse el límite.',
|
|
40861
|
+
retainedState: 'Esta lectura fallida no autoriza ninguna aprobación. Se conservaron las PRs, revisiones y efectos externos completados.',
|
|
40862
|
+
}),
|
|
40662
40863
|
'workspace-changes-rejected': Object.freeze({
|
|
40663
40864
|
impact: 'Los cambios se rechazaron durante la verificación del espacio de trabajo.',
|
|
40664
40865
|
action: 'Revisa las rutas rechazadas en la ejecución y corrige el espacio de trabajo antes de reintentar.',
|
|
40665
40866
|
retainedState: 'Se omitieron los pasos normales de commit y push. Comprueba el estado actual antes de reintentar.',
|
|
40666
40867
|
}),
|
|
40868
|
+
'sdd-draft-case-identity-invalid': Object.freeze({
|
|
40869
|
+
impact: 'La publicación del SDD se detuvo tras un intento automático de corrección: los identificadores de casos coinciden con un SDD existente o son ambiguos.',
|
|
40870
|
+
action: 'Revisa las tablas del borrador; usa identificadores completos y distintos y conserva el inventario original. Reintenta el workflow de la misma incidencia.',
|
|
40871
|
+
retainedState: 'Se conservaron las respuestas y los SDD publicados; no se publicó ningún borrador. Estas comprobaciones no demuestran la aceptación en ejecución.',
|
|
40872
|
+
}),
|
|
40873
|
+
'sdd-draft-case-budget-invalid': Object.freeze({
|
|
40874
|
+
impact: 'La publicación del SDD se detuvo tras un intento automático de corrección: las asignaciones por área no coinciden con el inventario de casos distintos.',
|
|
40875
|
+
action: 'Revisa las tablas del borrador; reconcilia cada área y el total con los casos enumerados. Reintenta el workflow de la misma incidencia.',
|
|
40876
|
+
retainedState: 'Se conservaron las respuestas y los SDD publicados; no se publicó ningún borrador. Estas comprobaciones no demuestran la aceptación en ejecución.',
|
|
40877
|
+
}),
|
|
40878
|
+
'sdd-draft-requirement-mapping-invalid': Object.freeze({
|
|
40879
|
+
impact: 'La publicación del SDD se detuvo tras un intento automático de corrección: los requisitos y sus casos están incompletos o son inconsistentes.',
|
|
40880
|
+
action: 'Revisa las tablas del borrador; vincula cada requisito a casos definidos y comprueba los enlaces inversos. Reintenta el workflow de la misma incidencia.',
|
|
40881
|
+
retainedState: 'Se conservaron las respuestas y los SDD publicados; no se publicó ningún borrador. Estas comprobaciones no demuestran la aceptación en ejecución.',
|
|
40882
|
+
}),
|
|
40883
|
+
'sdd-draft-repository-path-invalid': Object.freeze({
|
|
40884
|
+
impact: 'La publicación del SDD se detuvo tras un intento automático de corrección: no se pueden verificar las rutas citadas en la revisión base inmutable.',
|
|
40885
|
+
action: 'Revisa las tablas del borrador; corrige las rutas existentes o declara explícitamente los archivos nuevos previstos. Reintenta el workflow de la misma incidencia.',
|
|
40886
|
+
retainedState: 'Se conservaron las respuestas y los SDD publicados; no se publicó ningún borrador. Estas comprobaciones no demuestran la aceptación en ejecución.',
|
|
40887
|
+
}),
|
|
40667
40888
|
'sdd-draft-format-invalid': Object.freeze({
|
|
40668
40889
|
impact: 'La preparación del SDD se detuvo porque seguían faltando secciones obligatorias o un presupuesto numérico de pruebas tras un intento automático de corrección.',
|
|
40669
40890
|
action: 'Reintenta la preparación del SDD con la plantilla canónica y los criterios de aceptación explícitos.',
|
|
@@ -40778,12 +40999,16 @@ exports.buildApplicationErrorPresentation = buildApplicationErrorPresentation;
|
|
|
40778
40999
|
exports.renderApplicationErrorText = renderApplicationErrorText;
|
|
40779
41000
|
exports.renderApplicationErrorMarkdown = renderApplicationErrorMarkdown;
|
|
40780
41001
|
const application_error_message_catalog_1 = __nccwpck_require__(64809);
|
|
41002
|
+
// This trusted destination is inserted after localization, never supplied by a body or translation.
|
|
41003
|
+
const STORED_CONFIGURATION_RECOVERY_URL = 'https://docs.page/vypdev/copilot/security-operations/operations/troubleshooting#unsupported-stored-configuration';
|
|
40781
41004
|
/** Shared semantic view model for terminal, GitHub, and API presentation. */
|
|
40782
41005
|
function buildApplicationErrorPresentation(error, message = application_error_message_catalog_1.readEnglishApplicationErrorMessage) {
|
|
40783
41006
|
const descriptor = error.recovery
|
|
40784
41007
|
? `error.recovery.${error.recovery.id}`
|
|
40785
41008
|
: `error.${error.code}`;
|
|
40786
|
-
const variables = error.recovery?.
|
|
41009
|
+
const variables = error.recovery?.id.startsWith('stored-configuration-')
|
|
41010
|
+
? { ...error.recovery.variables, recoveryGuide: STORED_CONFIGURATION_RECOVERY_URL }
|
|
41011
|
+
: error.recovery?.variables;
|
|
40787
41012
|
return {
|
|
40788
41013
|
impact: message(`${descriptor}.impact`, variables),
|
|
40789
41014
|
code: error.code,
|
|
@@ -41825,6 +42050,7 @@ exports.BUGBOT_MESSAGE_IDS = Object.freeze([
|
|
|
41825
42050
|
'bugbot.overflow.body',
|
|
41826
42051
|
'bugbot.common.more',
|
|
41827
42052
|
'bugbot.diagnostic.operationFailed',
|
|
42053
|
+
'bugbot.diagnostic.findingMutationFailed',
|
|
41828
42054
|
'bugbot.diagnostic.identityUnavailable',
|
|
41829
42055
|
'bugbot.diagnostic.pullRequestCommentsFailed',
|
|
41830
42056
|
'bugbot.diagnostic.reviewThreadsFailed',
|
|
@@ -41910,6 +42136,7 @@ const ENGLISH_MESSAGES = Object.freeze({
|
|
|
41910
42136
|
'bugbot.overflow.heading': 'More findings (comment limit)',
|
|
41911
42137
|
'bugbot.overflow.body': Object.freeze({ one: 'There is {count} more finding that was not published as an individual comment. Review locally or in the full diff to see the list.', other: 'There are {count} more findings that were not published as individual comments. Review locally or in the full diff to see the list.' }),
|
|
41912
42138
|
'bugbot.common.more': Object.freeze({ one: 'and {count} more.', other: 'and {count} more.' }),
|
|
42139
|
+
'bugbot.diagnostic.findingMutationFailed': 'Finding mutation failed: stage={stage}; operation={operation}; finding={findingId}; affected={affectedCount}; {providerStatus}; provider reference={providerReference}. Completed effects are retained. Correct access/contract errors before retrying; for transient failures restore provider availability, then recheck the same PR. Recheck reconciles existing reviews and threads.',
|
|
41913
42140
|
'bugbot.diagnostic.operationFailed': 'Bugbot could not complete one or more finding mutations.',
|
|
41914
42141
|
'bugbot.diagnostic.identityUnavailable': 'The authenticated Bugbot identity is unavailable.',
|
|
41915
42142
|
'bugbot.diagnostic.pullRequestCommentsFailed': 'Unable to re-read pull request review comments.',
|
|
@@ -41999,6 +42226,7 @@ const SPANISH_MESSAGES = Object.freeze({
|
|
|
41999
42226
|
'bugbot.overflow.heading': 'Más hallazgos (límite de comentarios)',
|
|
42000
42227
|
'bugbot.overflow.body': Object.freeze({ one: 'Hay {count} hallazgo más que no se publicó como comentario individual. Revísalo localmente o en el diff completo para consultar la lista.', many: 'Hay {count} hallazgos más que no se publicaron como comentarios individuales. Revísalos localmente o en el diff completo para consultar la lista.', other: 'Hay {count} hallazgos más que no se publicaron como comentarios individuales. Revísalos localmente o en el diff completo para consultar la lista.' }),
|
|
42001
42228
|
'bugbot.common.more': Object.freeze({ one: 'y {count} más.', many: 'y {count} más.', other: 'y {count} más.' }),
|
|
42229
|
+
'bugbot.diagnostic.findingMutationFailed': 'Falló una mutación: fase={stage}; operación={operation}; hallazgo={findingId}; afectados={affectedCount}; {providerStatus}; referencia del proveedor={providerReference}. Se conservan los efectos completados. Corrige acceso/contrato antes de reintentar; para fallos transitorios restaura el proveedor y revisa la misma PR. La revisión reconcilia comentarios e hilos existentes.',
|
|
42002
42230
|
'bugbot.diagnostic.operationFailed': 'Bugbot no pudo completar una o más mutaciones de hallazgos.',
|
|
42003
42231
|
'bugbot.diagnostic.identityUnavailable': 'La identidad autenticada de Bugbot no está disponible.',
|
|
42004
42232
|
'bugbot.diagnostic.pullRequestCommentsFailed': 'No se pudieron volver a leer los comentarios del review del pull request.',
|
|
@@ -42038,6 +42266,7 @@ async function resolveBugbotCatalog(locale, configuration, resolver) {
|
|
|
42038
42266
|
}
|
|
42039
42267
|
function renderBugbotDiagnostic(diagnostic, catalog) {
|
|
42040
42268
|
switch (diagnostic.code) {
|
|
42269
|
+
case 'finding-mutation-failed': return catalog.message('bugbot.diagnostic.findingMutationFailed', { ...diagnostic.mutation });
|
|
42041
42270
|
case 'operation-failed': return catalog.message('bugbot.diagnostic.operationFailed');
|
|
42042
42271
|
case 'identity-unavailable': return catalog.message('bugbot.diagnostic.identityUnavailable');
|
|
42043
42272
|
case 'snapshot-pull-request-comments-failed': return catalog.message('bugbot.diagnostic.pullRequestCommentsFailed');
|
|
@@ -42665,6 +42894,10 @@ function renderBugbotStatusCard(projection, catalogOrLocale, links) {
|
|
|
42665
42894
|
facts.push(catalog.message('bugbot.coverage.omitted', { count: source.omittedItems }));
|
|
42666
42895
|
if (source.truncatedItems > 0)
|
|
42667
42896
|
facts.push(catalog.message('bugbot.coverage.truncated', { count: source.truncatedItems }));
|
|
42897
|
+
const truncatedIds = source.truncatedItemIds?.slice(0, 50)
|
|
42898
|
+
.filter(id => /^(?:issue:[0-9]+|review:[A-Za-z0-9_=-]+)$/.test(id) && id.length <= 160);
|
|
42899
|
+
if (truncatedIds?.length)
|
|
42900
|
+
facts.push(`truncated-source-ids=${truncatedIds.join(', ')}`);
|
|
42668
42901
|
if (source.providerLimitReached)
|
|
42669
42902
|
facts.push(catalog.message('bugbot.coverage.providerLimit'));
|
|
42670
42903
|
return `- ${source.source}: ${source.status}; ${facts.join(', ')}`;
|
|
@@ -42754,9 +42987,21 @@ function normalizeHistoricalSnapshot(originalBody, analyzedHeadSha, catalog) {
|
|
|
42754
42987
|
function renderFindingRow(finding) {
|
|
42755
42988
|
const label = (0, github_comment_publication_policy_1.sanitizeAgentMarkdown)(finding.title || finding.id, 500).replace(/[\r\n]+/gu, ' ');
|
|
42756
42989
|
const state = stateLabel(finding.state);
|
|
42990
|
+
const identity = finding.state === 'unknown'
|
|
42991
|
+
? ` — ${renderFindingId(finding.id)}`
|
|
42992
|
+
: '';
|
|
42757
42993
|
return finding.url
|
|
42758
|
-
? `- ${state} — [${label}](${finding.url})`
|
|
42759
|
-
: `- ${state} — ${label}`;
|
|
42994
|
+
? `- ${state} — [${label}](${finding.url})${identity}`
|
|
42995
|
+
: `- ${state} — ${label}${identity}`;
|
|
42996
|
+
}
|
|
42997
|
+
function renderFindingId(value) {
|
|
42998
|
+
const id = (0, github_comment_publication_policy_1.sanitizeAgentMarkdown)(value, 200).replace(/[\r\n]+/gu, ' ');
|
|
42999
|
+
// A delimiter longer than every embedded backtick run keeps links, images
|
|
43000
|
+
// and HTML inert even when the marker permits arbitrary Markdown punctuation.
|
|
43001
|
+
let delimiter = '`';
|
|
43002
|
+
while (id.includes(delimiter))
|
|
43003
|
+
delimiter += '`';
|
|
43004
|
+
return `${delimiter} ${id} ${delimiter}`;
|
|
42760
43005
|
}
|
|
42761
43006
|
function stateLabel(state) {
|
|
42762
43007
|
return `[ ] ${state}`;
|
|
@@ -42877,6 +43122,51 @@ function hasBugbotTelemetryField(value) {
|
|
|
42877
43122
|
}
|
|
42878
43123
|
|
|
42879
43124
|
|
|
43125
|
+
/***/ }),
|
|
43126
|
+
|
|
43127
|
+
/***/ 85462:
|
|
43128
|
+
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
43129
|
+
|
|
43130
|
+
"use strict";
|
|
43131
|
+
|
|
43132
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
43133
|
+
exports.projectClosedIssueCleanupCounts = projectClosedIssueCleanupCounts;
|
|
43134
|
+
const result_1 = __nccwpck_require__(73817);
|
|
43135
|
+
const closed_issue_reconciliation_1 = __nccwpck_require__(21565);
|
|
43136
|
+
/** Summary consumes semantic counts; internal result identifiers never become presentation. */
|
|
43137
|
+
function projectClosedIssueCleanupCounts(results) {
|
|
43138
|
+
let reconciled = 0;
|
|
43139
|
+
let converged = 0;
|
|
43140
|
+
let invalid = false;
|
|
43141
|
+
for (const result of results.filter(result => closed_issue_reconciliation_1.CLOSED_ISSUE_RESULTS.some(id => id === result.id))) {
|
|
43142
|
+
const payload = (0, result_1.getResultPayload)(result.payload);
|
|
43143
|
+
if (!result.success || result.errors?.length) {
|
|
43144
|
+
invalid = true;
|
|
43145
|
+
continue;
|
|
43146
|
+
}
|
|
43147
|
+
if (!payload)
|
|
43148
|
+
continue;
|
|
43149
|
+
const completion = result.id === 'CloseIssueAfterMergingUseCase' || result.id === 'ReconcileClosedIssueMetadataUseCase'
|
|
43150
|
+
? (0, result_1.getResultPayload)(payload.issueCompletion) : payload;
|
|
43151
|
+
if (completion?.outcome === 'not-applicable' && completion.nativeClosed === false)
|
|
43152
|
+
continue;
|
|
43153
|
+
if (completion?.nativeClosed !== true || completion.reconciled !== true) {
|
|
43154
|
+
invalid = true;
|
|
43155
|
+
continue;
|
|
43156
|
+
}
|
|
43157
|
+
if (completion.outcome === 'already-converged')
|
|
43158
|
+
converged++;
|
|
43159
|
+
else if (completion.outcome === 'reconciled')
|
|
43160
|
+
reconciled++;
|
|
43161
|
+
else
|
|
43162
|
+
invalid = true;
|
|
43163
|
+
}
|
|
43164
|
+
if (!invalid && !reconciled && !converged)
|
|
43165
|
+
return { status: 'absent' };
|
|
43166
|
+
return invalid ? { status: 'invalid' } : { status: 'valid', counts: { reconciled, converged } };
|
|
43167
|
+
}
|
|
43168
|
+
|
|
43169
|
+
|
|
42880
43170
|
/***/ }),
|
|
42881
43171
|
|
|
42882
43172
|
/***/ 27150:
|
|
@@ -47566,6 +47856,8 @@ The setup runner profile selects placement; it does not install the project's la
|
|
|
47566
47856
|
|
|
47567
47857
|
Declare reviewed version prefixes in \`.copilot/verification-prerequisites.json\` (schemaVersion 1, runtimes such as java 17, node 24, pnpm 10). Copilot checks declared versions in the credential-free verification environment before each configured verification command; a missing or incompatible runtime blocks publication. Without this optional declaration, existing verification behavior remains and no language is inferred. Java provisioning may use \`actions/setup-java\`; \`JAVA_HOME\` and \`PATH\` survive isolation, while agent credentials and tool-option injection variables do not. Do not add an unreviewed bootstrap or weaken verification to work around a missing runtime. Read [verification prerequisites and same-job setup](https://docs.page/vypdev/copilot/security-operations/operations/verification#repository-verification-prerequisites).
|
|
47568
47858
|
|
|
47859
|
+
The optional repository-owned composite action prepares each candidate before verification. Setup creates .github/actions/copilot-verification-setup/action.yml only if missing and preserves an existing consumer action and its assets. The shared terminal/web assistant offers explicit activation, disabled by default. Customize the generated failing placeholder before enabling; setup generation and installer PRs do not prove runtime readiness. Review \`.github/actions/copilot-verification-setup/action.yml\` and its assets onto trusted main, update generated workflows, then enable \`VERIFICATION_SETUP=true\` (Action input \`verification-setup\`, disabled by default). GitHub Actions executes the trusted snapshot before each command with a fresh private HOME; candidate changes cannot replace it. Native post steps finish before profile cleanup. Setup failure blocks verification and commit/push. The local CLI cannot execute composite actions and fails closed when opted in. Read [repository-owned setup](https://docs.page/vypdev/copilot/security-operations/operations/verification#repository-owned-setup).
|
|
47860
|
+
|
|
47569
47861
|
For the full contributor flow, read [repository collaboration](https://github.com/vypdev/copilot/blob/master/docs/agents/repository-collaboration.mdx). For drift and recovery, read [guidance troubleshooting](https://github.com/vypdev/copilot/blob/master/docs/agents/repository-guidance-troubleshooting.mdx).
|
|
47570
47862
|
`;
|
|
47571
47863
|
}
|
|
@@ -47785,6 +48077,40 @@ function calculateReviewersStillNeeded(desiredCount, currentCount, confirmedCoun
|
|
|
47785
48077
|
}
|
|
47786
48078
|
|
|
47787
48079
|
|
|
48080
|
+
/***/ }),
|
|
48081
|
+
|
|
48082
|
+
/***/ 81053:
|
|
48083
|
+
/***/ ((__unused_webpack_module, exports) => {
|
|
48084
|
+
|
|
48085
|
+
"use strict";
|
|
48086
|
+
|
|
48087
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
48088
|
+
exports.sddAnalysisStatusMarker = sddAnalysisStatusMarker;
|
|
48089
|
+
exports.renderSddAnalysisStatus = renderSddAnalysisStatus;
|
|
48090
|
+
function sddAnalysisStatusMarker(issueNumber) {
|
|
48091
|
+
return `<!-- copilot:sdd-analysis-status:v1 issue="${issueNumber}" -->`;
|
|
48092
|
+
}
|
|
48093
|
+
const reasons = {
|
|
48094
|
+
'update-owner-mismatch': ['The update path does not belong to the selected catalog owner.', 'La ruta de actualización no pertenece al propietario seleccionado del catálogo.'],
|
|
48095
|
+
'companion-owner-unknown': ['The companion owner is absent from the catalog.', 'El propietario del SDD complementario no existe en el catálogo.'],
|
|
48096
|
+
'companion-path-registered': ['The companion path is already registered in the catalog.', 'La ruta del SDD complementario ya está registrada en el catálogo.'],
|
|
48097
|
+
'new-owner-registered': ['The proposed new capability already exists in the catalog.', 'La capacidad propuesta como nueva ya existe en el catálogo.'],
|
|
48098
|
+
'new-path-registered': ['The proposed new SDD path is already registered in the catalog.', 'La ruta propuesta como nueva ya está registrada en el catálogo.'],
|
|
48099
|
+
};
|
|
48100
|
+
/** Stateless diagnostic, deliberately separate from the validated readiness record. */
|
|
48101
|
+
function renderSddAnalysisStatus(issueNumber, locale, reason) {
|
|
48102
|
+
const spanish = /^es(?:-|$)/i.test(locale ?? '');
|
|
48103
|
+
const marker = sddAnalysisStatusMarker(issueNumber);
|
|
48104
|
+
if (!reason)
|
|
48105
|
+
return spanish
|
|
48106
|
+
? `## Estado del análisis del SDD\n\nEl análisis posterior ha validado la propiedad. La publicación y la preparación de la rama siguen pendientes de sus comprobaciones.\n\n${marker}`
|
|
48107
|
+
: `## SDD analysis status\n\nA subsequent analysis validated ownership. Publication and branch readiness remain subject to their checks.\n\n${marker}`;
|
|
48108
|
+
return spanish
|
|
48109
|
+
? `## Estado del SDD: análisis bloqueado\n\nNo se ha preparado ningún borrador ni publicación nueva. ${reasons[reason][1]}\n\n**Acción de mantenimiento:** Aclara en la misma issue el ID de capacidad del catálogo y la ruta: una actualización usa una ruta de ese propietario; un complemento usa un propietario existente y una ruta nueva; una capacidad nueva necesita ID y ruta sin registrar. Después vuelve a ejecutar el workflow original. Cada ejecución hace un solo análisis; no hay reparación ni reintento automático. Se conservan las respuestas, los SDD y las publicaciones anteriores.\n\n**Diagnóstico:** \`${reason}\`. La decisión rechazada no autoriza una rama ni la etiqueta de preparación.\n\n${marker}`
|
|
48110
|
+
: `## SDD work status: analysis blocked\n\nNo draft or new publication was prepared. ${reasons[reason][0]}\n\n**Maintainer action:** Clarify the catalog capability ID and path in this same issue: an update uses a path owned by that capability; a companion uses an existing owner and a new path; a new capability needs an unregistered ID and path. Then rerun the original workflow. Each invocation performs one analysis; there is no automatic repair or retry. Existing answers, SDDs and publications are retained.\n\n**Diagnostic:** \`${reason}\`. The rejected decision authorizes no branch or readiness label.\n\n${marker}`;
|
|
48111
|
+
}
|
|
48112
|
+
|
|
48113
|
+
|
|
47788
48114
|
/***/ }),
|
|
47789
48115
|
|
|
47790
48116
|
/***/ 2230:
|
|
@@ -48736,6 +49062,7 @@ exports.isSetupBatchInstallationReceipt = isSetupBatchInstallationReceipt;
|
|
|
48736
49062
|
exports.parseSetupBatchOperation = parseSetupBatchOperation;
|
|
48737
49063
|
exports.validSetupBatchAssetPath = validSetupBatchAssetPath;
|
|
48738
49064
|
const setup_batch_1 = __nccwpck_require__(88308);
|
|
49065
|
+
const setup_verification_action_1 = __nccwpck_require__(33156);
|
|
48739
49066
|
const uuid = /^[a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[89ab][a-f0-9]{3}-[a-f0-9]{12}$/u;
|
|
48740
49067
|
const sha = /^[a-f0-9]{40}$/u;
|
|
48741
49068
|
const digest = /^[a-f0-9]{64}$/u;
|
|
@@ -48841,6 +49168,7 @@ function validSetupBatchAssetPath(path) {
|
|
|
48841
49168
|
if (path.length > 240 || path.split('/').some(part => !part || part === '.' || part === '..') || /[^A-Za-z0-9_./-]/u.test(path))
|
|
48842
49169
|
return false;
|
|
48843
49170
|
return path === 'AGENTS.md' || path === '.agents/skills/copilot-repository-workflow/SKILL.md'
|
|
49171
|
+
|| path === setup_verification_action_1.SETUP_VERIFICATION_ACTION_PATH
|
|
48844
49172
|
|| /^\.github\/(?:workflows|ISSUE_TEMPLATE)\/[A-Za-z0-9_.-]+\.(?:yml|yaml)$/u.test(path)
|
|
48845
49173
|
|| path === '.github/pull_request_template.md' || /^\.copilot\/(?:repository-profile|setup-manifest|runner-profile)\.json$/u.test(path)
|
|
48846
49174
|
|| path === '.copilot/AGENT_GUIDE.md' || path.startsWith('.copilot/setup-backups/');
|
|
@@ -48947,6 +49275,7 @@ function createDefaultSetupConfiguration() {
|
|
|
48947
49275
|
choreTree: 'chore',
|
|
48948
49276
|
issueManagedBranches: true,
|
|
48949
49277
|
preBranchSdd: false,
|
|
49278
|
+
verificationSetup: false,
|
|
48950
49279
|
reopenIssueOnPush: true,
|
|
48951
49280
|
desiredAssigneesCount: 1,
|
|
48952
49281
|
desiredReviewersCount: 1,
|
|
@@ -49103,6 +49432,7 @@ Object.defineProperty(exports, "buildSetupCredentialRequirements", ({ enumerable
|
|
|
49103
49432
|
const locale_1 = __nccwpck_require__(15386);
|
|
49104
49433
|
const issue_workflow_profile_1 = __nccwpck_require__(26744);
|
|
49105
49434
|
const setup_issue_workflow_policy_1 = __nccwpck_require__(81182);
|
|
49435
|
+
const setup_verification_action_1 = __nccwpck_require__(33156);
|
|
49106
49436
|
const repository_agent_guidance_policy_1 = __nccwpck_require__(67402);
|
|
49107
49437
|
function buildSetupPlan(configuration, mergeQueueReadiness = [], approvalReadiness = []) {
|
|
49108
49438
|
const workflowFiles = (0, setup_workflow_catalog_1.enabledSetupWorkflowFiles)((0, setup_issue_workflow_policy_1.effectiveIssueWorkflowFeatures)(configuration))
|
|
@@ -49114,6 +49444,7 @@ function buildSetupPlan(configuration, mergeQueueReadiness = [], approvalReadine
|
|
|
49114
49444
|
.filter(file => configuration.features.release !== false || file !== 'release.yml')
|
|
49115
49445
|
.filter(file => configuration.features.hotfix !== false || file !== 'hotfix.yml');
|
|
49116
49446
|
const selectedFiles = [
|
|
49447
|
+
setup_verification_action_1.SETUP_VERIFICATION_ACTION_PATH,
|
|
49117
49448
|
...(configuration.runners && configuration.runners.mode !== 'retain' ? ['.copilot/runner-profile.json'] : []),
|
|
49118
49449
|
...workflowFiles.map(file => `workflows/${file}`),
|
|
49119
49450
|
...issueTemplateFiles.map(file => `ISSUE_TEMPLATE/${file}`),
|
|
@@ -49214,6 +49545,7 @@ function buildSetupRepositoryVariables(configuration) {
|
|
|
49214
49545
|
add('CHORE_TREE', repository.choreTree);
|
|
49215
49546
|
add('ISSUE_MANAGED_BRANCHES', repository.issueManagedBranches);
|
|
49216
49547
|
add('PRE_BRANCH_SDD', repository.preBranchSdd);
|
|
49548
|
+
add('VERIFICATION_SETUP', repository.verificationSetup ?? false);
|
|
49217
49549
|
add('REOPEN_ISSUE_ON_PUSH', repository.reopenIssueOnPush);
|
|
49218
49550
|
add('DESIRED_ASSIGNEES_COUNT', repository.desiredAssigneesCount);
|
|
49219
49551
|
add('DESIRED_REVIEWERS_COUNT', repository.desiredReviewersCount);
|
|
@@ -49276,6 +49608,7 @@ function buildSetupActionInputs(configuration) {
|
|
|
49276
49608
|
'chore-tree': repository.choreTree,
|
|
49277
49609
|
'issue-managed-branches': String(repository.issueManagedBranches),
|
|
49278
49610
|
'pre-branch-sdd': String(repository.preBranchSdd),
|
|
49611
|
+
'verification-setup': String(repository.verificationSetup ?? false),
|
|
49279
49612
|
'reopen-issue-on-push': String(repository.reopenIssueOnPush),
|
|
49280
49613
|
'desired-assignees-count': String(repository.desiredAssigneesCount),
|
|
49281
49614
|
'desired-reviewers-count': String(repository.desiredReviewersCount),
|
|
@@ -49721,6 +50054,9 @@ function validateSetupConfiguration(configuration, options = {}) {
|
|
|
49721
50054
|
|| typeof configuration.repository.preBranchSdd !== 'boolean') {
|
|
49722
50055
|
errors.push('issue-managed-branches and pre-branch-sdd must be boolean values.');
|
|
49723
50056
|
}
|
|
50057
|
+
if (configuration.repository.verificationSetup !== undefined && typeof configuration.repository.verificationSetup !== 'boolean') {
|
|
50058
|
+
errors.push('verification-setup must be a boolean value.');
|
|
50059
|
+
}
|
|
49724
50060
|
if (configuration.repository.preBranchSdd && !configuration.repository.issueManagedBranches) {
|
|
49725
50061
|
errors.push('pre-branch-sdd requires issue-managed-branches.');
|
|
49726
50062
|
}
|
|
@@ -50123,6 +50459,7 @@ const repositoryFields = [
|
|
|
50123
50459
|
['HOTFIX_TREE', 'hotfixTree'], ['RELEASE_TREE', 'releaseTree'],
|
|
50124
50460
|
['DOCS_TREE', 'docsTree'], ['CHORE_TREE', 'choreTree'],
|
|
50125
50461
|
['ISSUE_MANAGED_BRANCHES', 'issueManagedBranches'], ['PRE_BRANCH_SDD', 'preBranchSdd'],
|
|
50462
|
+
['VERIFICATION_SETUP', 'verificationSetup'],
|
|
50126
50463
|
['REOPEN_ISSUE_ON_PUSH', 'reopenIssueOnPush'], ['DESIRED_ASSIGNEES_COUNT', 'desiredAssigneesCount'],
|
|
50127
50464
|
['DESIRED_REVIEWERS_COUNT', 'desiredReviewersCount'], ['INACTIVITY_THRESHOLD_HOURS', 'inactivityThresholdHours'],
|
|
50128
50465
|
['REPOSITORY_LOCALE', 'repositoryLocale'], ['ISSUES_LOCALE', 'issueLocale'],
|
|
@@ -50853,6 +51190,58 @@ function verificationRuntimeMatches(required, observed) {
|
|
|
50853
51190
|
}
|
|
50854
51191
|
|
|
50855
51192
|
|
|
51193
|
+
/***/ }),
|
|
51194
|
+
|
|
51195
|
+
/***/ 65326:
|
|
51196
|
+
/***/ ((__unused_webpack_module, exports) => {
|
|
51197
|
+
|
|
51198
|
+
"use strict";
|
|
51199
|
+
|
|
51200
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
51201
|
+
exports.VerificationSetupError = exports.VERIFICATION_SETUP_HELP = exports.VERIFICATION_SETUP_LIMITS = exports.VERIFICATION_SETUP_PATH = exports.VERIFICATION_SETUP_DIRECTORY = void 0;
|
|
51202
|
+
exports.parseVerificationSetupResult = parseVerificationSetupResult;
|
|
51203
|
+
exports.VERIFICATION_SETUP_DIRECTORY = '.github/actions/copilot-verification-setup';
|
|
51204
|
+
exports.VERIFICATION_SETUP_PATH = `${exports.VERIFICATION_SETUP_DIRECTORY}/action.yml`;
|
|
51205
|
+
exports.VERIFICATION_SETUP_LIMITS = Object.freeze({ timeoutMs: 300000, resultBytes: 16384, scriptBytes: 65536, snapshotBytes: 262144, files: 32, requests: 20 });
|
|
51206
|
+
exports.VERIFICATION_SETUP_HELP = 'https://docs.page/vypdev/copilot/security-operations/operations/verification#repository-owned-setup';
|
|
51207
|
+
/** Closed facts only. Provider/helper output and raw exception causes never cross this boundary. */
|
|
51208
|
+
class VerificationSetupError extends Error {
|
|
51209
|
+
constructor(reason, sourceSha, exitCode) {
|
|
51210
|
+
const sha = sourceSha && /^(?:[a-f0-9]{40}|[a-f0-9]{64})$/u.test(sourceSha) ? sourceSha : 'unavailable';
|
|
51211
|
+
const exit = Number.isInteger(exitCode) && exitCode >= 0 && exitCode <= 255 ? ` Exit status: ${exitCode}.` : '';
|
|
51212
|
+
const action = reason === 'native-workflow-required'
|
|
51213
|
+
? 'Update the generated Copilot workflows and run this operation in GitHub Actions; the local CLI cannot execute composite actions.'
|
|
51214
|
+
: `Review ${exports.VERIFICATION_SETUP_PATH} on the trusted main branch and rerun.`;
|
|
51215
|
+
super(`Repository setup blocked verification (${reason}). ${action} Trusted source SHA: ${sha}.${exit} Verification, commit and push are withheld. Help: ${exports.VERIFICATION_SETUP_HELP}`);
|
|
51216
|
+
this.reason = reason;
|
|
51217
|
+
this.exitCode = exitCode;
|
|
51218
|
+
this.name = 'VerificationSetupError';
|
|
51219
|
+
}
|
|
51220
|
+
}
|
|
51221
|
+
exports.VerificationSetupError = VerificationSetupError;
|
|
51222
|
+
function record(value) {
|
|
51223
|
+
return !!value && typeof value === 'object' && !Array.isArray(value);
|
|
51224
|
+
}
|
|
51225
|
+
function pathString(value) {
|
|
51226
|
+
return typeof value === 'string' && value.length > 0 && value.length <= 2048
|
|
51227
|
+
&& ![...value].some(character => character.charCodeAt(0) < 32 || character.charCodeAt(0) === 127);
|
|
51228
|
+
}
|
|
51229
|
+
/** Filesystem containment is checked by the adapter, after this closed schema is parsed. */
|
|
51230
|
+
function parseVerificationSetupResult(value) {
|
|
51231
|
+
if (!record(value) || value.schemaVersion !== 1 || Object.keys(value).some(key => !['schemaVersion', 'path', 'environment'].includes(key))) {
|
|
51232
|
+
throw new VerificationSetupError('result-invalid');
|
|
51233
|
+
}
|
|
51234
|
+
const paths = value.path === undefined ? [] : value.path;
|
|
51235
|
+
const environment = value.environment === undefined ? {} : value.environment;
|
|
51236
|
+
if (!Array.isArray(paths) || paths.length > 8 || !paths.every(pathString) || new Set(paths).size !== paths.length
|
|
51237
|
+
|| !record(environment) || Object.keys(environment).some(key => key !== 'JAVA_HOME')
|
|
51238
|
+
|| ('JAVA_HOME' in environment && !pathString(environment.JAVA_HOME))) {
|
|
51239
|
+
throw new VerificationSetupError('result-invalid');
|
|
51240
|
+
}
|
|
51241
|
+
return Object.freeze({ path: Object.freeze([...paths]), ...(environment.JAVA_HOME ? { javaHome: environment.JAVA_HOME } : {}) });
|
|
51242
|
+
}
|
|
51243
|
+
|
|
51244
|
+
|
|
50856
51245
|
/***/ }),
|
|
50857
51246
|
|
|
50858
51247
|
/***/ 43193:
|
|
@@ -51018,6 +51407,13 @@ class PullRequestReviewOperationError extends Error {
|
|
|
51018
51407
|
super(buildMessage(operation, context));
|
|
51019
51408
|
this.name = "PullRequestReviewOperationError";
|
|
51020
51409
|
this.operation = operation;
|
|
51410
|
+
const status = context?.providerStatus;
|
|
51411
|
+
if (typeof status === 'number' && Number.isInteger(status) && status >= 400 && status <= 599) {
|
|
51412
|
+
this.providerStatus = status;
|
|
51413
|
+
}
|
|
51414
|
+
if (typeof context?.providerReference === 'string' && /^[A-Za-z0-9:-]{1,64}$/.test(context.providerReference)) {
|
|
51415
|
+
this.providerReference = context.providerReference;
|
|
51416
|
+
}
|
|
51021
51417
|
}
|
|
51022
51418
|
}
|
|
51023
51419
|
exports.PullRequestReviewOperationError = PullRequestReviewOperationError;
|
|
@@ -51058,6 +51454,18 @@ function bindSddEvidenceReadPorts(ports) {
|
|
|
51058
51454
|
}
|
|
51059
51455
|
|
|
51060
51456
|
|
|
51457
|
+
/***/ }),
|
|
51458
|
+
|
|
51459
|
+
/***/ 26509:
|
|
51460
|
+
/***/ ((__unused_webpack_module, exports) => {
|
|
51461
|
+
|
|
51462
|
+
"use strict";
|
|
51463
|
+
|
|
51464
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
51465
|
+
exports.DISABLED_VERIFICATION_SETUP = void 0;
|
|
51466
|
+
exports.DISABLED_VERIFICATION_SETUP = Object.freeze({ kind: 'disabled' });
|
|
51467
|
+
|
|
51468
|
+
|
|
51061
51469
|
/***/ }),
|
|
51062
51470
|
|
|
51063
51471
|
/***/ 84387:
|
|
@@ -52968,6 +53376,7 @@ async function runInitialSetupWorkflow(request, dependencies) {
|
|
|
52968
53376
|
}
|
|
52969
53377
|
(0, logging_ports_1.logInfo)('📋 Ensuring .github and copying setup files...');
|
|
52970
53378
|
const workspaceSelection = {
|
|
53379
|
+
...(request.verificationActionState ? { verificationActionState: request.verificationActionState } : {}),
|
|
52971
53380
|
features: setupConfiguration?.features,
|
|
52972
53381
|
setupConfiguration,
|
|
52973
53382
|
...(request.workflowUpdates.length > 0 ? {
|
|
@@ -52979,6 +53388,8 @@ async function runInitialSetupWorkflow(request, dependencies) {
|
|
|
52979
53388
|
const filesResult = dependencies.setupWorkspacePort.prepare(workspaceSelection);
|
|
52980
53389
|
mark('files', filesResult.copied > 0 ? 'completed' : 'skipped');
|
|
52981
53390
|
steps.push(`✅ Setup files: ${filesResult.copied} copied, ${filesResult.skipped} already existed`);
|
|
53391
|
+
if (request.verificationActionState)
|
|
53392
|
+
steps.push(`✅ Verification setup action ${request.verificationActionState === 'create' ? 'created' : 'preserved'}; VERIFICATION_SETUP=${setupConfiguration?.repository.verificationSetup ?? false}. Customize and review on MAIN_BRANCH, then run a real verification.`);
|
|
52982
53393
|
if (setupConfiguration?.manageRepositorySecrets && secretValues > 0)
|
|
52983
53394
|
mark('secrets', 'in-progress');
|
|
52984
53395
|
const secrets = await (0, setup_resource_provisioning_1.ensureRepositorySecrets)(request, dependencies, setupConfiguration, remoteConfiguration);
|
|
@@ -54062,8 +54473,9 @@ function failure(taskId, message, code) {
|
|
|
54062
54473
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
54063
54474
|
exports.ReconcileClosedIssueMetadataUseCase = void 0;
|
|
54064
54475
|
const result_1 = __nccwpck_require__(73817);
|
|
54065
|
-
const issue_completion_1 = __nccwpck_require__(31147);
|
|
54066
54476
|
const application_error_1 = __nccwpck_require__(75999);
|
|
54477
|
+
const closed_issue_reconciliation_error_1 = __nccwpck_require__(12183);
|
|
54478
|
+
const reconcile_issue_completion_metadata_1 = __nccwpck_require__(70614);
|
|
54067
54479
|
/** Selective completion repair from fresh native facts; no native state authority. */
|
|
54068
54480
|
class ReconcileClosedIssueMetadataUseCase {
|
|
54069
54481
|
constructor(issues) {
|
|
@@ -54071,50 +54483,22 @@ class ReconcileClosedIssueMetadataUseCase {
|
|
|
54071
54483
|
this.taskId = 'ReconcileClosedIssueMetadataUseCase';
|
|
54072
54484
|
}
|
|
54073
54485
|
async invoke(context) {
|
|
54074
|
-
|
|
54075
|
-
let nativeClosed = false;
|
|
54486
|
+
const progress = (0, reconcile_issue_completion_metadata_1.completionRepairProgress)();
|
|
54076
54487
|
try {
|
|
54077
54488
|
if (!Number.isSafeInteger(context.issueNumber) || context.issueNumber < 1)
|
|
54078
54489
|
throw stale();
|
|
54079
54490
|
const target = this.issues.forIssue(context.issueNumber);
|
|
54080
|
-
const
|
|
54081
|
-
|
|
54082
|
-
const initialPlan = (0, issue_completion_1.planIssueCompletion)(initial, context.completionLabels);
|
|
54083
|
-
if (!nativeClosed || initialPlan.kind !== 'closed')
|
|
54084
|
-
throw stale();
|
|
54085
|
-
const fence = async () => {
|
|
54086
|
-
const current = await target.read();
|
|
54087
|
-
nativeClosed = current.number === context.issueNumber && current.state === 'closed';
|
|
54088
|
-
const plan = (0, issue_completion_1.planIssueCompletion)(current, context.completionLabels);
|
|
54089
|
-
if (!nativeClosed || plan.kind !== 'closed' || current.reason !== initial.reason)
|
|
54090
|
-
throw stale();
|
|
54091
|
-
return plan;
|
|
54092
|
-
};
|
|
54093
|
-
for (const label of initialPlan.remove) {
|
|
54094
|
-
if ((await fence()).remove.includes(label)) {
|
|
54095
|
-
await target.removeLabel(label);
|
|
54096
|
-
labelsChanged++;
|
|
54097
|
-
}
|
|
54098
|
-
}
|
|
54099
|
-
for (const label of initialPlan.add) {
|
|
54100
|
-
if ((await fence()).add.includes(label)) {
|
|
54101
|
-
await target.addLabel(label);
|
|
54102
|
-
labelsChanged++;
|
|
54103
|
-
}
|
|
54104
|
-
}
|
|
54105
|
-
const final = await fence();
|
|
54106
|
-
if (final.remove.length || final.add.length)
|
|
54107
|
-
throw stale();
|
|
54108
|
-
return [new result_1.Result({ id: this.taskId, success: true, executed: labelsChanged > 0,
|
|
54491
|
+
const repaired = await (0, reconcile_issue_completion_metadata_1.reconcileIssueCompletionMetadata)(target, context.issueNumber, context.completionLabels, progress);
|
|
54492
|
+
return [new result_1.Result({ id: this.taskId, success: true, executed: progress.labelsChanged > 0,
|
|
54109
54493
|
steps: ['The closed issue completion metadata was verified; historical and unrelated labels were retained.'],
|
|
54110
|
-
payload: { issueCompletion: { nativeClosed, labelsChanged, reconciled: true,
|
|
54494
|
+
payload: { issueCompletion: { nativeClosed: progress.nativeClosed, labelsChanged: progress.labelsChanged, reconciled: true, ...repaired } } })];
|
|
54111
54495
|
}
|
|
54112
54496
|
catch (cause) {
|
|
54113
|
-
return [new result_1.Result({ id: this.taskId, success: false, executed: labelsChanged > 0,
|
|
54114
|
-
steps: [nativeClosed ? 'The issue remains closed; completion metadata could not be fully verified. Inspect and retry the closed-issue workflow.'
|
|
54497
|
+
return [new result_1.Result({ id: this.taskId, success: false, executed: progress.labelsChanged > 0,
|
|
54498
|
+
steps: [progress.nativeClosed ? 'The issue remains closed; completion metadata could not be fully verified. Inspect and retry the closed-issue workflow.'
|
|
54115
54499
|
: 'Current native issue closure could not be verified; completion repair stopped without changing native state.'],
|
|
54116
|
-
errors: [(0,
|
|
54117
|
-
payload: { issueCompletion: { nativeClosed, labelsChanged, reconciled: false } } })];
|
|
54500
|
+
errors: [(0, closed_issue_reconciliation_error_1.closedIssueReconciliationError)(cause, { resultId: this.taskId, phase: progress.phase, state: progress.state, reason: progress.reason, changed: progress.labelsChanged, remaining: progress.remaining })],
|
|
54501
|
+
payload: { issueCompletion: { nativeClosed: progress.nativeClosed, labelsChanged: progress.labelsChanged, reconciled: false } } })];
|
|
54118
54502
|
}
|
|
54119
54503
|
}
|
|
54120
54504
|
}
|
|
@@ -54147,6 +54531,84 @@ class ReconcileClosedIssueUseCase {
|
|
|
54147
54531
|
exports.ReconcileClosedIssueUseCase = ReconcileClosedIssueUseCase;
|
|
54148
54532
|
|
|
54149
54533
|
|
|
54534
|
+
/***/ }),
|
|
54535
|
+
|
|
54536
|
+
/***/ 70614:
|
|
54537
|
+
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
54538
|
+
|
|
54539
|
+
"use strict";
|
|
54540
|
+
|
|
54541
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
54542
|
+
exports.completionRepairProgress = void 0;
|
|
54543
|
+
exports.reconcileIssueCompletionMetadata = reconcileIssueCompletionMetadata;
|
|
54544
|
+
const application_error_1 = __nccwpck_require__(75999);
|
|
54545
|
+
const issue_completion_1 = __nccwpck_require__(31147);
|
|
54546
|
+
const closed_issue_reconciliation_1 = __nccwpck_require__(21565);
|
|
54547
|
+
const completionRepairProgress = () => ({ nativeClosed: false, labelsChanged: 0,
|
|
54548
|
+
phase: 'identity', state: 'unavailable', reason: 'unavailable', remaining: 0 });
|
|
54549
|
+
exports.completionRepairProgress = completionRepairProgress;
|
|
54550
|
+
/** At most two bounded selective passes, with fresh native fences before every write. */
|
|
54551
|
+
async function reconcileIssueCompletionMetadata(target, number, configuration, progress, initial) {
|
|
54552
|
+
let expectedReason;
|
|
54553
|
+
let superseded = false;
|
|
54554
|
+
const read = async (phase, snapshot) => {
|
|
54555
|
+
progress.phase = phase;
|
|
54556
|
+
progress.state = 'unavailable';
|
|
54557
|
+
progress.reason = 'unavailable';
|
|
54558
|
+
const facts = snapshot ?? await target.read();
|
|
54559
|
+
progress.nativeClosed = facts?.number === number && facts.state === 'closed';
|
|
54560
|
+
progress.state = facts?.number === number && ['open', 'closed'].includes(facts.state) ? facts.state : 'unavailable';
|
|
54561
|
+
progress.reason = closed_issue_reconciliation_1.CLOSED_ISSUE_REASONS.some(reason => reason === facts?.reason) ? facts.reason : 'unavailable';
|
|
54562
|
+
const plan = (0, issue_completion_1.planIssueCompletion)(facts, configuration);
|
|
54563
|
+
if (!progress.nativeClosed || plan.kind !== 'closed' || expectedReason !== undefined && facts.reason !== expectedReason) {
|
|
54564
|
+
throw new application_error_1.ApplicationError('workflow.stale', 'The native issue identity, state or closure reason changed.');
|
|
54565
|
+
}
|
|
54566
|
+
expectedReason = facts.reason;
|
|
54567
|
+
progress.remaining = plan.remove.length + plan.add.length;
|
|
54568
|
+
return plan;
|
|
54569
|
+
};
|
|
54570
|
+
let plan = await read('read', initial);
|
|
54571
|
+
for (let pass = 0; pass < 2; pass++) {
|
|
54572
|
+
for (const label of plan.remove) {
|
|
54573
|
+
if (!(await read('label-remove')).remove.includes(label)) {
|
|
54574
|
+
superseded = true;
|
|
54575
|
+
continue;
|
|
54576
|
+
}
|
|
54577
|
+
try {
|
|
54578
|
+
await target.removeLabel(label);
|
|
54579
|
+
progress.labelsChanged++;
|
|
54580
|
+
}
|
|
54581
|
+
catch (cause) {
|
|
54582
|
+
if ((await read('label-remove')).remove.includes(label))
|
|
54583
|
+
throw cause;
|
|
54584
|
+
superseded = true;
|
|
54585
|
+
}
|
|
54586
|
+
}
|
|
54587
|
+
for (const label of plan.add) {
|
|
54588
|
+
if (!(await read('label-add')).add.includes(label)) {
|
|
54589
|
+
superseded = true;
|
|
54590
|
+
continue;
|
|
54591
|
+
}
|
|
54592
|
+
try {
|
|
54593
|
+
await target.addLabel(label);
|
|
54594
|
+
progress.labelsChanged++;
|
|
54595
|
+
}
|
|
54596
|
+
catch (cause) {
|
|
54597
|
+
if ((await read('label-add')).add.includes(label))
|
|
54598
|
+
throw cause;
|
|
54599
|
+
superseded = true;
|
|
54600
|
+
}
|
|
54601
|
+
}
|
|
54602
|
+
plan = await read('metadata-verification');
|
|
54603
|
+
if (!progress.remaining)
|
|
54604
|
+
return { reason: plan.reason,
|
|
54605
|
+
outcome: progress.labelsChanged ? 'reconciled' : 'already-converged', superseded };
|
|
54606
|
+
superseded = true;
|
|
54607
|
+
}
|
|
54608
|
+
throw new application_error_1.ApplicationError('provider.conflict', 'Completion metadata remains incomplete after two bounded passes.');
|
|
54609
|
+
}
|
|
54610
|
+
|
|
54611
|
+
|
|
54150
54612
|
/***/ }),
|
|
54151
54613
|
|
|
54152
54614
|
/***/ 74111:
|
|
@@ -54156,7 +54618,9 @@ exports.ReconcileClosedIssueUseCase = ReconcileClosedIssueUseCase;
|
|
|
54156
54618
|
|
|
54157
54619
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
54158
54620
|
exports.RetireBranchSyncUseCase = void 0;
|
|
54159
|
-
const
|
|
54621
|
+
const verify_closed_issue_card_retirement_1 = __nccwpck_require__(78813);
|
|
54622
|
+
const closed_issue_reconciliation_error_1 = __nccwpck_require__(12183);
|
|
54623
|
+
const closed_issue_reconciliation_1 = __nccwpck_require__(21565);
|
|
54160
54624
|
const result_1 = __nccwpck_require__(73817);
|
|
54161
54625
|
const github_user_policy_1 = __nccwpck_require__(84403);
|
|
54162
54626
|
const publication_identity_policy_1 = __nccwpck_require__(45403);
|
|
@@ -54174,17 +54638,33 @@ class RetireBranchSyncUseCase {
|
|
|
54174
54638
|
async invoke(context) {
|
|
54175
54639
|
let retired = 0;
|
|
54176
54640
|
let nativeClosed = false;
|
|
54641
|
+
let phase = 'identity';
|
|
54642
|
+
let state = 'unavailable';
|
|
54643
|
+
let reason = 'unavailable';
|
|
54644
|
+
let remaining = 0;
|
|
54645
|
+
let superseded = false;
|
|
54177
54646
|
try {
|
|
54178
54647
|
if (!Number.isSafeInteger(context.issueNumber) || context.issueNumber < 1 || !context.trustedBotLogin) {
|
|
54179
54648
|
return [this.result(retired, nativeClosed)];
|
|
54180
54649
|
}
|
|
54181
|
-
const
|
|
54182
|
-
|
|
54650
|
+
const read = async () => {
|
|
54651
|
+
state = 'unavailable';
|
|
54652
|
+
reason = 'unavailable';
|
|
54653
|
+
const facts = await this.issues.readIssue(context.issueNumber);
|
|
54654
|
+
nativeClosed = facts?.number === context.issueNumber && facts.state === 'closed';
|
|
54655
|
+
state = facts?.number === context.issueNumber && ['open', 'closed'].includes(facts.state) ? facts.state : 'unavailable';
|
|
54656
|
+
reason = closed_issue_reconciliation_1.CLOSED_ISSUE_REASONS.some(value => value === facts?.reason) ? facts.reason : 'unavailable';
|
|
54657
|
+
return facts;
|
|
54658
|
+
};
|
|
54659
|
+
phase = 'read';
|
|
54660
|
+
const initial = await read();
|
|
54661
|
+
if (initial.number !== context.issueNumber || !['open', 'closed'].includes(initial.state) || initial.state === 'closed' && !['completed', 'not_planned', 'duplicate', 'unknown'].includes(initial.reason))
|
|
54183
54662
|
throw stale();
|
|
54184
54663
|
if (initial.state !== 'closed')
|
|
54185
54664
|
return [this.result(retired, nativeClosed)];
|
|
54186
54665
|
nativeClosed = true;
|
|
54187
54666
|
const messages = (0, branch_sync_message_catalog_1.resolveStaticBranchSyncCatalog)(context.locale);
|
|
54667
|
+
phase = 'card-inventory';
|
|
54188
54668
|
const cards = (await this.comments.listIssueComments(context.issueNumber)).filter(comment => {
|
|
54189
54669
|
const marker = (0, publication_identity_policy_1.parsePublicationMarker)(comment.body);
|
|
54190
54670
|
return marker?.identity.topic === 'branch-sync' && marker.identity.target.kind === 'issue'
|
|
@@ -54193,38 +54673,40 @@ class RetireBranchSyncUseCase {
|
|
|
54193
54673
|
&& Number.isSafeInteger(comment.id) && comment.id > 0
|
|
54194
54674
|
&& Boolean(comment.user?.login && (0, github_user_policy_1.githubUsersMatch)(context.trustedBotLogin, comment.user.login));
|
|
54195
54675
|
});
|
|
54676
|
+
remaining = Math.min(cards.length, 3000);
|
|
54196
54677
|
if (cards.length > 20)
|
|
54197
54678
|
throw stale();
|
|
54679
|
+
const verifyClosed = async () => {
|
|
54680
|
+
phase = 'native-fence';
|
|
54681
|
+
const fresh = await read();
|
|
54682
|
+
if (!nativeClosed || fresh.reason !== initial.reason)
|
|
54683
|
+
throw stale();
|
|
54684
|
+
};
|
|
54198
54685
|
for (const card of cards) {
|
|
54199
54686
|
const marker = (0, publication_identity_policy_1.parsePublicationMarker)(card.body);
|
|
54200
54687
|
const body = (0, branch_sync_notification_policy_1.buildRetiredBranchSyncComment)(marker.identity, messages);
|
|
54201
|
-
|
|
54202
|
-
|
|
54203
|
-
|
|
54204
|
-
|
|
54205
|
-
|
|
54206
|
-
|
|
54207
|
-
throw stale();
|
|
54208
|
-
const fresh = await this.issues.readIssue(context.issueNumber);
|
|
54209
|
-
nativeClosed = fresh.number === context.issueNumber && fresh.state === 'closed';
|
|
54210
|
-
if (!nativeClosed || fresh.reason !== initial.reason)
|
|
54211
|
-
throw stale();
|
|
54212
|
-
await this.comments.updateComment(context.issueNumber, card.id, body);
|
|
54213
|
-
retired++;
|
|
54688
|
+
const verified = await (0, verify_closed_issue_card_retirement_1.verifyClosedIssueCardRetirement)({ issueNumber: context.issueNumber,
|
|
54689
|
+
commentId: card.id, author: context.trustedBotLogin, originalBody: card.body ?? '', finalBody: body,
|
|
54690
|
+
freshness: this.cardFreshness, verifyClosed, onUpdated: () => { retired++; }, phase: value => { phase = value; },
|
|
54691
|
+
update: () => this.comments.updateComment(context.issueNumber, card.id, body) });
|
|
54692
|
+
superseded || (superseded = verified.superseded);
|
|
54693
|
+
remaining--;
|
|
54214
54694
|
}
|
|
54215
|
-
|
|
54695
|
+
await verifyClosed();
|
|
54696
|
+
return [this.result(retired, nativeClosed, superseded)];
|
|
54216
54697
|
}
|
|
54217
54698
|
catch (cause) {
|
|
54218
54699
|
return [new result_1.Result({ id: this.taskId, success: false, executed: retired > 0,
|
|
54219
54700
|
steps: [nativeClosed ? 'Issue closure is retained; synchronization recommendation retirement could not be fully verified. Retry the closed-issue event or merged-PR operation.' : 'Native issue closure could not be verified; synchronization recommendations were left unchanged.'],
|
|
54220
|
-
errors: [(0,
|
|
54701
|
+
errors: [(0, closed_issue_reconciliation_error_1.closedIssueReconciliationError)(cause, { resultId: this.taskId, phase, state, reason, changed: retired, remaining })],
|
|
54221
54702
|
payload: { nativeClosed, retiredCards: retired, reconciled: false } })];
|
|
54222
54703
|
}
|
|
54223
54704
|
}
|
|
54224
|
-
result(retired, nativeClosed) {
|
|
54705
|
+
result(retired, nativeClosed, superseded = false) {
|
|
54225
54706
|
return new result_1.Result({ id: this.taskId, success: true, executed: retired > 0,
|
|
54226
54707
|
steps: [retired ? 'The closed issue’s synchronization recommendations were retired.' : 'No synchronization recommendation required retirement.'],
|
|
54227
|
-
payload: { ...(nativeClosed ? { state: 'closed' } : {}), nativeClosed, retiredCards: retired, reconciled: true
|
|
54708
|
+
payload: { ...(nativeClosed ? { state: 'closed' } : {}), nativeClosed, retiredCards: retired, reconciled: true, superseded,
|
|
54709
|
+
outcome: nativeClosed ? retired ? 'reconciled' : 'already-converged' : 'not-applicable' } });
|
|
54228
54710
|
}
|
|
54229
54711
|
}
|
|
54230
54712
|
exports.RetireBranchSyncUseCase = RetireBranchSyncUseCase;
|
|
@@ -54265,7 +54747,9 @@ exports.RetireClosedIssueCardsUseCase = RetireClosedIssueCardsUseCase;
|
|
|
54265
54747
|
|
|
54266
54748
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
54267
54749
|
exports.RetireProgressUseCase = void 0;
|
|
54268
|
-
const
|
|
54750
|
+
const verify_closed_issue_card_retirement_1 = __nccwpck_require__(78813);
|
|
54751
|
+
const closed_issue_reconciliation_error_1 = __nccwpck_require__(12183);
|
|
54752
|
+
const closed_issue_reconciliation_1 = __nccwpck_require__(21565);
|
|
54269
54753
|
const result_1 = __nccwpck_require__(73817);
|
|
54270
54754
|
const github_user_policy_1 = __nccwpck_require__(84403);
|
|
54271
54755
|
const publication_identity_policy_1 = __nccwpck_require__(45403);
|
|
@@ -54282,16 +54766,32 @@ class RetireProgressUseCase {
|
|
|
54282
54766
|
async invoke(context) {
|
|
54283
54767
|
let retired = 0;
|
|
54284
54768
|
let nativeClosed = false;
|
|
54769
|
+
let phase = 'identity';
|
|
54770
|
+
let state = 'unavailable';
|
|
54771
|
+
let reason = 'unavailable';
|
|
54772
|
+
let remaining = 0;
|
|
54773
|
+
let superseded = false;
|
|
54285
54774
|
try {
|
|
54286
54775
|
if (!Number.isSafeInteger(context.issueNumber) || context.issueNumber < 1 || !context.trustedBotLogin) {
|
|
54287
54776
|
return [this.result(retired, nativeClosed)];
|
|
54288
54777
|
}
|
|
54289
|
-
const
|
|
54778
|
+
const read = async () => {
|
|
54779
|
+
state = 'unavailable';
|
|
54780
|
+
reason = 'unavailable';
|
|
54781
|
+
const facts = await this.issues.readIssue(context.issueNumber);
|
|
54782
|
+
nativeClosed = facts?.number === context.issueNumber && facts.state === 'closed';
|
|
54783
|
+
state = facts?.number === context.issueNumber && ['open', 'closed'].includes(facts.state) ? facts.state : 'unavailable';
|
|
54784
|
+
reason = closed_issue_reconciliation_1.CLOSED_ISSUE_REASONS.some(value => value === facts?.reason) ? facts.reason : 'unavailable';
|
|
54785
|
+
return facts;
|
|
54786
|
+
};
|
|
54787
|
+
phase = 'read';
|
|
54788
|
+
const initial = await read();
|
|
54290
54789
|
if (initial.number !== context.issueNumber || !['open', 'closed'].includes(initial.state) || initial.state === 'closed' && !['completed', 'not_planned', 'duplicate', 'unknown'].includes(initial.reason))
|
|
54291
54790
|
throw stale();
|
|
54292
54791
|
if (initial.state !== 'closed')
|
|
54293
54792
|
return [this.result(retired, nativeClosed)];
|
|
54294
54793
|
nativeClosed = true;
|
|
54794
|
+
phase = 'card-inventory';
|
|
54295
54795
|
const cards = (await this.comments.listIssueComments(context.issueNumber)).filter(comment => {
|
|
54296
54796
|
const marker = (0, publication_identity_policy_1.parsePublicationMarker)(comment.body);
|
|
54297
54797
|
return marker?.identity.topic === 'progress' && marker.identity.target.kind === 'issue'
|
|
@@ -54300,37 +54800,39 @@ class RetireProgressUseCase {
|
|
|
54300
54800
|
&& Number.isSafeInteger(comment.id) && comment.id > 0
|
|
54301
54801
|
&& Boolean(comment.user?.login && (0, github_user_policy_1.githubUsersMatch)(context.trustedBotLogin, comment.user.login));
|
|
54302
54802
|
});
|
|
54803
|
+
remaining = Math.min(cards.length, 3000);
|
|
54303
54804
|
if (cards.length > 20)
|
|
54304
54805
|
throw stale();
|
|
54305
|
-
|
|
54306
|
-
|
|
54307
|
-
|
|
54308
|
-
continue;
|
|
54309
|
-
const witness = Object.freeze({ surface: 'issue-comment', commentId: card.id,
|
|
54310
|
-
author: context.trustedBotLogin, target: Object.freeze({ kind: 'issue', number: context.issueNumber }),
|
|
54311
|
-
bodyDigest: (0, reply_request_digest_1.replyRequestBodyDigest)(card.body ?? '') });
|
|
54312
|
-
if (!await this.cardFreshness.matches(witness))
|
|
54313
|
-
throw stale();
|
|
54314
|
-
const fresh = await this.issues.readIssue(context.issueNumber);
|
|
54315
|
-
nativeClosed = fresh.number === context.issueNumber && fresh.state === 'closed';
|
|
54806
|
+
const verifyClosed = async () => {
|
|
54807
|
+
phase = 'native-fence';
|
|
54808
|
+
const fresh = await read();
|
|
54316
54809
|
if (!nativeClosed || fresh.reason !== initial.reason)
|
|
54317
54810
|
throw stale();
|
|
54318
|
-
|
|
54319
|
-
|
|
54811
|
+
};
|
|
54812
|
+
for (const card of cards) {
|
|
54813
|
+
const body = (0, retired_progress_presentation_policy_1.buildRetiredProgressComment)(card.body ?? '', context.locale, initial.reason);
|
|
54814
|
+
const verified = await (0, verify_closed_issue_card_retirement_1.verifyClosedIssueCardRetirement)({ issueNumber: context.issueNumber,
|
|
54815
|
+
commentId: card.id, author: context.trustedBotLogin, originalBody: card.body ?? '', finalBody: body,
|
|
54816
|
+
freshness: this.cardFreshness, verifyClosed, onUpdated: () => { retired++; }, phase: value => { phase = value; },
|
|
54817
|
+
update: () => this.comments.updateComment(context.issueNumber, card.id, body) });
|
|
54818
|
+
superseded || (superseded = verified.superseded);
|
|
54819
|
+
remaining--;
|
|
54320
54820
|
}
|
|
54321
|
-
|
|
54821
|
+
await verifyClosed();
|
|
54822
|
+
return [this.result(retired, nativeClosed, superseded)];
|
|
54322
54823
|
}
|
|
54323
54824
|
catch (cause) {
|
|
54324
54825
|
return [new result_1.Result({ id: this.taskId, success: false, executed: retired > 0,
|
|
54325
54826
|
steps: [nativeClosed ? 'Issue closure is retained; progress card retirement could not be fully verified. Retry the closed-issue event or merged-PR operation.' : 'Native issue closure could not be verified; progress cards were left unchanged.'],
|
|
54326
|
-
errors: [(0,
|
|
54827
|
+
errors: [(0, closed_issue_reconciliation_error_1.closedIssueReconciliationError)(cause, { resultId: this.taskId, phase, state, reason, changed: retired, remaining })],
|
|
54327
54828
|
payload: { nativeClosed, retiredCards: retired, reconciled: false } })];
|
|
54328
54829
|
}
|
|
54329
54830
|
}
|
|
54330
|
-
result(retired, nativeClosed) {
|
|
54831
|
+
result(retired, nativeClosed, superseded = false) {
|
|
54331
54832
|
return new result_1.Result({ id: this.taskId, success: true, executed: retired > 0,
|
|
54332
54833
|
steps: [retired ? 'The closed issue’s progress cards were retired.' : 'No progress card required retirement.'],
|
|
54333
|
-
payload: { ...(nativeClosed ? { state: 'closed' } : {}), nativeClosed, retiredCards: retired, reconciled: true
|
|
54834
|
+
payload: { ...(nativeClosed ? { state: 'closed' } : {}), nativeClosed, retiredCards: retired, reconciled: true, superseded,
|
|
54835
|
+
outcome: nativeClosed ? retired ? 'reconciled' : 'already-converged' : 'not-applicable' } });
|
|
54334
54836
|
}
|
|
54335
54837
|
}
|
|
54336
54838
|
exports.RetireProgressUseCase = RetireProgressUseCase;
|
|
@@ -54853,6 +55355,48 @@ function sameLabels(left, right) {
|
|
|
54853
55355
|
}
|
|
54854
55356
|
|
|
54855
55357
|
|
|
55358
|
+
/***/ }),
|
|
55359
|
+
|
|
55360
|
+
/***/ 78813:
|
|
55361
|
+
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
55362
|
+
|
|
55363
|
+
"use strict";
|
|
55364
|
+
|
|
55365
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
55366
|
+
exports.verifyClosedIssueCardRetirement = verifyClosedIssueCardRetirement;
|
|
55367
|
+
const reply_request_digest_1 = __nccwpck_require__(47971);
|
|
55368
|
+
const application_error_1 = __nccwpck_require__(75999);
|
|
55369
|
+
/** Adopt another invocation only after the exact final owned body and native closure are fresh. */
|
|
55370
|
+
async function verifyClosedIssueCardRetirement(input) {
|
|
55371
|
+
const witness = (body) => Object.freeze({ surface: 'issue-comment',
|
|
55372
|
+
commentId: input.commentId, author: input.author,
|
|
55373
|
+
target: Object.freeze({ kind: 'issue', number: input.issueNumber }), bodyDigest: (0, reply_request_digest_1.replyRequestBodyDigest)(body) });
|
|
55374
|
+
let updated = false;
|
|
55375
|
+
let failedWrite;
|
|
55376
|
+
if (input.originalBody !== input.finalBody) {
|
|
55377
|
+
input.phase('card-freshness');
|
|
55378
|
+
if (await input.freshness.matches(witness(input.originalBody))) {
|
|
55379
|
+
await input.verifyClosed();
|
|
55380
|
+
input.phase('card-update');
|
|
55381
|
+
try {
|
|
55382
|
+
await input.update();
|
|
55383
|
+
updated = true;
|
|
55384
|
+
input.onUpdated();
|
|
55385
|
+
}
|
|
55386
|
+
catch (cause) {
|
|
55387
|
+
failedWrite = cause;
|
|
55388
|
+
}
|
|
55389
|
+
}
|
|
55390
|
+
}
|
|
55391
|
+
input.phase('card-verification');
|
|
55392
|
+
if (!await input.freshness.matches(witness(input.finalBody))) {
|
|
55393
|
+
throw failedWrite ?? new application_error_1.ApplicationError('workflow.stale', 'The required final owned card could not be verified.');
|
|
55394
|
+
}
|
|
55395
|
+
await input.verifyClosed();
|
|
55396
|
+
return { updated, superseded: !updated && input.originalBody !== input.finalBody };
|
|
55397
|
+
}
|
|
55398
|
+
|
|
55399
|
+
|
|
54856
55400
|
/***/ }),
|
|
54857
55401
|
|
|
54858
55402
|
/***/ 4643:
|
|
@@ -57197,6 +57741,8 @@ function buildCatalogResponseSchema(source, ids, targetLocale = 'en-US') {
|
|
|
57197
57741
|
|
|
57198
57742
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
57199
57743
|
exports.ObservePullRequestApprovalUseCase = void 0;
|
|
57744
|
+
const application_error_1 = __nccwpck_require__(75999);
|
|
57745
|
+
const approval_evidence_error_1 = __nccwpck_require__(50519);
|
|
57200
57746
|
const pull_request_approval_1 = __nccwpck_require__(8024);
|
|
57201
57747
|
const pull_request_approval_policy_1 = __nccwpck_require__(98820);
|
|
57202
57748
|
/** Read-first replay and exact-revision guard around the non-atomic GitHub review API. */
|
|
@@ -57210,8 +57756,9 @@ class ObservePullRequestApprovalUseCase {
|
|
|
57210
57756
|
try {
|
|
57211
57757
|
rawPolicy = await this.port.readPolicy(target);
|
|
57212
57758
|
}
|
|
57213
|
-
catch {
|
|
57759
|
+
catch (cause) {
|
|
57214
57760
|
return {
|
|
57761
|
+
failure: evidenceFailure(cause, 'policy'),
|
|
57215
57762
|
decision: { status: 'blocked', code: 'policy-unavailable', detail: 'The installed PR approval policy could not be read from GitHub. Verify the runtime PAT can read Actions Variables, then rerun the observer. Existing PRs and reviews are unchanged.' },
|
|
57216
57763
|
publication: 'not-applicable',
|
|
57217
57764
|
};
|
|
@@ -57232,8 +57779,9 @@ class ObservePullRequestApprovalUseCase {
|
|
|
57232
57779
|
try {
|
|
57233
57780
|
initial = await this.port.loadEvidence(target);
|
|
57234
57781
|
}
|
|
57235
|
-
catch {
|
|
57782
|
+
catch (cause) {
|
|
57236
57783
|
return {
|
|
57784
|
+
failure: evidenceFailure(cause),
|
|
57237
57785
|
decision: { status: 'blocked', code: 'evidence-unavailable', detail: 'GitHub approval evidence could not be read; rerun this observer.' },
|
|
57238
57786
|
publication: 'not-applicable',
|
|
57239
57787
|
};
|
|
@@ -57241,18 +57789,30 @@ class ObservePullRequestApprovalUseCase {
|
|
|
57241
57789
|
if (initial.repositoryId !== target.repositoryId || initial.pullNumber !== target.pullNumber) {
|
|
57242
57790
|
return { decision: { status: 'blocked', code: 'target-mismatch', detail: 'The resolved PR does not match the bound repository and number.' }, publication: 'not-applicable' };
|
|
57243
57791
|
}
|
|
57244
|
-
let
|
|
57792
|
+
let failure = initial.diagnostics?.[0] ? (0, approval_evidence_error_1.approvalDiagnosticError)(initial.diagnostics[0]) : undefined;
|
|
57793
|
+
let decision = failure
|
|
57794
|
+
? { status: 'blocked', code: 'evidence-unavailable', detail: 'Approval evidence is unavailable; inspect the causal diagnostic in the observer Job Summary.' }
|
|
57795
|
+
: (0, pull_request_approval_1.decidePullRequestApproval)(policy, initial);
|
|
57245
57796
|
let reviewId;
|
|
57246
57797
|
if (decision.status === 'eligible') {
|
|
57247
57798
|
let current;
|
|
57248
57799
|
let currentPolicy;
|
|
57800
|
+
let readOperation = 'evidence';
|
|
57249
57801
|
try {
|
|
57250
57802
|
current = await this.port.loadEvidence(target);
|
|
57803
|
+
readOperation = 'policy';
|
|
57251
57804
|
currentPolicy = await this.port.readPolicy(target);
|
|
57252
57805
|
}
|
|
57253
|
-
catch {
|
|
57806
|
+
catch (cause) {
|
|
57807
|
+
failure = evidenceFailure(cause, readOperation);
|
|
57808
|
+
current = undefined;
|
|
57254
57809
|
decision = { status: 'blocked', code: 'pre-submit-unavailable', detail: 'Current approval evidence could not be reread before submission.' };
|
|
57255
57810
|
}
|
|
57811
|
+
if (current?.diagnostics?.length) {
|
|
57812
|
+
failure = (0, approval_evidence_error_1.approvalDiagnosticError)(current.diagnostics[0]);
|
|
57813
|
+
current = undefined;
|
|
57814
|
+
decision = { status: 'blocked', code: 'pre-submit-unavailable', detail: 'Current evidence is unavailable; inspect the observer diagnostic.' };
|
|
57815
|
+
}
|
|
57256
57816
|
if (current && currentPolicy !== rawPolicy) {
|
|
57257
57817
|
decision = { status: 'pending', code: 'superseded', detail: 'The approval policy changed before submission; recheck the current head.' };
|
|
57258
57818
|
}
|
|
@@ -57274,7 +57834,11 @@ class ObservePullRequestApprovalUseCase {
|
|
|
57274
57834
|
const botReviews = readback.reviews.filter(review => review.userId === current.botUserId)
|
|
57275
57835
|
.sort((left, right) => right.submittedAt.localeCompare(left.submittedAt) || right.id - left.id);
|
|
57276
57836
|
const observed = botReviews.find(review => review.state === 'APPROVED' && review.commitId === current.headSha);
|
|
57277
|
-
if (
|
|
57837
|
+
if (readback.diagnostics?.length) {
|
|
57838
|
+
failure = (0, approval_evidence_error_1.approvalDiagnosticError)(readback.diagnostics[0]);
|
|
57839
|
+
decision = { status: 'pending', code: 'publication-unknown', detail: 'GitHub may have accepted the review; its final evidence is unavailable. Inspect the observer diagnostic before rechecking.' };
|
|
57840
|
+
}
|
|
57841
|
+
else if (observed && observed.userId === current.botUserId
|
|
57278
57842
|
&& observed.state === 'APPROVED' && observed.commitId === current.headSha
|
|
57279
57843
|
&& !botReviews.some(review => review.state === 'DISMISSED' && review.commitId === current.headSha)
|
|
57280
57844
|
&& readback.headSha === current.headSha && readback.baseSha === current.baseSha) {
|
|
@@ -57285,7 +57849,8 @@ class ObservePullRequestApprovalUseCase {
|
|
|
57285
57849
|
decision = { status: 'pending', code: 'publication-unknown', detail: 'GitHub may have accepted the review; rerun to read it before any new submission.' };
|
|
57286
57850
|
}
|
|
57287
57851
|
}
|
|
57288
|
-
catch {
|
|
57852
|
+
catch (cause) {
|
|
57853
|
+
failure = evidenceFailure(cause);
|
|
57289
57854
|
decision = { status: 'pending', code: 'publication-unknown', detail: 'GitHub may have accepted the review; rerun to read it before any new submission.' };
|
|
57290
57855
|
}
|
|
57291
57856
|
}
|
|
@@ -57294,11 +57859,11 @@ class ObservePullRequestApprovalUseCase {
|
|
|
57294
57859
|
try {
|
|
57295
57860
|
// The adapter guards the current head again before editing the single card.
|
|
57296
57861
|
await this.port.publishAssessment(target, initial, decision, reviewId);
|
|
57297
|
-
return { decision, headSha: initial.headSha, evidence: initial, mode: policy.mode,
|
|
57862
|
+
return { decision, ...(failure ? { failure } : {}), headSha: initial.headSha, evidence: initial, mode: policy.mode,
|
|
57298
57863
|
...(reviewId ? { reviewId } : {}), publication: 'published' };
|
|
57299
57864
|
}
|
|
57300
57865
|
catch {
|
|
57301
|
-
return { decision, headSha: initial.headSha, evidence: initial, mode: policy.mode,
|
|
57866
|
+
return { decision, ...(failure ? { failure } : {}), headSha: initial.headSha, evidence: initial, mode: policy.mode,
|
|
57302
57867
|
...(reviewId ? { reviewId } : {}), publication: 'failed' };
|
|
57303
57868
|
}
|
|
57304
57869
|
}
|
|
@@ -57314,6 +57879,10 @@ function sameRevisionAndEvidence(left, right) {
|
|
|
57314
57879
|
function approvalReviewBody(headSha) {
|
|
57315
57880
|
return `<!-- copilot:guarded-approval:v1 head="${headSha}" -->\nCopilot approved this revision (${headSha.slice(0, 7)}) after its configured CI and coverage gates passed and Bugbot reported no blocking findings. GitHub still applies branch rules. Configure a separate human-review requirement if needed; a bot approval may count toward a generic approval minimum.`;
|
|
57316
57881
|
}
|
|
57882
|
+
function evidenceFailure(cause, operation = 'evidence') {
|
|
57883
|
+
return cause instanceof application_error_1.ApplicationError && cause.recovery?.id === 'approval-evidence-read-failed'
|
|
57884
|
+
? cause : (0, approval_evidence_error_1.approvalEvidenceError)(operation, 'transport-unavailable');
|
|
57885
|
+
}
|
|
57317
57886
|
|
|
57318
57887
|
|
|
57319
57888
|
/***/ }),
|
|
@@ -57833,6 +58402,8 @@ function projectInitialSetupContext(source) {
|
|
|
57833
58402
|
...(credentials ? { setupCredentials: deepFreezeCopy(credentials) } : {}),
|
|
57834
58403
|
...(remote ? { setupRemoteConfiguration: deepFreezeCopy(remote) } : {}),
|
|
57835
58404
|
workflowUpdates: Object.freeze(asStringArray(source.inputs?.setupWorkflowUpdates)),
|
|
58405
|
+
...(source.inputs?.setupVerificationActionState === 'create' || source.inputs?.setupVerificationActionState === 'preserve'
|
|
58406
|
+
? { verificationActionState: source.inputs.setupVerificationActionState } : {}),
|
|
57836
58407
|
});
|
|
57837
58408
|
}
|
|
57838
58409
|
function projectIssueCommentActionContext(source) {
|
|
@@ -58338,6 +58909,7 @@ exports.draftSddMarkdown = draftSddMarkdown;
|
|
|
58338
58909
|
const application_error_1 = __nccwpck_require__(75999);
|
|
58339
58910
|
const pre_branch_sdd_1 = __nccwpck_require__(34730);
|
|
58340
58911
|
const agent_response_length_failure_1 = __nccwpck_require__(28528);
|
|
58912
|
+
const sdd_draft_consistency_1 = __nccwpck_require__(27910);
|
|
58341
58913
|
/** Size and typed format failures share one regeneration; the writer still validates every candidate. */
|
|
58342
58914
|
async function draftSddMarkdown(agent, configuration, plan, prompt, validate) {
|
|
58343
58915
|
const maximum = plan.action === 'update' ? pre_branch_sdd_1.SDD_MAX_UPDATE_CHARACTERS : pre_branch_sdd_1.SDD_MAX_DRAFT_CHARACTERS;
|
|
@@ -58349,13 +58921,13 @@ async function draftSddMarkdown(agent, configuration, plan, prompt, validate) {
|
|
|
58349
58921
|
};
|
|
58350
58922
|
let problem = 'size';
|
|
58351
58923
|
let formatReason = 'required-heading';
|
|
58352
|
-
const contractPrompt = `${prompt}\n\nDraft contract: keep the complete draft within ${maximum} characters; aim for ${target} characters. Preserve the same owner, decisions and requirements. Include these literal canonical heading prefixes as Markdown headings, with the shown capitalization:\n${pre_branch_sdd_1.SDD_REQUIRED_HEADINGS.join('\n')}\nUse the canonical numeric test-budget table in section 14: Area | Minimum distinct cases | Behaviors/risks covered. Every allocation and the Total must be a positive integer, and the Total must equal the sum of the allocations.
|
|
58924
|
+
const contractPrompt = `${prompt}\n\nDraft contract: keep the complete draft within ${maximum} characters; aim for ${target} characters. Preserve the same owner, decisions and requirements. Include these literal canonical heading prefixes as Markdown headings, with the shown capitalization:\n${pre_branch_sdd_1.SDD_REQUIRED_HEADINGS.join('\n')}\nUse the canonical numeric test-budget table in section 14: Area | Minimum distinct cases | Behaviors/risks covered. Every allocation and the Total must be a positive integer, and the Total must equal the sum of the allocations. Return only the required JSON.`;
|
|
58353
58925
|
for (let attempt = 0; attempt < 2; attempt++) {
|
|
58354
58926
|
let value;
|
|
58355
58927
|
try {
|
|
58356
58928
|
value = await agent.query({
|
|
58357
58929
|
configuration, agentId: 'pre-branch-sdd-draft',
|
|
58358
|
-
prompt: attempt === 0 ? contractPrompt : `${contractPrompt}\n\n${problem === 'size' ? `The previous response exceeded the ${maximum}-character draft limit.` : `The previous response failed the required SDD ${formatReason} contract.`} Regenerate a concise complete draft for this same owner and plan. Use the exact numbered canonical headings from the supplied template. Preserve all resolved requirements, architecture, documentation and acceptance. Do not change ownership or truncate a requirement
|
|
58930
|
+
prompt: `${attempt === 0 ? contractPrompt : `${contractPrompt}\n\n${problem === 'size' ? `The previous response exceeded the ${maximum}-character draft limit.` : `The previous response failed the required SDD ${formatReason} contract.`} Regenerate a concise complete draft for this same owner and plan. Use the exact numbered canonical headings from the supplied template. Preserve all resolved requirements, architecture, documentation and acceptance. Do not change ownership or truncate a requirement.`}\n\n${sdd_draft_consistency_1.SDD_CONSISTENCY_PROMPT}`,
|
|
58359
58931
|
options: { expectJson: true, schemaName: 'pre_branch_sdd_draft', schema },
|
|
58360
58932
|
});
|
|
58361
58933
|
}
|
|
@@ -58389,12 +58961,21 @@ async function draftSddMarkdown(agent, configuration, plan, prompt, validate) {
|
|
|
58389
58961
|
}
|
|
58390
58962
|
if (problem === 'format')
|
|
58391
58963
|
throw new application_error_1.ApplicationError('validation.invalid-input', `The SDD draft still violates its ${formatReason} format contract after one bounded repair.`, {
|
|
58392
|
-
recovery: { id:
|
|
58964
|
+
recovery: { id: consistencyRecovery(formatReason), variables: {} },
|
|
58393
58965
|
});
|
|
58394
58966
|
throw new application_error_1.ApplicationError('validation.invalid-input', 'The SDD draft exceeded its size limit after one bounded repair.', {
|
|
58395
58967
|
recovery: { id: 'sdd-draft-size-exceeded', variables: {} },
|
|
58396
58968
|
});
|
|
58397
58969
|
}
|
|
58970
|
+
function consistencyRecovery(reason) {
|
|
58971
|
+
switch (reason) {
|
|
58972
|
+
case 'case-identity': return 'sdd-draft-case-identity-invalid';
|
|
58973
|
+
case 'case-budget': return 'sdd-draft-case-budget-invalid';
|
|
58974
|
+
case 'requirement-mapping': return 'sdd-draft-requirement-mapping-invalid';
|
|
58975
|
+
case 'repository-path': return 'sdd-draft-repository-path-invalid';
|
|
58976
|
+
default: return 'sdd-draft-format-invalid';
|
|
58977
|
+
}
|
|
58978
|
+
}
|
|
58398
58979
|
|
|
58399
58980
|
|
|
58400
58981
|
/***/ }),
|
|
@@ -58412,8 +58993,10 @@ const issue_start_policy_1 = __nccwpck_require__(90332);
|
|
|
58412
58993
|
const pre_branch_sdd_1 = __nccwpck_require__(34730);
|
|
58413
58994
|
const recommendation_policy_1 = __nccwpck_require__(39410);
|
|
58414
58995
|
const logging_ports_1 = __nccwpck_require__(6152);
|
|
58996
|
+
const sdd_analysis_status_policy_1 = __nccwpck_require__(81053);
|
|
58415
58997
|
const application_error_1 = __nccwpck_require__(75999);
|
|
58416
58998
|
const pre_branch_sdd_draft_workflow_1 = __nccwpck_require__(93454);
|
|
58999
|
+
const sdd_draft_consistency_1 = __nccwpck_require__(27910);
|
|
58417
59000
|
const ANALYSIS_SCHEMA = {
|
|
58418
59001
|
type: 'object',
|
|
58419
59002
|
properties: {
|
|
@@ -58534,11 +59117,21 @@ class PreBranchSddGateUseCase {
|
|
|
58534
59117
|
});
|
|
58535
59118
|
const analysisValue = asRecord(analysis);
|
|
58536
59119
|
const owners = new Map(snapshot.capabilities.map(capability => [capability.id, capability.specs]));
|
|
58537
|
-
|
|
59120
|
+
let plan;
|
|
59121
|
+
try {
|
|
59122
|
+
plan = (0, pre_branch_sdd_1.parseSddPlan)(analysisValue, owners);
|
|
59123
|
+
}
|
|
59124
|
+
catch (error) {
|
|
59125
|
+
if (!(error instanceof pre_branch_sdd_1.SddOwnershipFailure))
|
|
59126
|
+
throw error;
|
|
59127
|
+
await this.writeAnalysisStatus(context, allComments, error.reason);
|
|
59128
|
+
throw new application_error_1.ApplicationError('provider.contract-invalid', `${error.message} Clarify the catalog owner/path in the same issue and rerun the original workflow. No automatic retry was attempted.`);
|
|
59129
|
+
}
|
|
58538
59130
|
if (card?.record.branchName && (plan.action !== 'update'
|
|
58539
59131
|
|| plan.path !== card.record.plan.path || plan.capabilityId !== card.record.plan.capabilityId)) {
|
|
58540
59132
|
throw new Error('An existing linked branch can only revise its owning SDD on the same path.');
|
|
58541
59133
|
}
|
|
59134
|
+
await this.writeAnalysisStatus(context, allComments);
|
|
58542
59135
|
const round = publicationRetry ? card.record.round
|
|
58543
59136
|
: card?.record.phase === 'awaiting-answer' && card.record.issueDigest === digest && !staleAwaiting
|
|
58544
59137
|
? card.record.round + (plan.questions.length > 0 ? 1 : 0) : 1;
|
|
@@ -58558,9 +59151,19 @@ class PreBranchSddGateUseCase {
|
|
|
58558
59151
|
const currentSdd = plan.action === 'update' ? await this.workspace.readSdd(snapshot.baseSha, plan.path) : undefined;
|
|
58559
59152
|
if (plan.action === 'update' && !currentSdd)
|
|
58560
59153
|
throw new Error('The catalogued SDD owner is missing from the selected base.');
|
|
59154
|
+
const ownerDocuments = [];
|
|
59155
|
+
for (const path of snapshot.capabilities.find(capability => capability.id === plan.capabilityId)?.specs ?? []) {
|
|
59156
|
+
const markdown = path === plan.path && currentSdd ? currentSdd : await this.workspace.readSdd(snapshot.baseSha, path);
|
|
59157
|
+
if (!markdown)
|
|
59158
|
+
throw new Error('A catalogued owning SDD is unavailable at the selected immutable base.');
|
|
59159
|
+
ownerDocuments.push({ path, markdown });
|
|
59160
|
+
}
|
|
59161
|
+
const reservedCases = JSON.stringify((0, sdd_draft_consistency_1.reservedSddCaseIds)(ownerDocuments));
|
|
59162
|
+
if (reservedCases.length > 30000)
|
|
59163
|
+
throw new Error('The owning SDD case inventory exceeds the bounded drafting context; maintainer review is required.');
|
|
58561
59164
|
const newCapability = plan.action === 'new' ? parseNewCapability(analysisValue.newCapability, plan) : undefined;
|
|
58562
59165
|
let prepared;
|
|
58563
|
-
await (0, pre_branch_sdd_draft_workflow_1.draftSddMarkdown)(this.agent, context.agentConfiguration, plan, buildDraftPrompt(context, snapshot, plan, answers, currentSdd)
|
|
59166
|
+
await (0, pre_branch_sdd_draft_workflow_1.draftSddMarkdown)(this.agent, context.agentConfiguration, plan, `${buildDraftPrompt(context, snapshot, plan, answers, currentSdd)}\n\nCase IDs reserved across every owning SDD at ${snapshot.baseSha}:\n${reservedCases}`, async (markdown) => {
|
|
58564
59167
|
prepared = await this.workspace.validateDraft(snapshot, plan, markdown, newCapability);
|
|
58565
59168
|
});
|
|
58566
59169
|
if (!prepared)
|
|
@@ -58650,6 +59253,20 @@ class PreBranchSddGateUseCase {
|
|
|
58650
59253
|
else
|
|
58651
59254
|
await this.comments.updateComment(issueNumber, cardId, body);
|
|
58652
59255
|
}
|
|
59256
|
+
async writeAnalysisStatus(context, comments, reason) {
|
|
59257
|
+
const marker = (0, sdd_analysis_status_policy_1.sddAnalysisStatusMarker)(context.issueNumber);
|
|
59258
|
+
const prior = comments.filter(comment => comment.user?.login?.toLowerCase() === context.tokenUser.toLowerCase()
|
|
59259
|
+
&& comment.body?.includes(marker)).sort((a, b) => b.id - a.id)[0];
|
|
59260
|
+
if (!reason && !prior)
|
|
59261
|
+
return;
|
|
59262
|
+
const body = (0, sdd_analysis_status_policy_1.renderSddAnalysisStatus)(context.issueNumber, context.issueLocale, reason);
|
|
59263
|
+
if (prior) {
|
|
59264
|
+
if (prior.body !== body)
|
|
59265
|
+
await this.comments.updateComment(context.issueNumber, prior.id, body);
|
|
59266
|
+
}
|
|
59267
|
+
else
|
|
59268
|
+
await this.comments.addComment(context.issueNumber, body);
|
|
59269
|
+
}
|
|
58653
59270
|
async assertFresh(context, expectedBaseSha, sourceBranch) {
|
|
58654
59271
|
const [liveBody, liveTitle, snapshot] = await Promise.all([
|
|
58655
59272
|
this.descriptions.getDescription(context.issueNumber),
|
|
@@ -59410,7 +60027,7 @@ function partitionFailureCategory(error) {
|
|
|
59410
60027
|
return error instanceof Error ? error.name : 'unknown';
|
|
59411
60028
|
}
|
|
59412
60029
|
function suppressDismissedFindings(execution, context, prepared) {
|
|
59413
|
-
const activeFindings = (prepared.activeFindings ?? prepared.toPublish).filter((finding) => {
|
|
60030
|
+
const activeFindings = (0, finding_1.retainExistingFindingIds)(prepared.activeFindings ?? prepared.toPublish, context.existingByFindingId).filter((finding) => {
|
|
59414
60031
|
const existing = (0, finding_1.findExistingFindingInfo)(context.existingByFindingId, finding);
|
|
59415
60032
|
return existing?.issue?.resolution !== 'dismissed' && existing?.pullRequest?.resolution !== 'dismissed';
|
|
59416
60033
|
});
|
|
@@ -59430,6 +60047,7 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
|
59430
60047
|
exports.applyDetectedFindings = applyDetectedFindings;
|
|
59431
60048
|
const mark_findings_resolved_use_case_1 = __nccwpck_require__(96963);
|
|
59432
60049
|
const publish_findings_use_case_1 = __nccwpck_require__(88442);
|
|
60050
|
+
const bugbot_mutation_error_1 = __nccwpck_require__(82937);
|
|
59433
60051
|
const pull_request_review_errors_1 = __nccwpck_require__(46445);
|
|
59434
60052
|
async function applyDetectedFindings(operation, context, prepared, publicationPorts, resolutionPorts, catalog) {
|
|
59435
60053
|
try {
|
|
@@ -59445,7 +60063,7 @@ async function applyDetectedFindings(operation, context, prepared, publicationPo
|
|
|
59445
60063
|
});
|
|
59446
60064
|
}
|
|
59447
60065
|
catch (error) {
|
|
59448
|
-
const publicationError = error instanceof pull_request_review_errors_1.PullRequestReviewOperationError
|
|
60066
|
+
const publicationError = error instanceof bugbot_mutation_error_1.BugbotMutationError || error instanceof pull_request_review_errors_1.PullRequestReviewOperationError
|
|
59449
60067
|
? error
|
|
59450
60068
|
: new Error("Unable to publish findings.");
|
|
59451
60069
|
return [publicationError];
|
|
@@ -59996,6 +60614,7 @@ function buildPreviousFindingsContext(previousFindings) {
|
|
|
59996
60614
|
`;
|
|
59997
60615
|
const suffix = `
|
|
59998
60616
|
**Your task 2:** For each finding above, analyze the current code and decide:
|
|
60617
|
+
- Trace the original failure precondition through current callers, validation helpers and effective configuration, including modules outside the original anchor. A retained finding is not proof that its old explanation is still true. Reuse its exact id if reporting the same defect again; do not create a second report for it.
|
|
59999
60618
|
- If the problem **still exists** (same code or same issue present): do **not** include it in \`resolved_findings\`.
|
|
60000
60619
|
- If the problem **no longer applies** (e.g. that code was removed or refactored away): include \`{ "id": "<exact id>", "resolution": "obsolete" }\` in \`resolved_findings\`.
|
|
60001
60620
|
- If the problem **has been fixed** (code was changed and the issue is resolved): include \`{ "id": "<exact id>", "resolution": "fixed" }\` in \`resolved_findings\`.
|
|
@@ -60115,6 +60734,10 @@ function buildReviewConversationContext(issueComments, commentsByPullRequest, bo
|
|
|
60115
60734
|
omitted,
|
|
60116
60735
|
truncated: chronological.filter((entry) => entry.truncated).length,
|
|
60117
60736
|
retained: chronological.length,
|
|
60737
|
+
...(chronological.some(entry => entry.truncated) ? {
|
|
60738
|
+
truncatedItemIds: chronological.filter(entry => entry.truncated)
|
|
60739
|
+
.map(entry => entry.providerId).filter(id => /^(?:issue:[0-9]+|review:[A-Za-z0-9_=-]+)$/.test(id) && id.length <= 160),
|
|
60740
|
+
} : {}),
|
|
60118
60741
|
};
|
|
60119
60742
|
}
|
|
60120
60743
|
function appendConversationEntry(entries, author, kind, body, createdAt, providerId) {
|
|
@@ -61606,6 +62229,7 @@ async function loadBugbotContext(request, ports, resolvedPreflight) {
|
|
|
61606
62229
|
itemsFetched: conversationContext.retained + conversationContext.omitted,
|
|
61607
62230
|
omittedItems: conversationContext.omitted,
|
|
61608
62231
|
truncatedItems: conversationContext.truncated,
|
|
62232
|
+
...(conversationContext.truncatedItemIds ? { truncatedItemIds: conversationContext.truncatedItemIds } : {}),
|
|
61609
62233
|
limitReached: conversationContext.omitted > 0 || conversationContext.truncated > 0,
|
|
61610
62234
|
},
|
|
61611
62235
|
{
|
|
@@ -61807,11 +62431,11 @@ Object.defineProperty(exports, "markFindingsResolved", ({ enumerable: true, get:
|
|
|
61807
62431
|
|
|
61808
62432
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
61809
62433
|
exports.markFindingsResolved = markFindingsResolved;
|
|
61810
|
-
const pull_request_review_errors_1 = __nccwpck_require__(46445);
|
|
61811
62434
|
const logging_ports_1 = __nccwpck_require__(6152);
|
|
61812
62435
|
const resolve_issue_finding_1 = __nccwpck_require__(35300);
|
|
61813
62436
|
const resolve_pull_request_finding_1 = __nccwpck_require__(64567);
|
|
61814
62437
|
const review_state_1 = __nccwpck_require__(79200);
|
|
62438
|
+
const bugbot_mutation_error_1 = __nccwpck_require__(82937);
|
|
61815
62439
|
const application_error_1 = __nccwpck_require__(75999);
|
|
61816
62440
|
async function markFindingsResolved(param) {
|
|
61817
62441
|
const errors = [];
|
|
@@ -61839,8 +62463,8 @@ async function repairExistingPullRequestFinding(ports, operation, findingId, des
|
|
|
61839
62463
|
try {
|
|
61840
62464
|
await ports.pullRequestComments.unresolvePullRequestReviewThread(destination.pullRequestNumber, destination.commentIdentity);
|
|
61841
62465
|
}
|
|
61842
|
-
catch {
|
|
61843
|
-
addResolutionError(errors, 'pull request');
|
|
62466
|
+
catch (cause) {
|
|
62467
|
+
addResolutionError(errors, 'pull request', findingId, cause);
|
|
61844
62468
|
}
|
|
61845
62469
|
}
|
|
61846
62470
|
}
|
|
@@ -61854,7 +62478,7 @@ async function resolveIssueIfNeeded(param, findingId, destination, errors) {
|
|
|
61854
62478
|
return;
|
|
61855
62479
|
const comment = param.context.issueComments.find(item => item.id === destination.commentId);
|
|
61856
62480
|
if (comment?.body == null) {
|
|
61857
|
-
addResolutionError(errors, 'issue');
|
|
62481
|
+
addResolutionError(errors, 'issue', findingId);
|
|
61858
62482
|
return;
|
|
61859
62483
|
}
|
|
61860
62484
|
try {
|
|
@@ -61865,8 +62489,8 @@ async function resolveIssueIfNeeded(param, findingId, destination, errors) {
|
|
|
61865
62489
|
resolution: param.resolvedFindingResolutions?.get(findingId),
|
|
61866
62490
|
}, param.catalog);
|
|
61867
62491
|
}
|
|
61868
|
-
catch {
|
|
61869
|
-
addResolutionError(errors, 'issue');
|
|
62492
|
+
catch (cause) {
|
|
62493
|
+
addResolutionError(errors, 'issue', findingId, cause);
|
|
61870
62494
|
}
|
|
61871
62495
|
}
|
|
61872
62496
|
async function tryResolvePullRequestFinding(ports, findingId, destination, errors, resolution, catalog) {
|
|
@@ -61878,17 +62502,14 @@ async function tryResolvePullRequestFinding(ports, findingId, destination, error
|
|
|
61878
62502
|
resolution,
|
|
61879
62503
|
}, catalog);
|
|
61880
62504
|
}
|
|
61881
|
-
catch {
|
|
61882
|
-
addResolutionError(errors, 'pull request');
|
|
62505
|
+
catch (cause) {
|
|
62506
|
+
addResolutionError(errors, 'pull request', findingId, cause);
|
|
61883
62507
|
}
|
|
61884
62508
|
}
|
|
61885
|
-
function addResolutionError(errors, destination) {
|
|
61886
|
-
const
|
|
61887
|
-
?
|
|
61888
|
-
: new
|
|
61889
|
-
const semanticError = new application_error_1.ApplicationError('provider.unavailable', destination === 'pull request'
|
|
61890
|
-
? 'Unable to mark a pull request finding as resolved.'
|
|
61891
|
-
: 'Unable to mark an issue finding as resolved.', { cause });
|
|
62509
|
+
function addResolutionError(errors, destination, findingId, cause) {
|
|
62510
|
+
const semanticError = destination === 'pull request'
|
|
62511
|
+
? (0, bugbot_mutation_error_1.bugbotMutationError)(cause, 'resolution', [findingId], 'mark-resolved')
|
|
62512
|
+
: new application_error_1.ApplicationError('provider.unavailable', 'Unable to mark an issue finding as resolved.');
|
|
61892
62513
|
(0, logging_ports_1.logError)(semanticError);
|
|
61893
62514
|
errors.push(semanticError);
|
|
61894
62515
|
}
|
|
@@ -62141,6 +62762,7 @@ function isRecord(value) {
|
|
|
62141
62762
|
*/
|
|
62142
62763
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
62143
62764
|
exports.publishFindings = publishFindings;
|
|
62765
|
+
const bugbot_mutation_error_1 = __nccwpck_require__(82937);
|
|
62144
62766
|
const finding_1 = __nccwpck_require__(31011);
|
|
62145
62767
|
const publish_issue_finding_comment_1 = __nccwpck_require__(84950);
|
|
62146
62768
|
const publish_pr_review_comments_1 = __nccwpck_require__(50352);
|
|
@@ -62159,12 +62781,17 @@ async function publishFindings(param) {
|
|
|
62159
62781
|
catalog,
|
|
62160
62782
|
})
|
|
62161
62783
|
: undefined;
|
|
62162
|
-
for (const finding of findings) {
|
|
62784
|
+
for (const finding of (0, finding_1.retainExistingFindingIds)(findings, existingByFindingId)) {
|
|
62163
62785
|
if (operation.target.issueNumber > 0 && !reviewPublisher) {
|
|
62164
62786
|
await (0, publish_issue_finding_comment_1.publishIssueFindingComment)(ports.issueComments, operation.target.issueNumber, finding, (0, finding_1.findExistingFindingInfo)(existingByFindingId, finding), commitSha, catalog);
|
|
62165
62787
|
}
|
|
62166
62788
|
if (reviewPublisher) {
|
|
62167
|
-
|
|
62789
|
+
try {
|
|
62790
|
+
await reviewPublisher.publish(finding, (0, finding_1.findExistingFindingInfo)(existingByFindingId, finding));
|
|
62791
|
+
}
|
|
62792
|
+
catch (cause) {
|
|
62793
|
+
throw (0, bugbot_mutation_error_1.bugbotMutationError)(cause, 'publication', [finding.id], 'publish-comments');
|
|
62794
|
+
}
|
|
62168
62795
|
}
|
|
62169
62796
|
}
|
|
62170
62797
|
await reviewPublisher?.flush(overflowCount, overflowTitles);
|
|
@@ -62236,6 +62863,7 @@ ${catalog.message('bugbot.overflow.body', { count: `**${overflowCount}**` }, ove
|
|
|
62236
62863
|
|
|
62237
62864
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
62238
62865
|
exports.PullRequestReviewCommentPublisher = void 0;
|
|
62866
|
+
const bugbot_mutation_error_1 = __nccwpck_require__(82937);
|
|
62239
62867
|
const bugbot_finding_marker_policy_1 = __nccwpck_require__(98024);
|
|
62240
62868
|
const path_validation_1 = __nccwpck_require__(70124);
|
|
62241
62869
|
const logging_ports_1 = __nccwpck_require__(6152);
|
|
@@ -62307,11 +62935,16 @@ class PullRequestReviewCommentPublisher {
|
|
|
62307
62935
|
if (this.findingsToCreate.length === 0 && overflowCount === 0)
|
|
62308
62936
|
return;
|
|
62309
62937
|
const { repository, operation, openPrNumber, prContext } = this.options;
|
|
62310
|
-
|
|
62311
|
-
|
|
62312
|
-
|
|
62313
|
-
|
|
62314
|
-
|
|
62938
|
+
try {
|
|
62939
|
+
await repository.createReviewWithComments(openPrNumber, prContext.prHeadSha, buildReviewSummary(this.findingsToCreate, this.commentsToCreate.length, this.unanchoredBodies, overflowCount, overflowTitles, operation.analysis.reviewConfiguration.traceRules
|
|
62940
|
+
? this.options.ruleSources ?? []
|
|
62941
|
+
: [], operation.analysis.reviewConfiguration.traceRules
|
|
62942
|
+
? this.options.omittedRuleCount ?? 0
|
|
62943
|
+
: 0, prContext.prHeadSha, this.catalog), this.commentsToCreate);
|
|
62944
|
+
}
|
|
62945
|
+
catch (cause) {
|
|
62946
|
+
throw (0, bugbot_mutation_error_1.bugbotMutationError)(cause, 'publication', this.findingsToCreate.map(finding => finding.id), 'publish-comments', this.findingsToCreate.length + overflowCount);
|
|
62947
|
+
}
|
|
62315
62948
|
}
|
|
62316
62949
|
get catalog() {
|
|
62317
62950
|
return this.options.catalog ?? (0, bugbot_message_catalog_1.resolveStaticBugbotCatalog)(this.options.operation.locale.pullRequest);
|
|
@@ -62467,6 +63100,8 @@ async function queryBugbotPartitionFindings(repository, configuration, prompt, t
|
|
|
62467
63100
|
|
|
62468
63101
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
62469
63102
|
exports.reconcileBugbotReviewState = reconcileBugbotReviewState;
|
|
63103
|
+
const bugbot_mutation_error_1 = __nccwpck_require__(82937);
|
|
63104
|
+
const finding_1 = __nccwpck_require__(31011);
|
|
62470
63105
|
const review_projection_1 = __nccwpck_require__(80859);
|
|
62471
63106
|
const bugbot_reconciliation_policy_1 = __nccwpck_require__(78128);
|
|
62472
63107
|
const bugbot_provider_projection_policy_1 = __nccwpck_require__(85821);
|
|
@@ -62497,11 +63132,12 @@ async function reconcileBugbotReviewState(input) {
|
|
|
62497
63132
|
};
|
|
62498
63133
|
}
|
|
62499
63134
|
const snapshot = snapshotResult.snapshot;
|
|
63135
|
+
const activeFindings = (0, finding_1.retainExistingFindingIds)(input.activeFindings, input.loadedContext.existingByFindingId);
|
|
63136
|
+
const expectedPublishedFindings = (0, finding_1.retainExistingFindingIds)(input.expectedPublishedFindings ?? input.activeFindings, input.loadedContext.existingByFindingId);
|
|
62500
63137
|
const diagnostics = [
|
|
62501
|
-
...(input.mutationErrors ?? []).map((error) =>
|
|
62502
|
-
code: '
|
|
62503
|
-
operatorMessage: toSafeOperationMessage(error),
|
|
62504
|
-
})),
|
|
63138
|
+
...(input.mutationErrors ?? []).map((error) => error instanceof bugbot_mutation_error_1.BugbotMutationError
|
|
63139
|
+
? { code: 'finding-mutation-failed', mutation: error.diagnostic }
|
|
63140
|
+
: { code: 'operation-failed', operatorMessage: toSafeOperationMessage(error) }),
|
|
62505
63141
|
...(!input.target.trustedAuthorLogin?.trim()
|
|
62506
63142
|
? [{ code: 'identity-unavailable' }]
|
|
62507
63143
|
: []),
|
|
@@ -62510,7 +63146,7 @@ async function reconcileBugbotReviewState(input) {
|
|
|
62510
63146
|
const providerProjection = (0, bugbot_provider_projection_policy_1.projectBugbotProviderEvidence)({
|
|
62511
63147
|
snapshot,
|
|
62512
63148
|
trustedAuthorLogin: input.target.trustedAuthorLogin,
|
|
62513
|
-
activeFindings
|
|
63149
|
+
activeFindings,
|
|
62514
63150
|
existingByFindingId: input.loadedContext.existingByFindingId,
|
|
62515
63151
|
});
|
|
62516
63152
|
const plan = (0, bugbot_reconciliation_policy_1.buildBugbotReconciliationPlan)({
|
|
@@ -62520,8 +63156,8 @@ async function reconcileBugbotReviewState(input) {
|
|
|
62520
63156
|
id,
|
|
62521
63157
|
(0, bugbot_finding_marker_policy_1.extractTitleFromBody)(fullBody) || id,
|
|
62522
63158
|
])),
|
|
62523
|
-
activeFindings
|
|
62524
|
-
expectedPublishedFindings
|
|
63159
|
+
activeFindings,
|
|
63160
|
+
expectedPublishedFindings,
|
|
62525
63161
|
diagnostics,
|
|
62526
63162
|
coverage: input.loadedContext.coverage,
|
|
62527
63163
|
});
|
|
@@ -63025,14 +63661,16 @@ function toPresentationFailure(diagnostic) {
|
|
|
63025
63661
|
const message = (0, bugbot_message_catalog_1.bugbotDiagnosticOperatorMessage)(diagnostic);
|
|
63026
63662
|
return {
|
|
63027
63663
|
diagnostic,
|
|
63028
|
-
error: diagnostic.code === '
|
|
63029
|
-
? new application_error_1.ApplicationError(
|
|
63030
|
-
|
|
63031
|
-
|
|
63032
|
-
|
|
63033
|
-
|
|
63034
|
-
|
|
63035
|
-
|
|
63664
|
+
error: diagnostic.code === 'finding-mutation-failed'
|
|
63665
|
+
? new application_error_1.ApplicationError(diagnostic.mutation.errorCode, message)
|
|
63666
|
+
: diagnostic.code === 'review-updates-pending'
|
|
63667
|
+
? new application_error_1.ApplicationError('workflow.presentation-pending', message, {
|
|
63668
|
+
recovery: {
|
|
63669
|
+
id: 'bugbot-review-blocks-pending',
|
|
63670
|
+
variables: { pendingCount: diagnostic.count },
|
|
63671
|
+
},
|
|
63672
|
+
})
|
|
63673
|
+
: new Error(message),
|
|
63036
63674
|
};
|
|
63037
63675
|
}
|
|
63038
63676
|
function report(projection, reviewUpdates, pendingReviewUpdates, statusCardOperation, errors) {
|
|
@@ -63145,6 +63783,7 @@ exports.runVerifyCommands = runVerifyCommands;
|
|
|
63145
63783
|
const logging_ports_1 = __nccwpck_require__(6152);
|
|
63146
63784
|
const verify_command_policy_1 = __nccwpck_require__(96031);
|
|
63147
63785
|
const verification_runtime_policy_1 = __nccwpck_require__(89347);
|
|
63786
|
+
const verification_setup_policy_1 = __nccwpck_require__(65326);
|
|
63148
63787
|
async function runVerifyCommands(commands, execute) {
|
|
63149
63788
|
for (const command of commands) {
|
|
63150
63789
|
const result = await executeVerifyCommand(command, execute);
|
|
@@ -63164,7 +63803,7 @@ async function executeVerifyCommand(command, execute) {
|
|
|
63164
63803
|
: { success: false, failedCommand: formatCommandForDiagnostics(parsed) };
|
|
63165
63804
|
}
|
|
63166
63805
|
catch (error) {
|
|
63167
|
-
if (error instanceof verification_runtime_policy_1.VerificationPrerequisiteError) {
|
|
63806
|
+
if (error instanceof verification_runtime_policy_1.VerificationPrerequisiteError || error instanceof verification_setup_policy_1.VerificationSetupError) {
|
|
63168
63807
|
return { success: false, failedCommand: formatCommandForDiagnostics(parsed),
|
|
63169
63808
|
error: `${error.message} Verification command: ${formatCommandForDiagnostics(parsed)}.` };
|
|
63170
63809
|
}
|
|
@@ -66398,6 +67037,8 @@ exports.CheckPriorityIssueSizeUseCase = CheckPriorityIssueSizeUseCase;
|
|
|
66398
67037
|
|
|
66399
67038
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
66400
67039
|
exports.CloseIssueAfterMergingUseCase = void 0;
|
|
67040
|
+
const reconcile_issue_completion_metadata_1 = __nccwpck_require__(70614);
|
|
67041
|
+
const closed_issue_reconciliation_error_1 = __nccwpck_require__(12183);
|
|
66401
67042
|
const result_1 = __nccwpck_require__(73817);
|
|
66402
67043
|
const issue_completion_1 = __nccwpck_require__(31147);
|
|
66403
67044
|
const application_error_1 = __nccwpck_require__(75999);
|
|
@@ -66416,7 +67057,7 @@ class CloseIssueAfterMergingUseCase {
|
|
|
66416
67057
|
steps: ['No separate safe linked issue and pull request were found; issue closure was skipped.'] })];
|
|
66417
67058
|
let closedThisRun = false;
|
|
66418
67059
|
let nativeClosed = false;
|
|
66419
|
-
|
|
67060
|
+
const progress = (0, reconcile_issue_completion_metadata_1.completionRepairProgress)();
|
|
66420
67061
|
try {
|
|
66421
67062
|
const pull = await this.issues.readPullRequest(pullNumber);
|
|
66422
67063
|
if (pull.number !== pullNumber || pull.state !== 'closed' || pull.merged !== true)
|
|
@@ -66440,44 +67081,21 @@ class CloseIssueAfterMergingUseCase {
|
|
|
66440
67081
|
nativeClosed = facts.state === 'closed';
|
|
66441
67082
|
if (!nativeClosed || closedThisRun && facts.reason !== 'completed')
|
|
66442
67083
|
throw stale();
|
|
66443
|
-
const
|
|
66444
|
-
|
|
66445
|
-
|
|
66446
|
-
if (freshPlan.kind !== 'closed' || freshFacts.reason !== facts.reason)
|
|
66447
|
-
throw stale();
|
|
66448
|
-
return freshPlan;
|
|
66449
|
-
};
|
|
66450
|
-
const plan = (0, issue_completion_1.planIssueCompletion)(facts, param.completionLabels);
|
|
66451
|
-
if (plan.kind !== 'closed')
|
|
66452
|
-
throw stale();
|
|
66453
|
-
for (const label of plan.remove) {
|
|
66454
|
-
const fresh = await fence();
|
|
66455
|
-
if (fresh.remove.includes(label)) {
|
|
66456
|
-
await target.removeLabel(label);
|
|
66457
|
-
labelsChanged++;
|
|
66458
|
-
}
|
|
66459
|
-
}
|
|
66460
|
-
for (const label of plan.add) {
|
|
66461
|
-
const fresh = await fence();
|
|
66462
|
-
if (fresh.add.includes(label)) {
|
|
66463
|
-
await target.addLabel(label);
|
|
66464
|
-
labelsChanged++;
|
|
66465
|
-
}
|
|
66466
|
-
}
|
|
66467
|
-
const final = await fence();
|
|
66468
|
-
if (final.remove.length || final.add.length)
|
|
66469
|
-
throw stale();
|
|
66470
|
-
return [new result_1.Result({ id: this.taskId, success: true, executed: closedThisRun || labelsChanged > 0,
|
|
67084
|
+
const repaired = await (0, reconcile_issue_completion_metadata_1.reconcileIssueCompletionMetadata)(target, number, param.completionLabels, progress, facts);
|
|
67085
|
+
nativeClosed = progress.nativeClosed;
|
|
67086
|
+
return [new result_1.Result({ id: this.taskId, success: true, executed: closedThisRun || progress.labelsChanged > 0,
|
|
66471
67087
|
steps: [`Issue #${number} is closed and its completion metadata was verified after PR #${pullNumber} merged.`],
|
|
66472
|
-
payload: { issueCompletion: Object.freeze({ number, nativeClosed, closedThisRun, labelsChanged
|
|
67088
|
+
payload: { issueCompletion: Object.freeze({ number, nativeClosed, closedThisRun, labelsChanged: progress.labelsChanged, ...repaired, reconciled: true }) } })];
|
|
66473
67089
|
}
|
|
66474
67090
|
catch (error) {
|
|
66475
|
-
|
|
66476
|
-
|
|
66477
|
-
|
|
66478
|
-
|
|
67091
|
+
if (progress.phase !== 'identity')
|
|
67092
|
+
nativeClosed = progress.nativeClosed;
|
|
67093
|
+
const semanticError = (0, closed_issue_reconciliation_error_1.closedIssueReconciliationError)(error, { resultId: this.taskId,
|
|
67094
|
+
phase: progress.phase, state: progress.state, reason: progress.reason,
|
|
67095
|
+
changed: progress.labelsChanged, remaining: progress.remaining });
|
|
67096
|
+
return [new result_1.Result({ id: this.taskId, success: false, executed: closedThisRun || progress.labelsChanged > 0,
|
|
66479
67097
|
steps: [nativeClosed ? 'The native issue closure was retained; completion metadata remains unverified.' : 'Native issue completion remains unverified.'],
|
|
66480
|
-
errors: [semanticError], payload: { issueCompletion: Object.freeze({ number, nativeClosed, closedThisRun, labelsChanged, reconciled: false }) } })];
|
|
67098
|
+
errors: [semanticError], payload: { issueCompletion: Object.freeze({ number, nativeClosed, closedThisRun, labelsChanged: progress.labelsChanged, reconciled: false }) } })];
|
|
66481
67099
|
}
|
|
66482
67100
|
}
|
|
66483
67101
|
}
|
|
@@ -68492,6 +69110,8 @@ var _ApplicationError_cause;
|
|
|
68492
69110
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
68493
69111
|
exports.ApplicationError = exports.APPLICATION_ERROR_METADATA = exports.APPLICATION_ERROR_RECOVERY_IDS = void 0;
|
|
68494
69112
|
exports.isApplicationErrorCorrelationId = isApplicationErrorCorrelationId;
|
|
69113
|
+
const closed_issue_reconciliation_1 = __nccwpck_require__(21565);
|
|
69114
|
+
const approval_evidence_diagnostic_1 = __nccwpck_require__(98205);
|
|
68495
69115
|
const branch_sync_validation_1 = __nccwpck_require__(90981);
|
|
68496
69116
|
exports.APPLICATION_ERROR_RECOVERY_IDS = Object.freeze([
|
|
68497
69117
|
'pull-request-link-restored',
|
|
@@ -68506,7 +69126,16 @@ exports.APPLICATION_ERROR_RECOVERY_IDS = Object.freeze([
|
|
|
68506
69126
|
'branch-sync-resolution-invalid',
|
|
68507
69127
|
'sdd-draft-size-exceeded',
|
|
68508
69128
|
'sdd-draft-format-invalid',
|
|
69129
|
+
'sdd-draft-case-identity-invalid',
|
|
69130
|
+
'sdd-draft-case-budget-invalid',
|
|
69131
|
+
'sdd-draft-requirement-mapping-invalid',
|
|
69132
|
+
'sdd-draft-repository-path-invalid',
|
|
68509
69133
|
'workspace-changes-rejected',
|
|
69134
|
+
'closed-issue-reconciliation-failed',
|
|
69135
|
+
'approval-evidence-read-failed',
|
|
69136
|
+
'stored-configuration-schema-missing',
|
|
69137
|
+
'stored-configuration-schema-unsupported',
|
|
69138
|
+
'stored-configuration-invalid',
|
|
68510
69139
|
]);
|
|
68511
69140
|
const PRESERVED_STATE = 'Existing persisted state and completed external effects were preserved.';
|
|
68512
69141
|
const UNCHANGED_STATE = 'No new state or external effect was created.';
|
|
@@ -68698,6 +69327,11 @@ class ApplicationError extends Error {
|
|
|
68698
69327
|
exports.ApplicationError = ApplicationError;
|
|
68699
69328
|
_ApplicationError_cause = new WeakMap();
|
|
68700
69329
|
const RECOVERY_VARIABLE_KEYS = Object.freeze({
|
|
69330
|
+
'stored-configuration-schema-missing': Object.freeze(['issueNumber', 'expectedVersion']),
|
|
69331
|
+
'stored-configuration-schema-unsupported': Object.freeze(['issueNumber', 'expectedVersion', 'actualVersion']),
|
|
69332
|
+
'stored-configuration-invalid': Object.freeze(['issueNumber', 'expectedVersion']),
|
|
69333
|
+
'closed-issue-reconciliation-failed': Object.freeze(['resultId', 'phase', 'state', 'reason', 'changed', 'remaining']),
|
|
69334
|
+
'approval-evidence-read-failed': Object.freeze(['operation', 'reason', 'permission']),
|
|
68701
69335
|
'pull-request-link-restored': Object.freeze([]),
|
|
68702
69336
|
'pull-request-link-base-retained': Object.freeze([]),
|
|
68703
69337
|
'pull-request-link-reference-retained': Object.freeze([]),
|
|
@@ -68710,6 +69344,10 @@ const RECOVERY_VARIABLE_KEYS = Object.freeze({
|
|
|
68710
69344
|
'branch-sync-resolution-invalid': Object.freeze(['validationCode', 'command']),
|
|
68711
69345
|
'sdd-draft-size-exceeded': Object.freeze([]),
|
|
68712
69346
|
'sdd-draft-format-invalid': Object.freeze([]),
|
|
69347
|
+
'sdd-draft-case-identity-invalid': Object.freeze([]),
|
|
69348
|
+
'sdd-draft-case-budget-invalid': Object.freeze([]),
|
|
69349
|
+
'sdd-draft-requirement-mapping-invalid': Object.freeze([]),
|
|
69350
|
+
'sdd-draft-repository-path-invalid': Object.freeze([]),
|
|
68713
69351
|
'workspace-changes-rejected': Object.freeze([]),
|
|
68714
69352
|
});
|
|
68715
69353
|
function normalizeApplicationErrorRecovery(recovery) {
|
|
@@ -68725,6 +69363,13 @@ function normalizeApplicationErrorRecovery(recovery) {
|
|
|
68725
69363
|
|| actualKeys.some((key, index) => key !== expectedKeys[index])) {
|
|
68726
69364
|
throw new TypeError(`Application error recovery variables are invalid for ${recovery.id}.`);
|
|
68727
69365
|
}
|
|
69366
|
+
if (recovery.id.startsWith('stored-configuration-')
|
|
69367
|
+
&& (![variables.issueNumber, variables.expectedVersion].every(value => typeof value === 'number' && Number.isSafeInteger(value) && value > 0)
|
|
69368
|
+
|| (recovery.id === 'stored-configuration-schema-unsupported'
|
|
69369
|
+
&& !(typeof variables.actualVersion === 'number'
|
|
69370
|
+
&& Number.isSafeInteger(variables.actualVersion) && variables.actualVersion >= 0)))) {
|
|
69371
|
+
throw new TypeError('Stored configuration diagnostic is invalid.');
|
|
69372
|
+
}
|
|
68728
69373
|
if (recovery.id === 'managed-branch-enrichment-failed'
|
|
68729
69374
|
&& (typeof variables.branchName !== 'string'
|
|
68730
69375
|
|| !/^[A-Za-z0-9][A-Za-z0-9._/-]{0,254}$/u.test(variables.branchName))) {
|
|
@@ -68750,6 +69395,20 @@ function normalizeApplicationErrorRecovery(recovery) {
|
|
|
68750
69395
|
&& !branch_sync_validation_1.BRANCH_SYNC_VALIDATION_CODES.some(code => code === variables.validationCode)) {
|
|
68751
69396
|
throw new TypeError('Application error recovery synchronization validation code is invalid.');
|
|
68752
69397
|
}
|
|
69398
|
+
if (recovery.id === 'closed-issue-reconciliation-failed'
|
|
69399
|
+
&& (!closed_issue_reconciliation_1.CLOSED_ISSUE_RESULTS.some(value => value === variables.resultId)
|
|
69400
|
+
|| !closed_issue_reconciliation_1.CLOSED_ISSUE_PHASES.some(value => value === variables.phase)
|
|
69401
|
+
|| !['open', 'closed', 'unavailable'].includes(variables.state)
|
|
69402
|
+
|| !closed_issue_reconciliation_1.CLOSED_ISSUE_REASONS.some(value => value === variables.reason)
|
|
69403
|
+
|| ![variables.changed, variables.remaining].every(value => typeof value === 'number' && Number.isSafeInteger(value) && value >= 0 && value <= 3000))) {
|
|
69404
|
+
throw new TypeError('Closed issue reconciliation diagnostic is invalid.');
|
|
69405
|
+
}
|
|
69406
|
+
if (recovery.id === 'approval-evidence-read-failed'
|
|
69407
|
+
&& (!Object.prototype.hasOwnProperty.call(approval_evidence_diagnostic_1.APPROVAL_EVIDENCE_PERMISSIONS, variables.operation)
|
|
69408
|
+
|| !approval_evidence_diagnostic_1.APPROVAL_EVIDENCE_REASONS.some(reason => reason === variables.reason)
|
|
69409
|
+
|| approval_evidence_diagnostic_1.APPROVAL_EVIDENCE_PERMISSIONS[variables.operation] !== variables.permission)) {
|
|
69410
|
+
throw new TypeError('Approval evidence diagnostic is invalid.');
|
|
69411
|
+
}
|
|
68753
69412
|
return Object.freeze({
|
|
68754
69413
|
id: recovery.id,
|
|
68755
69414
|
variables: Object.freeze({ ...variables }),
|
|
@@ -69092,6 +69751,7 @@ class Execution {
|
|
|
69092
69751
|
this.currentIssueWorkflowAdmission = components.issueWorkflowAdmission;
|
|
69093
69752
|
this.currentConfiguration.issueWorkflowProfileDigest = components.issueWorkflowProfileDigest;
|
|
69094
69753
|
this.preBranchSdd = components.preBranchSdd ?? false;
|
|
69754
|
+
this.verificationSetup = components.verificationSetup ?? false;
|
|
69095
69755
|
}
|
|
69096
69756
|
}
|
|
69097
69757
|
exports.Execution = Execution;
|
|
@@ -74154,6 +74814,7 @@ function combineOrganizationAccess(secrets, variables) {
|
|
|
74154
74814
|
|
|
74155
74815
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
74156
74816
|
exports.isGithubAlreadyExists = exports.isGithubPermissionDenied = exports.isGithubRateLimited = exports.isGithubNotFound = exports.getGithubErrorStatus = void 0;
|
|
74817
|
+
exports.githubReadErrorCode = githubReadErrorCode;
|
|
74157
74818
|
const getGithubErrorStatus = (error) => {
|
|
74158
74819
|
if (typeof error !== "object" || error === null)
|
|
74159
74820
|
return undefined;
|
|
@@ -74163,6 +74824,23 @@ const getGithubErrorStatus = (error) => {
|
|
|
74163
74824
|
exports.getGithubErrorStatus = getGithubErrorStatus;
|
|
74164
74825
|
const isGithubNotFound = (error) => (0, exports.getGithubErrorStatus)(error) === 404;
|
|
74165
74826
|
exports.isGithubNotFound = isGithubNotFound;
|
|
74827
|
+
/** Maps failed metadata reads without copying untrusted provider text. */
|
|
74828
|
+
function githubReadErrorCode(error) {
|
|
74829
|
+
const status = (0, exports.getGithubErrorStatus)(error);
|
|
74830
|
+
if (status === 401)
|
|
74831
|
+
return 'authorization.credential-invalid';
|
|
74832
|
+
if ((0, exports.isGithubRateLimited)(error))
|
|
74833
|
+
return 'provider.rate-limited';
|
|
74834
|
+
if (status === 403)
|
|
74835
|
+
return 'authorization.denied';
|
|
74836
|
+
if (status === 404)
|
|
74837
|
+
return 'provider.not-found';
|
|
74838
|
+
if (status === 409 || status === 412)
|
|
74839
|
+
return 'provider.conflict';
|
|
74840
|
+
if (status === 400 || status === 422)
|
|
74841
|
+
return 'provider.contract-invalid';
|
|
74842
|
+
return 'provider.unavailable';
|
|
74843
|
+
}
|
|
74166
74844
|
const isGithubRateLimited = (error) => {
|
|
74167
74845
|
const status = (0, exports.getGithubErrorStatus)(error);
|
|
74168
74846
|
if (status === 429)
|
|
@@ -74873,8 +75551,9 @@ class IssueContentRepository {
|
|
|
74873
75551
|
return issue.body ?? '';
|
|
74874
75552
|
}
|
|
74875
75553
|
catch (error) {
|
|
74876
|
-
(0,
|
|
74877
|
-
|
|
75554
|
+
const semanticError = (0, application_error_1.toApplicationError)(error, (0, github_error_policy_1.githubReadErrorCode)(error), 'Unable to read the issue or pull-request description.');
|
|
75555
|
+
(0, logger_1.logError)(semanticError);
|
|
75556
|
+
throw semanticError;
|
|
74878
75557
|
}
|
|
74879
75558
|
};
|
|
74880
75559
|
this.getIssueDescription = async (owner, repository, issueNumber, token) => {
|
|
@@ -76675,6 +77354,41 @@ function parseApprovalCoverageZip(value) {
|
|
|
76675
77354
|
}
|
|
76676
77355
|
|
|
76677
77356
|
|
|
77357
|
+
/***/ }),
|
|
77358
|
+
|
|
77359
|
+
/***/ 9958:
|
|
77360
|
+
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
77361
|
+
|
|
77362
|
+
"use strict";
|
|
77363
|
+
|
|
77364
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
77365
|
+
exports.readApprovalEvidence = readApprovalEvidence;
|
|
77366
|
+
const application_error_1 = __nccwpck_require__(75999);
|
|
77367
|
+
const approval_evidence_error_1 = __nccwpck_require__(50519);
|
|
77368
|
+
const approval_evidence_diagnostic_1 = __nccwpck_require__(98205);
|
|
77369
|
+
/** Terminates provider exceptions; even unknown statuses never interpolate provider text. */
|
|
77370
|
+
async function readApprovalEvidence(operation, read) {
|
|
77371
|
+
try {
|
|
77372
|
+
return await read();
|
|
77373
|
+
}
|
|
77374
|
+
catch (cause) {
|
|
77375
|
+
if (cause instanceof application_error_1.ApplicationError && cause.recovery?.id === 'approval-evidence-read-failed')
|
|
77376
|
+
throw cause;
|
|
77377
|
+
const error = cause && typeof cause === 'object' ? cause : undefined;
|
|
77378
|
+
const response = error?.response;
|
|
77379
|
+
const status = error?.status;
|
|
77380
|
+
const rateLimited = status === 403 && (response?.headers?.['x-ratelimit-remaining'] === '0'
|
|
77381
|
+
|| typeof response?.headers?.['retry-after'] === 'string' && /^\d{1,8}$/u.test(response.headers['retry-after']));
|
|
77382
|
+
const http = typeof status === 'number' ? `http-${status}` : undefined;
|
|
77383
|
+
const reason = rateLimited ? 'http-429'
|
|
77384
|
+
: approval_evidence_diagnostic_1.APPROVAL_EVIDENCE_REASONS.some(value => value === http) ? http
|
|
77385
|
+
: cause instanceof application_error_1.ApplicationError && cause.code === 'provider.contract-invalid' ? 'invalid-response'
|
|
77386
|
+
: status === undefined ? 'transport-unavailable' : 'invalid-response';
|
|
77387
|
+
throw (0, approval_evidence_error_1.approvalEvidenceError)(operation, reason);
|
|
77388
|
+
}
|
|
77389
|
+
}
|
|
77390
|
+
|
|
77391
|
+
|
|
76678
77392
|
/***/ }),
|
|
76679
77393
|
|
|
76680
77394
|
/***/ 55165:
|
|
@@ -76709,21 +77423,22 @@ exports.BugbotPullRequestRepository = BugbotPullRequestRepository;
|
|
|
76709
77423
|
/***/ }),
|
|
76710
77424
|
|
|
76711
77425
|
/***/ 68742:
|
|
76712
|
-
/***/ ((__unused_webpack_module, exports) => {
|
|
77426
|
+
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
76713
77427
|
|
|
76714
77428
|
"use strict";
|
|
76715
77429
|
|
|
76716
77430
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
76717
77431
|
exports.readCurrentBaseRevision = readCurrentBaseRevision;
|
|
77432
|
+
const application_error_1 = __nccwpck_require__(75999);
|
|
76718
77433
|
/** PR base metadata can lag a parent push; read the exact native branch ref. */
|
|
76719
77434
|
async function readCurrentBaseRevision(port, target, baseRef) {
|
|
76720
77435
|
if (typeof baseRef !== 'string' || baseRef.length === 0 || baseRef.length > 1024
|
|
76721
77436
|
|| baseRef.includes('\u0000') || /[\r\n]/u.test(baseRef))
|
|
76722
|
-
throw new
|
|
77437
|
+
throw new application_error_1.ApplicationError('provider.contract-invalid', 'The PR base ref is invalid.');
|
|
76723
77438
|
const { data } = await port.getRef({ owner: target.owner, repo: target.repository, ref: `heads/${baseRef}` });
|
|
76724
77439
|
if (data?.ref !== `refs/heads/${baseRef}` || data.object?.type !== 'commit' || typeof data.object.sha !== 'string'
|
|
76725
77440
|
|| !/^[a-f0-9]{40}$/u.test(data.object.sha))
|
|
76726
|
-
throw new
|
|
77441
|
+
throw new application_error_1.ApplicationError('provider.contract-invalid', 'The PR base ref cannot be verified.');
|
|
76727
77442
|
return data.object.sha;
|
|
76728
77443
|
}
|
|
76729
77444
|
|
|
@@ -76771,6 +77486,9 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
76771
77486
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
76772
77487
|
exports.PullRequestApprovalRepository = void 0;
|
|
76773
77488
|
exports.readEffectiveApprovalPolicy = readEffectiveApprovalPolicy;
|
|
77489
|
+
const approval_evidence_read_1 = __nccwpck_require__(9958);
|
|
77490
|
+
const approval_evidence_error_1 = __nccwpck_require__(50519);
|
|
77491
|
+
const application_error_1 = __nccwpck_require__(75999);
|
|
76774
77492
|
const current_base_revision_query_1 = __nccwpck_require__(68742);
|
|
76775
77493
|
const logging_ports_1 = __nccwpck_require__(6152);
|
|
76776
77494
|
const github = __importStar(__nccwpck_require__(78227));
|
|
@@ -76797,40 +77515,64 @@ class PullRequestApprovalRepository {
|
|
|
76797
77515
|
}
|
|
76798
77516
|
}
|
|
76799
77517
|
async readPolicy(target) {
|
|
76800
|
-
return (await this.readEffectivePolicy(target))?.value;
|
|
77518
|
+
return (0, approval_evidence_read_1.readApprovalEvidence)('policy', async () => (await this.readEffectivePolicy(target))?.value);
|
|
76801
77519
|
}
|
|
76802
77520
|
async readEffectivePolicy(target) {
|
|
76803
77521
|
return readEffectiveApprovalPolicy(this.octokit, target);
|
|
76804
77522
|
}
|
|
76805
77523
|
async loadEvidence(target) {
|
|
76806
|
-
const
|
|
76807
|
-
|
|
77524
|
+
const diagnostics = [];
|
|
77525
|
+
const { data: pull } = await (0, approval_evidence_read_1.readApprovalEvidence)('pull-request', async () => {
|
|
77526
|
+
const response = await this.octokit.rest.pulls.get({ owner: target.owner, repo: target.repository, pull_number: target.pullNumber });
|
|
77527
|
+
if (!response.data?.head || !response.data?.base || typeof response.data.head.sha !== 'string'
|
|
77528
|
+
|| typeof response.data.head.ref !== 'string' || !Number.isSafeInteger(response.data.number)) {
|
|
77529
|
+
throw (0, approval_evidence_error_1.approvalEvidenceError)('pull-request', 'invalid-response');
|
|
77530
|
+
}
|
|
77531
|
+
return response;
|
|
76808
77532
|
});
|
|
76809
77533
|
const headSha = pull.head.sha;
|
|
76810
77534
|
const baseSha = await this.readCurrentBaseSha(target, pull.base.ref);
|
|
76811
|
-
const policy = (0,
|
|
77535
|
+
const policy = await (0, approval_evidence_read_1.readApprovalEvidence)('policy', async () => {
|
|
77536
|
+
const raw = await this.readPolicy(target);
|
|
77537
|
+
try {
|
|
77538
|
+
return (0, pull_request_approval_policy_1.parsePullRequestApprovalPolicy)(raw);
|
|
77539
|
+
}
|
|
77540
|
+
catch {
|
|
77541
|
+
throw (0, approval_evidence_error_1.approvalEvidenceError)('policy', 'invalid-response');
|
|
77542
|
+
}
|
|
77543
|
+
});
|
|
76812
77544
|
let testedMergeSha;
|
|
76813
77545
|
if (pull.mergeable === true && /^[a-f0-9]{40}$/iu.test(pull.merge_commit_sha ?? '')) {
|
|
76814
77546
|
try {
|
|
76815
|
-
const merge = await
|
|
76816
|
-
owner: target.owner, repo: target.repository, commit_sha: pull.merge_commit_sha
|
|
77547
|
+
const merge = await (0, approval_evidence_read_1.readApprovalEvidence)('merge-commit', async () => {
|
|
77548
|
+
const response = await this.octokit.rest.git.getCommit({ owner: target.owner, repo: target.repository, commit_sha: pull.merge_commit_sha });
|
|
77549
|
+
if (!Array.isArray(response.data?.parents))
|
|
77550
|
+
throw (0, approval_evidence_error_1.approvalEvidenceError)('merge-commit', 'invalid-response');
|
|
77551
|
+
return response;
|
|
76817
77552
|
});
|
|
76818
77553
|
if (merge.data.parents[0]?.sha === baseSha && merge.data.parents[1]?.sha === headSha
|
|
76819
77554
|
&& merge.data.parents.length === 2)
|
|
76820
77555
|
testedMergeSha = pull.merge_commit_sha;
|
|
76821
77556
|
}
|
|
76822
|
-
catch {
|
|
77557
|
+
catch (cause) {
|
|
77558
|
+
collectDiagnostic(diagnostics, cause);
|
|
77559
|
+
}
|
|
76823
77560
|
}
|
|
76824
77561
|
const [files, reviews, comments, headChecks, mergeChecks, headRuns, mergeRuns, rules, user] = await Promise.all([
|
|
76825
|
-
this.allPages(this.octokit.rest.pulls.listFiles, { owner: target.owner, repo: target.repository, pull_number: target.pullNumber }),
|
|
76826
|
-
this.allPages(this.octokit.rest.pulls.listReviews, { owner: target.owner, repo: target.repository, pull_number: target.pullNumber }),
|
|
76827
|
-
this.allPages(this.octokit.rest.issues.listComments, { owner: target.owner, repo: target.repository, issue_number: target.pullNumber }),
|
|
76828
|
-
this.allPages(this.octokit.rest.checks.listForRef, { owner: target.owner, repo: target.repository, ref: headSha, filter: 'all' }),
|
|
76829
|
-
testedMergeSha ? this.allPages(this.octokit.rest.checks.listForRef, { owner: target.owner, repo: target.repository, ref: testedMergeSha, filter: 'all' }) : Promise.resolve([]),
|
|
76830
|
-
this.allPages(this.octokit.rest.actions.listWorkflowRunsForRepo, { owner: target.owner, repo: target.repository, head_sha: headSha }),
|
|
76831
|
-
testedMergeSha ? this.allPages(this.octokit.rest.actions.listWorkflowRunsForRepo, { owner: target.owner, repo: target.repository, head_sha: testedMergeSha }) : Promise.resolve([]),
|
|
76832
|
-
this.effectiveRules(target.owner, target.repository, pull.base.ref),
|
|
76833
|
-
|
|
77562
|
+
this.allPages('files', this.octokit.rest.pulls.listFiles, { owner: target.owner, repo: target.repository, pull_number: target.pullNumber }),
|
|
77563
|
+
this.allPages('reviews', this.octokit.rest.pulls.listReviews, { owner: target.owner, repo: target.repository, pull_number: target.pullNumber }),
|
|
77564
|
+
this.allPages('comments', this.octokit.rest.issues.listComments, { owner: target.owner, repo: target.repository, issue_number: target.pullNumber }),
|
|
77565
|
+
this.allPages('head-checks', this.octokit.rest.checks.listForRef, { owner: target.owner, repo: target.repository, ref: headSha, filter: 'all' }),
|
|
77566
|
+
testedMergeSha ? this.allPages('merge-checks', this.octokit.rest.checks.listForRef, { owner: target.owner, repo: target.repository, ref: testedMergeSha, filter: 'all' }) : Promise.resolve([]),
|
|
77567
|
+
this.allPages('head-runs', this.octokit.rest.actions.listWorkflowRunsForRepo, { owner: target.owner, repo: target.repository, head_sha: headSha }),
|
|
77568
|
+
testedMergeSha ? this.allPages('merge-runs', this.octokit.rest.actions.listWorkflowRunsForRepo, { owner: target.owner, repo: target.repository, head_sha: testedMergeSha }) : Promise.resolve([]),
|
|
77569
|
+
this.effectiveRules(target.owner, target.repository, pull.base.ref, diagnostics),
|
|
77570
|
+
(0, approval_evidence_read_1.readApprovalEvidence)('authenticated-user', async () => {
|
|
77571
|
+
const response = await this.octokit.rest.users.getAuthenticated();
|
|
77572
|
+
if (!Number.isSafeInteger(response.data?.id) || response.data.id < 1)
|
|
77573
|
+
throw (0, approval_evidence_error_1.approvalEvidenceError)('authenticated-user', 'invalid-response');
|
|
77574
|
+
return response;
|
|
77575
|
+
}),
|
|
76834
77576
|
]);
|
|
76835
77577
|
const branch = Object.entries(this.settings.branchPrefixes)
|
|
76836
77578
|
.find(([, prefix]) => pull.head.ref.startsWith(`${prefix}/`));
|
|
@@ -76851,7 +77593,7 @@ class PullRequestApprovalRepository {
|
|
|
76851
77593
|
});
|
|
76852
77594
|
const currentJobs = await Promise.all(latestRuns.map(async (run) => ({
|
|
76853
77595
|
run,
|
|
76854
|
-
jobs: await this.allPages(this.octokit.rest.actions.listJobsForWorkflowRunAttempt, {
|
|
77596
|
+
jobs: await this.allPages('jobs', this.octokit.rest.actions.listJobsForWorkflowRunAttempt, {
|
|
76855
77597
|
owner: target.owner, repo: target.repository, run_id: run.id, attempt_number: run.run_attempt,
|
|
76856
77598
|
}),
|
|
76857
77599
|
})));
|
|
@@ -76882,9 +77624,10 @@ class PullRequestApprovalRepository {
|
|
|
76882
77624
|
submittedAt: review.submitted_at ?? '',
|
|
76883
77625
|
}));
|
|
76884
77626
|
const numericCoverage = policy.coverage.mode === 'numeric'
|
|
76885
|
-
? await this.numericCoverage(target, policy.coverage.artifactWorkflowName, headSha, baseSha, testedMergeSha, workflowRuns)
|
|
77627
|
+
? await this.numericCoverage(target, policy.coverage.artifactWorkflowName, headSha, baseSha, testedMergeSha, workflowRuns, diagnostics)
|
|
76886
77628
|
: undefined;
|
|
76887
77629
|
return {
|
|
77630
|
+
...(diagnostics.length ? { diagnostics: Object.freeze(diagnostics) } : {}),
|
|
76888
77631
|
repositoryId: pull.base.repo?.id ?? 0,
|
|
76889
77632
|
pullNumber: pull.number,
|
|
76890
77633
|
headSha,
|
|
@@ -76918,7 +77661,7 @@ class PullRequestApprovalRepository {
|
|
|
76918
77661
|
...(numericCoverage ? { numericCoverage } : {}),
|
|
76919
77662
|
};
|
|
76920
77663
|
}
|
|
76921
|
-
async numericCoverage(target, workflowName, headSha, baseSha, testedMergeSha, workflowRuns) {
|
|
77664
|
+
async numericCoverage(target, workflowName, headSha, baseSha, testedMergeSha, workflowRuns, diagnostics) {
|
|
76922
77665
|
const candidates = workflowRuns.filter(run => run.name === workflowName
|
|
76923
77666
|
&& (run.head_sha === headSha || run.head_sha === testedMergeSha));
|
|
76924
77667
|
const mergeCandidates = candidates.filter(run => run.head_sha === testedMergeSha);
|
|
@@ -76927,25 +77670,27 @@ class PullRequestApprovalRepository {
|
|
|
76927
77670
|
if (!run || run.conclusion !== 'success' || run.status !== 'completed')
|
|
76928
77671
|
return undefined;
|
|
76929
77672
|
try {
|
|
76930
|
-
const artifacts = await this.allPages(this.octokit.rest.actions.listWorkflowRunArtifacts, {
|
|
77673
|
+
const artifacts = await this.allPages('coverage-artifacts', this.octokit.rest.actions.listWorkflowRunArtifacts, {
|
|
76931
77674
|
owner: target.owner, repo: target.repository, run_id: run.id,
|
|
76932
77675
|
});
|
|
76933
77676
|
const matches = artifacts.filter(artifact => artifact.name === 'copilot-diff-coverage-v1' && !artifact.expired);
|
|
76934
77677
|
if (matches.length !== 1 || matches[0].size_in_bytes > 64 * 1024)
|
|
76935
|
-
|
|
76936
|
-
const response = await this.octokit.rest.actions.downloadArtifact({
|
|
77678
|
+
throw (0, approval_evidence_error_1.approvalEvidenceError)('coverage-artifacts', 'artifact-unavailable');
|
|
77679
|
+
const response = await (0, approval_evidence_read_1.readApprovalEvidence)('coverage-download', async () => this.octokit.rest.actions.downloadArtifact({
|
|
76937
77680
|
owner: target.owner, repo: target.repository, artifact_id: matches[0].id, archive_format: 'zip',
|
|
76938
|
-
});
|
|
77681
|
+
}));
|
|
76939
77682
|
const data = response.data;
|
|
76940
77683
|
const bytes = data instanceof ArrayBuffer ? new Uint8Array(data)
|
|
76941
77684
|
: data instanceof Uint8Array ? data
|
|
76942
77685
|
: typeof data === 'string' ? Buffer.from(data, 'binary') : undefined;
|
|
76943
77686
|
const attestation = bytes ? (0, approval_coverage_artifact_1.parseApprovalCoverageZip)(bytes) : undefined;
|
|
76944
|
-
if (!attestation
|
|
77687
|
+
if (!attestation)
|
|
77688
|
+
throw (0, approval_evidence_error_1.approvalEvidenceError)('coverage-parse', 'artifact-invalid');
|
|
77689
|
+
if (attestation.repositoryId !== target.repositoryId
|
|
76945
77690
|
|| attestation.pullNumber !== target.pullNumber || attestation.headSha !== headSha
|
|
76946
77691
|
|| attestation.baseSha !== baseSha || attestation.workflowRunId !== run.id
|
|
76947
77692
|
|| attestation.workflowRunAttempt !== run.run_attempt)
|
|
76948
|
-
|
|
77693
|
+
throw (0, approval_evidence_error_1.approvalEvidenceError)('coverage-parse', 'artifact-mismatch');
|
|
76949
77694
|
return {
|
|
76950
77695
|
coveredChangedLines: attestation.coveredChangedLines,
|
|
76951
77696
|
totalChangedLines: attestation.totalChangedLines,
|
|
@@ -76953,7 +77698,8 @@ class PullRequestApprovalRepository {
|
|
|
76953
77698
|
baseSha,
|
|
76954
77699
|
};
|
|
76955
77700
|
}
|
|
76956
|
-
catch {
|
|
77701
|
+
catch (cause) {
|
|
77702
|
+
collectDiagnostic(diagnostics, cause);
|
|
76957
77703
|
return undefined;
|
|
76958
77704
|
}
|
|
76959
77705
|
}
|
|
@@ -76979,7 +77725,7 @@ class PullRequestApprovalRepository {
|
|
|
76979
77725
|
throw new Error('PR head or base changed before assessment publication.');
|
|
76980
77726
|
}
|
|
76981
77727
|
const user = await this.octokit.rest.users.getAuthenticated();
|
|
76982
|
-
const comments = await this.allPages(this.octokit.rest.issues.listComments, {
|
|
77728
|
+
const comments = await this.allPages('comments', this.octokit.rest.issues.listComments, {
|
|
76983
77729
|
owner: target.owner, repo: target.repository, issue_number: target.pullNumber,
|
|
76984
77730
|
});
|
|
76985
77731
|
const card = [...comments].reverse().find(comment => comment.user?.id === user.data.id
|
|
@@ -77025,24 +77771,26 @@ class PullRequestApprovalRepository {
|
|
|
77025
77771
|
}
|
|
77026
77772
|
}
|
|
77027
77773
|
async readCurrentBaseSha(target, baseRef) {
|
|
77028
|
-
return (0, current_base_revision_query_1.readCurrentBaseRevision)(this.octokit.rest.git, target, baseRef);
|
|
77774
|
+
return (0, approval_evidence_read_1.readApprovalEvidence)('base-ref', () => (0, current_base_revision_query_1.readCurrentBaseRevision)(this.octokit.rest.git, target, baseRef));
|
|
77029
77775
|
}
|
|
77030
|
-
async effectiveRules(owner, repo, branch) {
|
|
77776
|
+
async effectiveRules(owner, repo, branch, diagnostics) {
|
|
77031
77777
|
try {
|
|
77032
|
-
const rulesResponse = await this.octokit.request('GET /repos/{owner}/{repo}/rules/branches/{branch}', { owner, repo, branch });
|
|
77778
|
+
const rulesResponse = await (0, approval_evidence_read_1.readApprovalEvidence)('rules', async () => this.octokit.request('GET /repos/{owner}/{repo}/rules/branches/{branch}', { owner, repo, branch }));
|
|
77033
77779
|
if (!Array.isArray(rulesResponse.data) || rulesResponse.data.some((rule) => !record(rule)
|
|
77034
77780
|
|| typeof record(rule)?.type !== 'string' || record(rule)?.type === '')) {
|
|
77035
|
-
throw
|
|
77781
|
+
throw (0, approval_evidence_error_1.approvalEvidenceError)('rules', 'invalid-response');
|
|
77036
77782
|
}
|
|
77037
77783
|
const rules = rulesResponse.data;
|
|
77038
77784
|
let classic;
|
|
77039
77785
|
try {
|
|
77040
77786
|
const response = await this.octokit.rest.repos.getBranchProtection({ owner, repo, branch });
|
|
77787
|
+
if (!record(response.data))
|
|
77788
|
+
throw (0, approval_evidence_error_1.approvalEvidenceError)('classic-protection', 'invalid-response');
|
|
77041
77789
|
classic = response.data;
|
|
77042
77790
|
}
|
|
77043
77791
|
catch (error) {
|
|
77044
77792
|
if (statusOf(error) !== 404)
|
|
77045
|
-
throw error;
|
|
77793
|
+
await (0, approval_evidence_read_1.readApprovalEvidence)('classic-protection', async () => { throw error; });
|
|
77046
77794
|
}
|
|
77047
77795
|
const reviewRules = rules.filter(rule => rule.type === 'pull_request');
|
|
77048
77796
|
const classicReview = classic?.required_pull_request_reviews;
|
|
@@ -77068,23 +77816,26 @@ class PullRequestApprovalRepository {
|
|
|
77068
77816
|
}
|
|
77069
77817
|
return { readable: true, dismissesStaleReviews: hasStaleRule && allStale, requiredChecks: [...requiredChecks] };
|
|
77070
77818
|
}
|
|
77071
|
-
catch {
|
|
77819
|
+
catch (cause) {
|
|
77820
|
+
collectDiagnostic(diagnostics, cause);
|
|
77072
77821
|
return { readable: false, dismissesStaleReviews: false, requiredChecks: [] };
|
|
77073
77822
|
}
|
|
77074
77823
|
}
|
|
77075
|
-
async allPages(method, params) {
|
|
77076
|
-
|
|
77077
|
-
|
|
77078
|
-
const
|
|
77079
|
-
|
|
77080
|
-
|
|
77081
|
-
|
|
77082
|
-
|
|
77083
|
-
|
|
77084
|
-
|
|
77085
|
-
|
|
77086
|
-
|
|
77087
|
-
|
|
77824
|
+
async allPages(operation, method, params) {
|
|
77825
|
+
return (0, approval_evidence_read_1.readApprovalEvidence)(operation, async () => {
|
|
77826
|
+
const result = [];
|
|
77827
|
+
for await (const response of this.octokit.paginate.iterator(method, { ...params, per_page: 100 })) {
|
|
77828
|
+
const page = Array.isArray(response.data) ? response.data
|
|
77829
|
+
: record(response.data)?.check_runs ?? record(response.data)?.workflow_runs
|
|
77830
|
+
?? record(response.data)?.artifacts ?? record(response.data)?.jobs;
|
|
77831
|
+
if (!Array.isArray(page))
|
|
77832
|
+
throw (0, approval_evidence_error_1.approvalEvidenceError)(operation, 'invalid-page');
|
|
77833
|
+
result.push(...page);
|
|
77834
|
+
if (result.length > 3000)
|
|
77835
|
+
throw (0, approval_evidence_error_1.approvalEvidenceError)(operation, 'page-limit');
|
|
77836
|
+
}
|
|
77837
|
+
return result;
|
|
77838
|
+
});
|
|
77088
77839
|
}
|
|
77089
77840
|
}
|
|
77090
77841
|
exports.PullRequestApprovalRepository = PullRequestApprovalRepository;
|
|
@@ -77121,7 +77872,7 @@ function array(value) { return Array.isArray(value) ? value : []; }
|
|
|
77121
77872
|
async function readEffectiveApprovalPolicy(octokit, target) {
|
|
77122
77873
|
const admit = (source, value) => {
|
|
77123
77874
|
if (typeof value !== 'string' || value.length > 65536)
|
|
77124
|
-
throw new
|
|
77875
|
+
throw new application_error_1.ApplicationError('provider.contract-invalid', 'Approval policy response is malformed or unbounded.');
|
|
77125
77876
|
return { source, value };
|
|
77126
77877
|
};
|
|
77127
77878
|
try {
|
|
@@ -77145,6 +77896,14 @@ async function readEffectiveApprovalPolicy(octokit, target) {
|
|
|
77145
77896
|
throw error;
|
|
77146
77897
|
}
|
|
77147
77898
|
}
|
|
77899
|
+
function collectDiagnostic(diagnostics, cause) {
|
|
77900
|
+
if (cause instanceof application_error_1.ApplicationError && cause.recovery?.id === 'approval-evidence-read-failed') {
|
|
77901
|
+
diagnostics.push(cause.recovery.variables);
|
|
77902
|
+
}
|
|
77903
|
+
else {
|
|
77904
|
+
diagnostics.push((0, approval_evidence_error_1.approvalEvidenceError)('evidence', 'invalid-response').recovery.variables);
|
|
77905
|
+
}
|
|
77906
|
+
}
|
|
77148
77907
|
|
|
77149
77908
|
|
|
77150
77909
|
/***/ }),
|
|
@@ -77156,8 +77915,8 @@ async function readEffectiveApprovalPolicy(octokit, target) {
|
|
|
77156
77915
|
|
|
77157
77916
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
77158
77917
|
exports.PullRequestChangesRepository = void 0;
|
|
77918
|
+
const pull_request_review_error_metadata_1 = __nccwpck_require__(54354);
|
|
77159
77919
|
const logger_1 = __nccwpck_require__(91151);
|
|
77160
|
-
const pull_request_review_errors_1 = __nccwpck_require__(46445);
|
|
77161
77920
|
const github_pagination_policy_1 = __nccwpck_require__(44812);
|
|
77162
77921
|
const application_error_1 = __nccwpck_require__(75999);
|
|
77163
77922
|
class PullRequestChangesRepository {
|
|
@@ -77170,7 +77929,7 @@ class PullRequestChangesRepository {
|
|
|
77170
77929
|
}
|
|
77171
77930
|
catch (error) {
|
|
77172
77931
|
(0, logger_1.logError)((0, application_error_1.toApplicationError)(error, 'provider.unavailable', 'Unable to read the pull request review diff.'));
|
|
77173
|
-
throw (0,
|
|
77932
|
+
throw (0, pull_request_review_error_metadata_1.toPullRequestReviewOperationError)(error, 'list-files');
|
|
77174
77933
|
}
|
|
77175
77934
|
};
|
|
77176
77935
|
this.getBoundedBugbotReviewDiffSnapshot = async (owner, repository, pullNumber, token) => {
|
|
@@ -77212,7 +77971,7 @@ class PullRequestChangesRepository {
|
|
|
77212
77971
|
}
|
|
77213
77972
|
catch (error) {
|
|
77214
77973
|
(0, logger_1.logError)((0, application_error_1.toApplicationError)(error, 'provider.unavailable', 'Unable to read the pull request review diff.'));
|
|
77215
|
-
throw (0,
|
|
77974
|
+
throw (0, pull_request_review_error_metadata_1.toPullRequestReviewOperationError)(error, 'list-files');
|
|
77216
77975
|
}
|
|
77217
77976
|
};
|
|
77218
77977
|
/** Head commit SHA of the PR (for creating review). */
|
|
@@ -77231,7 +77990,7 @@ class PullRequestChangesRepository {
|
|
|
77231
77990
|
}
|
|
77232
77991
|
catch (error) {
|
|
77233
77992
|
(0, logger_1.logError)((0, application_error_1.toApplicationError)(error, 'provider.unavailable', 'Unable to read the pull request head SHA.'));
|
|
77234
|
-
throw (0,
|
|
77993
|
+
throw (0, pull_request_review_error_metadata_1.toPullRequestReviewOperationError)(error, "get-head-sha");
|
|
77235
77994
|
}
|
|
77236
77995
|
};
|
|
77237
77996
|
}
|
|
@@ -77574,6 +78333,7 @@ function toBugbotPullRequestIdentity(value) {
|
|
|
77574
78333
|
|
|
77575
78334
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
77576
78335
|
exports.PullRequestReviewCommentCommandRepository = void 0;
|
|
78336
|
+
const pull_request_review_error_metadata_1 = __nccwpck_require__(54354);
|
|
77577
78337
|
const pull_request_review_errors_1 = __nccwpck_require__(46445);
|
|
77578
78338
|
const github_pagination_policy_1 = __nccwpck_require__(44812);
|
|
77579
78339
|
class PullRequestReviewCommentCommandRepository {
|
|
@@ -77642,7 +78402,7 @@ class PullRequestReviewCommentCommandRepository {
|
|
|
77642
78402
|
const context = comments.length > 0
|
|
77643
78403
|
? { failedCount: comments.length, totalCount: comments.length }
|
|
77644
78404
|
: undefined;
|
|
77645
|
-
throw (0,
|
|
78405
|
+
throw (0, pull_request_review_error_metadata_1.toPullRequestReviewOperationError)(error, "publish-comments", context);
|
|
77646
78406
|
}
|
|
77647
78407
|
}
|
|
77648
78408
|
async updatePullRequestReview(owner, repository, pullRequestNumber, reviewIdentity, body, token) {
|
|
@@ -77663,7 +78423,7 @@ class PullRequestReviewCommentCommandRepository {
|
|
|
77663
78423
|
throw new pull_request_review_errors_1.PullRequestReviewOperationError('update-review');
|
|
77664
78424
|
}
|
|
77665
78425
|
catch (error) {
|
|
77666
|
-
throw (0,
|
|
78426
|
+
throw (0, pull_request_review_error_metadata_1.toPullRequestReviewOperationError)(error, 'update-review');
|
|
77667
78427
|
}
|
|
77668
78428
|
}
|
|
77669
78429
|
async updatePullRequestReviewComment(_owner, _repository, commentIdentity, body, token) {
|
|
@@ -77682,7 +78442,7 @@ class PullRequestReviewCommentCommandRepository {
|
|
|
77682
78442
|
}
|
|
77683
78443
|
}
|
|
77684
78444
|
catch (error) {
|
|
77685
|
-
throw (0,
|
|
78445
|
+
throw (0, pull_request_review_error_metadata_1.toPullRequestReviewOperationError)(error, "update-comment");
|
|
77686
78446
|
}
|
|
77687
78447
|
}
|
|
77688
78448
|
}
|
|
@@ -77698,7 +78458,7 @@ exports.PullRequestReviewCommentCommandRepository = PullRequestReviewCommentComm
|
|
|
77698
78458
|
|
|
77699
78459
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
77700
78460
|
exports.PullRequestReviewCommentQueryRepository = void 0;
|
|
77701
|
-
const
|
|
78461
|
+
const pull_request_review_error_metadata_1 = __nccwpck_require__(54354);
|
|
77702
78462
|
const github_pagination_policy_1 = __nccwpck_require__(44812);
|
|
77703
78463
|
function toReviewComment(comment) {
|
|
77704
78464
|
if (typeof comment.node_id !== "string" || comment.node_id.length === 0) {
|
|
@@ -77754,7 +78514,7 @@ class PullRequestReviewCommentQueryRepository {
|
|
|
77754
78514
|
return comments;
|
|
77755
78515
|
}
|
|
77756
78516
|
catch (error) {
|
|
77757
|
-
throw (0,
|
|
78517
|
+
throw (0, pull_request_review_error_metadata_1.toPullRequestReviewOperationError)(error, "list-comments");
|
|
77758
78518
|
}
|
|
77759
78519
|
}
|
|
77760
78520
|
async listBugbotPullRequestReviewCommentsBounded(owner, repository, pullRequestNumber, token) {
|
|
@@ -77797,7 +78557,7 @@ class PullRequestReviewCommentQueryRepository {
|
|
|
77797
78557
|
};
|
|
77798
78558
|
}
|
|
77799
78559
|
catch (error) {
|
|
77800
|
-
throw (0,
|
|
78560
|
+
throw (0, pull_request_review_error_metadata_1.toPullRequestReviewOperationError)(error, "list-comments");
|
|
77801
78561
|
}
|
|
77802
78562
|
}
|
|
77803
78563
|
async listPullRequestReviews(owner, repository, pullRequestNumber, token) {
|
|
@@ -77811,7 +78571,7 @@ class PullRequestReviewCommentQueryRepository {
|
|
|
77811
78571
|
return reviews;
|
|
77812
78572
|
}
|
|
77813
78573
|
catch (error) {
|
|
77814
|
-
throw (0,
|
|
78574
|
+
throw (0, pull_request_review_error_metadata_1.toPullRequestReviewOperationError)(error, 'list-reviews');
|
|
77815
78575
|
}
|
|
77816
78576
|
}
|
|
77817
78577
|
async getPullRequestReviewCommentBody(owner, repository, _pullRequestNumber, commentId, token) {
|
|
@@ -77825,13 +78585,37 @@ class PullRequestReviewCommentQueryRepository {
|
|
|
77825
78585
|
return data.body ?? null;
|
|
77826
78586
|
}
|
|
77827
78587
|
catch (error) {
|
|
77828
|
-
throw (0,
|
|
78588
|
+
throw (0, pull_request_review_error_metadata_1.toPullRequestReviewOperationError)(error, "get-comment");
|
|
77829
78589
|
}
|
|
77830
78590
|
}
|
|
77831
78591
|
}
|
|
77832
78592
|
exports.PullRequestReviewCommentQueryRepository = PullRequestReviewCommentQueryRepository;
|
|
77833
78593
|
|
|
77834
78594
|
|
|
78595
|
+
/***/ }),
|
|
78596
|
+
|
|
78597
|
+
/***/ 54354:
|
|
78598
|
+
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
78599
|
+
|
|
78600
|
+
"use strict";
|
|
78601
|
+
|
|
78602
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
78603
|
+
exports.toPullRequestReviewOperationError = toPullRequestReviewOperationError;
|
|
78604
|
+
const pull_request_review_errors_1 = __nccwpck_require__(46445);
|
|
78605
|
+
/** Only safe HTTP metadata crosses the provider boundary; provider prose never does. */
|
|
78606
|
+
function toPullRequestReviewOperationError(error, operation, context) {
|
|
78607
|
+
if (!error || typeof error !== 'object')
|
|
78608
|
+
return (0, pull_request_review_errors_1.toPullRequestReviewOperationError)(error, operation, context);
|
|
78609
|
+
const record = error;
|
|
78610
|
+
return (0, pull_request_review_errors_1.toPullRequestReviewOperationError)(error, operation, {
|
|
78611
|
+
...context,
|
|
78612
|
+
...(typeof record.status === 'number' ? { providerStatus: record.status } : {}),
|
|
78613
|
+
...(typeof record.response?.headers?.['x-github-request-id'] === 'string'
|
|
78614
|
+
? { providerReference: record.response.headers['x-github-request-id'] } : {}),
|
|
78615
|
+
});
|
|
78616
|
+
}
|
|
78617
|
+
|
|
78618
|
+
|
|
77835
78619
|
/***/ }),
|
|
77836
78620
|
|
|
77837
78621
|
/***/ 2307:
|
|
@@ -77942,6 +78726,7 @@ function nextConnectionCursor(pageInfo, seenCursors) {
|
|
|
77942
78726
|
|
|
77943
78727
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
77944
78728
|
exports.PullRequestReviewThreadRepository = void 0;
|
|
78729
|
+
const pull_request_review_error_metadata_1 = __nccwpck_require__(54354);
|
|
77945
78730
|
const logger_1 = __nccwpck_require__(91151);
|
|
77946
78731
|
const pull_request_review_errors_1 = __nccwpck_require__(46445);
|
|
77947
78732
|
const pull_request_review_thread_locator_1 = __nccwpck_require__(2307);
|
|
@@ -77989,7 +78774,7 @@ class PullRequestReviewThreadRepository {
|
|
|
77989
78774
|
return states;
|
|
77990
78775
|
}
|
|
77991
78776
|
catch (error) {
|
|
77992
|
-
throw (0,
|
|
78777
|
+
throw (0, pull_request_review_error_metadata_1.toPullRequestReviewOperationError)(error, 'list-threads');
|
|
77993
78778
|
}
|
|
77994
78779
|
};
|
|
77995
78780
|
this.listBugbotPullRequestReviewThreadStatesBounded = async (owner, repository, pullNumber, token) => {
|
|
@@ -78058,7 +78843,7 @@ class PullRequestReviewThreadRepository {
|
|
|
78058
78843
|
};
|
|
78059
78844
|
}
|
|
78060
78845
|
catch (error) {
|
|
78061
|
-
throw (0,
|
|
78846
|
+
throw (0, pull_request_review_error_metadata_1.toPullRequestReviewOperationError)(error, 'list-threads');
|
|
78062
78847
|
}
|
|
78063
78848
|
};
|
|
78064
78849
|
this.resolvePullRequestReviewThread = async (owner, repository, pullNumber, commentIdentity, token) => {
|
|
@@ -78082,7 +78867,7 @@ class PullRequestReviewThreadRepository {
|
|
|
78082
78867
|
(0, logger_1.logDebugInfo)('Resolved pull request review thread.');
|
|
78083
78868
|
}
|
|
78084
78869
|
catch (error) {
|
|
78085
|
-
throw (0,
|
|
78870
|
+
throw (0, pull_request_review_error_metadata_1.toPullRequestReviewOperationError)(error, 'resolve-thread');
|
|
78086
78871
|
}
|
|
78087
78872
|
};
|
|
78088
78873
|
this.unresolvePullRequestReviewThread = async (owner, repository, pullNumber, commentIdentity, token) => {
|
|
@@ -78106,7 +78891,7 @@ class PullRequestReviewThreadRepository {
|
|
|
78106
78891
|
(0, logger_1.logDebugInfo)('Reopened pull request review thread.');
|
|
78107
78892
|
}
|
|
78108
78893
|
catch (error) {
|
|
78109
|
-
throw (0,
|
|
78894
|
+
throw (0, pull_request_review_error_metadata_1.toPullRequestReviewOperationError)(error, 'unresolve-thread');
|
|
78110
78895
|
}
|
|
78111
78896
|
};
|
|
78112
78897
|
}
|
|
@@ -78123,7 +78908,7 @@ exports.PullRequestReviewThreadRepository = PullRequestReviewThreadRepository;
|
|
|
78123
78908
|
|
|
78124
78909
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
78125
78910
|
exports.PullRequestReviewerRepository = void 0;
|
|
78126
|
-
const
|
|
78911
|
+
const pull_request_review_error_metadata_1 = __nccwpck_require__(54354);
|
|
78127
78912
|
const github_pagination_policy_1 = __nccwpck_require__(44812);
|
|
78128
78913
|
const COMPLETED_REVIEW_STATES = new Set([
|
|
78129
78914
|
"APPROVED",
|
|
@@ -78156,7 +78941,7 @@ class PullRequestReviewerRepository {
|
|
|
78156
78941
|
return [...reviewers.values()];
|
|
78157
78942
|
}
|
|
78158
78943
|
catch (error) {
|
|
78159
|
-
throw (0,
|
|
78944
|
+
throw (0, pull_request_review_error_metadata_1.toPullRequestReviewOperationError)(error, "list-reviewers");
|
|
78160
78945
|
}
|
|
78161
78946
|
}
|
|
78162
78947
|
async addReviewersToPullRequest(owner, repository, pullRequestNumber, reviewers, token) {
|
|
@@ -78181,7 +78966,7 @@ class PullRequestReviewerRepository {
|
|
|
78181
78966
|
return [...confirmed.values()];
|
|
78182
78967
|
}
|
|
78183
78968
|
catch (error) {
|
|
78184
|
-
throw (0,
|
|
78969
|
+
throw (0, pull_request_review_error_metadata_1.toPullRequestReviewOperationError)(error, "request-reviewers");
|
|
78185
78970
|
}
|
|
78186
78971
|
}
|
|
78187
78972
|
async listRequestedReviewers(client, parameters) {
|
|
@@ -79385,6 +80170,44 @@ class AgentResponseLengthFailure extends Error {
|
|
|
79385
80170
|
exports.AgentResponseLengthFailure = AgentResponseLengthFailure;
|
|
79386
80171
|
|
|
79387
80172
|
|
|
80173
|
+
/***/ }),
|
|
80174
|
+
|
|
80175
|
+
/***/ 98205:
|
|
80176
|
+
/***/ ((__unused_webpack_module, exports) => {
|
|
80177
|
+
|
|
80178
|
+
"use strict";
|
|
80179
|
+
|
|
80180
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
80181
|
+
exports.APPROVAL_EVIDENCE_REASONS = exports.APPROVAL_EVIDENCE_PERMISSIONS = void 0;
|
|
80182
|
+
/** Closed vocabulary: no provider text, URLs, headers, policy values or credentials. */
|
|
80183
|
+
exports.APPROVAL_EVIDENCE_PERMISSIONS = Object.freeze({
|
|
80184
|
+
'evidence': 'repository-read',
|
|
80185
|
+
'pull-request': 'pull-requests-read',
|
|
80186
|
+
'base-ref': 'contents-read',
|
|
80187
|
+
'merge-commit': 'contents-read',
|
|
80188
|
+
'policy': 'actions-variables-read',
|
|
80189
|
+
'files': 'pull-requests-read',
|
|
80190
|
+
'reviews': 'pull-requests-read',
|
|
80191
|
+
'comments': 'issues-read',
|
|
80192
|
+
'head-checks': 'checks-read',
|
|
80193
|
+
'merge-checks': 'checks-read',
|
|
80194
|
+
'head-runs': 'actions-read',
|
|
80195
|
+
'merge-runs': 'actions-read',
|
|
80196
|
+
'jobs': 'actions-read',
|
|
80197
|
+
'rules': 'metadata-read',
|
|
80198
|
+
'classic-protection': 'administration-read',
|
|
80199
|
+
'authenticated-user': 'authenticated-user-read',
|
|
80200
|
+
'coverage-artifacts': 'actions-read',
|
|
80201
|
+
'coverage-download': 'actions-read',
|
|
80202
|
+
'coverage-parse': 'actions-read',
|
|
80203
|
+
});
|
|
80204
|
+
exports.APPROVAL_EVIDENCE_REASONS = Object.freeze([
|
|
80205
|
+
'http-400', 'http-401', 'http-403', 'http-404', 'http-409', 'http-422', 'http-429',
|
|
80206
|
+
'http-500', 'http-502', 'http-503', 'http-504', 'transport-unavailable',
|
|
80207
|
+
'invalid-response', 'invalid-page', 'page-limit', 'artifact-unavailable', 'artifact-invalid', 'artifact-mismatch',
|
|
80208
|
+
]);
|
|
80209
|
+
|
|
80210
|
+
|
|
79388
80211
|
/***/ }),
|
|
79389
80212
|
|
|
79390
80213
|
/***/ 51114:
|
|
@@ -79561,10 +80384,15 @@ function matchesConstrainedHead(target, candidate) {
|
|
|
79561
80384
|
/***/ }),
|
|
79562
80385
|
|
|
79563
80386
|
/***/ 31011:
|
|
79564
|
-
/***/ ((__unused_webpack_module, exports) => {
|
|
80387
|
+
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
79565
80388
|
|
|
79566
80389
|
"use strict";
|
|
79567
80390
|
|
|
80391
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
80392
|
+
exports.isExistingFindingFullyResolved = isExistingFindingFullyResolved;
|
|
80393
|
+
exports.findExistingFindingInfo = findExistingFindingInfo;
|
|
80394
|
+
exports.findExistingFindingMatch = findExistingFindingMatch;
|
|
80395
|
+
exports.retainExistingFindingIds = retainExistingFindingIds;
|
|
79568
80396
|
/**
|
|
79569
80397
|
* Provider-neutral Bugbot finding and durable identity contracts.
|
|
79570
80398
|
*
|
|
@@ -79572,9 +80400,7 @@ function matchesConstrainedHead(target, candidate) {
|
|
|
79572
80400
|
* them in the domain prevents policies from depending on a particular use-case
|
|
79573
80401
|
* folder and gives every adapter one stable semantic vocabulary.
|
|
79574
80402
|
*/
|
|
79575
|
-
|
|
79576
|
-
exports.isExistingFindingFullyResolved = isExistingFindingFullyResolved;
|
|
79577
|
-
exports.findExistingFindingInfo = findExistingFindingInfo;
|
|
80403
|
+
const finding_identity_1 = __nccwpck_require__(91853);
|
|
79578
80404
|
function isExistingFindingFullyResolved(finding) {
|
|
79579
80405
|
const destinations = [finding.issue, finding.pullRequest].filter((destination) => destination != null);
|
|
79580
80406
|
return (destinations.length > 0 &&
|
|
@@ -79582,21 +80408,62 @@ function isExistingFindingFullyResolved(finding) {
|
|
|
79582
80408
|
finding.pullRequest?.verificationRequired !== true);
|
|
79583
80409
|
}
|
|
79584
80410
|
function findExistingFindingInfo(existingByFindingId, finding) {
|
|
80411
|
+
return findExistingFindingMatch(existingByFindingId, finding)?.info;
|
|
80412
|
+
}
|
|
80413
|
+
/** A match carries its durable key so updating a comment cannot re-key it. */
|
|
80414
|
+
function findExistingFindingMatch(existingByFindingId, finding) {
|
|
79585
80415
|
const direct = existingByFindingId[finding.id];
|
|
79586
80416
|
if (direct && identitiesAreCompatible(direct, finding))
|
|
79587
|
-
return direct;
|
|
79588
|
-
const candidates = Object.
|
|
80417
|
+
return { id: finding.id, info: direct };
|
|
80418
|
+
const candidates = Object.entries(existingByFindingId);
|
|
79589
80419
|
if (finding.fingerprint) {
|
|
79590
|
-
const
|
|
80420
|
+
const locationMatches = candidates.filter(([, candidate]) => candidate.issue?.fingerprint === finding.fingerprint
|
|
79591
80421
|
|| candidate.pullRequest?.fingerprint === finding.fingerprint);
|
|
79592
|
-
if (
|
|
79593
|
-
return
|
|
80422
|
+
if (locationMatches.length > 0)
|
|
80423
|
+
return uniqueFindingMatch(locationMatches);
|
|
79594
80424
|
}
|
|
79595
80425
|
if (!finding.semanticFingerprint)
|
|
79596
80426
|
return undefined;
|
|
79597
|
-
const semanticMatches = candidates.filter((candidate) => candidate.issue?.semanticFingerprint === finding.semanticFingerprint
|
|
80427
|
+
const semanticMatches = candidates.filter(([, candidate]) => candidate.issue?.semanticFingerprint === finding.semanticFingerprint
|
|
79598
80428
|
|| candidate.pullRequest?.semanticFingerprint === finding.semanticFingerprint);
|
|
79599
|
-
return semanticMatches
|
|
80429
|
+
return uniqueFindingMatch(semanticMatches);
|
|
80430
|
+
}
|
|
80431
|
+
/**
|
|
80432
|
+
* Preserve trusted IDs across title/location changes, before limits, publication
|
|
80433
|
+
* and final projection. Multiple reports of one uniquely matched durable finding
|
|
80434
|
+
* share one record; unmatched or ambiguous reports remain independent evidence.
|
|
80435
|
+
*/
|
|
80436
|
+
function retainExistingFindingIds(findings, existingByFindingId) {
|
|
80437
|
+
const retained = new Set();
|
|
80438
|
+
const durableIds = new Set(Object.keys(existingByFindingId));
|
|
80439
|
+
// Reserve the whole input up front so a generated ID cannot take another
|
|
80440
|
+
// report's ID, including one that occurs later in the response.
|
|
80441
|
+
const reservedIds = new Set([...durableIds, ...findings.map((finding) => finding.id)]);
|
|
80442
|
+
const emittedIds = new Set();
|
|
80443
|
+
return findings.flatMap((finding) => {
|
|
80444
|
+
const match = findExistingFindingMatch(existingByFindingId, finding);
|
|
80445
|
+
if (!match) {
|
|
80446
|
+
let id = finding.id;
|
|
80447
|
+
if (durableIds.has(id) || emittedIds.has(id)) {
|
|
80448
|
+
const base = `candidate-${(0, finding_identity_1.buildFindingFingerprint)(finding)}`;
|
|
80449
|
+
id = base;
|
|
80450
|
+
let suffix = 0;
|
|
80451
|
+
while (reservedIds.has(id))
|
|
80452
|
+
id = `${base}-${++suffix}`;
|
|
80453
|
+
reservedIds.add(id);
|
|
80454
|
+
}
|
|
80455
|
+
emittedIds.add(id);
|
|
80456
|
+
return [id === finding.id ? finding : { ...finding, id }];
|
|
80457
|
+
}
|
|
80458
|
+
if (retained.has(match.id))
|
|
80459
|
+
return [];
|
|
80460
|
+
retained.add(match.id);
|
|
80461
|
+
emittedIds.add(match.id);
|
|
80462
|
+
return [finding.id === match.id ? finding : { ...finding, id: match.id }];
|
|
80463
|
+
});
|
|
80464
|
+
}
|
|
80465
|
+
function uniqueFindingMatch(matches) {
|
|
80466
|
+
return matches.length === 1 ? { id: matches[0][0], info: matches[0][1] } : undefined;
|
|
79600
80467
|
}
|
|
79601
80468
|
function identitiesAreCompatible(existing, finding) {
|
|
79602
80469
|
const existingFingerprints = [
|
|
@@ -79945,6 +80812,25 @@ function countActionableBugbotFindings(counts) {
|
|
|
79945
80812
|
}
|
|
79946
80813
|
|
|
79947
80814
|
|
|
80815
|
+
/***/ }),
|
|
80816
|
+
|
|
80817
|
+
/***/ 21565:
|
|
80818
|
+
/***/ ((__unused_webpack_module, exports) => {
|
|
80819
|
+
|
|
80820
|
+
"use strict";
|
|
80821
|
+
|
|
80822
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
80823
|
+
exports.CLOSED_ISSUE_REASONS = exports.CLOSED_ISSUE_PHASES = exports.CLOSED_ISSUE_RESULTS = void 0;
|
|
80824
|
+
exports.CLOSED_ISSUE_RESULTS = Object.freeze([
|
|
80825
|
+
'ReconcileClosedIssueMetadataUseCase', 'CloseIssueAfterMergingUseCase', 'RetireBranchSyncUseCase', 'RetireProgressUseCase',
|
|
80826
|
+
]);
|
|
80827
|
+
exports.CLOSED_ISSUE_PHASES = Object.freeze([
|
|
80828
|
+
'identity', 'read', 'native-fence', 'label-remove', 'label-add', 'metadata-verification',
|
|
80829
|
+
'card-inventory', 'card-freshness', 'card-update', 'card-verification',
|
|
80830
|
+
]);
|
|
80831
|
+
exports.CLOSED_ISSUE_REASONS = Object.freeze(['completed', 'not_planned', 'duplicate', 'reopened', 'unknown', 'unavailable']);
|
|
80832
|
+
|
|
80833
|
+
|
|
79948
80834
|
/***/ }),
|
|
79949
80835
|
|
|
79950
80836
|
/***/ 77454:
|
|
@@ -80119,6 +81005,63 @@ function isCopilotCommentRequest(commentBody, botLogin) {
|
|
|
80119
81005
|
}
|
|
80120
81006
|
|
|
80121
81007
|
|
|
81008
|
+
/***/ }),
|
|
81009
|
+
|
|
81010
|
+
/***/ 33430:
|
|
81011
|
+
/***/ ((__unused_webpack_module, exports) => {
|
|
81012
|
+
|
|
81013
|
+
"use strict";
|
|
81014
|
+
|
|
81015
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
81016
|
+
exports.COPILOT_COMMENT_REMOTE_WORKFLOW = exports.COPILOT_COMMENT_SELF_WORKFLOW = exports.COPILOT_COMMENT_RUNTIME = void 0;
|
|
81017
|
+
exports.isCopilotCommentWorkflow = isCopilotCommentWorkflow;
|
|
81018
|
+
exports.isCopilotCommentRunner = isCopilotCommentRunner;
|
|
81019
|
+
exports.copilotCommentRunner = copilotCommentRunner;
|
|
81020
|
+
/** The comment coordinator is a versioned Copilot workflow, not an arbitrary reusable job. */
|
|
81021
|
+
exports.COPILOT_COMMENT_RUNTIME = 'copilot_comment_runtime.yml';
|
|
81022
|
+
exports.COPILOT_COMMENT_SELF_WORKFLOW = `$/.github/workflows/${exports.COPILOT_COMMENT_RUNTIME}`;
|
|
81023
|
+
exports.COPILOT_COMMENT_REMOTE_WORKFLOW = `vypdev/copilot/.github/workflows/${exports.COPILOT_COMMENT_RUNTIME}@v3`;
|
|
81024
|
+
function isCopilotCommentWorkflow(value) {
|
|
81025
|
+
return typeof value === 'string' && (value === exports.COPILOT_COMMENT_SELF_WORKFLOW
|
|
81026
|
+
|| /^vypdev\/copilot\/\.github\/workflows\/copilot_comment_runtime\.yml@(?:v3(?:\.[0-9]+\.[0-9]+)?|[a-f0-9]{40})$/u.test(value));
|
|
81027
|
+
}
|
|
81028
|
+
const literal = (value) => typeof value === 'string' && value.length > 0 && value.length <= 100
|
|
81029
|
+
&& value === value.trim() && !/[\p{Cc}\p{Cf}${}<>]/u.test(value);
|
|
81030
|
+
const labels = (value) => literal(value) || Array.isArray(value) && value.length > 0 && value.length <= 10
|
|
81031
|
+
&& value.every(literal) && new Set(value.map(label => label.toLowerCase())).size === value.length;
|
|
81032
|
+
/** Runner routing is literal data; expressions need their original full workflow reviewed. */
|
|
81033
|
+
function isCopilotCommentRunner(value) {
|
|
81034
|
+
if (labels(value))
|
|
81035
|
+
return true;
|
|
81036
|
+
if (!value || typeof value !== 'object' || Array.isArray(value))
|
|
81037
|
+
return false;
|
|
81038
|
+
const route = value;
|
|
81039
|
+
const keys = Object.keys(route);
|
|
81040
|
+
return keys.length > 0 && (route.group !== undefined || route.labels !== undefined)
|
|
81041
|
+
&& keys.every(key => key === 'group' || key === 'labels')
|
|
81042
|
+
&& (route.group === undefined || literal(route.group))
|
|
81043
|
+
&& (route.labels === undefined || labels(route.labels));
|
|
81044
|
+
}
|
|
81045
|
+
function copilotCommentRunner(job) {
|
|
81046
|
+
if (!job || !isCopilotCommentWorkflow(job.uses))
|
|
81047
|
+
return job?.['runs-on'];
|
|
81048
|
+
const inputs = job.with;
|
|
81049
|
+
if (typeof inputs?.['runs-on'] !== 'string')
|
|
81050
|
+
throw new Error('Comment workflow runner JSON is unavailable; review the workflow separately.');
|
|
81051
|
+
try {
|
|
81052
|
+
if (inputs['runs-on'].length > 16000)
|
|
81053
|
+
throw new Error('Runner JSON exceeds its bound.');
|
|
81054
|
+
const route = JSON.parse(inputs['runs-on']);
|
|
81055
|
+
if (!isCopilotCommentRunner(route))
|
|
81056
|
+
throw new Error('Unsupported execution route.');
|
|
81057
|
+
return route;
|
|
81058
|
+
}
|
|
81059
|
+
catch {
|
|
81060
|
+
throw new Error('Comment workflow runner JSON is invalid; review the workflow separately.');
|
|
81061
|
+
}
|
|
81062
|
+
}
|
|
81063
|
+
|
|
81064
|
+
|
|
80122
81065
|
/***/ }),
|
|
80123
81066
|
|
|
80124
81067
|
/***/ 72418:
|
|
@@ -81923,7 +82866,7 @@ function parsePositiveSafeInteger(value) {
|
|
|
81923
82866
|
"use strict";
|
|
81924
82867
|
|
|
81925
82868
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
81926
|
-
exports.SDD_REQUIRED_HEADINGS = exports.SddOwnerFormatFailure = exports.SddDraftFormatFailure = exports.SDD_MAX_UPDATE_CHARACTERS = exports.SDD_MAX_DRAFT_CHARACTERS = exports.SDD_MIN_DRAFT_CHARACTERS = exports.SDD_GATE_MARKER = void 0;
|
|
82869
|
+
exports.SDD_REQUIRED_HEADINGS = exports.SddOwnerFormatFailure = exports.SddDraftFormatFailure = exports.SddOwnershipFailure = exports.SDD_MAX_UPDATE_CHARACTERS = exports.SDD_MAX_DRAFT_CHARACTERS = exports.SDD_MIN_DRAFT_CHARACTERS = exports.SDD_GATE_MARKER = void 0;
|
|
81927
82870
|
exports.retainSddAnswers = retainSddAnswers;
|
|
81928
82871
|
exports.normalizeSddIssueTitle = normalizeSddIssueTitle;
|
|
81929
82872
|
exports.isSafeSddPath = isSafeSddPath;
|
|
@@ -81934,6 +82877,7 @@ exports.isSddAnswerComment = isSddAnswerComment;
|
|
|
81934
82877
|
exports.parseSddAnswer = parseSddAnswer;
|
|
81935
82878
|
exports.validateSddMarkdown = validateSddMarkdown;
|
|
81936
82879
|
exports.composeSddUpdate = composeSddUpdate;
|
|
82880
|
+
exports.recoverSddUpdate = recoverSddUpdate;
|
|
81937
82881
|
exports.SDD_GATE_MARKER = 'copilot:sdd-gate:v1';
|
|
81938
82882
|
exports.SDD_MIN_DRAFT_CHARACTERS = 1800;
|
|
81939
82883
|
exports.SDD_MAX_DRAFT_CHARACTERS = 70000;
|
|
@@ -81961,6 +82905,15 @@ function normalizeSddIssueTitle(title) {
|
|
|
81961
82905
|
function isSafeSddPath(path) {
|
|
81962
82906
|
return SDD_PATH.test(path) && !['specs/CATALOG.md', 'specs/_template.md'].includes(path);
|
|
81963
82907
|
}
|
|
82908
|
+
/** Closed diagnostics contain no model-selected identifiers or provider text. */
|
|
82909
|
+
class SddOwnershipFailure extends Error {
|
|
82910
|
+
constructor(reason) {
|
|
82911
|
+
super(`SDD ownership analysis rejected (${reason}).`);
|
|
82912
|
+
this.reason = reason;
|
|
82913
|
+
this.name = 'SddOwnershipFailure';
|
|
82914
|
+
}
|
|
82915
|
+
}
|
|
82916
|
+
exports.SddOwnershipFailure = SddOwnershipFailure;
|
|
81964
82917
|
/** The agent may propose ownership but cannot invent a catalogued owner or arbitrary path. */
|
|
81965
82918
|
function parseSddPlan(value, catalog) {
|
|
81966
82919
|
if (!isRecord(value))
|
|
@@ -81978,14 +82931,16 @@ function parseSddPlan(value, catalog) {
|
|
|
81978
82931
|
const ownerPaths = catalog.get(capabilityId);
|
|
81979
82932
|
const registered = [...catalog.values()].some(paths => paths.includes(path));
|
|
81980
82933
|
if (action === 'update' && (!ownerPaths?.includes(path) || !registered)) {
|
|
81981
|
-
throw new
|
|
81982
|
-
}
|
|
81983
|
-
if (action === 'companion' &&
|
|
81984
|
-
throw new
|
|
81985
|
-
|
|
81986
|
-
|
|
81987
|
-
|
|
81988
|
-
|
|
82934
|
+
throw new SddOwnershipFailure('update-owner-mismatch');
|
|
82935
|
+
}
|
|
82936
|
+
if (action === 'companion' && !ownerPaths)
|
|
82937
|
+
throw new SddOwnershipFailure('companion-owner-unknown');
|
|
82938
|
+
if (action === 'companion' && registered)
|
|
82939
|
+
throw new SddOwnershipFailure('companion-path-registered');
|
|
82940
|
+
if (action === 'new' && ownerPaths)
|
|
82941
|
+
throw new SddOwnershipFailure('new-owner-registered');
|
|
82942
|
+
if (action === 'new' && registered)
|
|
82943
|
+
throw new SddOwnershipFailure('new-path-registered');
|
|
81989
82944
|
if (!Array.isArray(value.questions) || value.questions.length > 8) {
|
|
81990
82945
|
throw new Error('The SDD analysis must contain at most eight blocking questions.');
|
|
81991
82946
|
}
|
|
@@ -82226,8 +83181,24 @@ function composeSddUpdate(existing, change) {
|
|
|
82226
83181
|
validateSddMarkdown(change);
|
|
82227
83182
|
if (change.length > exports.SDD_MAX_UPDATE_CHARACTERS)
|
|
82228
83183
|
throw new Error('An SDD update appendix exceeds 18000 characters; use a proportional change or a companion SDD.');
|
|
83184
|
+
const appendix = shiftSddHeadings(change, 1);
|
|
83185
|
+
const merged = `${existing.trimEnd()}\n\n${appendix.trim()}\n`;
|
|
83186
|
+
validateSddMarkdown(merged);
|
|
83187
|
+
return merged;
|
|
83188
|
+
}
|
|
83189
|
+
/** Recovery validates the original candidate, not a second copy of its retained baseline. */
|
|
83190
|
+
function recoverSddUpdate(existing, published) {
|
|
83191
|
+
const prefix = `${existing.trimEnd()}\n\n`;
|
|
83192
|
+
if (!published.startsWith(prefix))
|
|
83193
|
+
return undefined;
|
|
83194
|
+
// Composition normalizes outer whitespace and adds a publication newline.
|
|
83195
|
+
// Reconstruct an equivalent candidate inside the original size bounds.
|
|
83196
|
+
const change = shiftSddHeadings(published.slice(prefix.length), -1).trim().padEnd(exports.SDD_MIN_DRAFT_CHARACTERS, '\n');
|
|
83197
|
+
return composeSddUpdate(existing, change) === published ? change : undefined;
|
|
83198
|
+
}
|
|
83199
|
+
function shiftSddHeadings(source, direction) {
|
|
82229
83200
|
let fence;
|
|
82230
|
-
|
|
83201
|
+
return source.split('\n').map(line => {
|
|
82231
83202
|
const boundary = line.match(/^\s*(`{3,}|~{3,})/);
|
|
82232
83203
|
if (boundary) {
|
|
82233
83204
|
if (!fence)
|
|
@@ -82236,11 +83207,11 @@ function composeSddUpdate(existing, change) {
|
|
|
82236
83207
|
fence = undefined;
|
|
82237
83208
|
return line;
|
|
82238
83209
|
}
|
|
82239
|
-
|
|
83210
|
+
if (fence)
|
|
83211
|
+
return line;
|
|
83212
|
+
return direction === 1 ? (/^#{1,5} /.test(line) ? `#${line}` : line)
|
|
83213
|
+
: (/^#{2,6} /.test(line) ? line.slice(1) : line);
|
|
82240
83214
|
}).join('\n');
|
|
82241
|
-
const merged = `${existing.trimEnd()}\n\n${appendix.trim()}\n`;
|
|
82242
|
-
validateSddMarkdown(merged);
|
|
82243
|
-
return merged;
|
|
82244
83215
|
}
|
|
82245
83216
|
function serializeSddGateValue(value) {
|
|
82246
83217
|
// Human answer text must never terminate its hidden state comment.
|
|
@@ -82837,6 +83808,254 @@ function replyRequestBodyDigest(body) {
|
|
|
82837
83808
|
}
|
|
82838
83809
|
|
|
82839
83810
|
|
|
83811
|
+
/***/ }),
|
|
83812
|
+
|
|
83813
|
+
/***/ 27910:
|
|
83814
|
+
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
83815
|
+
|
|
83816
|
+
"use strict";
|
|
83817
|
+
|
|
83818
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
83819
|
+
exports.SDD_CONSISTENCY_PROMPT = void 0;
|
|
83820
|
+
exports.reservedSddCaseIds = reservedSddCaseIds;
|
|
83821
|
+
exports.validateSddDraftConsistency = validateSddDraftConsistency;
|
|
83822
|
+
const pre_branch_sdd_1 = __nccwpck_require__(34730);
|
|
83823
|
+
const CASE = /\b(?:[A-Za-z][A-Za-z0-9]*-)+C\d+\b/gu;
|
|
83824
|
+
const CASE_ID = /^(?:[A-Za-z][A-Za-z0-9]*-)+C\d+$/u;
|
|
83825
|
+
const REQUIREMENT_ID = /^[A-Za-z][A-Za-z0-9]*(?:-[A-Za-z0-9]+)+$/u;
|
|
83826
|
+
/** Generated candidates use visible tables; retained legacy owners are never reformatted. */
|
|
83827
|
+
exports.SDD_CONSISTENCY_PROMPT = `Consistency contract for the proposed draft/appendix (not the retained owner):
|
|
83828
|
+
In section 4 include one table: Requirement | Behavior. Give every goal a stable requirement ID.
|
|
83829
|
+
In section 14 include one budget table: Area | Minimum distinct cases | Behaviors/risks covered; positive integers and one Total.
|
|
83830
|
+
Also in section 14 include one inventory table: Case ID | Area | Requirements | Scenario.
|
|
83831
|
+
Each row is one distinct executable case with a fully qualified ID such as capability-change-C01, one exact budget area, comma-separated requirement IDs and an observable scenario. Never use shorthand C01, ranges or redefine an ID found in any owning SDD. Reference retained baseline cases in prose using their full IDs; count only the new inventory.
|
|
83832
|
+
In section 17 include one table: Requirement | Cases. List comma-separated full case IDs for every requirement. Its links must exactly match the case inventory in both directions, with no undefined or generic documentation checks.
|
|
83833
|
+
In section 15 include one table: Path | Change. Change is update, reference or create. Include the selected SDD path itself with update for an existing SDD or create for a new/companion SDD. Use existing immutable-base files for update/reference. Only explicitly proposed new files may use create; never mark a missing current document as an existing artifact. Cite repository files as full repository-relative paths in backticks, or relative Markdown file links. Put every planned new file in this table. These tables are publication consistency checks, not runtime/security acceptance.`;
|
|
83834
|
+
function fail(reason) {
|
|
83835
|
+
// Closed diagnostics: rejected Markdown and repository text never become repair instructions.
|
|
83836
|
+
throw new pre_branch_sdd_1.SddDraftFormatFailure(reason, `The SDD draft violates its ${reason} consistency contract.`);
|
|
83837
|
+
}
|
|
83838
|
+
/** Excludes examples and hidden records from the contract. */
|
|
83839
|
+
function visible(source) {
|
|
83840
|
+
let fence;
|
|
83841
|
+
let comment = false;
|
|
83842
|
+
return source.replace(/\r\n/gu, '\n').split('\n').map(line => {
|
|
83843
|
+
const boundary = /^\s*(`{3,}|~{3,})/u.exec(line);
|
|
83844
|
+
if (fence) {
|
|
83845
|
+
// Comment syntax inside code is literal; only the original line can close it.
|
|
83846
|
+
if (boundary && boundary[1][0] === fence[0] && boundary[1].length >= fence.length
|
|
83847
|
+
&& /^ {0,3}(?:`+|~+)[ \t]*$/u.test(line))
|
|
83848
|
+
fence = undefined;
|
|
83849
|
+
return '';
|
|
83850
|
+
}
|
|
83851
|
+
if (!comment && boundary) {
|
|
83852
|
+
fence = boundary[1];
|
|
83853
|
+
return '';
|
|
83854
|
+
}
|
|
83855
|
+
let result = '';
|
|
83856
|
+
let offset = 0;
|
|
83857
|
+
while (offset < line.length) {
|
|
83858
|
+
const marker = comment ? '-->' : '<!--';
|
|
83859
|
+
const next = line.indexOf(marker, offset);
|
|
83860
|
+
if (next < 0)
|
|
83861
|
+
return result + (comment ? '' : line.slice(offset));
|
|
83862
|
+
if (!comment)
|
|
83863
|
+
result += line.slice(offset, next) + ' ';
|
|
83864
|
+
offset = next + marker.length;
|
|
83865
|
+
comment = !comment;
|
|
83866
|
+
}
|
|
83867
|
+
return result;
|
|
83868
|
+
}).join('\n');
|
|
83869
|
+
}
|
|
83870
|
+
function clean(value) { return value.trim().replace(/^(?:\*\*|__|`)(.*?)(?:\*\*|__|`)$/u, '$1').trim(); }
|
|
83871
|
+
function table(source, section, headers, reason) {
|
|
83872
|
+
const sections = [...source.matchAll(/^## (\d+)\. [^\n]*$/gmu)];
|
|
83873
|
+
const matches = sections.filter(heading => Number(heading[1]) === section);
|
|
83874
|
+
if (matches.length !== 1)
|
|
83875
|
+
return fail(reason);
|
|
83876
|
+
const start = matches[0];
|
|
83877
|
+
const end = sections.find(heading => heading.index > start.index)?.index ?? source.length;
|
|
83878
|
+
const lines = source.slice(start.index + start[0].length, end).split('\n');
|
|
83879
|
+
const found = [];
|
|
83880
|
+
for (let index = 0; index < lines.length; index++) {
|
|
83881
|
+
if (!/^\s*\|/u.test(lines[index]))
|
|
83882
|
+
continue;
|
|
83883
|
+
const cells = (line) => line.trim().replace(/^\||\|$/gu, '').split('|').map(clean);
|
|
83884
|
+
const header = cells(lines[index]);
|
|
83885
|
+
if (!headers.every((value, position) => header[position] === value) || header.length !== headers.length)
|
|
83886
|
+
continue;
|
|
83887
|
+
const separator = cells(lines[++index] ?? '');
|
|
83888
|
+
if (separator.length !== headers.length || !separator.every(cell => /^:?-{3,}:?$/u.test(cell)))
|
|
83889
|
+
return fail(reason);
|
|
83890
|
+
const rows = [];
|
|
83891
|
+
while (++index < lines.length && /^\s*\|/u.test(lines[index])) {
|
|
83892
|
+
const row = cells(lines[index]);
|
|
83893
|
+
if (row.length !== headers.length || row.some(cell => !cell))
|
|
83894
|
+
return fail(reason);
|
|
83895
|
+
rows.push(row);
|
|
83896
|
+
}
|
|
83897
|
+
if (!rows.length)
|
|
83898
|
+
return fail(reason);
|
|
83899
|
+
found.push(rows);
|
|
83900
|
+
}
|
|
83901
|
+
return found.length === 1 ? found[0] : fail(reason);
|
|
83902
|
+
}
|
|
83903
|
+
function ids(value, pattern, reason) {
|
|
83904
|
+
const values = value.split(/\s*,\s*/u);
|
|
83905
|
+
if (!values.every(id => pattern.test(id)) || new Set(values).size !== values.length)
|
|
83906
|
+
return fail(reason);
|
|
83907
|
+
return values;
|
|
83908
|
+
}
|
|
83909
|
+
function reservedSddCaseIds(documents) {
|
|
83910
|
+
const reserved = new Set();
|
|
83911
|
+
for (const document of documents) {
|
|
83912
|
+
const source = visible(document.markdown);
|
|
83913
|
+
const qualified = source.match(CASE) ?? [];
|
|
83914
|
+
const namespaces = new Set(qualified.map(id => id.slice(0, id.lastIndexOf('-C') + 2)));
|
|
83915
|
+
for (const id of qualified)
|
|
83916
|
+
reserved.add(id);
|
|
83917
|
+
// Legacy inventories often qualify C01 and abbreviate the remaining rows.
|
|
83918
|
+
// Reserve every plausible namespace instead of silently assigning an alias a new meaning.
|
|
83919
|
+
for (const match of source.matchAll(/(?<![\w-])C(\d+)\b/gu)) {
|
|
83920
|
+
for (const namespace of namespaces)
|
|
83921
|
+
reserved.add(`${namespace}${match[1]}`);
|
|
83922
|
+
}
|
|
83923
|
+
for (const match of source.matchAll(/\bC(\d+)\s*[-–—]\s*C?(\d+)\b/gu)) {
|
|
83924
|
+
const start = Number(match[1]);
|
|
83925
|
+
const end = Number(match[2]);
|
|
83926
|
+
if (!Number.isSafeInteger(start) || !Number.isSafeInteger(end) || end < start || end - start > 1000) {
|
|
83927
|
+
throw new Error('An owning SDD case range cannot be reconciled within the fixed bound; review the baseline before retrying.');
|
|
83928
|
+
}
|
|
83929
|
+
for (let number = start; number <= end; number++) {
|
|
83930
|
+
for (const namespace of namespaces)
|
|
83931
|
+
reserved.add(`${namespace}${String(number).padStart(match[1].length, '0')}`);
|
|
83932
|
+
}
|
|
83933
|
+
}
|
|
83934
|
+
}
|
|
83935
|
+
return [...reserved].sort();
|
|
83936
|
+
}
|
|
83937
|
+
function validateSddDraftConsistency(markdown, owners, inventory, sddPath) {
|
|
83938
|
+
const source = visible(markdown);
|
|
83939
|
+
const requirements = table(source, 4, ['Requirement', 'Behavior'], 'requirement-mapping');
|
|
83940
|
+
const requirementIds = requirements.map(row => row[0]);
|
|
83941
|
+
if (new Set(requirementIds).size !== requirementIds.length || !requirementIds.every(id => REQUIREMENT_ID.test(id)))
|
|
83942
|
+
fail('requirement-mapping');
|
|
83943
|
+
const cases = table(source, 14, ['Case ID', 'Area', 'Requirements', 'Scenario'], 'case-identity');
|
|
83944
|
+
const caseIds = cases.map(row => row[0]);
|
|
83945
|
+
const reserved = new Set(reservedSddCaseIds(owners));
|
|
83946
|
+
if (new Set(caseIds).size !== caseIds.length || caseIds.some(id => !CASE_ID.test(id) || reserved.has(id))
|
|
83947
|
+
|| /(?<![\w-])C\d+\b/u.test(source))
|
|
83948
|
+
fail('case-identity');
|
|
83949
|
+
// References to existing owner cases are allowed, but cannot count as newly defined cases.
|
|
83950
|
+
if ([...source.matchAll(CASE)].some(([id]) => !caseIds.includes(id) && !reserved.has(id)))
|
|
83951
|
+
fail('case-identity');
|
|
83952
|
+
const budget = table(source, 14, ['Area', 'Minimum distinct cases', 'Behaviors/risks covered'], 'case-budget');
|
|
83953
|
+
const counts = new Map();
|
|
83954
|
+
let total;
|
|
83955
|
+
for (const [area, value] of budget) {
|
|
83956
|
+
const count = /^[1-9]\d*$/u.test(value) ? Number(value) : NaN;
|
|
83957
|
+
if (!Number.isSafeInteger(count) || counts.has(area) || total !== undefined)
|
|
83958
|
+
fail('case-budget');
|
|
83959
|
+
if (area === 'Total')
|
|
83960
|
+
total = count;
|
|
83961
|
+
else
|
|
83962
|
+
counts.set(area, count);
|
|
83963
|
+
}
|
|
83964
|
+
if (!counts.size || total !== caseIds.length || [...counts.values()].reduce((sum, count) => sum + count, 0) !== total
|
|
83965
|
+
|| cases.some(row => !counts.has(row[1])))
|
|
83966
|
+
fail('case-budget');
|
|
83967
|
+
for (const [area, count] of counts)
|
|
83968
|
+
if (cases.filter(row => row[1] === area).length !== count)
|
|
83969
|
+
fail('case-budget');
|
|
83970
|
+
const edges = new Map(requirementIds.map(id => [id, new Set()]));
|
|
83971
|
+
for (const [id, , links] of cases) {
|
|
83972
|
+
for (const requirement of ids(links, REQUIREMENT_ID, 'requirement-mapping')) {
|
|
83973
|
+
const linked = edges.get(requirement);
|
|
83974
|
+
if (!linked)
|
|
83975
|
+
fail('requirement-mapping');
|
|
83976
|
+
linked.add(id);
|
|
83977
|
+
}
|
|
83978
|
+
}
|
|
83979
|
+
const traceability = table(source, 17, ['Requirement', 'Cases'], 'requirement-mapping');
|
|
83980
|
+
const seen = new Set();
|
|
83981
|
+
for (const [requirement, links] of traceability) {
|
|
83982
|
+
const expected = edges.get(requirement);
|
|
83983
|
+
const actual = ids(links, CASE_ID, 'requirement-mapping');
|
|
83984
|
+
if (!expected || seen.has(requirement) || expected.size !== actual.length || actual.some(id => !expected.has(id)))
|
|
83985
|
+
fail('requirement-mapping');
|
|
83986
|
+
seen.add(requirement);
|
|
83987
|
+
}
|
|
83988
|
+
if (seen.size !== edges.size || [...edges.values()].some(links => links.size === 0))
|
|
83989
|
+
fail('requirement-mapping');
|
|
83990
|
+
validatePaths(source, inventory, sddPath);
|
|
83991
|
+
}
|
|
83992
|
+
function safePath(value) {
|
|
83993
|
+
return value.length > 0 && !/[\\:*?"<>|\p{Cc}]/u.test(value)
|
|
83994
|
+
&& value.split('/').every(segment => segment && segment !== '.' && segment !== '..' && segment.toLowerCase() !== '.git');
|
|
83995
|
+
}
|
|
83996
|
+
function validatePaths(source, inventory, sddPath) {
|
|
83997
|
+
const rows = table(source, 15, ['Path', 'Change'], 'repository-path');
|
|
83998
|
+
const expectedChange = inventory.files.has(sddPath) ? 'update' : 'create';
|
|
83999
|
+
if (!rows.some(([file, change]) => file === sddPath && change === expectedChange))
|
|
84000
|
+
fail('repository-path');
|
|
84001
|
+
const proposed = new Set();
|
|
84002
|
+
const seen = new Set();
|
|
84003
|
+
for (const [file, change] of rows) {
|
|
84004
|
+
if (!safePath(file) || seen.has(file) || inventory.blocked.has(file))
|
|
84005
|
+
fail('repository-path');
|
|
84006
|
+
seen.add(file);
|
|
84007
|
+
if (change === 'create') {
|
|
84008
|
+
if (inventory.files.has(file) || inventory.directories.has(file))
|
|
84009
|
+
fail('repository-path');
|
|
84010
|
+
if ([...proposed].some(other => file.startsWith(`${other}/`) || other.startsWith(`${file}/`)))
|
|
84011
|
+
fail('repository-path');
|
|
84012
|
+
const segments = file.split('/');
|
|
84013
|
+
if (segments.some((_, index) => inventory.files.has(segments.slice(0, index + 1).join('/')) || inventory.blocked.has(segments.slice(0, index + 1).join('/'))))
|
|
84014
|
+
fail('repository-path');
|
|
84015
|
+
proposed.add(file);
|
|
84016
|
+
}
|
|
84017
|
+
else if (!['update', 'reference'].includes(change) || !inventory.files.has(file))
|
|
84018
|
+
fail('repository-path');
|
|
84019
|
+
}
|
|
84020
|
+
const check = (file) => {
|
|
84021
|
+
if (!safePath(file) || (!inventory.files.has(file) && !inventory.directories.has(file) && !proposed.has(file)))
|
|
84022
|
+
fail('repository-path');
|
|
84023
|
+
};
|
|
84024
|
+
// Relative Markdown file links resolve against the selected SDD, never the current checkout.
|
|
84025
|
+
for (const match of source.matchAll(/\]\(([^\s)]+)\)/gu)) {
|
|
84026
|
+
const href = match[1].split(/[?#]/u)[0];
|
|
84027
|
+
if (!href || /^(?:[a-z][a-z0-9+.-]*:|\/)/iu.test(href))
|
|
84028
|
+
continue;
|
|
84029
|
+
let decoded;
|
|
84030
|
+
try {
|
|
84031
|
+
decoded = decodeURIComponent(href);
|
|
84032
|
+
}
|
|
84033
|
+
catch {
|
|
84034
|
+
return fail('repository-path');
|
|
84035
|
+
}
|
|
84036
|
+
const parts = sddPath.split('/').slice(0, -1);
|
|
84037
|
+
for (const part of decoded.split('/')) {
|
|
84038
|
+
if (part === '..') {
|
|
84039
|
+
if (!parts.length)
|
|
84040
|
+
fail('repository-path');
|
|
84041
|
+
parts.pop();
|
|
84042
|
+
}
|
|
84043
|
+
else if (part !== '.')
|
|
84044
|
+
parts.push(part);
|
|
84045
|
+
}
|
|
84046
|
+
check(parts.join('/'));
|
|
84047
|
+
}
|
|
84048
|
+
for (const match of source.matchAll(/`([^`\n]+)`/gu)) {
|
|
84049
|
+
const value = match[1];
|
|
84050
|
+
if (value.includes('/') && !/^(?:[a-z][a-z0-9+.-]*:|\/)/iu.test(value) && !/\s/u.test(value))
|
|
84051
|
+
check(value.replace(/\/$/u, ''));
|
|
84052
|
+
}
|
|
84053
|
+
const prose = source.replace(/\]\([^\s)]+\)/gu, ']()').replace(/[a-z][a-z0-9+.-]*:\/\/[^\s)>]+/giu, '');
|
|
84054
|
+
for (const match of prose.matchAll(/(?<![\w./:-])([A-Za-z0-9_.-]+(?:\/[A-Za-z0-9_.-]+)+\.[A-Za-z0-9]+)(?![\w/-])/gu))
|
|
84055
|
+
check(match[1]);
|
|
84056
|
+
}
|
|
84057
|
+
|
|
84058
|
+
|
|
82840
84059
|
/***/ }),
|
|
82841
84060
|
|
|
82842
84061
|
/***/ 47122:
|
|
@@ -83020,6 +84239,20 @@ exports.DEFAULT_SETUP_RUNNERS = Object.freeze({
|
|
|
83020
84239
|
});
|
|
83021
84240
|
|
|
83022
84241
|
|
|
84242
|
+
/***/ }),
|
|
84243
|
+
|
|
84244
|
+
/***/ 33156:
|
|
84245
|
+
/***/ ((__unused_webpack_module, exports) => {
|
|
84246
|
+
|
|
84247
|
+
"use strict";
|
|
84248
|
+
|
|
84249
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
84250
|
+
exports.SETUP_VERIFICATION_ACTION_PARENTS = exports.SETUP_VERIFICATION_ACTION_PATH = void 0;
|
|
84251
|
+
/** Fixed consumer-owned asset: setup may create it, never regenerate or retire it. */
|
|
84252
|
+
exports.SETUP_VERIFICATION_ACTION_PATH = '.github/actions/copilot-verification-setup/action.yml';
|
|
84253
|
+
exports.SETUP_VERIFICATION_ACTION_PARENTS = ['.github', '.github/actions', '.github/actions/copilot-verification-setup'];
|
|
84254
|
+
|
|
84255
|
+
|
|
83023
84256
|
/***/ }),
|
|
83024
84257
|
|
|
83025
84258
|
/***/ 24596:
|
|
@@ -85846,12 +87079,14 @@ function createDeploymentOrchestrationUseCase(issueDescriptionQueryPort, publica
|
|
|
85846
87079
|
});
|
|
85847
87080
|
}
|
|
85848
87081
|
const copilot_history_port_factory_1 = __nccwpck_require__(12321);
|
|
85849
|
-
|
|
87082
|
+
const verification_setup_snapshot_1 = __nccwpck_require__(62148);
|
|
87083
|
+
const verification_setup_ports_1 = __nccwpck_require__(26509);
|
|
87084
|
+
function createIssueCommentUseCaseCompositionRoot(binding, setup = verification_setup_ports_1.DISABLED_VERIFICATION_SETUP) {
|
|
85850
87085
|
const bugbot = (0, bugbot_composition_root_1.createBugbotCompositionRoot)(binding);
|
|
85851
87086
|
const findings = (0, agent_capability_composition_root_1.createFindingsQueryPort)();
|
|
85852
87087
|
const language = (0, agent_capability_composition_root_1.createLanguageQueryPort)();
|
|
85853
87088
|
const fixer = (0, agent_capability_composition_root_1.createFixerQueryPort)();
|
|
85854
|
-
const gitCommit = new git_commit_adapter_1.GitCommitAdapter();
|
|
87089
|
+
const gitCommit = new git_commit_adapter_1.GitCommitAdapter(undefined, undefined, setup);
|
|
85855
87090
|
const authenticatedUser = (0, authenticated_user_composition_root_1.createAuthenticatedUserCompositionRoot)();
|
|
85856
87091
|
const bugbotGit = new bound_bugbot_git_mutation_adapter_1.BoundBugbotGitMutationAdapter(gitCommit, authenticatedUser, binding.token);
|
|
85857
87092
|
const pullRequestDescription = new update_pull_request_description_use_case_1.UpdatePullRequestDescriptionUseCase((0, lifecycle_capability_port_binding_1.bindPullRequestDescription)(new pull_request_lifecycle_repository_1.PullRequestLifecycleRepository((0, github_pull_request_client_factory_1.createPullRequestLifecycleClient)()), binding, new pull_request_changes_repository_1.PullRequestChangesRepository((0, github_pull_request_client_factory_1.createPullRequestChangesClient)())), (0, shared_capability_port_binding_1.bindIssueDescriptionQuery)((0, issue_content_composition_root_1.createIssueContentCompositionRoot)(), binding), (0, shared_capability_port_binding_1.bindOrganizationMembers)((0, organization_members_composition_root_1.createOrganizationMembersCompositionRoot)(), binding), (0, agent_capability_composition_root_1.createFindingsQueryPort)());
|
|
@@ -85862,12 +87097,12 @@ function createIssueCommentUseCaseCompositionRoot(binding) {
|
|
|
85862
87097
|
catalogResolver: new resolve_message_catalog_use_case_1.ResolveMessageCatalogUseCase(language),
|
|
85863
87098
|
}), new detect_potential_problems_use_case_1.DetectPotentialProblemsUseCase(findings, bugbot.scm, bugbot.telemetry, new resolve_message_catalog_use_case_1.ResolveMessageCatalogUseCase(language)), pullRequestDescription, new remember_bugbot_rule_use_case_1.RememberBugbotRuleUseCase(bugbot.rules), branchSync, (0, issue_use_case_composition_root_1.createIssueUseCaseCompositionRoot)(binding), rememberBranchPorts(binding, bugbot.scm.context), (0, pull_request_status_composition_root_1.createPullRequestStatusReadPorts)(binding, bugbot.scm.context), (0, copilot_history_port_factory_1.createCopilotHistoryReadPort)(bugbot.scm.context, process.env.GITHUB_SERVER_URL ?? 'https://github.com'), (0, sdd_evidence_composition_root_1.createSddEvidenceQueryPort)(binding, bugbot.scm.context), (0, sdd_diff_composition_root_1.createSddDiffQueryPort)(binding, bugbot.scm.context), (0, issue_completion_composition_root_2.createNativeStatusReadPort)(binding), (0, github_runtime_doctor_composition_root_1.createGithubRuntimeDoctorPorts)(binding, bugbot.scm.context));
|
|
85864
87099
|
}
|
|
85865
|
-
function createPullRequestReviewCommentUseCaseCompositionRoot(binding) {
|
|
87100
|
+
function createPullRequestReviewCommentUseCaseCompositionRoot(binding, setup = verification_setup_ports_1.DISABLED_VERIFICATION_SETUP) {
|
|
85866
87101
|
const bugbot = (0, bugbot_composition_root_1.createBugbotCompositionRoot)(binding);
|
|
85867
87102
|
const findings = (0, agent_capability_composition_root_1.createFindingsQueryPort)();
|
|
85868
87103
|
const language = (0, agent_capability_composition_root_1.createLanguageQueryPort)();
|
|
85869
87104
|
const fixer = (0, agent_capability_composition_root_1.createFixerQueryPort)();
|
|
85870
|
-
const gitCommit = new git_commit_adapter_1.GitCommitAdapter();
|
|
87105
|
+
const gitCommit = new git_commit_adapter_1.GitCommitAdapter(undefined, undefined, setup);
|
|
85871
87106
|
const authenticatedUser = (0, authenticated_user_composition_root_1.createAuthenticatedUserCompositionRoot)();
|
|
85872
87107
|
const bugbotGit = new bound_bugbot_git_mutation_adapter_1.BoundBugbotGitMutationAdapter(gitCommit, authenticatedUser, binding.token);
|
|
85873
87108
|
const pullRequestDescription = new update_pull_request_description_use_case_1.UpdatePullRequestDescriptionUseCase((0, lifecycle_capability_port_binding_1.bindPullRequestDescription)(new pull_request_lifecycle_repository_1.PullRequestLifecycleRepository((0, github_pull_request_client_factory_1.createPullRequestLifecycleClient)()), binding, new pull_request_changes_repository_1.PullRequestChangesRepository((0, github_pull_request_client_factory_1.createPullRequestChangesClient)())), (0, shared_capability_port_binding_1.bindIssueDescriptionQuery)((0, issue_content_composition_root_1.createIssueContentCompositionRoot)(), binding), (0, shared_capability_port_binding_1.bindOrganizationMembers)((0, organization_members_composition_root_1.createOrganizationMembersCompositionRoot)(), binding), (0, agent_capability_composition_root_1.createFindingsQueryPort)());
|
|
@@ -85894,7 +87129,7 @@ function createMainRunRouteCompositionRoot(projectBoardCommandPort, surface, set
|
|
|
85894
87129
|
return singleAction.invoke(execution);
|
|
85895
87130
|
},
|
|
85896
87131
|
"issue-comment": async (execution) => {
|
|
85897
|
-
issueComment ?? (issueComment = createIssueCommentUseCaseCompositionRoot(bugbotBinding(execution)));
|
|
87132
|
+
issueComment ?? (issueComment = createIssueCommentUseCaseCompositionRoot(bugbotBinding(execution), (0, verification_setup_snapshot_1.captureVerificationSetup)(execution.verificationSetup, execution.branches.main)));
|
|
85898
87133
|
return issueComment.invoke(execution);
|
|
85899
87134
|
},
|
|
85900
87135
|
issue: async (execution) => {
|
|
@@ -85902,7 +87137,7 @@ function createMainRunRouteCompositionRoot(projectBoardCommandPort, surface, set
|
|
|
85902
87137
|
return issue.invoke(execution);
|
|
85903
87138
|
},
|
|
85904
87139
|
"pull-request-review-comment": async (execution) => {
|
|
85905
|
-
pullRequestReviewComment ?? (pullRequestReviewComment = createPullRequestReviewCommentUseCaseCompositionRoot(bugbotBinding(execution)));
|
|
87140
|
+
pullRequestReviewComment ?? (pullRequestReviewComment = createPullRequestReviewCommentUseCaseCompositionRoot(bugbotBinding(execution), (0, verification_setup_snapshot_1.captureVerificationSetup)(execution.verificationSetup, execution.branches.main)));
|
|
85906
87141
|
return pullRequestReviewComment.invoke(execution);
|
|
85907
87142
|
},
|
|
85908
87143
|
"pull-request": async (execution) => {
|
|
@@ -86839,23 +88074,28 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
86839
88074
|
})();
|
|
86840
88075
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
86841
88076
|
exports.GitCommitAdapter = void 0;
|
|
88077
|
+
const verification_executable_1 = __nccwpck_require__(20878);
|
|
88078
|
+
const native_verification_profiles_1 = __nccwpck_require__(22290);
|
|
86842
88079
|
const exec = __importStar(__nccwpck_require__(18538));
|
|
86843
88080
|
const git_authentication_environment_1 = __nccwpck_require__(16535);
|
|
86844
88081
|
const untrusted_command_environment_1 = __nccwpck_require__(2304);
|
|
86845
88082
|
const git_hook_isolation_1 = __nccwpck_require__(39764);
|
|
86846
88083
|
const verification_runtime_preflight_1 = __nccwpck_require__(23100);
|
|
88084
|
+
const verification_setup_ports_1 = __nccwpck_require__(26509);
|
|
88085
|
+
const verification_setup_runner_1 = __nccwpck_require__(11709);
|
|
86847
88086
|
class GitCommitAdapter {
|
|
86848
88087
|
constructor(executeCommand = (program, args, options) => options
|
|
86849
|
-
? exec.exec(program, args, {
|
|
88088
|
+
? exec.exec(options.resolveFromEnvironment && options.env ? (0, verification_executable_1.verificationExecutable)(program, options.env) : program, args, {
|
|
86850
88089
|
// Captured Git reads can contain NUL-delimited records that
|
|
86851
88090
|
// hide subsequent lines in GitHub's Actions log viewer.
|
|
86852
88091
|
...(options.stdout ? { silent: true } : {}),
|
|
86853
88092
|
...(options.stdout ? { listeners: { stdout: options.stdout } } : {}),
|
|
86854
88093
|
...(options.env ? { env: options.env } : {}),
|
|
86855
88094
|
})
|
|
86856
|
-
: exec.exec(program, args), checkPrerequisites = verification_runtime_preflight_1.assertVerificationRuntimePrerequisites) {
|
|
88095
|
+
: exec.exec(program, args), checkPrerequisites = verification_runtime_preflight_1.assertVerificationRuntimePrerequisites, verificationSetup = verification_setup_ports_1.DISABLED_VERIFICATION_SETUP) {
|
|
86857
88096
|
this.executeCommand = executeCommand;
|
|
86858
88097
|
this.checkPrerequisites = checkPrerequisites;
|
|
88098
|
+
this.verificationSetup = verificationSetup;
|
|
86859
88099
|
}
|
|
86860
88100
|
async execute(program, args, options) {
|
|
86861
88101
|
if (options?.verifyRuntimePrerequisites && !options.untrusted)
|
|
@@ -86866,15 +88106,19 @@ class GitCommitAdapter {
|
|
|
86866
88106
|
throw new Error('Untrusted command execution does not accept a caller-supplied environment.');
|
|
86867
88107
|
const runtime = (0, untrusted_command_environment_1.prepareUntrustedCommandEnvironment)();
|
|
86868
88108
|
try {
|
|
86869
|
-
if (options.verifyRuntimePrerequisites)
|
|
88109
|
+
if (options.verifyRuntimePrerequisites) {
|
|
88110
|
+
await (0, verification_setup_runner_1.prepareRepositoryVerification)(this.verificationSetup, runtime.environment);
|
|
86870
88111
|
this.checkPrerequisites(runtime.environment);
|
|
88112
|
+
}
|
|
86871
88113
|
return await this.executeCommand(program, args, {
|
|
86872
88114
|
...(options.stdout ? { stdout: options.stdout } : {}),
|
|
86873
88115
|
env: runtime.environment,
|
|
88116
|
+
...(options.verifyRuntimePrerequisites && this.verificationSetup.kind === 'ready' ? { resolveFromEnvironment: true } : {}),
|
|
86874
88117
|
});
|
|
86875
88118
|
}
|
|
86876
88119
|
finally {
|
|
86877
|
-
runtime.
|
|
88120
|
+
if (!(0, native_verification_profiles_1.nativeVerificationRetainsProfile)(runtime.environment.HOME))
|
|
88121
|
+
runtime.cleanup();
|
|
86878
88122
|
}
|
|
86879
88123
|
}
|
|
86880
88124
|
async configureAuthor(name, email) {
|
|
@@ -87570,6 +88814,659 @@ class LoggerWorkflowPollingObserverAdapter {
|
|
|
87570
88814
|
exports.LoggerWorkflowPollingObserverAdapter = LoggerWorkflowPollingObserverAdapter;
|
|
87571
88815
|
|
|
87572
88816
|
|
|
88817
|
+
/***/ }),
|
|
88818
|
+
|
|
88819
|
+
/***/ 18883:
|
|
88820
|
+
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
88821
|
+
|
|
88822
|
+
"use strict";
|
|
88823
|
+
|
|
88824
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
88825
|
+
exports.verificationCandidateIdentity = verificationCandidateIdentity;
|
|
88826
|
+
const node_child_process_1 = __nccwpck_require__(17718);
|
|
88827
|
+
const node_crypto_1 = __nccwpck_require__(6005);
|
|
88828
|
+
const node_fs_1 = __nccwpck_require__(87561);
|
|
88829
|
+
const node_path_1 = __nccwpck_require__(49411);
|
|
88830
|
+
const verification_setup_policy_1 = __nccwpck_require__(65326);
|
|
88831
|
+
/** Bind setup to the exact HEAD, branch, index, tracked edits and publishable untracked files. */
|
|
88832
|
+
function verificationCandidateIdentity(workspace, environment) {
|
|
88833
|
+
const hash = (0, node_crypto_1.createHash)('sha256');
|
|
88834
|
+
const git = (...args) => {
|
|
88835
|
+
const result = (0, node_child_process_1.spawnSync)('git', ['--no-replace-objects', ...args], { cwd: workspace, env: environment, shell: false,
|
|
88836
|
+
windowsHide: true, timeout: 10000, maxBuffer: 16 * 1024 * 1024 });
|
|
88837
|
+
if (result.error || result.status !== 0)
|
|
88838
|
+
throw new verification_setup_policy_1.VerificationSetupError('candidate-changed');
|
|
88839
|
+
hash.update(result.stdout).update('\0');
|
|
88840
|
+
return result.stdout;
|
|
88841
|
+
};
|
|
88842
|
+
git('rev-parse', '--verify', 'HEAD');
|
|
88843
|
+
git('rev-parse', '--symbolic-full-name', 'HEAD');
|
|
88844
|
+
git('ls-files', '--stage', '-z');
|
|
88845
|
+
git('diff', '--no-ext-diff', '--no-textconv', '--binary', 'HEAD', '--');
|
|
88846
|
+
const paths = git('ls-files', '--others', '--exclude-standard', '-z').toString('utf8').split('\0').filter(Boolean);
|
|
88847
|
+
let total = 0;
|
|
88848
|
+
if (paths.length > 256)
|
|
88849
|
+
throw new verification_setup_policy_1.VerificationSetupError('candidate-changed');
|
|
88850
|
+
for (const path of paths) {
|
|
88851
|
+
const file = (0, node_path_1.join)(workspace, path);
|
|
88852
|
+
const stat = (0, node_fs_1.lstatSync)(file);
|
|
88853
|
+
total += stat.size;
|
|
88854
|
+
if (total > 16 * 1024 * 1024)
|
|
88855
|
+
throw new verification_setup_policy_1.VerificationSetupError('candidate-changed');
|
|
88856
|
+
hash.update(path).update('\0');
|
|
88857
|
+
if (stat.isSymbolicLink())
|
|
88858
|
+
hash.update('120000\0').update((0, node_fs_1.readlinkSync)(file));
|
|
88859
|
+
else if (stat.isFile())
|
|
88860
|
+
hash.update(stat.mode & 0o100 ? '100755\0' : '100644\0').update((0, node_fs_1.readFileSync)(file));
|
|
88861
|
+
else
|
|
88862
|
+
throw new verification_setup_policy_1.VerificationSetupError('candidate-changed');
|
|
88863
|
+
hash.update('\0');
|
|
88864
|
+
}
|
|
88865
|
+
return hash.digest('hex');
|
|
88866
|
+
}
|
|
88867
|
+
|
|
88868
|
+
|
|
88869
|
+
/***/ }),
|
|
88870
|
+
|
|
88871
|
+
/***/ 71046:
|
|
88872
|
+
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
|
|
88873
|
+
|
|
88874
|
+
"use strict";
|
|
88875
|
+
|
|
88876
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
88877
|
+
if (k2 === undefined) k2 = k;
|
|
88878
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
88879
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
88880
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
88881
|
+
}
|
|
88882
|
+
Object.defineProperty(o, k2, desc);
|
|
88883
|
+
}) : (function(o, m, k, k2) {
|
|
88884
|
+
if (k2 === undefined) k2 = k;
|
|
88885
|
+
o[k2] = m[k];
|
|
88886
|
+
}));
|
|
88887
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
88888
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
88889
|
+
}) : function(o, v) {
|
|
88890
|
+
o["default"] = v;
|
|
88891
|
+
});
|
|
88892
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
88893
|
+
var ownKeys = function(o) {
|
|
88894
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
88895
|
+
var ar = [];
|
|
88896
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
88897
|
+
return ar;
|
|
88898
|
+
};
|
|
88899
|
+
return ownKeys(o);
|
|
88900
|
+
};
|
|
88901
|
+
return function (mod) {
|
|
88902
|
+
if (mod && mod.__esModule) return mod;
|
|
88903
|
+
var result = {};
|
|
88904
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
88905
|
+
__setModuleDefault(result, mod);
|
|
88906
|
+
return result;
|
|
88907
|
+
};
|
|
88908
|
+
})();
|
|
88909
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
88910
|
+
exports.drainNativeWorkerLog = drainNativeWorkerLog;
|
|
88911
|
+
exports.awaitNativeBoundary = awaitNativeBoundary;
|
|
88912
|
+
exports.continueNativeVerification = continueNativeVerification;
|
|
88913
|
+
exports.cleanupNativeVerification = cleanupNativeVerification;
|
|
88914
|
+
exports.runNativeVerificationEntry = runNativeVerificationEntry;
|
|
88915
|
+
const native_verification_source_runtime_1 = __nccwpck_require__(85290);
|
|
88916
|
+
const verification_executable_1 = __nccwpck_require__(20878);
|
|
88917
|
+
const native_verification_redaction_1 = __nccwpck_require__(27632);
|
|
88918
|
+
const native_verification_profiles_1 = __nccwpck_require__(22290);
|
|
88919
|
+
const core = __importStar(__nccwpck_require__(75855));
|
|
88920
|
+
const node_child_process_1 = __nccwpck_require__(17718);
|
|
88921
|
+
const node_fs_1 = __nccwpck_require__(87561);
|
|
88922
|
+
const node_path_1 = __nccwpck_require__(49411);
|
|
88923
|
+
const agent_private_install_root_1 = __nccwpck_require__(44640);
|
|
88924
|
+
const agent_trusted_system_tools_1 = __nccwpck_require__(76049);
|
|
88925
|
+
const github_action_input_1 = __nccwpck_require__(57581);
|
|
88926
|
+
const verification_setup_policy_1 = __nccwpck_require__(65326);
|
|
88927
|
+
const native_verification_protocol_1 = __nccwpck_require__(88709);
|
|
88928
|
+
const native_verification_staging_1 = __nccwpck_require__(63587);
|
|
88929
|
+
const verification_setup_snapshot_1 = __nccwpck_require__(62148);
|
|
88930
|
+
function emitWorkerOutput(root) {
|
|
88931
|
+
const file = (0, node_path_1.join)(root, 'worker-output');
|
|
88932
|
+
if (process.env.GITHUB_OUTPUT && (0, node_fs_1.existsSync)(file))
|
|
88933
|
+
(0, node_fs_1.appendFileSync)(process.env.GITHUB_OUTPUT, requireRead(file));
|
|
88934
|
+
const summary = (0, node_path_1.join)(root, 'worker-summary');
|
|
88935
|
+
if (process.env.GITHUB_STEP_SUMMARY && (0, node_fs_1.existsSync)(summary) && !(0, native_verification_protocol_1.readNativeRecord)(root, 'summary-emitted.json')) {
|
|
88936
|
+
(0, node_fs_1.appendFileSync)(process.env.GITHUB_STEP_SUMMARY, requireRead(summary, 1048576));
|
|
88937
|
+
(0, native_verification_protocol_1.writeNativeRecord)(root, 'summary-emitted.json', { emitted: true });
|
|
88938
|
+
}
|
|
88939
|
+
}
|
|
88940
|
+
function requireRead(file, limit = 262144) {
|
|
88941
|
+
const fd = (0, node_fs_1.openSync)(file, 'r');
|
|
88942
|
+
try {
|
|
88943
|
+
const size = (0, node_fs_1.statSync)(file).size;
|
|
88944
|
+
if (size > limit)
|
|
88945
|
+
throw new verification_setup_policy_1.VerificationSetupError('output-limit');
|
|
88946
|
+
const data = Buffer.alloc(size);
|
|
88947
|
+
(0, node_fs_1.readSync)(fd, data, 0, data.length, 0);
|
|
88948
|
+
return data;
|
|
88949
|
+
}
|
|
88950
|
+
finally {
|
|
88951
|
+
(0, node_fs_1.closeSync)(fd);
|
|
88952
|
+
}
|
|
88953
|
+
}
|
|
88954
|
+
/** Drain complete lines so runner masking and workflow commands keep their native framing. */
|
|
88955
|
+
function drainNativeWorkerLog(root, flush = false) {
|
|
88956
|
+
const file = (0, node_path_1.join)(root, 'worker-log');
|
|
88957
|
+
if (!(0, node_fs_1.existsSync)(file))
|
|
88958
|
+
return;
|
|
88959
|
+
const cursor = (0, native_verification_protocol_1.readNativeRecord)(root, 'log-cursor.json')?.offset ?? 0;
|
|
88960
|
+
const fd = (0, node_fs_1.openSync)(file, 'r');
|
|
88961
|
+
let offset = cursor;
|
|
88962
|
+
try {
|
|
88963
|
+
const buffer = Buffer.alloc(65536);
|
|
88964
|
+
let pending = Buffer.alloc(0);
|
|
88965
|
+
let size;
|
|
88966
|
+
while ((size = (0, node_fs_1.readSync)(fd, buffer, 0, buffer.length, offset + pending.length))) {
|
|
88967
|
+
pending = Buffer.concat([pending, buffer.subarray(0, size)]);
|
|
88968
|
+
const lastLine = pending.lastIndexOf(10);
|
|
88969
|
+
if (lastLine >= 0) {
|
|
88970
|
+
const complete = pending.subarray(0, lastLine + 1);
|
|
88971
|
+
process.stdout.write(complete);
|
|
88972
|
+
offset += complete.length;
|
|
88973
|
+
pending = pending.subarray(lastLine + 1);
|
|
88974
|
+
}
|
|
88975
|
+
// Existing action logs may contain long lines; retain framing without unbounded buffering.
|
|
88976
|
+
if (pending.length > 1048576)
|
|
88977
|
+
throw new verification_setup_policy_1.VerificationSetupError('output-limit');
|
|
88978
|
+
}
|
|
88979
|
+
if (flush && pending.length) {
|
|
88980
|
+
process.stdout.write(pending);
|
|
88981
|
+
offset += pending.length;
|
|
88982
|
+
}
|
|
88983
|
+
(0, native_verification_protocol_1.writeNativeRecord)(root, 'log-cursor.json', { offset });
|
|
88984
|
+
}
|
|
88985
|
+
finally {
|
|
88986
|
+
(0, node_fs_1.closeSync)(fd);
|
|
88987
|
+
}
|
|
88988
|
+
}
|
|
88989
|
+
async function awaitNativeBoundary(root, timeoutMs = 7200000) {
|
|
88990
|
+
const deadline = Date.now() + timeoutMs;
|
|
88991
|
+
while (true) {
|
|
88992
|
+
drainNativeWorkerLog(root);
|
|
88993
|
+
const done = (0, native_verification_protocol_1.readNativeRecord)(root, 'done.json');
|
|
88994
|
+
if (done) {
|
|
88995
|
+
drainNativeWorkerLog(root, true);
|
|
88996
|
+
emitWorkerOutput(root);
|
|
88997
|
+
core.setOutput('verification-setup-pending', 'false');
|
|
88998
|
+
if (done.exitCode !== 0)
|
|
88999
|
+
core.setFailed('Copilot execution failed; inspect the preceding operation result.');
|
|
89000
|
+
return;
|
|
89001
|
+
}
|
|
89002
|
+
const request = (0, native_verification_protocol_1.readNativeRecord)(root, 'request.json', 32768);
|
|
89003
|
+
if (request) {
|
|
89004
|
+
if (!/^[a-f0-9-]{36}$/u.test(request.id) || !/^(?:[a-f0-9]{40}|[a-f0-9]{64})$/u.test(request.sourceSha)
|
|
89005
|
+
|| !/^[a-f0-9]{64}$/u.test(request.digest) || !request.environment || typeof request.environment.HOME !== 'string')
|
|
89006
|
+
throw new verification_setup_policy_1.VerificationSetupError('handoff-invalid');
|
|
89007
|
+
core.setOutput('verification-request', request.id);
|
|
89008
|
+
core.setOutput('verification-source', request.sourceSha);
|
|
89009
|
+
core.setOutput('verification-digest', request.digest);
|
|
89010
|
+
core.saveState('native-verification-digest', request.digest);
|
|
89011
|
+
core.saveState('native-verification-source', request.sourceSha);
|
|
89012
|
+
for (const key of ['HOME', 'USERPROFILE', 'APPDATA', 'LOCALAPPDATA', 'PATH', 'JAVA_HOME', 'TMP', 'TEMP', 'TMPDIR']) {
|
|
89013
|
+
const value = request.environment[key] ?? '';
|
|
89014
|
+
if (typeof value !== 'string' || /[\r\n\0]/u.test(value))
|
|
89015
|
+
throw new verification_setup_policy_1.VerificationSetupError('handoff-invalid');
|
|
89016
|
+
core.setOutput(`verification-${key.toLowerCase()}`, value);
|
|
89017
|
+
}
|
|
89018
|
+
core.setOutput('verification-setup-pending', 'true');
|
|
89019
|
+
return;
|
|
89020
|
+
}
|
|
89021
|
+
if (Date.now() >= deadline)
|
|
89022
|
+
throw new verification_setup_policy_1.VerificationSetupError('timeout');
|
|
89023
|
+
const session = (0, native_verification_protocol_1.nativeSession)(root);
|
|
89024
|
+
try {
|
|
89025
|
+
process.kill(session.pid, 0);
|
|
89026
|
+
}
|
|
89027
|
+
catch {
|
|
89028
|
+
throw new verification_setup_policy_1.VerificationSetupError('process-failed');
|
|
89029
|
+
}
|
|
89030
|
+
await (0, native_verification_protocol_1.nativePause)(100);
|
|
89031
|
+
}
|
|
89032
|
+
}
|
|
89033
|
+
async function continueNativeVerification(root, id, outcome, environment = process.env) {
|
|
89034
|
+
(0, native_verification_protocol_1.nativeSession)(root);
|
|
89035
|
+
const request = (0, native_verification_protocol_1.readNativeRecord)(root, 'request.json', 32768);
|
|
89036
|
+
if (!request || request.id !== id || !/^[a-f0-9-]{36}$/u.test(id)
|
|
89037
|
+
|| (0, node_fs_1.existsSync)((0, node_path_1.join)(root, `response-${id}.json`)))
|
|
89038
|
+
throw new verification_setup_policy_1.VerificationSetupError('handoff-invalid');
|
|
89039
|
+
const response = { id, success: outcome === 'success', path: environment.PATH ?? '',
|
|
89040
|
+
...(environment.JAVA_HOME ? { javaHome: environment.JAVA_HOME } : {}) };
|
|
89041
|
+
(0, node_fs_1.rmSync)((0, node_path_1.join)(root, 'request.json'));
|
|
89042
|
+
(0, native_verification_protocol_1.writeNativeRecord)(root, `response-${id}.json`, response);
|
|
89043
|
+
await awaitNativeBoundary(root);
|
|
89044
|
+
}
|
|
89045
|
+
async function cleanupNativeVerification(root, waitMs = 10000, deferProfileCleanup = false) {
|
|
89046
|
+
if (!(0, node_fs_1.existsSync)(root))
|
|
89047
|
+
return;
|
|
89048
|
+
const session = (0, native_verification_protocol_1.nativeSession)(root);
|
|
89049
|
+
if (!(0, native_verification_protocol_1.readNativeRecord)(root, 'done.json')) {
|
|
89050
|
+
(0, native_verification_protocol_1.writeNativeRecord)(root, 'cancel.json', { cancelled: true });
|
|
89051
|
+
const deadline = Date.now() + waitMs;
|
|
89052
|
+
while (!(0, native_verification_protocol_1.readNativeRecord)(root, 'done.json') && Date.now() < deadline)
|
|
89053
|
+
await (0, native_verification_protocol_1.nativePause)(100);
|
|
89054
|
+
if (!(0, native_verification_protocol_1.readNativeRecord)(root, 'done.json')) {
|
|
89055
|
+
try {
|
|
89056
|
+
if (process.platform === 'win32')
|
|
89057
|
+
(0, node_child_process_1.spawnSync)((0, agent_trusted_system_tools_1.trustedWindowsSystemTool)('taskkill.exe'), ['/PID', String(session.pid), '/T', '/F'], { windowsHide: true, shell: false, timeout: 5000, stdio: 'ignore' });
|
|
89058
|
+
else
|
|
89059
|
+
process.kill(-session.pid, 'SIGKILL');
|
|
89060
|
+
}
|
|
89061
|
+
catch { /* Worker may have exited while cancellation completed. */ }
|
|
89062
|
+
}
|
|
89063
|
+
}
|
|
89064
|
+
if (!deferProfileCleanup)
|
|
89065
|
+
(0, native_verification_staging_1.cleanupNativeVerificationAction)(root, session.workspace);
|
|
89066
|
+
drainNativeWorkerLog(root, true);
|
|
89067
|
+
if (!deferProfileCleanup) {
|
|
89068
|
+
(0, native_verification_profiles_1.removeNativeVerificationProfiles)(root);
|
|
89069
|
+
(0, node_fs_1.rmSync)(root, { recursive: true, force: true });
|
|
89070
|
+
}
|
|
89071
|
+
}
|
|
89072
|
+
async function startNativeVerification() {
|
|
89073
|
+
for (const secret of (0, native_verification_redaction_1.nativeWorkerSecrets)(process.env))
|
|
89074
|
+
core.setSecret(secret);
|
|
89075
|
+
const git = (0, verification_executable_1.verificationExecutable)('git', { PATH: process.env.PATH ?? '', PATHEXT: process.env.PATHEXT ?? '.EXE;.CMD;.BAT;.COM' });
|
|
89076
|
+
core.saveState('native-verification-git', git);
|
|
89077
|
+
core.setOutput('verification-git', git);
|
|
89078
|
+
const root = (0, node_fs_1.realpathSync)((0, agent_private_install_root_1.createPrivateVerificationRuntimeRoot)());
|
|
89079
|
+
for (const name of ['worker-output', 'worker-env', 'worker-path', 'worker-log', 'worker-summary'])
|
|
89080
|
+
(0, node_fs_1.writeFileSync)((0, node_path_1.join)(root, name), '', { flag: 'wx', mode: 0o600 });
|
|
89081
|
+
const log = (0, node_fs_1.openSync)((0, node_path_1.join)(root, 'worker-log'), 'a');
|
|
89082
|
+
try {
|
|
89083
|
+
const worker = (0, node_child_process_1.spawn)(process.execPath, [process.argv[1]], { cwd: process.cwd(), detached: true, windowsHide: true,
|
|
89084
|
+
stdio: ['ignore', log, log], env: { ...process.env, COPILOT_NATIVE_PHASE: '', COPILOT_NATIVE_WORKER_SESSION: root,
|
|
89085
|
+
GITHUB_STEP_SUMMARY: (0, node_path_1.join)(root, 'worker-summary'), GITHUB_OUTPUT: (0, node_path_1.join)(root, 'worker-output'), GITHUB_ENV: (0, node_path_1.join)(root, 'worker-env'), GITHUB_PATH: (0, node_path_1.join)(root, 'worker-path') } });
|
|
89086
|
+
await new Promise((resolve, reject) => { worker.once('spawn', resolve); worker.once('error', reject); });
|
|
89087
|
+
worker.unref();
|
|
89088
|
+
(0, native_verification_protocol_1.writeNativeRecord)(root, 'session.json', { schemaVersion: 1, workspace: (0, node_fs_1.realpathSync)(process.cwd()), run: process.env.GITHUB_RUN_ID ?? '',
|
|
89089
|
+
attempt: process.env.GITHUB_RUN_ATTEMPT ?? '', job: process.env.GITHUB_JOB ?? '', pid: worker.pid });
|
|
89090
|
+
core.saveState('native-verification-ticket', root);
|
|
89091
|
+
core.saveState('native-verification-owner', 'true');
|
|
89092
|
+
core.setOutput('verification-ticket', root);
|
|
89093
|
+
await awaitNativeBoundary(root);
|
|
89094
|
+
}
|
|
89095
|
+
catch (error) {
|
|
89096
|
+
if ((0, node_fs_1.existsSync)((0, node_path_1.join)(root, 'session.json')))
|
|
89097
|
+
await cleanupNativeVerification(root);
|
|
89098
|
+
else
|
|
89099
|
+
(0, node_fs_1.rmSync)(root, { recursive: true, force: true });
|
|
89100
|
+
throw error;
|
|
89101
|
+
}
|
|
89102
|
+
finally {
|
|
89103
|
+
(0, node_fs_1.closeSync)(log);
|
|
89104
|
+
}
|
|
89105
|
+
}
|
|
89106
|
+
/** Native phases are runner-only control messages; no credentials or agent operations are replayed. */
|
|
89107
|
+
async function runNativeVerificationEntry(run) {
|
|
89108
|
+
const post = core.getState('copilot-native-post');
|
|
89109
|
+
if (post === 'true') {
|
|
89110
|
+
const root = core.getState('native-verification-ticket');
|
|
89111
|
+
if (root && core.getState('native-verification-owner') === 'true')
|
|
89112
|
+
await cleanupNativeVerification(root);
|
|
89113
|
+
else if (root && (0, node_fs_1.existsSync)(root) && core.getState('native-verification-source')) {
|
|
89114
|
+
const session = (0, native_verification_protocol_1.nativeSession)(root);
|
|
89115
|
+
try {
|
|
89116
|
+
const snapshot = (0, verification_setup_snapshot_1.captureVerificationSetupAtCommit)(core.getState('native-verification-source'), session.workspace, core.getState('native-verification-git'));
|
|
89117
|
+
if (snapshot.kind !== 'ready' || (0, verification_setup_snapshot_1.verificationSetupDigest)(snapshot) !== core.getState('native-verification-digest'))
|
|
89118
|
+
throw new verification_setup_policy_1.VerificationSetupError('helper-invalid');
|
|
89119
|
+
(0, native_verification_staging_1.stageNativeVerificationAction)(snapshot, root);
|
|
89120
|
+
}
|
|
89121
|
+
catch {
|
|
89122
|
+
// A later native post must fail to load rather than execute candidate-modified metadata.
|
|
89123
|
+
(0, native_verification_staging_1.cleanupNativeVerificationAction)(root, session.workspace);
|
|
89124
|
+
throw new verification_setup_policy_1.VerificationSetupError('helper-invalid');
|
|
89125
|
+
}
|
|
89126
|
+
}
|
|
89127
|
+
const sourceRuntime = core.getState('native-source-runtime');
|
|
89128
|
+
if (sourceRuntime)
|
|
89129
|
+
(0, native_verification_source_runtime_1.cleanupNativeSourceRuntime)(sourceRuntime, (0, node_fs_1.realpathSync)(process.cwd()));
|
|
89130
|
+
return;
|
|
89131
|
+
}
|
|
89132
|
+
core.saveState('copilot-native-post', 'true');
|
|
89133
|
+
if (process.env.COPILOT_NATIVE_PHASE === 'prepare' && process.env.COPILOT_NATIVE_RUNTIME_CACHE)
|
|
89134
|
+
core.saveState('native-source-runtime', process.env.COPILOT_NATIVE_RUNTIME_CACHE);
|
|
89135
|
+
const worker = process.env.COPILOT_NATIVE_WORKER_SESSION;
|
|
89136
|
+
if (worker) {
|
|
89137
|
+
const deadline = Date.now() + 30000;
|
|
89138
|
+
while (!(0, native_verification_protocol_1.readNativeRecord)(worker, 'session.json')) {
|
|
89139
|
+
if (Date.now() >= deadline)
|
|
89140
|
+
throw new verification_setup_policy_1.VerificationSetupError('timeout');
|
|
89141
|
+
await (0, native_verification_protocol_1.nativePause)(10);
|
|
89142
|
+
}
|
|
89143
|
+
if ((0, native_verification_protocol_1.nativeSession)(worker).pid !== process.pid)
|
|
89144
|
+
throw new verification_setup_policy_1.VerificationSetupError('handoff-invalid');
|
|
89145
|
+
const restoreLog = (0, native_verification_redaction_1.redactNativeWorkerLogs)();
|
|
89146
|
+
try {
|
|
89147
|
+
await run();
|
|
89148
|
+
}
|
|
89149
|
+
finally {
|
|
89150
|
+
restoreLog();
|
|
89151
|
+
(0, native_verification_protocol_1.writeNativeRecord)(worker, 'done.json', { exitCode: Number(process.exitCode ?? 0) });
|
|
89152
|
+
}
|
|
89153
|
+
return;
|
|
89154
|
+
}
|
|
89155
|
+
const phase = process.env.COPILOT_NATIVE_PHASE;
|
|
89156
|
+
if (!phase || phase === 'prepare' && (0, github_action_input_1.getGithubActionInput)('verification-setup') !== 'true') {
|
|
89157
|
+
await run();
|
|
89158
|
+
return;
|
|
89159
|
+
}
|
|
89160
|
+
if (process.env.GITHUB_ACTIONS !== 'true')
|
|
89161
|
+
throw new verification_setup_policy_1.VerificationSetupError('native-workflow-required');
|
|
89162
|
+
if (phase === 'prepare') {
|
|
89163
|
+
await startNativeVerification();
|
|
89164
|
+
return;
|
|
89165
|
+
}
|
|
89166
|
+
const root = process.env.COPILOT_NATIVE_TICKET;
|
|
89167
|
+
if (!root)
|
|
89168
|
+
throw new verification_setup_policy_1.VerificationSetupError('handoff-invalid');
|
|
89169
|
+
(0, native_verification_protocol_1.nativeSession)(root);
|
|
89170
|
+
core.saveState('native-verification-ticket', root);
|
|
89171
|
+
core.saveState('native-verification-source', process.env.COPILOT_NATIVE_SOURCE ?? '');
|
|
89172
|
+
core.saveState('native-verification-digest', process.env.COPILOT_NATIVE_DIGEST ?? '');
|
|
89173
|
+
core.saveState('native-verification-git', process.env.COPILOT_NATIVE_GIT ?? '');
|
|
89174
|
+
if (phase === 'continue') {
|
|
89175
|
+
await continueNativeVerification(root, process.env.COPILOT_NATIVE_REQUEST ?? '', process.env.COPILOT_NATIVE_OUTCOME ?? '');
|
|
89176
|
+
return;
|
|
89177
|
+
}
|
|
89178
|
+
if (phase === 'finish') {
|
|
89179
|
+
(0, native_verification_protocol_1.nativeSession)(root);
|
|
89180
|
+
const done = (0, native_verification_protocol_1.readNativeRecord)(root, 'done.json');
|
|
89181
|
+
if (done) {
|
|
89182
|
+
emitWorkerOutput(root);
|
|
89183
|
+
if (done.exitCode !== 0)
|
|
89184
|
+
core.setFailed('Copilot execution failed.');
|
|
89185
|
+
}
|
|
89186
|
+
else
|
|
89187
|
+
core.setFailed(`Repository setup did not complete within ${verification_setup_policy_1.VERIFICATION_SETUP_LIMITS.requests} native verification boundaries. Pending verification and subsequent publication are blocked; inspect earlier operation results for completed effects.`);
|
|
89188
|
+
await cleanupNativeVerification(root, 10000, true);
|
|
89189
|
+
return;
|
|
89190
|
+
}
|
|
89191
|
+
throw new verification_setup_policy_1.VerificationSetupError('handoff-invalid');
|
|
89192
|
+
}
|
|
89193
|
+
|
|
89194
|
+
|
|
89195
|
+
/***/ }),
|
|
89196
|
+
|
|
89197
|
+
/***/ 22290:
|
|
89198
|
+
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
89199
|
+
|
|
89200
|
+
"use strict";
|
|
89201
|
+
|
|
89202
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
89203
|
+
exports.nativeVerificationProfilePaths = nativeVerificationProfilePaths;
|
|
89204
|
+
exports.registerNativeVerificationProfile = registerNativeVerificationProfile;
|
|
89205
|
+
exports.nativeVerificationRetainsProfile = nativeVerificationRetainsProfile;
|
|
89206
|
+
exports.removeNativeVerificationProfiles = removeNativeVerificationProfiles;
|
|
89207
|
+
const node_crypto_1 = __nccwpck_require__(6005);
|
|
89208
|
+
const node_fs_1 = __nccwpck_require__(87561);
|
|
89209
|
+
const node_path_1 = __nccwpck_require__(49411);
|
|
89210
|
+
const verification_setup_policy_1 = __nccwpck_require__(65326);
|
|
89211
|
+
const native_verification_protocol_1 = __nccwpck_require__(88709);
|
|
89212
|
+
function nativeVerificationProfilePaths(root) {
|
|
89213
|
+
const stored = (0, native_verification_protocol_1.readNativeRecord)(root, 'profiles.json', 65536);
|
|
89214
|
+
const paths = stored === undefined ? [] : stored;
|
|
89215
|
+
if (!Array.isArray(paths) || paths.length > 20 || new Set(paths).size !== paths.length || paths.some(path => typeof path !== 'string'
|
|
89216
|
+
|| (0, node_path_1.dirname)(path) !== (0, node_path_1.dirname)(root) || !/^copilot-verify-runtime-[A-Za-z0-9]+$/u.test((0, node_path_1.basename)(path)) || path === root))
|
|
89217
|
+
throw new verification_setup_policy_1.VerificationSetupError('handoff-invalid');
|
|
89218
|
+
return paths;
|
|
89219
|
+
}
|
|
89220
|
+
/** Native actions may have post steps. Preserve dependency-only profiles until those steps finish. */
|
|
89221
|
+
function registerNativeVerificationProfile(root, profile) {
|
|
89222
|
+
const previous = nativeVerificationProfilePaths(root);
|
|
89223
|
+
if (previous.length >= 20 || previous.includes(profile) || (0, node_path_1.dirname)(profile) !== (0, node_path_1.dirname)(root)
|
|
89224
|
+
|| profile === root || !/^copilot-verify-runtime-[A-Za-z0-9]+$/u.test((0, node_path_1.basename)(profile))
|
|
89225
|
+
|| (0, node_fs_1.realpathSync)(profile) !== profile || !(0, node_fs_1.lstatSync)(profile).isDirectory() || (0, node_fs_1.lstatSync)(profile).isSymbolicLink())
|
|
89226
|
+
throw new verification_setup_policy_1.VerificationSetupError('handoff-invalid');
|
|
89227
|
+
(0, node_fs_1.writeFileSync)((0, node_path_1.join)(profile, 'native-session-owner'), (0, node_crypto_1.createHash)('sha256').update(root).digest('hex'), { mode: 0o600, flag: 'wx' });
|
|
89228
|
+
(0, native_verification_protocol_1.writeNativeRecord)(root, 'profiles.json', [...previous, profile]);
|
|
89229
|
+
}
|
|
89230
|
+
function nativeVerificationRetainsProfile(profile) {
|
|
89231
|
+
const root = process.env.COPILOT_NATIVE_WORKER_SESSION;
|
|
89232
|
+
return !!root && nativeVerificationProfilePaths(root).includes(profile);
|
|
89233
|
+
}
|
|
89234
|
+
function removeNativeVerificationProfiles(root) {
|
|
89235
|
+
for (const path of nativeVerificationProfilePaths(root)) {
|
|
89236
|
+
let stat;
|
|
89237
|
+
try {
|
|
89238
|
+
stat = (0, node_fs_1.lstatSync)(path);
|
|
89239
|
+
}
|
|
89240
|
+
catch (error) {
|
|
89241
|
+
if (error.code === 'ENOENT')
|
|
89242
|
+
continue;
|
|
89243
|
+
throw error;
|
|
89244
|
+
}
|
|
89245
|
+
if (!stat.isDirectory() || stat.isSymbolicLink() || (0, node_fs_1.realpathSync)(path) !== path || (0, node_fs_1.readFileSync)((0, node_path_1.join)(path, 'native-session-owner'), 'utf8') !== (0, node_crypto_1.createHash)('sha256').update(root).digest('hex'))
|
|
89246
|
+
throw new verification_setup_policy_1.VerificationSetupError('handoff-invalid');
|
|
89247
|
+
(0, node_fs_1.rmSync)(path, { recursive: true, force: true });
|
|
89248
|
+
}
|
|
89249
|
+
}
|
|
89250
|
+
|
|
89251
|
+
|
|
89252
|
+
/***/ }),
|
|
89253
|
+
|
|
89254
|
+
/***/ 88709:
|
|
89255
|
+
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
89256
|
+
|
|
89257
|
+
"use strict";
|
|
89258
|
+
|
|
89259
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
89260
|
+
exports.nativePause = void 0;
|
|
89261
|
+
exports.writeNativeRecord = writeNativeRecord;
|
|
89262
|
+
exports.readNativeRecord = readNativeRecord;
|
|
89263
|
+
exports.nativeSession = nativeSession;
|
|
89264
|
+
const node_fs_1 = __nccwpck_require__(87561);
|
|
89265
|
+
const node_path_1 = __nccwpck_require__(49411);
|
|
89266
|
+
const node_crypto_1 = __nccwpck_require__(6005);
|
|
89267
|
+
const verification_setup_policy_1 = __nccwpck_require__(65326);
|
|
89268
|
+
function writeNativeRecord(root, name, value) {
|
|
89269
|
+
const temporary = (0, node_path_1.join)(root, `${(0, node_crypto_1.randomUUID)()}.tmp`);
|
|
89270
|
+
(0, node_fs_1.writeFileSync)(temporary, JSON.stringify(value), { mode: 0o600, flag: 'wx' });
|
|
89271
|
+
(0, node_fs_1.renameSync)(temporary, (0, node_path_1.join)(root, name));
|
|
89272
|
+
}
|
|
89273
|
+
function readNativeRecord(root, name, limit = 16384) {
|
|
89274
|
+
const file = (0, node_path_1.join)(root, name);
|
|
89275
|
+
let descriptor;
|
|
89276
|
+
try {
|
|
89277
|
+
const before = (0, node_fs_1.lstatSync)(file, { bigint: true });
|
|
89278
|
+
if (!before.isFile() || before.isSymbolicLink() || before.nlink !== 1n || before.size > BigInt(limit))
|
|
89279
|
+
throw new Error();
|
|
89280
|
+
descriptor = (0, node_fs_1.openSync)(file, node_fs_1.constants.O_RDONLY | (node_fs_1.constants.O_NOFOLLOW ?? 0));
|
|
89281
|
+
const after = (0, node_fs_1.fstatSync)(descriptor, { bigint: true });
|
|
89282
|
+
if (after.dev !== before.dev || after.ino !== before.ino || after.size !== before.size || after.mtimeNs !== before.mtimeNs)
|
|
89283
|
+
throw new Error();
|
|
89284
|
+
const data = (0, node_fs_1.readFileSync)(descriptor);
|
|
89285
|
+
const final = (0, node_fs_1.fstatSync)(descriptor, { bigint: true });
|
|
89286
|
+
if (data.length > limit || final.size !== after.size || final.mtimeNs !== after.mtimeNs)
|
|
89287
|
+
throw new Error();
|
|
89288
|
+
return JSON.parse(data.toString('utf8'));
|
|
89289
|
+
}
|
|
89290
|
+
catch (error) {
|
|
89291
|
+
if (error.code === 'ENOENT')
|
|
89292
|
+
return undefined;
|
|
89293
|
+
throw new verification_setup_policy_1.VerificationSetupError('handoff-invalid');
|
|
89294
|
+
}
|
|
89295
|
+
finally {
|
|
89296
|
+
if (descriptor !== undefined)
|
|
89297
|
+
(0, node_fs_1.closeSync)(descriptor);
|
|
89298
|
+
}
|
|
89299
|
+
}
|
|
89300
|
+
function nativeSession(root, environment = process.env) {
|
|
89301
|
+
if (!/^copilot-verify-runtime-[A-Za-z0-9]+$/u.test((0, node_path_1.basename)(root)) || (0, node_fs_1.realpathSync)(root) !== root
|
|
89302
|
+
|| !(0, node_fs_1.lstatSync)(root).isDirectory() || (0, node_fs_1.lstatSync)(root).isSymbolicLink())
|
|
89303
|
+
throw new verification_setup_policy_1.VerificationSetupError('handoff-invalid');
|
|
89304
|
+
if (process.platform !== 'win32' && ((0, node_fs_1.lstatSync)(root).mode & 0o077) !== 0)
|
|
89305
|
+
throw new verification_setup_policy_1.VerificationSetupError('handoff-invalid');
|
|
89306
|
+
const session = readNativeRecord(root, 'session.json');
|
|
89307
|
+
if (session?.schemaVersion !== 1 || session.workspace !== (0, node_fs_1.realpathSync)(process.cwd())
|
|
89308
|
+
|| session.run !== (environment.GITHUB_RUN_ID ?? '') || session.attempt !== (environment.GITHUB_RUN_ATTEMPT ?? '')
|
|
89309
|
+
|| session.job !== (environment.GITHUB_JOB ?? '') || !Number.isSafeInteger(session.pid) || session.pid <= 0)
|
|
89310
|
+
throw new verification_setup_policy_1.VerificationSetupError('handoff-invalid');
|
|
89311
|
+
return session;
|
|
89312
|
+
}
|
|
89313
|
+
const nativePause = (milliseconds) => new Promise(resolve => setTimeout(resolve, milliseconds));
|
|
89314
|
+
exports.nativePause = nativePause;
|
|
89315
|
+
|
|
89316
|
+
|
|
89317
|
+
/***/ }),
|
|
89318
|
+
|
|
89319
|
+
/***/ 27632:
|
|
89320
|
+
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
89321
|
+
|
|
89322
|
+
"use strict";
|
|
89323
|
+
|
|
89324
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
89325
|
+
exports.nativeWorkerSecrets = nativeWorkerSecrets;
|
|
89326
|
+
exports.redactNativeWorkerLogs = redactNativeWorkerLogs;
|
|
89327
|
+
const node_string_decoder_1 = __nccwpck_require__(76915);
|
|
89328
|
+
const SECRET_KEY = /(?:TOKEN|SECRET|API_KEY|PASSWORD|AUTH_JSON)/iu;
|
|
89329
|
+
function nativeWorkerSecrets(environment) {
|
|
89330
|
+
const values = Object.entries(environment).filter(([key, value]) => SECRET_KEY.test(key) && value).map(([, value]) => value);
|
|
89331
|
+
if (environment.INPUT_VARS_JSON) {
|
|
89332
|
+
try {
|
|
89333
|
+
const inputs = JSON.parse(environment.INPUT_VARS_JSON);
|
|
89334
|
+
for (const [key, value] of Object.entries(inputs))
|
|
89335
|
+
if (SECRET_KEY.test(key) && typeof value === 'string')
|
|
89336
|
+
values.push(value);
|
|
89337
|
+
}
|
|
89338
|
+
catch { /* The existing input parser reports invalid configuration without raw values. */ }
|
|
89339
|
+
}
|
|
89340
|
+
return [...new Set(values.flatMap(value => [value, ...value.split(/[\r\n]/u)]).filter(value => value.length >= 3))].sort((a, b) => b.length - a.length);
|
|
89341
|
+
}
|
|
89342
|
+
/** Secrets are removed before bytes reach a private log file, not merely masked in the runner UI. */
|
|
89343
|
+
function redactNativeWorkerLogs(environment = process.env) {
|
|
89344
|
+
const secrets = nativeWorkerSecrets(environment);
|
|
89345
|
+
const restores = [];
|
|
89346
|
+
for (const stream of [process.stdout, process.stderr]) {
|
|
89347
|
+
const original = stream.write;
|
|
89348
|
+
const decoder = new node_string_decoder_1.StringDecoder('utf8');
|
|
89349
|
+
let pending = '';
|
|
89350
|
+
const emit = (line) => {
|
|
89351
|
+
const command = /^::add-mask::(.*?)(?:\r?\n)?$/u.exec(line);
|
|
89352
|
+
if (command) {
|
|
89353
|
+
const value = command[1].replace(/%0D/gu, '\r').replace(/%0A/gu, '\n').replace(/%25/gu, '%');
|
|
89354
|
+
secrets.push(...value.split(/[\r\n]/u).filter(part => part.length >= 3));
|
|
89355
|
+
return;
|
|
89356
|
+
}
|
|
89357
|
+
for (const secret of secrets)
|
|
89358
|
+
line = line.split(secret).join('[REDACTED]');
|
|
89359
|
+
original.call(stream, line);
|
|
89360
|
+
};
|
|
89361
|
+
stream.write = ((chunk, encoding, callback) => {
|
|
89362
|
+
pending += typeof chunk === 'string' ? chunk : decoder.write(Buffer.from(chunk));
|
|
89363
|
+
let end;
|
|
89364
|
+
while ((end = pending.indexOf('\n')) >= 0) {
|
|
89365
|
+
const line = pending.slice(0, end + 1);
|
|
89366
|
+
pending = pending.slice(end + 1);
|
|
89367
|
+
emit(line);
|
|
89368
|
+
}
|
|
89369
|
+
if (pending.length > 1048576)
|
|
89370
|
+
throw new Error('Copilot worker log line exceeded its fixed limit.');
|
|
89371
|
+
if (typeof encoding === 'function')
|
|
89372
|
+
encoding();
|
|
89373
|
+
else
|
|
89374
|
+
callback?.();
|
|
89375
|
+
return true;
|
|
89376
|
+
});
|
|
89377
|
+
restores.push(() => { pending += decoder.end(); if (pending)
|
|
89378
|
+
emit(pending); stream.write = original; });
|
|
89379
|
+
}
|
|
89380
|
+
return () => { for (const restore of restores)
|
|
89381
|
+
restore(); };
|
|
89382
|
+
}
|
|
89383
|
+
|
|
89384
|
+
|
|
89385
|
+
/***/ }),
|
|
89386
|
+
|
|
89387
|
+
/***/ 85290:
|
|
89388
|
+
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
89389
|
+
|
|
89390
|
+
"use strict";
|
|
89391
|
+
|
|
89392
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
89393
|
+
exports.cleanupNativeSourceRuntime = cleanupNativeSourceRuntime;
|
|
89394
|
+
const node_fs_1 = __nccwpck_require__(87561);
|
|
89395
|
+
const node_path_1 = __nccwpck_require__(49411);
|
|
89396
|
+
const verification_setup_policy_1 = __nccwpck_require__(65326);
|
|
89397
|
+
/** Only source workflows use this snapshot; installed remote Actions already live outside the candidate. */
|
|
89398
|
+
function cleanupNativeSourceRuntime(root, workspace) {
|
|
89399
|
+
if (!root || !(0, node_fs_1.existsSync)(root))
|
|
89400
|
+
return;
|
|
89401
|
+
const allowed = ['.copilot-native-runtime', '.copilot-native-fixture-runtime'].map(name => (0, node_path_1.join)((0, node_path_1.dirname)(workspace), name));
|
|
89402
|
+
if (!allowed.includes(root) || (0, node_fs_1.lstatSync)(root).isSymbolicLink() || (0, node_fs_1.realpathSync)(root) !== root)
|
|
89403
|
+
throw new verification_setup_policy_1.VerificationSetupError('handoff-invalid');
|
|
89404
|
+
let receipt;
|
|
89405
|
+
try {
|
|
89406
|
+
receipt = JSON.parse((0, node_fs_1.readFileSync)((0, node_path_1.join)(root, '.copilot-runtime-snapshot.json'), 'utf8'));
|
|
89407
|
+
}
|
|
89408
|
+
catch {
|
|
89409
|
+
throw new verification_setup_policy_1.VerificationSetupError('handoff-invalid');
|
|
89410
|
+
}
|
|
89411
|
+
if (receipt?.kind !== 'copilot-native-runtime' || receipt.workspace !== workspace)
|
|
89412
|
+
throw new verification_setup_policy_1.VerificationSetupError('handoff-invalid');
|
|
89413
|
+
(0, node_fs_1.rmSync)(root, { recursive: true, force: true });
|
|
89414
|
+
}
|
|
89415
|
+
|
|
89416
|
+
|
|
89417
|
+
/***/ }),
|
|
89418
|
+
|
|
89419
|
+
/***/ 63587:
|
|
89420
|
+
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
89421
|
+
|
|
89422
|
+
"use strict";
|
|
89423
|
+
|
|
89424
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
89425
|
+
exports.NATIVE_VERIFICATION_ACTION = void 0;
|
|
89426
|
+
exports.stageNativeVerificationAction = stageNativeVerificationAction;
|
|
89427
|
+
exports.cleanupNativeVerificationAction = cleanupNativeVerificationAction;
|
|
89428
|
+
const node_fs_1 = __nccwpck_require__(87561);
|
|
89429
|
+
const node_path_1 = __nccwpck_require__(49411);
|
|
89430
|
+
const verification_setup_policy_1 = __nccwpck_require__(65326);
|
|
89431
|
+
const native_verification_protocol_1 = __nccwpck_require__(88709);
|
|
89432
|
+
exports.NATIVE_VERIFICATION_ACTION = '.git/copilot-verification-setup';
|
|
89433
|
+
function targetPath(workspace) {
|
|
89434
|
+
const metadata = (0, node_path_1.join)(workspace, '.git');
|
|
89435
|
+
const stat = (0, node_fs_1.lstatSync)(metadata);
|
|
89436
|
+
if (!stat.isDirectory() || stat.isSymbolicLink() || (0, node_fs_1.realpathSync)(metadata) !== metadata)
|
|
89437
|
+
throw new verification_setup_policy_1.VerificationSetupError('native-workflow-required');
|
|
89438
|
+
return (0, node_path_1.join)(workspace, exports.NATIVE_VERIFICATION_ACTION);
|
|
89439
|
+
}
|
|
89440
|
+
/** Native composite metadata must remain available until its deferred post steps have finished. */
|
|
89441
|
+
function stageNativeVerificationAction(setup, session) {
|
|
89442
|
+
const target = targetPath(setup.workspace);
|
|
89443
|
+
const record = (0, native_verification_protocol_1.readNativeRecord)(session, 'staging.json');
|
|
89444
|
+
if (record && record.target !== target || !record && !!(0, node_fs_1.lstatSync)(target, { throwIfNoEntry: false }))
|
|
89445
|
+
throw new verification_setup_policy_1.VerificationSetupError('handoff-invalid');
|
|
89446
|
+
(0, native_verification_protocol_1.writeNativeRecord)(session, 'staging.json', { target });
|
|
89447
|
+
(0, node_fs_1.rmSync)(target, { recursive: true, force: true });
|
|
89448
|
+
(0, node_fs_1.mkdirSync)(target, { mode: 0o700 });
|
|
89449
|
+
for (const file of setup.files) {
|
|
89450
|
+
const destination = (0, node_path_1.join)(target, file.path);
|
|
89451
|
+
const remainder = (0, node_path_1.relative)(target, destination);
|
|
89452
|
+
if (!remainder || remainder.startsWith(`..${node_path_1.sep}`) || remainder === '..')
|
|
89453
|
+
throw new verification_setup_policy_1.VerificationSetupError('helper-invalid');
|
|
89454
|
+
(0, node_fs_1.mkdirSync)((0, node_path_1.dirname)(destination), { recursive: true, mode: 0o700 });
|
|
89455
|
+
(0, node_fs_1.writeFileSync)(destination, Buffer.from(file.base64, 'base64'), { mode: file.executable ? 0o700 : 0o600, flag: 'wx' });
|
|
89456
|
+
}
|
|
89457
|
+
}
|
|
89458
|
+
function cleanupNativeVerificationAction(session, workspace) {
|
|
89459
|
+
const record = (0, native_verification_protocol_1.readNativeRecord)(session, 'staging.json');
|
|
89460
|
+
if (!record)
|
|
89461
|
+
return;
|
|
89462
|
+
const target = targetPath(workspace);
|
|
89463
|
+
if (record.target !== target)
|
|
89464
|
+
throw new verification_setup_policy_1.VerificationSetupError('handoff-invalid');
|
|
89465
|
+
(0, node_fs_1.rmSync)(target, { recursive: true, force: true });
|
|
89466
|
+
(0, node_fs_1.rmSync)((0, node_path_1.join)(session, 'staging.json'), { force: true });
|
|
89467
|
+
}
|
|
89468
|
+
|
|
89469
|
+
|
|
87573
89470
|
/***/ }),
|
|
87574
89471
|
|
|
87575
89472
|
/***/ 35849:
|
|
@@ -87619,6 +89516,7 @@ const node_crypto_1 = __nccwpck_require__(6005);
|
|
|
87619
89516
|
const node_child_process_1 = __nccwpck_require__(17718);
|
|
87620
89517
|
const node_util_1 = __nccwpck_require__(47261);
|
|
87621
89518
|
const pre_branch_sdd_1 = __nccwpck_require__(34730);
|
|
89519
|
+
const sdd_draft_consistency_1 = __nccwpck_require__(27910);
|
|
87622
89520
|
const git_authentication_environment_1 = __nccwpck_require__(16535);
|
|
87623
89521
|
const git_hook_isolation_1 = __nccwpck_require__(39764);
|
|
87624
89522
|
const runFile = (0, node_util_1.promisify)(node_child_process_1.execFile);
|
|
@@ -87692,6 +89590,17 @@ class PreBranchSddWorkspaceAdapter {
|
|
|
87692
89590
|
if (fs.existsSync(target) !== (plan.action === 'update')) {
|
|
87693
89591
|
throw new Error('The SDD owner changed since analysis; restart clarification.');
|
|
87694
89592
|
}
|
|
89593
|
+
const owners = [];
|
|
89594
|
+
const inventory = await this.inventoryAt(snapshot.baseSha);
|
|
89595
|
+
for (const file of snapshot.capabilities.find(capability => capability.id === plan.capabilityId)?.specs ?? []) {
|
|
89596
|
+
if (!(0, pre_branch_sdd_1.isSafeSddPath)(file))
|
|
89597
|
+
throw new Error('An owning SDD path is unsafe.');
|
|
89598
|
+
if (!inventory.files.has(file))
|
|
89599
|
+
throw new Error('An owning SDD is not a regular file at the immutable base.');
|
|
89600
|
+
assertRegularSpecFile(path.join(root, file));
|
|
89601
|
+
owners.push({ path: file, markdown: await this.git(['show', `${snapshot.baseSha}:${file}`]) });
|
|
89602
|
+
}
|
|
89603
|
+
(0, sdd_draft_consistency_1.validateSddDraftConsistency)(markdown, owners, inventory, plan.path);
|
|
87695
89604
|
if (plan.action === 'update') {
|
|
87696
89605
|
assertRegularSpecFile(target);
|
|
87697
89606
|
const owner = await this.git(['show', `${snapshot.baseSha}:${plan.path}`]);
|
|
@@ -87830,7 +89739,13 @@ class PreBranchSddWorkspaceAdapter {
|
|
|
87830
89739
|
const raw = await this.git(['show', `${first}:specs/catalog.json`]);
|
|
87831
89740
|
newCapability = JSON.parse(raw).capabilities.find(capability => capability.id === prepared.plan.capabilityId);
|
|
87832
89741
|
}
|
|
87833
|
-
const
|
|
89742
|
+
const candidate = prepared.plan.action === 'update'
|
|
89743
|
+
? (0, pre_branch_sdd_1.recoverSddUpdate)(await this.git(['show', `${prepared.baseSha}:${prepared.plan.path}`]), content) : content;
|
|
89744
|
+
if (!candidate)
|
|
89745
|
+
return undefined;
|
|
89746
|
+
const recovered = await this.validateDraft(snapshot, prepared.plan, candidate, newCapability);
|
|
89747
|
+
if (recovered.markdown !== content)
|
|
89748
|
+
return undefined;
|
|
87834
89749
|
const committedPaths = (await this.git(['diff-tree', '--no-commit-id', '--name-only', '-r', first])).trim().split('\n').filter(Boolean).sort();
|
|
87835
89750
|
if (committedPaths.join('\n') !== recovered.changedPaths.join('\n'))
|
|
87836
89751
|
return undefined;
|
|
@@ -87865,6 +89780,25 @@ class PreBranchSddWorkspaceAdapter {
|
|
|
87865
89780
|
const output = await this.git(['status', '--porcelain', '--untracked-files=all'], root);
|
|
87866
89781
|
return output.split('\n').filter(Boolean).map(line => line.slice(3)).sort();
|
|
87867
89782
|
}
|
|
89783
|
+
async inventoryAt(sha) {
|
|
89784
|
+
const files = new Set();
|
|
89785
|
+
const directories = new Set();
|
|
89786
|
+
const blocked = new Set();
|
|
89787
|
+
const tree = await this.git(['ls-tree', '-rz', '--full-tree', sha]);
|
|
89788
|
+
for (const entry of tree.split('\0').filter(Boolean)) {
|
|
89789
|
+
const tab = entry.indexOf('\t');
|
|
89790
|
+
const file = entry.slice(tab + 1);
|
|
89791
|
+
const mode = entry.slice(0, 6);
|
|
89792
|
+
if (mode === '100644' || mode === '100755')
|
|
89793
|
+
files.add(file);
|
|
89794
|
+
else
|
|
89795
|
+
blocked.add(file);
|
|
89796
|
+
const parts = file.split('/');
|
|
89797
|
+
for (let index = 1; index < parts.length; index++)
|
|
89798
|
+
directories.add(parts.slice(0, index).join('/'));
|
|
89799
|
+
}
|
|
89800
|
+
return { files, directories, blocked };
|
|
89801
|
+
}
|
|
87868
89802
|
async addDetachedWorktree(sha) {
|
|
87869
89803
|
const root = fs.mkdtempSync(path.join(os.tmpdir(), 'copilot-sdd-'));
|
|
87870
89804
|
try {
|
|
@@ -87971,6 +89905,190 @@ function writeSpecFile(target, content, exists) {
|
|
|
87971
89905
|
}
|
|
87972
89906
|
|
|
87973
89907
|
|
|
89908
|
+
/***/ }),
|
|
89909
|
+
|
|
89910
|
+
/***/ 12471:
|
|
89911
|
+
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
|
|
89912
|
+
|
|
89913
|
+
"use strict";
|
|
89914
|
+
|
|
89915
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
89916
|
+
if (k2 === undefined) k2 = k;
|
|
89917
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
89918
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
89919
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
89920
|
+
}
|
|
89921
|
+
Object.defineProperty(o, k2, desc);
|
|
89922
|
+
}) : (function(o, m, k, k2) {
|
|
89923
|
+
if (k2 === undefined) k2 = k;
|
|
89924
|
+
o[k2] = m[k];
|
|
89925
|
+
}));
|
|
89926
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
89927
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
89928
|
+
}) : function(o, v) {
|
|
89929
|
+
o["default"] = v;
|
|
89930
|
+
});
|
|
89931
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
89932
|
+
var ownKeys = function(o) {
|
|
89933
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
89934
|
+
var ar = [];
|
|
89935
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
89936
|
+
return ar;
|
|
89937
|
+
};
|
|
89938
|
+
return ownKeys(o);
|
|
89939
|
+
};
|
|
89940
|
+
return function (mod) {
|
|
89941
|
+
if (mod && mod.__esModule) return mod;
|
|
89942
|
+
var result = {};
|
|
89943
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
89944
|
+
__setModuleDefault(result, mod);
|
|
89945
|
+
return result;
|
|
89946
|
+
};
|
|
89947
|
+
})();
|
|
89948
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
89949
|
+
exports.inspectSetupVerificationActionPath = inspectSetupVerificationActionPath;
|
|
89950
|
+
exports.readSetupVerificationActionStarter = readSetupVerificationActionStarter;
|
|
89951
|
+
exports.createSetupVerificationAction = createSetupVerificationAction;
|
|
89952
|
+
const fs = __importStar(__nccwpck_require__(87561));
|
|
89953
|
+
const node_path_1 = __nccwpck_require__(49411);
|
|
89954
|
+
const setup_verification_action_1 = __nccwpck_require__(33156);
|
|
89955
|
+
const unsafe = () => new Error(`${setup_verification_action_1.SETUP_VERIFICATION_ACTION_PATH}: setup requires real parent directories and a regular action file. Inspect the path and remove unsafe links or collisions, then review setup again. Existing contents were preserved.`);
|
|
89956
|
+
const stale = () => new Error(`${setup_verification_action_1.SETUP_VERIFICATION_ACTION_PATH}: the path changed after review. No existing action was replaced. Review a fresh setup plan.`);
|
|
89957
|
+
const sameDirectory = (left, right) => left.ino > 0n
|
|
89958
|
+
&& left.dev === right.dev && left.ino === right.ino;
|
|
89959
|
+
const directoryFlags = fs.constants.O_RDONLY | (fs.constants.O_DIRECTORY ?? 0)
|
|
89960
|
+
| (fs.constants.O_NOFOLLOW ?? 0) | (fs.constants.O_NONBLOCK ?? 0);
|
|
89961
|
+
function entry(path) {
|
|
89962
|
+
try {
|
|
89963
|
+
return fs.lstatSync(path, { bigint: true });
|
|
89964
|
+
}
|
|
89965
|
+
catch (error) {
|
|
89966
|
+
if (error.code === 'ENOENT')
|
|
89967
|
+
return undefined;
|
|
89968
|
+
throw error;
|
|
89969
|
+
}
|
|
89970
|
+
}
|
|
89971
|
+
/** Inspect metadata only: consumer action contents and auxiliary files are never read. */
|
|
89972
|
+
function inspectSetupVerificationActionPath(root) {
|
|
89973
|
+
for (const parent of setup_verification_action_1.SETUP_VERIFICATION_ACTION_PARENTS) {
|
|
89974
|
+
const info = entry((0, node_path_1.join)(root, parent));
|
|
89975
|
+
if (!info)
|
|
89976
|
+
return 'create';
|
|
89977
|
+
if (!info.isDirectory() || info.isSymbolicLink())
|
|
89978
|
+
throw unsafe();
|
|
89979
|
+
}
|
|
89980
|
+
const info = entry((0, node_path_1.join)(root, setup_verification_action_1.SETUP_VERIFICATION_ACTION_PATH));
|
|
89981
|
+
if (!info)
|
|
89982
|
+
return 'create';
|
|
89983
|
+
if (!info.isFile() || info.isSymbolicLink())
|
|
89984
|
+
throw unsafe();
|
|
89985
|
+
return 'preserve';
|
|
89986
|
+
}
|
|
89987
|
+
/** Resolve the package-controlled starter, independently of workflow test overrides. */
|
|
89988
|
+
function readSetupVerificationActionStarter() {
|
|
89989
|
+
return fs.readFileSync((0, node_path_1.join)(__dirname, '..', '..', 'setup/actions/copilot-verification-setup/action.yml'), 'utf8');
|
|
89990
|
+
}
|
|
89991
|
+
/** Exclusive creation cannot truncate a file that wins the Apply race. */
|
|
89992
|
+
function createSetupVerificationAction(root, expected) {
|
|
89993
|
+
const state = inspectSetupVerificationActionPath(root);
|
|
89994
|
+
if (expected && expected !== state)
|
|
89995
|
+
throw stale();
|
|
89996
|
+
if (state === 'preserve')
|
|
89997
|
+
return { copied: 0, skipped: 1 };
|
|
89998
|
+
const content = readSetupVerificationActionStarter();
|
|
89999
|
+
const absoluteRoot = fs.realpathSync(root);
|
|
90000
|
+
const previousDirectory = fs.realpathSync('.');
|
|
90001
|
+
// Node has no portable openat. Pin each validated directory as the OS cwd,
|
|
90002
|
+
// then use only single-component relative operations. On POSIX this retains
|
|
90003
|
+
// the directory even if renamed; Windows locks the current directory.
|
|
90004
|
+
// This critical section is synchronous: never await or invoke user callbacks
|
|
90005
|
+
// here. The installer owns this main-thread section and always restores cwd.
|
|
90006
|
+
try {
|
|
90007
|
+
enterPinnedDirectory(absoluteRoot);
|
|
90008
|
+
for (const segment of ['.github', 'actions', 'copilot-verification-setup']) {
|
|
90009
|
+
try {
|
|
90010
|
+
fs.mkdirSync(segment);
|
|
90011
|
+
}
|
|
90012
|
+
catch (error) {
|
|
90013
|
+
if (error.code !== 'EEXIST')
|
|
90014
|
+
throw error;
|
|
90015
|
+
}
|
|
90016
|
+
enterPinnedDirectory(segment);
|
|
90017
|
+
}
|
|
90018
|
+
// Detect a relocated route before creation as well as after writing. A
|
|
90019
|
+
// replacement after this check cannot redirect the cwd-relative open.
|
|
90020
|
+
inspectSetupVerificationActionPath(absoluteRoot);
|
|
90021
|
+
writeStarterInPinnedDirectory(absoluteRoot, content);
|
|
90022
|
+
}
|
|
90023
|
+
finally {
|
|
90024
|
+
process.chdir(previousDirectory);
|
|
90025
|
+
}
|
|
90026
|
+
return { copied: 1, skipped: 0 };
|
|
90027
|
+
}
|
|
90028
|
+
function enterPinnedDirectory(path) {
|
|
90029
|
+
let descriptor;
|
|
90030
|
+
try {
|
|
90031
|
+
descriptor = fs.openSync(path, directoryFlags);
|
|
90032
|
+
}
|
|
90033
|
+
catch (error) {
|
|
90034
|
+
if (['ELOOP', 'ENOTDIR'].includes(error.code))
|
|
90035
|
+
throw unsafe();
|
|
90036
|
+
throw error;
|
|
90037
|
+
}
|
|
90038
|
+
try {
|
|
90039
|
+
// Keep the directory handle open until cwd is pinned, preventing inode reuse.
|
|
90040
|
+
const bound = fs.fstatSync(descriptor, { bigint: true });
|
|
90041
|
+
const observed = fs.lstatSync(path, { bigint: true });
|
|
90042
|
+
if (!bound.isDirectory() || !observed.isDirectory() || observed.isSymbolicLink())
|
|
90043
|
+
throw unsafe();
|
|
90044
|
+
if (!sameDirectory(bound, observed))
|
|
90045
|
+
throw stale();
|
|
90046
|
+
process.chdir(path);
|
|
90047
|
+
if (!sameDirectory(bound, fs.lstatSync('.', { bigint: true })))
|
|
90048
|
+
throw stale();
|
|
90049
|
+
}
|
|
90050
|
+
finally {
|
|
90051
|
+
fs.closeSync(descriptor);
|
|
90052
|
+
}
|
|
90053
|
+
}
|
|
90054
|
+
function writeStarterInPinnedDirectory(root, content) {
|
|
90055
|
+
const destination = 'action.yml';
|
|
90056
|
+
let descriptor;
|
|
90057
|
+
try {
|
|
90058
|
+
descriptor = fs.openSync(destination, 'wx', 0o644);
|
|
90059
|
+
}
|
|
90060
|
+
catch (error) {
|
|
90061
|
+
if (error.code === 'EEXIST')
|
|
90062
|
+
throw stale();
|
|
90063
|
+
throw error;
|
|
90064
|
+
}
|
|
90065
|
+
let created;
|
|
90066
|
+
try {
|
|
90067
|
+
try {
|
|
90068
|
+
created = fs.fstatSync(descriptor, { bigint: true });
|
|
90069
|
+
fs.writeFileSync(descriptor, content, 'utf8');
|
|
90070
|
+
if (inspectSetupVerificationActionPath(root) !== 'preserve')
|
|
90071
|
+
throw stale();
|
|
90072
|
+
if (!sameDirectory(fs.lstatSync('.', { bigint: true }), fs.lstatSync((0, node_path_1.join)(root, setup_verification_action_1.SETUP_VERIFICATION_ACTION_PARENTS[2]), { bigint: true })))
|
|
90073
|
+
throw stale();
|
|
90074
|
+
}
|
|
90075
|
+
finally {
|
|
90076
|
+
fs.closeSync(descriptor);
|
|
90077
|
+
}
|
|
90078
|
+
}
|
|
90079
|
+
catch (error) {
|
|
90080
|
+
// Remove only our incomplete file, never a concurrent replacement.
|
|
90081
|
+
try {
|
|
90082
|
+
const current = entry(destination);
|
|
90083
|
+
if (created && current?.dev === created.dev && current.ino === created.ino)
|
|
90084
|
+
fs.unlinkSync(destination);
|
|
90085
|
+
}
|
|
90086
|
+
catch { /* Preserve the original failure; an incomplete asset needs inspection. */ }
|
|
90087
|
+
throw error;
|
|
90088
|
+
}
|
|
90089
|
+
}
|
|
90090
|
+
|
|
90091
|
+
|
|
87974
90092
|
/***/ }),
|
|
87975
90093
|
|
|
87976
90094
|
/***/ 5729:
|
|
@@ -88000,6 +90118,7 @@ class SetupWorkspaceMutationAdapter {
|
|
|
88000
90118
|
updateExistingWorkflows: selection?.updateExistingWorkflows,
|
|
88001
90119
|
approvedWorkflowFiles: selection?.approvedWorkflowFiles,
|
|
88002
90120
|
setupConfiguration: selection?.setupConfiguration,
|
|
90121
|
+
verificationActionState: selection.verificationActionState,
|
|
88003
90122
|
});
|
|
88004
90123
|
}
|
|
88005
90124
|
hasValidToken(tokenOverride) {
|
|
@@ -88214,7 +90333,7 @@ const ALLOWED_VARIABLES = [
|
|
|
88214
90333
|
* credentials or paths to local agent authentication stores.
|
|
88215
90334
|
*/
|
|
88216
90335
|
function prepareUntrustedCommandEnvironment(source = process.env, platform = process.platform) {
|
|
88217
|
-
const runtimeHome = (0, agent_private_install_root_1.createPrivateVerificationRuntimeRoot)();
|
|
90336
|
+
const runtimeHome = (0, node_fs_1.realpathSync)((0, agent_private_install_root_1.createPrivateVerificationRuntimeRoot)());
|
|
88218
90337
|
const environment = { HOME: runtimeHome };
|
|
88219
90338
|
for (const variable of ALLOWED_VARIABLES) {
|
|
88220
90339
|
const value = source[variable];
|
|
@@ -88242,6 +90361,39 @@ function prepareUntrustedCommandEnvironment(source = process.env, platform = pro
|
|
|
88242
90361
|
}
|
|
88243
90362
|
|
|
88244
90363
|
|
|
90364
|
+
/***/ }),
|
|
90365
|
+
|
|
90366
|
+
/***/ 20878:
|
|
90367
|
+
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
90368
|
+
|
|
90369
|
+
"use strict";
|
|
90370
|
+
|
|
90371
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
90372
|
+
exports.verificationExecutable = verificationExecutable;
|
|
90373
|
+
const node_fs_1 = __nccwpck_require__(87561);
|
|
90374
|
+
const node_path_1 = __nccwpck_require__(49411);
|
|
90375
|
+
/** @actions/exec resolves basenames against its own process PATH; native tools belong to the verifier PATH. */
|
|
90376
|
+
function verificationExecutable(program, environment, platform = process.platform) {
|
|
90377
|
+
const explicit = (0, node_path_1.isAbsolute)(program) || /[\\/]/u.test(program);
|
|
90378
|
+
const candidates = explicit ? [(0, node_path_1.resolve)(program)] : (environment.PATH ?? '').split(node_path_1.delimiter).filter(Boolean).map(directory => (0, node_path_1.resolve)((0, node_path_1.join)(directory, program)));
|
|
90379
|
+
const windowsExtensions = (environment.PATHEXT || '.COM;.EXE;.BAT;.CMD').split(';').filter(Boolean);
|
|
90380
|
+
const hasWindowsExtension = windowsExtensions.some(extension => program.toLowerCase().endsWith(extension.toLowerCase()));
|
|
90381
|
+
const extensions = platform === 'win32' && !hasWindowsExtension ? windowsExtensions : [''];
|
|
90382
|
+
for (const candidate of candidates)
|
|
90383
|
+
for (const extension of extensions) {
|
|
90384
|
+
const file = candidate + extension;
|
|
90385
|
+
try {
|
|
90386
|
+
if ((0, node_fs_1.statSync)(file).isFile()) {
|
|
90387
|
+
(0, node_fs_1.accessSync)(file, node_fs_1.constants.X_OK);
|
|
90388
|
+
return file;
|
|
90389
|
+
}
|
|
90390
|
+
}
|
|
90391
|
+
catch { /* Try only the next executable in the isolated PATH. */ }
|
|
90392
|
+
}
|
|
90393
|
+
throw new Error('Verification executable is unavailable in the isolated PATH.');
|
|
90394
|
+
}
|
|
90395
|
+
|
|
90396
|
+
|
|
88245
90397
|
/***/ }),
|
|
88246
90398
|
|
|
88247
90399
|
/***/ 91053:
|
|
@@ -88368,6 +90520,267 @@ function checkRuntime(requirement, environment, run, platform, job) {
|
|
|
88368
90520
|
}
|
|
88369
90521
|
|
|
88370
90522
|
|
|
90523
|
+
/***/ }),
|
|
90524
|
+
|
|
90525
|
+
/***/ 23358:
|
|
90526
|
+
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
90527
|
+
|
|
90528
|
+
"use strict";
|
|
90529
|
+
|
|
90530
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
90531
|
+
exports.applyVerificationSetupResult = applyVerificationSetupResult;
|
|
90532
|
+
const node_fs_1 = __nccwpck_require__(87561);
|
|
90533
|
+
const node_path_1 = __nccwpck_require__(49411);
|
|
90534
|
+
const verification_setup_policy_1 = __nccwpck_require__(65326);
|
|
90535
|
+
function contained(root, path) {
|
|
90536
|
+
const remainder = (0, node_path_1.relative)(root, path);
|
|
90537
|
+
return remainder === '' || (remainder !== '..' && !remainder.startsWith(`..${node_path_1.sep}`) && !(0, node_path_1.isAbsolute)(remainder));
|
|
90538
|
+
}
|
|
90539
|
+
/** Accept only existing contained directories, checking both lexical paths and symlink targets. */
|
|
90540
|
+
function approvedDirectory(value, roots) {
|
|
90541
|
+
if (!(0, node_path_1.isAbsolute)(value) || value.includes(node_path_1.delimiter) || value.split(/[\\/]/u).includes('..')
|
|
90542
|
+
|| !roots.some(root => contained(root, value)))
|
|
90543
|
+
throw new verification_setup_policy_1.VerificationSetupError('result-invalid');
|
|
90544
|
+
const actual = (0, node_fs_1.realpathSync)(value);
|
|
90545
|
+
if (!roots.some(root => contained(root, actual)) || !(0, node_fs_1.lstatSync)(actual).isDirectory())
|
|
90546
|
+
throw new verification_setup_policy_1.VerificationSetupError('result-invalid');
|
|
90547
|
+
return actual;
|
|
90548
|
+
}
|
|
90549
|
+
function applyVerificationSetupResult(file, environment, roots) {
|
|
90550
|
+
let descriptor;
|
|
90551
|
+
try {
|
|
90552
|
+
let before;
|
|
90553
|
+
try {
|
|
90554
|
+
before = (0, node_fs_1.lstatSync)(file, { bigint: true });
|
|
90555
|
+
}
|
|
90556
|
+
catch (error) {
|
|
90557
|
+
if (error.code === 'ENOENT')
|
|
90558
|
+
return;
|
|
90559
|
+
throw error;
|
|
90560
|
+
}
|
|
90561
|
+
if (!before.isFile() || before.isSymbolicLink() || before.nlink !== 1n || before.size > BigInt(verification_setup_policy_1.VERIFICATION_SETUP_LIMITS.resultBytes))
|
|
90562
|
+
throw new Error();
|
|
90563
|
+
descriptor = (0, node_fs_1.openSync)(file, node_fs_1.constants.O_RDONLY | (node_fs_1.constants.O_NOFOLLOW ?? 0));
|
|
90564
|
+
const opened = (0, node_fs_1.fstatSync)(descriptor, { bigint: true });
|
|
90565
|
+
if (!opened.isFile() || opened.nlink !== 1n || opened.dev !== before.dev || opened.ino !== before.ino
|
|
90566
|
+
|| opened.size !== before.size || opened.mtimeNs !== before.mtimeNs)
|
|
90567
|
+
throw new Error();
|
|
90568
|
+
const bytes = Buffer.alloc(verification_setup_policy_1.VERIFICATION_SETUP_LIMITS.resultBytes + 1);
|
|
90569
|
+
const size = (0, node_fs_1.readSync)(descriptor, bytes, 0, bytes.length, 0);
|
|
90570
|
+
if (size > verification_setup_policy_1.VERIFICATION_SETUP_LIMITS.resultBytes)
|
|
90571
|
+
throw new Error();
|
|
90572
|
+
const after = (0, node_fs_1.fstatSync)(descriptor, { bigint: true });
|
|
90573
|
+
if (after.size !== opened.size || after.mtimeNs !== opened.mtimeNs)
|
|
90574
|
+
throw new Error();
|
|
90575
|
+
const result = (0, verification_setup_policy_1.parseVerificationSetupResult)(JSON.parse(bytes.subarray(0, size).toString('utf8')));
|
|
90576
|
+
const paths = result.path.map(value => approvedDirectory(value, roots));
|
|
90577
|
+
const javaHome = result.javaHome ? approvedDirectory(result.javaHome, roots) : undefined;
|
|
90578
|
+
if (paths.length)
|
|
90579
|
+
environment.PATH = [...paths, ...(environment.PATH ? [environment.PATH] : [])].join(node_path_1.delimiter);
|
|
90580
|
+
if (javaHome)
|
|
90581
|
+
environment.JAVA_HOME = javaHome;
|
|
90582
|
+
}
|
|
90583
|
+
catch {
|
|
90584
|
+
throw new verification_setup_policy_1.VerificationSetupError('result-invalid');
|
|
90585
|
+
}
|
|
90586
|
+
finally {
|
|
90587
|
+
if (descriptor !== undefined)
|
|
90588
|
+
(0, node_fs_1.closeSync)(descriptor);
|
|
90589
|
+
}
|
|
90590
|
+
}
|
|
90591
|
+
|
|
90592
|
+
|
|
90593
|
+
/***/ }),
|
|
90594
|
+
|
|
90595
|
+
/***/ 11709:
|
|
90596
|
+
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
90597
|
+
|
|
90598
|
+
"use strict";
|
|
90599
|
+
|
|
90600
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
90601
|
+
exports.prepareRepositoryVerification = prepareRepositoryVerification;
|
|
90602
|
+
const verification_setup_snapshot_1 = __nccwpck_require__(62148);
|
|
90603
|
+
const native_verification_profiles_1 = __nccwpck_require__(22290);
|
|
90604
|
+
const node_fs_1 = __nccwpck_require__(87561);
|
|
90605
|
+
const node_path_1 = __nccwpck_require__(49411);
|
|
90606
|
+
const node_crypto_1 = __nccwpck_require__(6005);
|
|
90607
|
+
const verification_setup_policy_1 = __nccwpck_require__(65326);
|
|
90608
|
+
const verification_setup_result_1 = __nccwpck_require__(23358);
|
|
90609
|
+
const logging_ports_1 = __nccwpck_require__(6152);
|
|
90610
|
+
const native_verification_protocol_1 = __nccwpck_require__(88709);
|
|
90611
|
+
const native_verification_staging_1 = __nccwpck_require__(63587);
|
|
90612
|
+
const native_verification_candidate_1 = __nccwpck_require__(18883);
|
|
90613
|
+
/** The runner executes YAML. This adapter pauses the admitted call stack at its verification boundary. */
|
|
90614
|
+
async function prepareRepositoryVerification(setup, environment) {
|
|
90615
|
+
if (setup.kind === 'disabled')
|
|
90616
|
+
return;
|
|
90617
|
+
if (setup.kind === 'blocked')
|
|
90618
|
+
throw new verification_setup_policy_1.VerificationSetupError(setup.reason, setup.sourceSha);
|
|
90619
|
+
const session = process.env.COPILOT_NATIVE_WORKER_SESSION;
|
|
90620
|
+
if (!session)
|
|
90621
|
+
throw new verification_setup_policy_1.VerificationSetupError('native-workflow-required', setup.sourceSha);
|
|
90622
|
+
let requestCreated = false;
|
|
90623
|
+
try {
|
|
90624
|
+
(0, native_verification_protocol_1.nativeSession)(session);
|
|
90625
|
+
const requests = (0, native_verification_protocol_1.readNativeRecord)(session, 'request-count.json')?.count ?? 0;
|
|
90626
|
+
if (requests >= verification_setup_policy_1.VERIFICATION_SETUP_LIMITS.requests)
|
|
90627
|
+
throw new verification_setup_policy_1.VerificationSetupError('handoff-invalid');
|
|
90628
|
+
(0, native_verification_protocol_1.writeNativeRecord)(session, 'request-count.json', { count: requests + 1 });
|
|
90629
|
+
if ((0, node_fs_1.realpathSync)(process.cwd()) !== setup.workspace)
|
|
90630
|
+
throw new verification_setup_policy_1.VerificationSetupError('workspace-changed');
|
|
90631
|
+
(0, native_verification_profiles_1.registerNativeVerificationProfile)(session, environment.HOME);
|
|
90632
|
+
const identity = (0, native_verification_candidate_1.verificationCandidateIdentity)(setup.workspace, environment);
|
|
90633
|
+
(0, native_verification_staging_1.stageNativeVerificationAction)(setup, session);
|
|
90634
|
+
const id = (0, node_crypto_1.randomUUID)();
|
|
90635
|
+
(0, native_verification_protocol_1.writeNativeRecord)(session, 'request.json', { id, sourceSha: setup.sourceSha, digest: (0, verification_setup_snapshot_1.verificationSetupDigest)(setup), environment });
|
|
90636
|
+
requestCreated = true;
|
|
90637
|
+
(0, logging_ports_1.logInfo)(`Preparing repository verification (${verification_setup_policy_1.VERIFICATION_SETUP_PATH}; trusted source SHA: ${setup.sourceSha}).`);
|
|
90638
|
+
const deadline = Date.now() + verification_setup_policy_1.VERIFICATION_SETUP_LIMITS.timeoutMs;
|
|
90639
|
+
let response;
|
|
90640
|
+
while (!(response = (0, native_verification_protocol_1.readNativeRecord)(session, `response-${id}.json`))) {
|
|
90641
|
+
if ((0, native_verification_protocol_1.readNativeRecord)(session, 'cancel.json'))
|
|
90642
|
+
throw new verification_setup_policy_1.VerificationSetupError('cancelled');
|
|
90643
|
+
if (Date.now() >= deadline)
|
|
90644
|
+
throw new verification_setup_policy_1.VerificationSetupError('timeout');
|
|
90645
|
+
await (0, native_verification_protocol_1.nativePause)(100);
|
|
90646
|
+
}
|
|
90647
|
+
if (response.id !== id || response.success !== true)
|
|
90648
|
+
throw new verification_setup_policy_1.VerificationSetupError('process-failed');
|
|
90649
|
+
if ((0, native_verification_candidate_1.verificationCandidateIdentity)(setup.workspace, environment) !== identity)
|
|
90650
|
+
throw new verification_setup_policy_1.VerificationSetupError('candidate-changed');
|
|
90651
|
+
if (typeof response.path !== 'string' || response.path.length > 16384 || response.javaHome !== undefined && typeof response.javaHome !== 'string')
|
|
90652
|
+
throw new verification_setup_policy_1.VerificationSetupError('result-invalid');
|
|
90653
|
+
const original = new Set((environment.PATH ?? '').split(node_path_1.delimiter));
|
|
90654
|
+
const previousProfiles = (0, native_verification_profiles_1.nativeVerificationProfilePaths)(session).filter(profile => profile !== environment.HOME);
|
|
90655
|
+
const fromPreviousProfile = (path) => previousProfiles.some(profile => {
|
|
90656
|
+
const part = (0, node_path_1.relative)(profile, path);
|
|
90657
|
+
return part === '' || part !== '..' && !part.startsWith(`..${node_path_1.sep}`) && !(0, node_path_1.isAbsolute)(part);
|
|
90658
|
+
});
|
|
90659
|
+
const additions = [...new Set(response.path.split(node_path_1.delimiter).filter(path => path && !original.has(path) && !fromPreviousProfile(path)))];
|
|
90660
|
+
const result = (0, node_path_1.join)(environment.HOME, 'native-setup-result.json');
|
|
90661
|
+
(0, node_fs_1.writeFileSync)(result, JSON.stringify({ schemaVersion: 1, path: additions,
|
|
90662
|
+
environment: response.javaHome && response.javaHome !== environment.JAVA_HOME ? { JAVA_HOME: response.javaHome } : {} }), { mode: 0o600, flag: 'wx' });
|
|
90663
|
+
(0, verification_setup_result_1.applyVerificationSetupResult)(result, environment, [setup.workspace, environment.HOME, ...(setup.toolRoot ? [setup.toolRoot] : [])]);
|
|
90664
|
+
(0, logging_ports_1.logInfo)('Repository setup completed; runtime preflight and verification may proceed.');
|
|
90665
|
+
}
|
|
90666
|
+
catch (error) {
|
|
90667
|
+
throw new verification_setup_policy_1.VerificationSetupError(error instanceof verification_setup_policy_1.VerificationSetupError ? error.reason : 'handoff-invalid', setup.sourceSha);
|
|
90668
|
+
}
|
|
90669
|
+
finally {
|
|
90670
|
+
if (requestCreated)
|
|
90671
|
+
(0, node_fs_1.rmSync)((0, node_path_1.join)(session, 'request.json'), { force: true });
|
|
90672
|
+
}
|
|
90673
|
+
}
|
|
90674
|
+
|
|
90675
|
+
|
|
90676
|
+
/***/ }),
|
|
90677
|
+
|
|
90678
|
+
/***/ 62148:
|
|
90679
|
+
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
90680
|
+
|
|
90681
|
+
"use strict";
|
|
90682
|
+
|
|
90683
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
90684
|
+
exports.verificationSetupDigest = verificationSetupDigest;
|
|
90685
|
+
exports.captureVerificationSetup = captureVerificationSetup;
|
|
90686
|
+
exports.captureVerificationSetupAtCommit = captureVerificationSetupAtCommit;
|
|
90687
|
+
const node_path_1 = __nccwpck_require__(49411);
|
|
90688
|
+
const node_child_process_1 = __nccwpck_require__(17718);
|
|
90689
|
+
const node_crypto_1 = __nccwpck_require__(6005);
|
|
90690
|
+
const node_fs_1 = __nccwpck_require__(87561);
|
|
90691
|
+
const js_yaml_1 = __nccwpck_require__(783);
|
|
90692
|
+
const verification_setup_ports_1 = __nccwpck_require__(26509);
|
|
90693
|
+
const verification_setup_policy_1 = __nccwpck_require__(65326);
|
|
90694
|
+
const untrusted_command_environment_1 = __nccwpck_require__(2304);
|
|
90695
|
+
/** Only immutable Git objects are read. Errors remain deferred on non-verifying routes. */
|
|
90696
|
+
function verificationSetupDigest(setup) {
|
|
90697
|
+
return (0, node_crypto_1.createHash)('sha256').update(JSON.stringify(setup.files)).digest('hex');
|
|
90698
|
+
}
|
|
90699
|
+
function captureVerificationSetup(enabled, mainBranch, root = process.cwd()) {
|
|
90700
|
+
return capture(enabled, mainBranch, root);
|
|
90701
|
+
}
|
|
90702
|
+
/** Post steps use the already pinned commit from runner state, never a mutable branch ref. */
|
|
90703
|
+
function captureVerificationSetupAtCommit(commit, root = process.cwd(), gitExecutable) {
|
|
90704
|
+
return capture(true, '', root, commit, gitExecutable);
|
|
90705
|
+
}
|
|
90706
|
+
function capture(enabled, mainBranch, root, pinned, gitExecutable) {
|
|
90707
|
+
if (!enabled)
|
|
90708
|
+
return verification_setup_ports_1.DISABLED_VERIFICATION_SETUP;
|
|
90709
|
+
let sourceSha;
|
|
90710
|
+
let runtime;
|
|
90711
|
+
let snapshot;
|
|
90712
|
+
try {
|
|
90713
|
+
runtime = (0, untrusted_command_environment_1.prepareUntrustedCommandEnvironment)();
|
|
90714
|
+
const environment = runtime.environment;
|
|
90715
|
+
if (!pinned && (!/^[A-Za-z0-9][A-Za-z0-9._/-]{0,200}$/u.test(mainBranch) || mainBranch.includes('..')
|
|
90716
|
+
|| mainBranch.includes('//') || mainBranch.endsWith('/') || mainBranch.endsWith('.lock')))
|
|
90717
|
+
throw new Error();
|
|
90718
|
+
if (gitExecutable !== undefined && !(0, node_path_1.isAbsolute)(gitExecutable))
|
|
90719
|
+
throw new Error();
|
|
90720
|
+
const workspace = (0, node_fs_1.realpathSync)(root);
|
|
90721
|
+
const git = (...args) => {
|
|
90722
|
+
const result = (0, node_child_process_1.spawnSync)(gitExecutable ?? 'git', ['--no-replace-objects', ...args], { cwd: workspace, env: environment,
|
|
90723
|
+
shell: false, windowsHide: true, timeout: 5000, maxBuffer: verification_setup_policy_1.VERIFICATION_SETUP_LIMITS.snapshotBytes + 4096 });
|
|
90724
|
+
if (result.error || result.status !== 0)
|
|
90725
|
+
throw new Error();
|
|
90726
|
+
return result.stdout;
|
|
90727
|
+
};
|
|
90728
|
+
const sha = pinned ?? git('rev-parse', '--verify', `refs/remotes/origin/${mainBranch}^{commit}`).toString('utf8').trim();
|
|
90729
|
+
if (!/^(?:[a-f0-9]{40}|[a-f0-9]{64})$/u.test(sha))
|
|
90730
|
+
throw new Error();
|
|
90731
|
+
sourceSha = sha;
|
|
90732
|
+
const entries = git('ls-tree', '-rz', sourceSha, '--', verification_setup_policy_1.VERIFICATION_SETUP_DIRECTORY).toString('utf8').split('\0').filter(Boolean);
|
|
90733
|
+
if (!entries.length || entries.length > verification_setup_policy_1.VERIFICATION_SETUP_LIMITS.files)
|
|
90734
|
+
throw new verification_setup_policy_1.VerificationSetupError('helper-invalid');
|
|
90735
|
+
let total = 0;
|
|
90736
|
+
const files = entries.map(entry => {
|
|
90737
|
+
const match = /^(100644|100755) blob ([a-f0-9]{40}|[a-f0-9]{64})\t(.+)$/u.exec(entry);
|
|
90738
|
+
if (!match || !match[3].startsWith(`${verification_setup_policy_1.VERIFICATION_SETUP_DIRECTORY}/`))
|
|
90739
|
+
throw new verification_setup_policy_1.VerificationSetupError('helper-invalid');
|
|
90740
|
+
const path = match[3].slice(verification_setup_policy_1.VERIFICATION_SETUP_DIRECTORY.length + 1);
|
|
90741
|
+
if (!/^[A-Za-z0-9_./-]{1,200}$/u.test(path) || path.split('/').some(part => !part || part === '.' || part === '..' || part.endsWith('.') || /^(?:con|prn|aux|nul|com[0-9]|lpt[0-9])(?:\.|$)/iu.test(part)))
|
|
90742
|
+
throw new verification_setup_policy_1.VerificationSetupError('helper-invalid');
|
|
90743
|
+
const bytes = git('cat-file', 'blob', match[2]);
|
|
90744
|
+
total += bytes.length;
|
|
90745
|
+
const digest = (0, node_crypto_1.createHash)(match[2].length === 40 ? 'sha1' : 'sha256').update(`blob ${bytes.length}\0`).update(bytes).digest('hex');
|
|
90746
|
+
if (bytes.length > verification_setup_policy_1.VERIFICATION_SETUP_LIMITS.scriptBytes || total > verification_setup_policy_1.VERIFICATION_SETUP_LIMITS.snapshotBytes || digest !== match[2])
|
|
90747
|
+
throw new verification_setup_policy_1.VerificationSetupError('helper-invalid');
|
|
90748
|
+
return Object.freeze({ path, base64: bytes.toString('base64'), executable: match[1] === '100755' });
|
|
90749
|
+
});
|
|
90750
|
+
const manifest = files.find(file => file.path === 'action.yml');
|
|
90751
|
+
if (!manifest)
|
|
90752
|
+
throw new verification_setup_policy_1.VerificationSetupError('helper-invalid');
|
|
90753
|
+
const bytes = Buffer.from(manifest.base64, 'base64');
|
|
90754
|
+
const text = bytes.toString('utf8');
|
|
90755
|
+
if (!bytes.length || !bytes.equals(Buffer.from(text)) || text.includes('\0'))
|
|
90756
|
+
throw new verification_setup_policy_1.VerificationSetupError('helper-invalid');
|
|
90757
|
+
let action;
|
|
90758
|
+
try {
|
|
90759
|
+
action = (0, js_yaml_1.load)(text);
|
|
90760
|
+
}
|
|
90761
|
+
catch {
|
|
90762
|
+
throw new verification_setup_policy_1.VerificationSetupError('helper-invalid');
|
|
90763
|
+
}
|
|
90764
|
+
if (action?.runs?.using !== 'composite' || !Array.isArray(action.runs.steps) || !action.runs.steps.length || action.runs.steps.length > 32)
|
|
90765
|
+
throw new verification_setup_policy_1.VerificationSetupError('helper-invalid');
|
|
90766
|
+
if (action.runs.steps.some(step => !step || typeof step !== 'object' || 'uses' in step && typeof step.uses === 'string' && step.uses.startsWith('./')))
|
|
90767
|
+
throw new verification_setup_policy_1.VerificationSetupError('helper-invalid');
|
|
90768
|
+
const toolRoot = environment.RUNNER_TOOL_CACHE ? (0, node_fs_1.realpathSync)(environment.RUNNER_TOOL_CACHE) : undefined;
|
|
90769
|
+
snapshot = Object.freeze({ kind: 'ready', files: Object.freeze(files), sourceSha, workspace, ...(toolRoot ? { toolRoot } : {}) });
|
|
90770
|
+
}
|
|
90771
|
+
catch (error) {
|
|
90772
|
+
snapshot = Object.freeze({ kind: 'blocked', reason: error instanceof verification_setup_policy_1.VerificationSetupError ? error.reason : 'source-unavailable', ...(sourceSha ? { sourceSha } : {}) });
|
|
90773
|
+
}
|
|
90774
|
+
try {
|
|
90775
|
+
runtime?.cleanup();
|
|
90776
|
+
}
|
|
90777
|
+
catch {
|
|
90778
|
+
snapshot = Object.freeze({ kind: 'blocked', reason: 'source-unavailable', ...(sourceSha ? { sourceSha } : {}) });
|
|
90779
|
+
}
|
|
90780
|
+
return snapshot;
|
|
90781
|
+
}
|
|
90782
|
+
|
|
90783
|
+
|
|
88371
90784
|
/***/ }),
|
|
88372
90785
|
|
|
88373
90786
|
/***/ 92540:
|
|
@@ -88525,26 +90938,64 @@ const logger_1 = __nccwpck_require__(91151);
|
|
|
88525
90938
|
const issue_content_interface_1 = __nccwpck_require__(60608);
|
|
88526
90939
|
const configuration_payload_policy_1 = __nccwpck_require__(58043);
|
|
88527
90940
|
const application_error_1 = __nccwpck_require__(75999);
|
|
90941
|
+
const configuration_markers_1 = __nccwpck_require__(4586);
|
|
88528
90942
|
class ConfigurationHandler extends issue_content_interface_1.IssueContentInterface {
|
|
88529
90943
|
constructor() {
|
|
88530
90944
|
super(...arguments);
|
|
90945
|
+
this.getContent = (description) => {
|
|
90946
|
+
const block = (0, configuration_markers_1.readConfigurationBlock)(description);
|
|
90947
|
+
return block.kind === 'present' ? block.content : undefined;
|
|
90948
|
+
};
|
|
90949
|
+
this.updateContent = (description, content) => {
|
|
90950
|
+
if (description === undefined || content === undefined)
|
|
90951
|
+
return undefined;
|
|
90952
|
+
const updated = (0, configuration_markers_1.writeConfigurationBlock)(description, content);
|
|
90953
|
+
if (updated === undefined)
|
|
90954
|
+
(0, logger_1.logError)('The content has a problem with open-close tags: stored configuration.');
|
|
90955
|
+
return updated;
|
|
90956
|
+
};
|
|
88531
90957
|
this.update = async (query, context) => {
|
|
88532
90958
|
const storedRaw = await this.internalGetter(query);
|
|
88533
90959
|
return this.internalUpdate(query, (0, configuration_payload_policy_1.buildConfigurationPayload)(context, storedRaw));
|
|
88534
90960
|
};
|
|
88535
90961
|
this.get = async (query) => {
|
|
90962
|
+
let description;
|
|
90963
|
+
try {
|
|
90964
|
+
description = await this.issueDescriptionPort.getDescription(query.owner, query.repository, query.issueNumber, query.token);
|
|
90965
|
+
}
|
|
90966
|
+
catch (cause) {
|
|
90967
|
+
const semanticError = (0, application_error_1.toApplicationError)(cause, 'provider.unavailable', 'Unable to read issue configuration.');
|
|
90968
|
+
(0, logger_1.logError)(semanticError);
|
|
90969
|
+
throw semanticError;
|
|
90970
|
+
}
|
|
90971
|
+
const variables = { issueNumber: query.issueNumber, expectedVersion: config_1.CONFIG_SCHEMA_VERSION };
|
|
90972
|
+
let recovery = { id: 'stored-configuration-invalid', variables };
|
|
88536
90973
|
try {
|
|
88537
|
-
const description = await this.issueDescriptionPort.getDescription(query.owner, query.repository, query.issueNumber, query.token);
|
|
88538
90974
|
const config = this.getContent(description);
|
|
88539
90975
|
if (config === undefined) {
|
|
90976
|
+
if ((0, configuration_markers_1.readConfigurationBlock)(description).kind === 'invalid') {
|
|
90977
|
+
throw new Error('Stored configuration markers are inconsistent.');
|
|
90978
|
+
}
|
|
88540
90979
|
return undefined;
|
|
88541
90980
|
}
|
|
88542
|
-
const
|
|
90981
|
+
const parsed = JSON.parse(config);
|
|
90982
|
+
if (parsed !== null && typeof parsed === 'object' && !Array.isArray(parsed)) {
|
|
90983
|
+
const version = parsed.schemaVersion;
|
|
90984
|
+
if (version === undefined) {
|
|
90985
|
+
recovery = { id: 'stored-configuration-schema-missing', variables };
|
|
90986
|
+
}
|
|
90987
|
+
else if (typeof version === 'number' && Number.isSafeInteger(version)
|
|
90988
|
+
&& version >= 0 && version !== config_1.CONFIG_SCHEMA_VERSION) {
|
|
90989
|
+
recovery = { id: 'stored-configuration-schema-unsupported', variables: { ...variables, actualVersion: version } };
|
|
90990
|
+
}
|
|
90991
|
+
}
|
|
90992
|
+
const branchConfig = (0, config_1.requireCurrentConfigurationPayload)(parsed);
|
|
88543
90993
|
return new config_1.Config(branchConfig);
|
|
88544
90994
|
}
|
|
88545
|
-
catch (
|
|
88546
|
-
|
|
88547
|
-
|
|
90995
|
+
catch (cause) {
|
|
90996
|
+
const semanticError = (0, application_error_1.toApplicationError)(cause, 'configuration.invalid', 'Stored issue/PR configuration is invalid.', { recovery });
|
|
90997
|
+
(0, logger_1.logError)(semanticError);
|
|
90998
|
+
throw semanticError;
|
|
88548
90999
|
}
|
|
88549
91000
|
};
|
|
88550
91001
|
}
|
|
@@ -88558,6 +91009,96 @@ class ConfigurationHandler extends issue_content_interface_1.IssueContentInterfa
|
|
|
88558
91009
|
exports.ConfigurationHandler = ConfigurationHandler;
|
|
88559
91010
|
|
|
88560
91011
|
|
|
91012
|
+
/***/ }),
|
|
91013
|
+
|
|
91014
|
+
/***/ 4586:
|
|
91015
|
+
/***/ ((__unused_webpack_module, exports) => {
|
|
91016
|
+
|
|
91017
|
+
"use strict";
|
|
91018
|
+
|
|
91019
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
91020
|
+
exports.CONFIGURATION_END = exports.CONFIGURATION_START = void 0;
|
|
91021
|
+
exports.readConfigurationBlock = readConfigurationBlock;
|
|
91022
|
+
exports.writeConfigurationBlock = writeConfigurationBlock;
|
|
91023
|
+
exports.CONFIGURATION_START = '<!-- copilot-configuration-start';
|
|
91024
|
+
exports.CONFIGURATION_END = 'copilot-configuration-end -->';
|
|
91025
|
+
/** Owned delimiters begin a line; ordinary mentions are not state. Complete legacy fenced records remain readable. */
|
|
91026
|
+
function readConfigurationBlock(description) {
|
|
91027
|
+
if (description === undefined)
|
|
91028
|
+
return { kind: 'absent' };
|
|
91029
|
+
let fence;
|
|
91030
|
+
let fencedMarker = false;
|
|
91031
|
+
let fencedStart;
|
|
91032
|
+
let nestedFencedStart = false;
|
|
91033
|
+
let start;
|
|
91034
|
+
let contentStart = 0;
|
|
91035
|
+
let block;
|
|
91036
|
+
let offset = 0;
|
|
91037
|
+
for (const line of description.match(/[^\n]*(?:\n|$)/gu) ?? []) {
|
|
91038
|
+
const text = line.replace(/\r?\n$/u, '');
|
|
91039
|
+
const starts = /^ {0,3}<!-- copilot-configuration-start(?:[ \t]|$)/u.test(text);
|
|
91040
|
+
const ends = /^ {0,3}copilot-configuration-end -->[ \t]*$/u.test(text);
|
|
91041
|
+
const boundary = /^ {0,3}(`{3,}|~{3,})(.*)$/u.exec(text);
|
|
91042
|
+
if (fence) {
|
|
91043
|
+
fencedMarker || (fencedMarker = starts || ends);
|
|
91044
|
+
if (starts) {
|
|
91045
|
+
if (fencedStart !== undefined)
|
|
91046
|
+
nestedFencedStart = true;
|
|
91047
|
+
else
|
|
91048
|
+
fencedStart = offset + text.indexOf(exports.CONFIGURATION_START);
|
|
91049
|
+
}
|
|
91050
|
+
const end = text.indexOf(exports.CONFIGURATION_END);
|
|
91051
|
+
if (fencedStart !== undefined && end >= 0 && !text.slice(end + exports.CONFIGURATION_END.length).trim()) {
|
|
91052
|
+
if (block || nestedFencedStart)
|
|
91053
|
+
return { kind: 'invalid' };
|
|
91054
|
+
block = { kind: 'present', start: fencedStart, end: offset + end + exports.CONFIGURATION_END.length,
|
|
91055
|
+
content: description.slice(fencedStart + exports.CONFIGURATION_START.length, offset + end) };
|
|
91056
|
+
fencedStart = undefined;
|
|
91057
|
+
}
|
|
91058
|
+
if (boundary && boundary[1][0] === fence[0] && boundary[1].length >= fence.length && !boundary[2].trim()) {
|
|
91059
|
+
fence = undefined;
|
|
91060
|
+
fencedMarker = false;
|
|
91061
|
+
fencedStart = undefined;
|
|
91062
|
+
nestedFencedStart = false;
|
|
91063
|
+
}
|
|
91064
|
+
}
|
|
91065
|
+
else if (start !== undefined || starts) {
|
|
91066
|
+
if (starts) {
|
|
91067
|
+
if (start !== undefined || block)
|
|
91068
|
+
return { kind: 'invalid' };
|
|
91069
|
+
start = offset + text.indexOf(exports.CONFIGURATION_START);
|
|
91070
|
+
contentStart = start + exports.CONFIGURATION_START.length;
|
|
91071
|
+
}
|
|
91072
|
+
const end = text.indexOf(exports.CONFIGURATION_END);
|
|
91073
|
+
if (end >= 0 && !text.slice(end + exports.CONFIGURATION_END.length).trim()) {
|
|
91074
|
+
block = { kind: 'present', start: start, end: offset + end + exports.CONFIGURATION_END.length,
|
|
91075
|
+
content: description.slice(contentStart, offset + end) };
|
|
91076
|
+
start = undefined;
|
|
91077
|
+
}
|
|
91078
|
+
}
|
|
91079
|
+
else if (ends)
|
|
91080
|
+
return { kind: 'invalid' };
|
|
91081
|
+
else if (boundary && (boundary[1][0] !== '`' || !boundary[2].includes('`')))
|
|
91082
|
+
fence = boundary[1];
|
|
91083
|
+
offset += line.length;
|
|
91084
|
+
}
|
|
91085
|
+
// A legacy block behind an unclosed fence is ambiguous: never silently discard its state.
|
|
91086
|
+
if (start !== undefined || fence && fencedMarker)
|
|
91087
|
+
return { kind: 'invalid' };
|
|
91088
|
+
return block ?? { kind: 'absent', ...(fence ? { closingFence: fence } : {}) };
|
|
91089
|
+
}
|
|
91090
|
+
function writeConfigurationBlock(description, content) {
|
|
91091
|
+
const block = readConfigurationBlock(description);
|
|
91092
|
+
if (block.kind === 'invalid')
|
|
91093
|
+
return undefined;
|
|
91094
|
+
const replacement = `${exports.CONFIGURATION_START}\n${content}\n${exports.CONFIGURATION_END}`;
|
|
91095
|
+
if (block.kind === 'present')
|
|
91096
|
+
return description.slice(0, block.start) + replacement + description.slice(block.end);
|
|
91097
|
+
// Closing an otherwise empty dangling example preserves its rendered text and keeps new state outside it.
|
|
91098
|
+
return `${description}\n\n${block.closingFence ? `${block.closingFence}\n\n` : ''}${replacement}`;
|
|
91099
|
+
}
|
|
91100
|
+
|
|
91101
|
+
|
|
88561
91102
|
/***/ }),
|
|
88562
91103
|
|
|
88563
91104
|
/***/ 58043:
|
|
@@ -88687,11 +91228,13 @@ function getBranchSyncConflictsPrompt(params) {
|
|
|
88687
91228
|
"use strict";
|
|
88688
91229
|
|
|
88689
91230
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
91231
|
+
exports.BUGBOT_FINDING_GROUNDING_INSTRUCTION = void 0;
|
|
88690
91232
|
exports.getBugbotPrompt = getBugbotPrompt;
|
|
88691
91233
|
/**
|
|
88692
91234
|
* Prompt for Bugbot detection (detect potential problems on push).
|
|
88693
91235
|
*/
|
|
88694
91236
|
const fill_1 = __nccwpck_require__(2559);
|
|
91237
|
+
exports.BUGBOT_FINDING_GROUNDING_INSTRUCTION = 'Before returning a finding, try to disprove it against the exact reviewed source. Read effective repository configuration and inherited library/protocol defaults before inferring behavior from a missing command flag. Trace short-circuit guards, validation helpers and the actual caller/render path before claiming that an unsafe branch is reachable or that separate call sites coexist. Recompute arithmetic and check cited line numbers against the current file/diff. If your evidence refutes the alleged defect, withdraw the finding entirely; do not publish a contradictory or self-refuting report. These checks apply equally to low/info severity. Report a confirmed failure when those protections are absent; do not assume they exist.';
|
|
88695
91238
|
const TEMPLATE = `You are analyzing the latest code changes for potential bugs and issues.
|
|
88696
91239
|
|
|
88697
91240
|
Write every human-readable finding title, description, evidence, and suggestion in {{targetLocale}}. Preserve identifiers, code, symbols, paths, refs, commands, and URLs verbatim. Echo \`outputLocale\` exactly as \`{{targetLocale}}\`.
|
|
@@ -88727,6 +91270,8 @@ For every finding:
|
|
|
88727
91270
|
- include the nearest stable \`symbol\` and a minimal exact \`codeSnippet\` when available so the finding can survive rebases, line movement, and file renames.
|
|
88728
91271
|
- when a fix is a safe replacement of exactly the reported line range, include only the replacement text in \`suggestedCode\`; otherwise omit it.
|
|
88729
91272
|
|
|
91273
|
+
${exports.BUGBOT_FINDING_GROUNDING_INSTRUCTION}
|
|
91274
|
+
|
|
88730
91275
|
Return every finding field required by the response schema. Use null for file, line, endLine, severity, confidence, category, evidence, suggestion, symbol, codeSnippet, or suggestedCode when that value does not safely apply. Only include files outside the ignore list.
|
|
88731
91276
|
{{previousBlock}}
|
|
88732
91277
|
|
|
@@ -90204,11 +92749,13 @@ const setup_approval_workflow_1 = __nccwpck_require__(9512);
|
|
|
90204
92749
|
const setup_workflow_upgrade_1 = __nccwpck_require__(85493);
|
|
90205
92750
|
const setup_installation_review_1 = __nccwpck_require__(23799);
|
|
90206
92751
|
const repository_agent_guidance_policy_1 = __nccwpck_require__(67402);
|
|
92752
|
+
const setup_verification_action_1 = __nccwpck_require__(12471);
|
|
90207
92753
|
/**
|
|
90208
92754
|
* Ensure .github, .github/workflows and .github/ISSUE_TEMPLATE exist; create them if missing.
|
|
90209
92755
|
* @param cwd - Directory (repo root)
|
|
90210
92756
|
*/
|
|
90211
92757
|
function ensureGitHubDirs(cwd) {
|
|
92758
|
+
(0, setup_verification_action_1.inspectSetupVerificationActionPath)(cwd);
|
|
90212
92759
|
const githubDir = path.join(cwd, '.github');
|
|
90213
92760
|
const workflowsDir = path.join(cwd, '.github', 'workflows');
|
|
90214
92761
|
const issueTemplateDir = path.join(cwd, '.github', 'ISSUE_TEMPLATE');
|
|
@@ -90241,6 +92788,7 @@ function copySetupFiles(cwd, setupDirOverride, features, options = {}) {
|
|
|
90241
92788
|
const installationReview = options.setupConfiguration && (0, setup_installation_review_1.inspectSetupInstallation)(cwd, options.setupConfiguration, setupDir);
|
|
90242
92789
|
if (installationReview?.blockers.length)
|
|
90243
92790
|
throw new Error(installationReview.blockers.join(' '));
|
|
92791
|
+
const verificationAction = (0, setup_verification_action_1.createSetupVerificationAction)(cwd, options.verificationActionState);
|
|
90244
92792
|
const preserveSourceGuidance = installationReview?.assets.some(asset => asset.path === repository_agent_guidance_policy_1.REPOSITORY_AGENT_GUIDE_PATH && asset.status === 'source-only');
|
|
90245
92793
|
const sourceInstallation = installationReview?.assets.some(asset => asset.path.startsWith('.github/workflows/') && asset.status === 'source-only');
|
|
90246
92794
|
const snapshotContent = options.setupConfiguration && (0, setup_installation_review_1.renderSetupRunnerSnapshot)(options.setupConfiguration);
|
|
@@ -90295,7 +92843,7 @@ function copySetupFiles(cwd, setupDirOverride, features, options = {}) {
|
|
|
90295
92843
|
snapshot.copied++;
|
|
90296
92844
|
}
|
|
90297
92845
|
}
|
|
90298
|
-
return [retired, workflows, approvalWorkflow, issueTemplates, pullRequestTemplate, guidance, snapshot].reduce((total, current) => ({
|
|
92846
|
+
return [verificationAction, retired, workflows, approvalWorkflow, issueTemplates, pullRequestTemplate, guidance, snapshot].reduce((total, current) => ({
|
|
90299
92847
|
copied: total.copied + current.copied,
|
|
90300
92848
|
skipped: total.skipped + current.skipped,
|
|
90301
92849
|
}), { copied: 0, skipped: 0 });
|
|
@@ -90509,6 +93057,9 @@ const setup_workflow_upgrade_1 = __nccwpck_require__(85493);
|
|
|
90509
93057
|
const setup_approval_workflow_1 = __nccwpck_require__(9512);
|
|
90510
93058
|
const sensitive_text_1 = __nccwpck_require__(47122);
|
|
90511
93059
|
const repository_agent_guidance_policy_1 = __nccwpck_require__(67402);
|
|
93060
|
+
const setup_verification_action_1 = __nccwpck_require__(33156);
|
|
93061
|
+
const setup_verification_action_2 = __nccwpck_require__(12471);
|
|
93062
|
+
const copilot_comment_workflow_1 = __nccwpck_require__(33430);
|
|
90512
93063
|
exports.SETUP_RUNNER_SNAPSHOT = '.copilot/runner-profile.json';
|
|
90513
93064
|
const object = (value) => value !== null && typeof value === 'object' && !Array.isArray(value)
|
|
90514
93065
|
? value : undefined;
|
|
@@ -90550,6 +93101,22 @@ function inspectSetupInstallation(root, configuration, setup = (0, node_path_1.j
|
|
|
90550
93101
|
const jobs = [];
|
|
90551
93102
|
const changes = [];
|
|
90552
93103
|
const blockers = [];
|
|
93104
|
+
let action;
|
|
93105
|
+
try {
|
|
93106
|
+
action = (0, setup_verification_action_2.inspectSetupVerificationActionPath)(root);
|
|
93107
|
+
}
|
|
93108
|
+
catch (error) {
|
|
93109
|
+
action = 'blocked';
|
|
93110
|
+
blockers.push(error instanceof Error ? error.message : 'Verification setup path could not be inspected.');
|
|
93111
|
+
}
|
|
93112
|
+
const verificationSetup = { action, enabled: configuration.repository.verificationSetup ?? false,
|
|
93113
|
+
mainBranch: configuration.repository.mainBranch };
|
|
93114
|
+
assets.push({ path: setup_verification_action_1.SETUP_VERIFICATION_ACTION_PATH, enabled: verificationSetup.enabled,
|
|
93115
|
+
status: action === 'create' ? 'missing' : action === 'preserve' ? 'customized' : 'incompatible' });
|
|
93116
|
+
if (action === 'blocked')
|
|
93117
|
+
return { assets, jobs, changes, blockers, verificationSetup };
|
|
93118
|
+
if (action === 'create')
|
|
93119
|
+
changes.push({ path: setup_verification_action_1.SETUP_VERIFICATION_ACTION_PATH, before: null, after: (0, setup_verification_action_2.readSetupVerificationActionStarter)() });
|
|
90553
93120
|
const addJobs = (file, content, retained) => {
|
|
90554
93121
|
const documents = (0, js_yaml_1.loadAll)(content);
|
|
90555
93122
|
if (documents.length !== 1)
|
|
@@ -90558,7 +93125,7 @@ function inspectSetupInstallation(root, configuration, setup = (0, node_path_1.j
|
|
|
90558
93125
|
if (!parsedJobs)
|
|
90559
93126
|
throw new Error('Workflow jobs are unavailable for review.');
|
|
90560
93127
|
for (const [job, raw] of Object.entries(parsedJobs)) {
|
|
90561
|
-
const runsOn = object(raw)
|
|
93128
|
+
const runsOn = (0, copilot_comment_workflow_1.copilotCommentRunner)(object(raw));
|
|
90562
93129
|
if (runsOn === undefined)
|
|
90563
93130
|
continue; // reusable workflow calls have no runner
|
|
90564
93131
|
jobs.push({ file, job, role: (0, setup_runner_policy_1.setupRunnerRole)(file, job) ?? 'validation',
|
|
@@ -90646,7 +93213,7 @@ function inspectSetupInstallation(root, configuration, setup = (0, node_path_1.j
|
|
|
90646
93213
|
before: before === undefined ? null : (0, sensitive_text_1.redactSensitiveText)(before), after: (0, sensitive_text_1.redactSensitiveText)(after) });
|
|
90647
93214
|
if (after !== undefined && before !== undefined && !compatibleSetupRunnerSnapshot(before))
|
|
90648
93215
|
blockers.push('Runner snapshot is incompatible. Retain it or restore a supported version before replacing routing.');
|
|
90649
|
-
return { assets, jobs, changes, blockers };
|
|
93216
|
+
return { assets, jobs, changes, blockers, verificationSetup };
|
|
90650
93217
|
}
|
|
90651
93218
|
|
|
90652
93219
|
|
|
@@ -90665,6 +93232,7 @@ const js_yaml_1 = __nccwpck_require__(783);
|
|
|
90665
93232
|
const node_util_1 = __nccwpck_require__(47261);
|
|
90666
93233
|
const setup_runner_policy_1 = __nccwpck_require__(91027);
|
|
90667
93234
|
const action_types_1 = __nccwpck_require__(19625);
|
|
93235
|
+
const copilot_comment_workflow_1 = __nccwpck_require__(33430);
|
|
90668
93236
|
const object = (value) => value !== null && typeof value === 'object' && !Array.isArray(value) ? value : undefined;
|
|
90669
93237
|
const document = (value) => {
|
|
90670
93238
|
try {
|
|
@@ -90686,6 +93254,8 @@ const runner = (value) => labels(value) || !!object(value)
|
|
|
90686
93254
|
&& (object(value).labels === undefined || labels(object(value).labels));
|
|
90687
93255
|
const copilotCommands = new Set(Object.values(action_types_1.ACTIONS));
|
|
90688
93256
|
const callsRootAction = (jobs) => !!jobs && Object.values(jobs).some(job => {
|
|
93257
|
+
if (object(job)?.uses === copilot_comment_workflow_1.COPILOT_COMMENT_SELF_WORKFLOW)
|
|
93258
|
+
return true;
|
|
90689
93259
|
const steps = object(job)?.steps;
|
|
90690
93260
|
return Array.isArray(steps) && steps.some(step => {
|
|
90691
93261
|
const invocation = object(step);
|
|
@@ -90748,6 +93318,32 @@ function renderSetupWorkflowUpgrade(template, existing, selection) {
|
|
|
90748
93318
|
const templateJobs = object(document(template)?.jobs);
|
|
90749
93319
|
if (!previousJobs || !templateJobs)
|
|
90750
93320
|
throw new Error('Workflow jobs cannot be inspected; review the workflow separately.');
|
|
93321
|
+
if (Object.values(templateJobs).some(job => (0, copilot_comment_workflow_1.isCopilotCommentWorkflow)(object(job)?.uses))) {
|
|
93322
|
+
const parsed = document(template);
|
|
93323
|
+
const jobs = object(parsed.jobs);
|
|
93324
|
+
let changed = false;
|
|
93325
|
+
for (const [name, value] of Object.entries(jobs)) {
|
|
93326
|
+
const job = object(value);
|
|
93327
|
+
if (!(0, copilot_comment_workflow_1.isCopilotCommentWorkflow)(job.uses))
|
|
93328
|
+
throw new Error('Mixed comment workflow jobs require separate workflow review before setup.');
|
|
93329
|
+
const previousJob = object(previousJobs[name]);
|
|
93330
|
+
if (Array.isArray(previousJob?.steps) && previousJob.steps.some(raw => {
|
|
93331
|
+
const uses = object(raw)?.uses;
|
|
93332
|
+
return typeof uses !== 'string' || !(uses.startsWith('actions/checkout@')
|
|
93333
|
+
|| /^vypdev\/copilot@[^\s]+$/u.test(uses) || uses === './.git/copilot-verification-setup');
|
|
93334
|
+
}))
|
|
93335
|
+
throw new Error('Custom comment job steps require migration to the reviewed repository verification setup action before switching to the reusable workflow. Review the workflow separately.');
|
|
93336
|
+
const retained = (0, setup_runner_policy_1.selectedSetupRunsOn)(selection?.runners, selection && (0, setup_runner_policy_1.setupRunnerRole)(selection.file, name))
|
|
93337
|
+
?? (0, copilot_comment_workflow_1.copilotCommentRunner)(previousJob) ?? (0, copilot_comment_workflow_1.copilotCommentRunner)(job);
|
|
93338
|
+
if (!runner(retained))
|
|
93339
|
+
throw new Error('Existing runner selection is invalid; review the workflow separately.');
|
|
93340
|
+
if (JSON.stringify(retained).includes('${{') && existing !== template)
|
|
93341
|
+
throw new Error('Dynamic runner selection requires separate workflow review before setup.');
|
|
93342
|
+
changed || (changed = !(0, node_util_1.isDeepStrictEqual)(retained, (0, copilot_comment_workflow_1.copilotCommentRunner)(job)));
|
|
93343
|
+
job.with = { ...object(job.with), 'runs-on': JSON.stringify(retained) };
|
|
93344
|
+
}
|
|
93345
|
+
return changed ? (0, js_yaml_1.dump)(parsed, { noRefs: true, lineWidth: -1 }) : template;
|
|
93346
|
+
}
|
|
90751
93347
|
const lines = template.split('\n');
|
|
90752
93348
|
let job = '';
|
|
90753
93349
|
let insideJobs = false;
|
|
@@ -91123,6 +93719,14 @@ module.exports = require("node:stream");
|
|
|
91123
93719
|
|
|
91124
93720
|
/***/ }),
|
|
91125
93721
|
|
|
93722
|
+
/***/ 76915:
|
|
93723
|
+
/***/ ((module) => {
|
|
93724
|
+
|
|
93725
|
+
"use strict";
|
|
93726
|
+
module.exports = require("node:string_decoder");
|
|
93727
|
+
|
|
93728
|
+
/***/ }),
|
|
93729
|
+
|
|
91126
93730
|
/***/ 31764:
|
|
91127
93731
|
/***/ ((module) => {
|
|
91128
93732
|
|