Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 67 additions & 0 deletions build/api/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7038,6 +7038,7 @@ var _ApplicationError_cause;
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.ApplicationError = exports.APPLICATION_ERROR_METADATA = exports.APPLICATION_ERROR_RECOVERY_IDS = void 0;
exports.isApplicationErrorCorrelationId = isApplicationErrorCorrelationId;
const branch_sync_publication_1 = __nccwpck_require__(7857);
const framed_review_1 = __nccwpck_require__(3750);
const progress_response_diagnostic_1 = __nccwpck_require__(6289);
const progress_completion_diagnostic_1 = __nccwpck_require__(5095);
Expand Down Expand Up @@ -7068,6 +7069,8 @@ exports.APPLICATION_ERROR_RECOVERY_IDS = Object.freeze([
'branch-sync-resolution-invalid',
'branch-sync-verification-failed',
'branch-sync-catalog-incompatible',
'branch-sync-workflow-write-required',
'branch-sync-publication-failed',
'sdd-draft-size-exceeded',
'sdd-catalog-unsupported-profile',
'sdd-catalog-format-invalid',
Expand Down Expand Up @@ -7322,6 +7325,8 @@ const RECOVERY_VARIABLE_KEYS = Object.freeze({
'branch-sync-resolution-invalid': Object.freeze(['validationCode', 'command']),
'branch-sync-verification-failed': Object.freeze(['stage', 'reason', 'command', 'commandIndex', 'childSha', 'restoration']),
'branch-sync-catalog-incompatible': Object.freeze(['phase', 'profile', 'field', 'capabilityNumber', 'abort']),
'branch-sync-workflow-write-required': Object.freeze(['reason', 'remoteState', 'originalSha', 'candidateSha', 'observedSha', 'pushAttempted']),
'branch-sync-publication-failed': Object.freeze(['reason', 'remoteState', 'originalSha', 'candidateSha', 'observedSha', 'pushAttempted']),
'sdd-draft-size-exceeded': Object.freeze([]),
'sdd-catalog-unsupported-profile': Object.freeze([]),
'sdd-catalog-format-invalid': Object.freeze([]),
Expand Down Expand Up @@ -7401,6 +7406,12 @@ function normalizeApplicationErrorRecovery(recovery) {
if (recovery.id === 'branch-sync-verification-failed' && !(0, verification_failure_1.isBranchSyncVerificationFailure)(variables)) {
throw new TypeError('Branch synchronization verification diagnostic is invalid.');
}
if (recovery.id === 'branch-sync-workflow-write-required' || recovery.id === 'branch-sync-publication-failed') {
if (!(0, branch_sync_publication_1.isBranchSyncPublicationDiagnostic)(variables) || variables.remoteState === 'published'
|| (recovery.id === 'branch-sync-workflow-write-required') !== (variables.reason === 'workflow-write-required')) {
throw new TypeError('Branch synchronization publication diagnostic is invalid.');
}
}
if (recovery.id === 'branch-sync-catalog-incompatible') {
const { abort, ...diagnostic } = variables;
if (!(0, branch_sync_catalog_diagnostic_1.isBranchSyncCatalogDiagnostic)(diagnostic) || !['completed', 'unverified'].includes(String(abort))) {
Expand Down Expand Up @@ -7726,6 +7737,62 @@ function classifyBranchSyncCatalog(value) {
}


/***/ }),

/***/ 7857:
/***/ ((__unused_webpack_module, exports) => {


Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.BranchSyncPublicationFailure = exports.BRANCH_SYNC_REMOTE_STATES = exports.BRANCH_SYNC_PUBLICATION_REASONS = void 0;
exports.isBranchSyncObjectId = isBranchSyncObjectId;
exports.admittedBranchSyncObjectId = admittedBranchSyncObjectId;
exports.isBranchSyncPublicationDiagnostic = isBranchSyncPublicationDiagnostic;
exports.BRANCH_SYNC_PUBLICATION_REASONS = Object.freeze(['workflow-write-required', 'push-failed', 'candidate-unverified']);
exports.BRANCH_SYNC_REMOTE_STATES = Object.freeze(['unchanged', 'published', 'changed', 'unverified']);
function isBranchSyncObjectId(value) {
return typeof value === 'string' && /^(?:[a-f0-9]{40}|[a-f0-9]{64})$/u.test(value) && !/^0+$/u.test(value);
}
function admittedBranchSyncObjectId(value) {
return isBranchSyncObjectId(value) ? value : 'unavailable';
}
function isBranchSyncPublicationDiagnostic(value) {
if (!value || typeof value !== 'object' || Array.isArray(value))
return false;
const d = value;
if (Object.keys(d).sort().join(',') !== 'candidateSha,observedSha,originalSha,pushAttempted,reason,remoteState'
|| !exports.BRANCH_SYNC_PUBLICATION_REASONS.includes(d.reason) || !exports.BRANCH_SYNC_REMOTE_STATES.includes(d.remoteState)
|| typeof d.pushAttempted !== 'boolean'
|| ![d.originalSha, d.candidateSha, d.observedSha].every(x => x === 'unavailable' || isBranchSyncObjectId(x)))
return false;
if (d.reason === 'candidate-unverified' && (d.pushAttempted || d.candidateSha !== 'unavailable'))
return false;
if (d.reason !== 'candidate-unverified' && (!d.pushAttempted || !isBranchSyncObjectId(d.candidateSha) || d.candidateSha === d.originalSha))
return false;
if (d.remoteState === 'published')
return isBranchSyncObjectId(d.candidateSha) && d.observedSha === d.candidateSha;
if (d.remoteState === 'unchanged')
return isBranchSyncObjectId(d.originalSha) && d.observedSha === d.originalSha && d.observedSha !== d.candidateSha;
if (d.remoteState === 'changed')
return isBranchSyncObjectId(d.originalSha) && isBranchSyncObjectId(d.observedSha)
&& d.observedSha !== d.originalSha && d.observedSha !== d.candidateSha;
return (d.observedSha === 'unavailable' || d.originalSha === 'unavailable')
&& !(isBranchSyncObjectId(d.candidateSha) && d.observedSha === d.candidateSha);
}
/** A committed candidate is no longer an in-progress Git merge. */
class BranchSyncPublicationFailure extends Error {
constructor(diagnostic) {
super('Branch synchronization candidate publication requires reconciliation.');
if (!isBranchSyncPublicationDiagnostic(diagnostic))
throw new TypeError('Invalid branch synchronization publication facts.');
this.name = 'BranchSyncPublicationFailure';
this.diagnostic = Object.freeze({ ...diagnostic });
Object.freeze(this);
}
}
exports.BranchSyncPublicationFailure = BranchSyncPublicationFailure;


/***/ }),

/***/ 981:
Expand Down
5 changes: 4 additions & 1 deletion build/api/src/data/model/application_error.d.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { type BranchSyncPublicationDiagnostic } from '../../domain/branch_sync_publication';
import { type BugbotReviewBlockFacts } from '../../domain/bugbot/framed_review';
import { type ProgressScopeCapacityFacts } from '../../domain/progress_response_diagnostic';
import { type ProgressCompletionDiagnostic } from '../../domain/progress_completion_diagnostic';
Expand All @@ -17,7 +18,7 @@ import { type BranchSyncCatalogDiagnostic } from '../../domain/branch_sync_catal
import { type SddSourceContextDiagnostic } from '../../domain/agent_source_snapshot';
export type ApplicationErrorKind = 'configuration' | 'authorization' | 'provider' | 'agent' | 'validation' | 'workflow' | 'unknown';
export type ApplicationErrorCode = 'configuration.invalid' | 'configuration.unsupported' | 'authorization.denied' | 'authorization.credential-invalid' | 'provider.not-found' | 'provider.conflict' | 'provider.rate-limited' | 'provider.unavailable' | 'provider.contract-invalid' | 'agent.policy-rejected' | 'agent.failed' | 'locale.output-invalid' | 'locale.translation-failed' | 'validation.invalid-input' | 'validation.evidence-too-large' | 'validation.evidence-unavailable' | 'workflow.invalid-event' | 'workflow.stale' | 'workflow.cancelled' | 'workflow.failed' | 'workflow.presentation-pending' | 'timeout' | 'unexpected';
export declare const APPLICATION_ERROR_RECOVERY_IDS: readonly ["comment-command-length", "comment-command-name-missing", "comment-command-name-unknown", "comment-command-argument-count", "comment-command-arguments-unexpected", "comment-command-arguments-missing", "comment-command-finding-quoting", "comment-command-review-format", "comment-command-review-effort", "comment-command-review-boolean", "comment-command-review-option", "comment-command-sync-option", "comment-command-sync-parent", "pull-request-link-restored", "pull-request-link-base-retained", "pull-request-link-reference-retained", "pull-request-link-base-and-reference-retained", "managed-branch-enrichment-failed", "inactivity-explanation-failed", "bugbot-review-blocks-pending", "branch-sync-agent-disabled", "branch-sync-fixer-unavailable", "branch-sync-resolution-invalid", "branch-sync-verification-failed", "branch-sync-catalog-incompatible", "sdd-draft-size-exceeded", "sdd-catalog-unsupported-profile", "sdd-catalog-format-invalid", "sdd-catalog-missing-trusted-source", "sdd-source-context-unavailable", "sdd-draft-format-invalid", "sdd-draft-case-identity-invalid", "sdd-draft-case-budget-invalid", "sdd-draft-requirement-mapping-invalid", "sdd-draft-repository-path-invalid", "deployment-publication-context-missing", "workspace-changes-rejected", "closed-issue-reconciliation-failed", "approval-evidence-read-failed", "change-size-reconciliation-failed", "issue-workflow-admission-blocked", "progress-binary-evidence-unavailable", "progress-inventory-incomplete", "bugbot-review-incomplete", "progress-result-contract-invalid", "progress-partition-length-invalid", "progress-assessment-capacity-exceeded", "progress-scope-clause-limit", "progress-completion-recovery-exhausted", "stored-configuration-schema-missing", "stored-configuration-schema-unsupported", "stored-configuration-invalid"];
export declare const APPLICATION_ERROR_RECOVERY_IDS: readonly ["comment-command-length", "comment-command-name-missing", "comment-command-name-unknown", "comment-command-argument-count", "comment-command-arguments-unexpected", "comment-command-arguments-missing", "comment-command-finding-quoting", "comment-command-review-format", "comment-command-review-effort", "comment-command-review-boolean", "comment-command-review-option", "comment-command-sync-option", "comment-command-sync-parent", "pull-request-link-restored", "pull-request-link-base-retained", "pull-request-link-reference-retained", "pull-request-link-base-and-reference-retained", "managed-branch-enrichment-failed", "inactivity-explanation-failed", "bugbot-review-blocks-pending", "branch-sync-agent-disabled", "branch-sync-fixer-unavailable", "branch-sync-resolution-invalid", "branch-sync-verification-failed", "branch-sync-catalog-incompatible", "branch-sync-workflow-write-required", "branch-sync-publication-failed", "sdd-draft-size-exceeded", "sdd-catalog-unsupported-profile", "sdd-catalog-format-invalid", "sdd-catalog-missing-trusted-source", "sdd-source-context-unavailable", "sdd-draft-format-invalid", "sdd-draft-case-identity-invalid", "sdd-draft-case-budget-invalid", "sdd-draft-requirement-mapping-invalid", "sdd-draft-repository-path-invalid", "deployment-publication-context-missing", "workspace-changes-rejected", "closed-issue-reconciliation-failed", "approval-evidence-read-failed", "change-size-reconciliation-failed", "issue-workflow-admission-blocked", "progress-binary-evidence-unavailable", "progress-inventory-incomplete", "bugbot-review-incomplete", "progress-result-contract-invalid", "progress-partition-length-invalid", "progress-assessment-capacity-exceeded", "progress-scope-clause-limit", "progress-completion-recovery-exhausted", "stored-configuration-schema-missing", "stored-configuration-schema-unsupported", "stored-configuration-invalid"];
export type ApplicationErrorRecoveryId = typeof APPLICATION_ERROR_RECOVERY_IDS[number];
interface ApplicationErrorRecoveryVariables extends Readonly<Record<CopilotCommandValidationReason, Readonly<{
command: CopilotCommandName;
Expand Down Expand Up @@ -74,6 +75,8 @@ interface ApplicationErrorRecoveryVariables extends Readonly<Record<CopilotComma
readonly 'branch-sync-catalog-incompatible': BranchSyncCatalogDiagnostic & Readonly<{
abort: 'completed' | 'unverified';
}>;
readonly 'branch-sync-workflow-write-required': BranchSyncPublicationDiagnostic;
readonly 'branch-sync-publication-failed': BranchSyncPublicationDiagnostic;
readonly 'sdd-draft-size-exceeded': Readonly<Record<string, never>>;
readonly 'sdd-catalog-unsupported-profile': Readonly<Record<string, never>>;
readonly 'sdd-catalog-format-invalid': Readonly<Record<string, never>>;
Expand Down
18 changes: 18 additions & 0 deletions build/api/src/domain/branch_sync_publication.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
export declare const BRANCH_SYNC_PUBLICATION_REASONS: readonly ["workflow-write-required", "push-failed", "candidate-unverified"];
export declare const BRANCH_SYNC_REMOTE_STATES: readonly ["unchanged", "published", "changed", "unverified"];
export interface BranchSyncPublicationDiagnostic {
readonly reason: typeof BRANCH_SYNC_PUBLICATION_REASONS[number];
readonly remoteState: typeof BRANCH_SYNC_REMOTE_STATES[number];
readonly originalSha: string;
readonly candidateSha: string;
readonly observedSha: string;
readonly pushAttempted: boolean;
}
export declare function isBranchSyncObjectId(value: unknown): value is string;
export declare function admittedBranchSyncObjectId(value: unknown): string;
export declare function isBranchSyncPublicationDiagnostic(value: unknown): value is BranchSyncPublicationDiagnostic;
/** A committed candidate is no longer an in-progress Git merge. */
export declare class BranchSyncPublicationFailure extends Error {
readonly diagnostic: BranchSyncPublicationDiagnostic;
constructor(diagnostic: BranchSyncPublicationDiagnostic);
}
Loading
Loading