@databricks-solutions/lakebase-scm-utils 0.2.47 → 0.2.48
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/scripts/index.cjs +55 -2
- package/dist/scripts/index.d.cts +1 -1
- package/dist/scripts/index.d.ts +1 -1
- package/dist/scripts/index.js +54 -2
- package/dist/scripts/lakebase/ci-resolve-branch.cli.cjs +2 -2
- package/dist/scripts/lakebase/ci-resolve-branch.cli.js +2 -2
- package/dist/scripts/lakebase/collapse-heads.cli.cjs +2 -2
- package/dist/scripts/lakebase/collapse-heads.cli.js +2 -2
- package/dist/scripts/lakebase/detect-language.cli.cjs +2 -2
- package/dist/scripts/lakebase/detect-language.cli.js +2 -2
- package/dist/scripts/lakebase/doctor.cli.cjs +2 -2
- package/dist/scripts/lakebase/doctor.cli.js +2 -2
- package/dist/scripts/lakebase/get-connection.cli.cjs +2 -2
- package/dist/scripts/lakebase/get-connection.cli.js +2 -2
- package/dist/scripts/lakebase/index.cjs +55 -2
- package/dist/scripts/lakebase/index.d.cts +29 -11
- package/dist/scripts/lakebase/index.d.ts +29 -11
- package/dist/scripts/lakebase/index.js +54 -2
- package/dist/scripts/lakebase/infra-runner.cli.cjs +2 -2
- package/dist/scripts/lakebase/infra-runner.cli.js +2 -2
- package/dist/scripts/lakebase/new-migration.cli.cjs +2 -2
- package/dist/scripts/lakebase/new-migration.cli.js +2 -2
- package/dist/scripts/lakebase/schema-diff.cli.cjs +2 -2
- package/dist/scripts/lakebase/schema-diff.cli.js +2 -2
- package/dist/scripts/lakebase/schema-migrate.cli.cjs +2 -2
- package/dist/scripts/lakebase/schema-migrate.cli.js +2 -2
- package/dist/scripts/lakebase/scm-claim-feature.cli.cjs +2 -2
- package/dist/scripts/lakebase/scm-claim-feature.cli.js +2 -2
- package/dist/scripts/lakebase/scm-doctor.cli.cjs +2 -2
- package/dist/scripts/lakebase/scm-doctor.cli.js +2 -2
- package/dist/scripts/lakebase/scm-merge.cli.cjs +131 -2
- package/dist/scripts/lakebase/scm-merge.cli.js +131 -2
- package/dist/scripts/lakebase/scm-reconcile-tier.cli.cjs +2 -2
- package/dist/scripts/lakebase/scm-reconcile-tier.cli.js +2 -2
- package/dist/scripts/util/index.cjs +2 -2
- package/dist/scripts/util/index.js +2 -2
- package/package.json +1 -1
- package/scripts/lakebase/scm-merge.ts +91 -0
- package/templates/project/common/.gitignore.base +4 -6
|
@@ -3171,8 +3171,8 @@ declare function reconcileTierToOrigin(args: {
|
|
|
3171
3171
|
}): Promise<string | null>;
|
|
3172
3172
|
|
|
3173
3173
|
declare class ScmMergeError extends Error {
|
|
3174
|
-
readonly code: "no-state-file" | "bad-precondition" | "no-github-remote" | "no-pr-url" | "bad-pr-url" | "merge-failed" | "migrate-failed" | "migrate-timeout" | "migrate-auth";
|
|
3175
|
-
constructor(message: string, code: "no-state-file" | "bad-precondition" | "no-github-remote" | "no-pr-url" | "bad-pr-url" | "merge-failed" | "migrate-failed" | "migrate-timeout" | "migrate-auth");
|
|
3174
|
+
readonly code: "no-state-file" | "bad-precondition" | "no-github-remote" | "no-pr-url" | "bad-pr-url" | "merge-failed" | "promote-conflict" | "migrate-failed" | "migrate-timeout" | "migrate-auth";
|
|
3175
|
+
constructor(message: string, code: "no-state-file" | "bad-precondition" | "no-github-remote" | "no-pr-url" | "bad-pr-url" | "merge-failed" | "promote-conflict" | "migrate-failed" | "migrate-timeout" | "migrate-auth");
|
|
3176
3176
|
}
|
|
3177
3177
|
interface MergeArgs {
|
|
3178
3178
|
projectDir: string;
|
|
@@ -3272,6 +3272,18 @@ interface MergeArgs {
|
|
|
3272
3272
|
refreshed: boolean;
|
|
3273
3273
|
detail?: string;
|
|
3274
3274
|
}>;
|
|
3275
|
+
/** Pre-merge reconcile of a pipeline.json-ledger promotion conflict to the run side (keeps it
|
|
3276
|
+
* tracked). Called ONLY when the PR is CONFLICTING. Defaults to {@link reconcilePromoteRunState};
|
|
3277
|
+
* injected in tests. */
|
|
3278
|
+
reconcileRunState?: (baseBranch: string) => Promise<{
|
|
3279
|
+
reconciled: boolean;
|
|
3280
|
+
detail?: string;
|
|
3281
|
+
}>;
|
|
3282
|
+
/** Fetch the PR's mergeability (to gate the reconcile). Defaults to the real getPullRequest;
|
|
3283
|
+
* injected in tests so the gate is exercised without the network. */
|
|
3284
|
+
fetchPrState?: (ownerRepo: string, headBranch: string) => Promise<{
|
|
3285
|
+
mergeableState?: string;
|
|
3286
|
+
} | undefined>;
|
|
3275
3287
|
}
|
|
3276
3288
|
interface MergeResult {
|
|
3277
3289
|
state: ScmWorkflowState;
|
|
@@ -3300,15 +3312,21 @@ interface MergeResult {
|
|
|
3300
3312
|
warnings: string[];
|
|
3301
3313
|
}
|
|
3302
3314
|
/**
|
|
3303
|
-
*
|
|
3304
|
-
*
|
|
3305
|
-
* the PR head
|
|
3306
|
-
*
|
|
3307
|
-
*
|
|
3308
|
-
*
|
|
3309
|
-
*
|
|
3310
|
-
*
|
|
3315
|
+
* Clear a promotion-merge conflict that is ONLY the pipeline.json ledger, so GitHub can dispatch CI
|
|
3316
|
+
* and merge — WITHOUT untracking the ledger (it's durable run-state that must persist). Merges the
|
|
3317
|
+
* base into the PR head and resolves the ledger path(s) to the head (run) side, then pushes. This is
|
|
3318
|
+
* the merge-layer fix for the "pipeline.json conflict blocks promotion" defect, replacing the wrong
|
|
3319
|
+
* earlier approach of gitignoring/untracking it. Behavior:
|
|
3320
|
+
* - a dirty tree under `.consort/` only is checkpointed first (the run's own bookkeeping);
|
|
3321
|
+
* - a dirty tree OUTSIDE `.consort/` aborts (never auto-commit app code);
|
|
3322
|
+
* - a conflict on any NON-ledger path aborts the merge + surfaces (real divergence isn't resolved);
|
|
3323
|
+
* - a clean merge (no conflict) is a no-op (reconciled:false).
|
|
3324
|
+
* Only call this when the PR is actually CONFLICTING — a clean promote needs no merge commit.
|
|
3311
3325
|
*/
|
|
3326
|
+
declare function reconcilePromoteRunState(projectDir: string, baseBranch: string): Promise<{
|
|
3327
|
+
reconciled: boolean;
|
|
3328
|
+
detail?: string;
|
|
3329
|
+
}>;
|
|
3312
3330
|
declare function defaultRefreshPromoteWorkflows(projectDir: string): Promise<{
|
|
3313
3331
|
refreshed: boolean;
|
|
3314
3332
|
detail?: string;
|
|
@@ -4099,4 +4117,4 @@ declare function applySchemaMigrations(args: ApplySchemaMigrationsArgs): Promise
|
|
|
4099
4117
|
declare function rollbackSchemaMigration(args: RollbackSchemaMigrationArgs): Promise<RollbackSchemaMigrationResult>;
|
|
4100
4118
|
declare function schemaMigrationStatus(args: SchemaMigrationStatusArgs): Promise<SchemaMigrationStatusResult>;
|
|
4101
4119
|
|
|
4102
|
-
export { type AbandonFeatureArgs, type AbandonFeatureResult, type AddE2eToRunTestsScriptArgs, type AddE2eToRunTestsScriptResult, type AddInfraToPackageJsonArgs, type AddInfraToPackageJsonResult, type AddInfraToRunTestsScriptArgs, type AddInfraToRunTestsScriptResult, type AddPlaywrightToPackageJsonArgs, type AddPlaywrightToPackageJsonResult, type AddPythonE2eDepsArgs, type AddPythonE2eDepsResult, type AdoptLakebaseProjectArgs, type AdoptLakebaseProjectResult, type AdoptStateArgs, type AdoptStateResult, type AppServicePrincipal, type AppliedSchemaMigration, type ApplySchemaMigrationsArgs, type ApplySchemaMigrationsResult, type BranchLookupOpts, type BranchMetadata, CONVENTION_TIER_DEFAULTS, type CatalogExistsArgs, type CheckoutMode, type CheckoutPairedArgs, type CheckoutPairedResult, type ClaimFeatureBranchArgs, type ClaimFeatureBranchResult, type ClaimedOrphan, type ClientFramework, type CommandDriftReport, type CommandFileEntry, type CommandFileStatus, type ConnectionArgs, type ConsortSetupHooks, type CreateBranchArgs, type CreateConventionBranchArgs, type CreateConventionPairedBranchArgs, type CreateLongRunningBranchArgs, type CreateLongRunningBranchResult, type CreatePairedBranchArgs, type CreatePairedBranchResult, type CreateProjectArgs, type CreateProjectResult, type CutBackupArgs, type CutBackupResult, DEFAULT_PROTECTED_TIER_NAMES, type DatabricksProfile, type DeleteAppEndpointArgs, type DeleteAppEndpointResult, type DeleteBranchArgs, type DeletePairedBranchArgs, type DeletePairedBranchResult, type DeployClaudeCommandsOptions, type DeployClaudeCommandsResult, type DeployEnvExampleArgs, type DeployLanguageProjectArgs, type DeploySpringStarterArgs, type DeployTarget, type DeployTargetsConfig, type DetectCommandDriftArgs, type DetectScaffoldedDriftArgs, type DetectWorkflowDriftArgs, type DoctorArgs$1 as DoctorArgs, type DoctorFinding, type DoctorReport$1 as DoctorReport, type DoctorSeverity, type DsnArgs, type DsnResult, type EnableE2eForProjectArgs, type EnableE2eForProjectResult, type EnableInfraForProjectArgs, type EnableInfraForProjectResult, type EndpointInfo, type EnsureAppEndpointArgs, type EnsureAppEndpointResult, type EnsureEndpointArgs, type EnsureLakebaseSecretAuthArgs, type EnsureLakebaseSecretAuthResult, type EnsureProfilePinnedArgs, type EnsureProfilePinnedResult, type EnsureSchemaAndVolumeArgs, type EnsureSchemaAndVolumeResult, FIXABLE_FINDING_IDS, type FixFindingArgs, type FixFindingResult, type FixableFindingId, type GateInvariant, type GateStatus, type GenerateAppYamlOptions, type GenerateMavenProjectOptions, type GetAppEndpointArgs, type GetAppEndpointResult, type GetAppServicePrincipalArgs, type GetCiAppEndpointArgs, type GetCiAppEndpointResult, type GetConnectionArgs, type GetCredentialArgs, type GetEndpointArgs, type GetSchemaDiffArgs, type GrantLakebasePermissionArgs, type GrantLakebasePermissionResult, type GrantUcCatalogPermissionArgs, type GrantUcCatalogPermissionResult, type DoctorReport as HealthDoctorReport, type HookVerification, type InfraCheckResult, type InfraSuiteResult, type InitWorkflowStateArgs, type InitializrMetadata, InitializrNetworkError, InitializrParseError, type InstallPlaywrightArgs, type InstallPlaywrightOptions, type InstallPlaywrightResult, LakebaseBranchError, type LakebaseBranchInfo, LakebaseBranchTtlTooLongError, type LakebasePermissionLevel, type LakebaseProjectArgs, LakebaseProjectError, type LakebaseProjectInfo, type LakebaseProjectMetadata, type ListSchemaMigrationsArgs, MIGRATION_DEFAULTS, type MergeArgs, type MergePairedArgs, type MergePairedResult, type MergeResult, type MigrationDefaults, type MigrationLanguage, type MigrationLayout, type ModifiedSchemaObject, NODE_E2E_TEMPLATE_FILES, type OrphanCandidate, PLAYWRIGHT_TEMPLATE_FILES, PLAYWRIGHT_TEST_VERSION_RANGE, PYTEST_BDD_VERSION_RANGE, PYTEST_PLAYWRIGHT_VERSION_RANGE, PYTHON_E2E_TEMPLATE_FILES, type PendingSchemaMigration, type PoolArgs, type PreflightResult, type PreparePrArgs, type PreparePrResult, type ProgressCallback, type ProjectLanguage, type PropagateCredentialsArgs, type PropagateCredentialsResult, ProtectedBranchCommitError, type QueryBranchSchemaArgs, type RecoverOrphansArgs, type RecoverOrphansResult, type ReleaseArgs, type ReleaseResult, type RemoveRunnerArgs, type ResolveDatabricksHostArgs, type ResolveMigrationLayoutArgs, type RollbackDeployArgs, type RollbackDeployResult, type RollbackOptions, type RollbackSchemaMigrationArgs, type RollbackSchemaMigrationResult, type RunDoctorDeps, type RunInfraSuiteArgs, type RunPlaywrightInstallArgs, type RunPlaywrightInstallResult, type RunnerInfo, type RunnerReportFn, type RunnerType, SCM_STATES, STATE_FILE_REL, type ScaffoldAllArgs, type ScaffoldOptions, type ScaffoldReportFn, type ScaffoldStaticAllArgs, type ScaffoldStaticAllResult, type ScaffoldedDriftReport, type SchemaColumn, type SchemaDiffResult, SchemaMigrationError, type SchemaMigrationFile, type SchemaMigrationLanguage, type SchemaMigrationStatusArgs, type SchemaMigrationStatusResult, type SchemaMigrationToolName, type SchemaObject, type SchemaQueryRow, ScmAbandonError, ScmAdoptError, ScmClaimError, ScmDoctorFixError, ScmMergeError, ScmPreparePrError, ScmRecoverError, type ScmState, ScmWaitCiError, type ScmWorkflowState, type SetupRunnerArgs, type SftddSetupHooks, SpringInitializrClient, type SpringJvmLanguage, type StaleBranchFinding, type SyncEnvArgs, type SyncEnvResult, type TableSchema, type TierTopology, type TryCreateCatalogArgs, type TryCreateCatalogResult, type UcCatalogPermission, type UpdateEnvConnectionArgs, type UpdateWorkflowsArgs, type UpdateWorkflowsResult, type UploadDirectoryArgs, type UploadDirectoryResult, type ValidateAppOptions, type ValidateAppResult, type ValidationError, type ValidationResult, type WaitCiArgs, type WaitCiResult, type WaitForBranchAuthReadyArgs, type WaitForBranchReadyArgs, type WorkflowDriftReport, type WorkflowFileStatus, type WorkflowFileUpdate, type WorkflowStatus, type WorkflowUpdateOutcome, type WorkflowVerification, type WriteEnvFileArgs, type WritePlaywrightTemplatesArgs, type WritePlaywrightTemplatesResult, _testMakeBrownfieldFixture, abandonFeatureBranch, addE2eToRunTestsScript, addInfraToPackageJson, addInfraToRunTestsScript, addPlaywrightToPackageJson, adoptLakebaseProject, adoptScmState, applySchemaMigrations, assertAdoptionPreflight, assertCleanForFork, assertCommitTargetNotProtected, assertCreatedProjectReady, buildPostgresUrl, buildSchemaQuery, cacheProjectRetention, catalogExists, catalogExplorerUrl, checkDatabricksAuth, checkoutPaired, claimFeatureBranch, clearRetentionCache, compileMigrationPattern, connectionApplicationName, createBranch, createFeaturePairedBranch, createLakebaseProject, createLongRunningBranch, createPairedBranch, createPerfPairedBranch, createProject, createTestPairedBranch, createUatPairedBranch, cutBackup, databricksAuthPrereqMessage, defaultRefreshPromoteWorkflows, deleteAppEndpoint, deleteBranch, deleteLakebaseProject, deletePairedBranch, deployClaudeAgents, deployClaudeCommands, deployClaudeSettings, deployClaudeSkills, deployClientProject, deployDeployTargets, deployEnv, deployEnvExample, deployGitignore, deployLanguageProject, deployScripts, deploySpringStarter, deployVscodeSettings, deployWorkflows, deriveCiAppName, describeGates, detectCommandDrift, detectLanguage, detectLanguageAt, detectScaffoldedDrift, detectWorkflowDrift, dirIsEmpty, enableE2eForProject, enableInfraForProject, endpointPath, ensureAppEndpoint, ensureCachedArchive, ensureEndpoint, ensureLakebaseSecretAuth, ensureProfilePinned, ensurePythonBddDeps, ensurePythonE2eDeps, ensureSchemaAndVolume, extractPullNumber, featureBranchName, findDefaultBranchName, findHistoryRetentionDuration, fixFinding, formatJUnit, formatSchemaDiffAsMarkdown, generateAppYaml, getAppEndpoint, getAppServicePrincipal, getBranchByName, getCachedProjectRetention, getCiAppEndpoint, getConnection, getCredential, getDefaultBranch, getDefaultBranchId, getDefaultBranchName, getEndpoint, getProjectInfo, getProjectRetentionDuration, getRunnerInfo, getSchemaDiff, getTargetNames, grantLakebasePermission, grantUcCatalogPermission, inferTierTopology, initWorkflowState, installHooks, installPlaywright, isAllSchemas, isForeignFeatureClaim, isGitTracked, isLongRunningTierBranch, isLtsJavaVersion, isPrereleaseBootVersion, isRunning, isTier, isTtlTooLongError, kitWarmWarning, listAppDeployments, listBranches, listSchemaMigrations, mergeFeature, mergePaired, minLakebaseTtl, mintCredential, normalizeHost, normalizeTierName, parseHostFromAuthDescribe, parseLakebaseTtl, parseTargetsYaml, patchWorkflowsForRunnerType, preparePr, projectPath, propagateCredentials, protectedTierNamesFromEnv, pushFailureHint, queryBranchSchema, queryBranchTables, readEnvVar, readTargets, readWorkflowState, reconcileTierToOrigin, recoverOrphans, release, removeRunner, resolveBranchId, resolveBranchPath, resolveCurrentUser, resolveDatabricksHost, resolveEndpointHost, resolveFeatureStartPoint, resolveJavaHome, resolveLatestBootVersion, resolveLatestLtsJavaVersion, resolveMigrationLanguage, resolveMigrationLayout, resolveParentBranch, resolveProfileForHost, resolveProfileForHostSync, resolveProtectedTierNames, rollbackDeploy, rollbackSchemaMigration, runDoctor$1 as runDoctor, runDoctor as runHealthDoctor, runInfraSuite, runPlaywrightInstall, runnerDir, runnerName, sanitizeFeatureSlug, scaffoldAll, scaffoldStaticAll, schemaMigrationStatus, schemaObjectName, selectProfileForHost, setupRunner, stateFilePath, stopRunner, substituteScmUtilsVersion, substrateVersion, syncEnvToCurrentBranch, tierBranchNames, toolForLanguage, tryCreateCatalog, updateEnvConnection, updateWorkflows, uploadDirectory, validateApp, validateCreateInputs, validateWorkflowState, verifyHooks, verifyProject, verifyWorkflows, waitForBranchAuthReady, waitForBranchReady, waitForCi, warmAndVerifyKit, withLakebaseRollback, workflowStateFileExists, writeEnvFile, writePlaywrightTemplates, writeTargets, writeWorkflowState };
|
|
4120
|
+
export { type AbandonFeatureArgs, type AbandonFeatureResult, type AddE2eToRunTestsScriptArgs, type AddE2eToRunTestsScriptResult, type AddInfraToPackageJsonArgs, type AddInfraToPackageJsonResult, type AddInfraToRunTestsScriptArgs, type AddInfraToRunTestsScriptResult, type AddPlaywrightToPackageJsonArgs, type AddPlaywrightToPackageJsonResult, type AddPythonE2eDepsArgs, type AddPythonE2eDepsResult, type AdoptLakebaseProjectArgs, type AdoptLakebaseProjectResult, type AdoptStateArgs, type AdoptStateResult, type AppServicePrincipal, type AppliedSchemaMigration, type ApplySchemaMigrationsArgs, type ApplySchemaMigrationsResult, type BranchLookupOpts, type BranchMetadata, CONVENTION_TIER_DEFAULTS, type CatalogExistsArgs, type CheckoutMode, type CheckoutPairedArgs, type CheckoutPairedResult, type ClaimFeatureBranchArgs, type ClaimFeatureBranchResult, type ClaimedOrphan, type ClientFramework, type CommandDriftReport, type CommandFileEntry, type CommandFileStatus, type ConnectionArgs, type ConsortSetupHooks, type CreateBranchArgs, type CreateConventionBranchArgs, type CreateConventionPairedBranchArgs, type CreateLongRunningBranchArgs, type CreateLongRunningBranchResult, type CreatePairedBranchArgs, type CreatePairedBranchResult, type CreateProjectArgs, type CreateProjectResult, type CutBackupArgs, type CutBackupResult, DEFAULT_PROTECTED_TIER_NAMES, type DatabricksProfile, type DeleteAppEndpointArgs, type DeleteAppEndpointResult, type DeleteBranchArgs, type DeletePairedBranchArgs, type DeletePairedBranchResult, type DeployClaudeCommandsOptions, type DeployClaudeCommandsResult, type DeployEnvExampleArgs, type DeployLanguageProjectArgs, type DeploySpringStarterArgs, type DeployTarget, type DeployTargetsConfig, type DetectCommandDriftArgs, type DetectScaffoldedDriftArgs, type DetectWorkflowDriftArgs, type DoctorArgs$1 as DoctorArgs, type DoctorFinding, type DoctorReport$1 as DoctorReport, type DoctorSeverity, type DsnArgs, type DsnResult, type EnableE2eForProjectArgs, type EnableE2eForProjectResult, type EnableInfraForProjectArgs, type EnableInfraForProjectResult, type EndpointInfo, type EnsureAppEndpointArgs, type EnsureAppEndpointResult, type EnsureEndpointArgs, type EnsureLakebaseSecretAuthArgs, type EnsureLakebaseSecretAuthResult, type EnsureProfilePinnedArgs, type EnsureProfilePinnedResult, type EnsureSchemaAndVolumeArgs, type EnsureSchemaAndVolumeResult, FIXABLE_FINDING_IDS, type FixFindingArgs, type FixFindingResult, type FixableFindingId, type GateInvariant, type GateStatus, type GenerateAppYamlOptions, type GenerateMavenProjectOptions, type GetAppEndpointArgs, type GetAppEndpointResult, type GetAppServicePrincipalArgs, type GetCiAppEndpointArgs, type GetCiAppEndpointResult, type GetConnectionArgs, type GetCredentialArgs, type GetEndpointArgs, type GetSchemaDiffArgs, type GrantLakebasePermissionArgs, type GrantLakebasePermissionResult, type GrantUcCatalogPermissionArgs, type GrantUcCatalogPermissionResult, type DoctorReport as HealthDoctorReport, type HookVerification, type InfraCheckResult, type InfraSuiteResult, type InitWorkflowStateArgs, type InitializrMetadata, InitializrNetworkError, InitializrParseError, type InstallPlaywrightArgs, type InstallPlaywrightOptions, type InstallPlaywrightResult, LakebaseBranchError, type LakebaseBranchInfo, LakebaseBranchTtlTooLongError, type LakebasePermissionLevel, type LakebaseProjectArgs, LakebaseProjectError, type LakebaseProjectInfo, type LakebaseProjectMetadata, type ListSchemaMigrationsArgs, MIGRATION_DEFAULTS, type MergeArgs, type MergePairedArgs, type MergePairedResult, type MergeResult, type MigrationDefaults, type MigrationLanguage, type MigrationLayout, type ModifiedSchemaObject, NODE_E2E_TEMPLATE_FILES, type OrphanCandidate, PLAYWRIGHT_TEMPLATE_FILES, PLAYWRIGHT_TEST_VERSION_RANGE, PYTEST_BDD_VERSION_RANGE, PYTEST_PLAYWRIGHT_VERSION_RANGE, PYTHON_E2E_TEMPLATE_FILES, type PendingSchemaMigration, type PoolArgs, type PreflightResult, type PreparePrArgs, type PreparePrResult, type ProgressCallback, type ProjectLanguage, type PropagateCredentialsArgs, type PropagateCredentialsResult, ProtectedBranchCommitError, type QueryBranchSchemaArgs, type RecoverOrphansArgs, type RecoverOrphansResult, type ReleaseArgs, type ReleaseResult, type RemoveRunnerArgs, type ResolveDatabricksHostArgs, type ResolveMigrationLayoutArgs, type RollbackDeployArgs, type RollbackDeployResult, type RollbackOptions, type RollbackSchemaMigrationArgs, type RollbackSchemaMigrationResult, type RunDoctorDeps, type RunInfraSuiteArgs, type RunPlaywrightInstallArgs, type RunPlaywrightInstallResult, type RunnerInfo, type RunnerReportFn, type RunnerType, SCM_STATES, STATE_FILE_REL, type ScaffoldAllArgs, type ScaffoldOptions, type ScaffoldReportFn, type ScaffoldStaticAllArgs, type ScaffoldStaticAllResult, type ScaffoldedDriftReport, type SchemaColumn, type SchemaDiffResult, SchemaMigrationError, type SchemaMigrationFile, type SchemaMigrationLanguage, type SchemaMigrationStatusArgs, type SchemaMigrationStatusResult, type SchemaMigrationToolName, type SchemaObject, type SchemaQueryRow, ScmAbandonError, ScmAdoptError, ScmClaimError, ScmDoctorFixError, ScmMergeError, ScmPreparePrError, ScmRecoverError, type ScmState, ScmWaitCiError, type ScmWorkflowState, type SetupRunnerArgs, type SftddSetupHooks, SpringInitializrClient, type SpringJvmLanguage, type StaleBranchFinding, type SyncEnvArgs, type SyncEnvResult, type TableSchema, type TierTopology, type TryCreateCatalogArgs, type TryCreateCatalogResult, type UcCatalogPermission, type UpdateEnvConnectionArgs, type UpdateWorkflowsArgs, type UpdateWorkflowsResult, type UploadDirectoryArgs, type UploadDirectoryResult, type ValidateAppOptions, type ValidateAppResult, type ValidationError, type ValidationResult, type WaitCiArgs, type WaitCiResult, type WaitForBranchAuthReadyArgs, type WaitForBranchReadyArgs, type WorkflowDriftReport, type WorkflowFileStatus, type WorkflowFileUpdate, type WorkflowStatus, type WorkflowUpdateOutcome, type WorkflowVerification, type WriteEnvFileArgs, type WritePlaywrightTemplatesArgs, type WritePlaywrightTemplatesResult, _testMakeBrownfieldFixture, abandonFeatureBranch, addE2eToRunTestsScript, addInfraToPackageJson, addInfraToRunTestsScript, addPlaywrightToPackageJson, adoptLakebaseProject, adoptScmState, applySchemaMigrations, assertAdoptionPreflight, assertCleanForFork, assertCommitTargetNotProtected, assertCreatedProjectReady, buildPostgresUrl, buildSchemaQuery, cacheProjectRetention, catalogExists, catalogExplorerUrl, checkDatabricksAuth, checkoutPaired, claimFeatureBranch, clearRetentionCache, compileMigrationPattern, connectionApplicationName, createBranch, createFeaturePairedBranch, createLakebaseProject, createLongRunningBranch, createPairedBranch, createPerfPairedBranch, createProject, createTestPairedBranch, createUatPairedBranch, cutBackup, databricksAuthPrereqMessage, defaultRefreshPromoteWorkflows, deleteAppEndpoint, deleteBranch, deleteLakebaseProject, deletePairedBranch, deployClaudeAgents, deployClaudeCommands, deployClaudeSettings, deployClaudeSkills, deployClientProject, deployDeployTargets, deployEnv, deployEnvExample, deployGitignore, deployLanguageProject, deployScripts, deploySpringStarter, deployVscodeSettings, deployWorkflows, deriveCiAppName, describeGates, detectCommandDrift, detectLanguage, detectLanguageAt, detectScaffoldedDrift, detectWorkflowDrift, dirIsEmpty, enableE2eForProject, enableInfraForProject, endpointPath, ensureAppEndpoint, ensureCachedArchive, ensureEndpoint, ensureLakebaseSecretAuth, ensureProfilePinned, ensurePythonBddDeps, ensurePythonE2eDeps, ensureSchemaAndVolume, extractPullNumber, featureBranchName, findDefaultBranchName, findHistoryRetentionDuration, fixFinding, formatJUnit, formatSchemaDiffAsMarkdown, generateAppYaml, getAppEndpoint, getAppServicePrincipal, getBranchByName, getCachedProjectRetention, getCiAppEndpoint, getConnection, getCredential, getDefaultBranch, getDefaultBranchId, getDefaultBranchName, getEndpoint, getProjectInfo, getProjectRetentionDuration, getRunnerInfo, getSchemaDiff, getTargetNames, grantLakebasePermission, grantUcCatalogPermission, inferTierTopology, initWorkflowState, installHooks, installPlaywright, isAllSchemas, isForeignFeatureClaim, isGitTracked, isLongRunningTierBranch, isLtsJavaVersion, isPrereleaseBootVersion, isRunning, isTier, isTtlTooLongError, kitWarmWarning, listAppDeployments, listBranches, listSchemaMigrations, mergeFeature, mergePaired, minLakebaseTtl, mintCredential, normalizeHost, normalizeTierName, parseHostFromAuthDescribe, parseLakebaseTtl, parseTargetsYaml, patchWorkflowsForRunnerType, preparePr, projectPath, propagateCredentials, protectedTierNamesFromEnv, pushFailureHint, queryBranchSchema, queryBranchTables, readEnvVar, readTargets, readWorkflowState, reconcilePromoteRunState, reconcileTierToOrigin, recoverOrphans, release, removeRunner, resolveBranchId, resolveBranchPath, resolveCurrentUser, resolveDatabricksHost, resolveEndpointHost, resolveFeatureStartPoint, resolveJavaHome, resolveLatestBootVersion, resolveLatestLtsJavaVersion, resolveMigrationLanguage, resolveMigrationLayout, resolveParentBranch, resolveProfileForHost, resolveProfileForHostSync, resolveProtectedTierNames, rollbackDeploy, rollbackSchemaMigration, runDoctor$1 as runDoctor, runDoctor as runHealthDoctor, runInfraSuite, runPlaywrightInstall, runnerDir, runnerName, sanitizeFeatureSlug, scaffoldAll, scaffoldStaticAll, schemaMigrationStatus, schemaObjectName, selectProfileForHost, setupRunner, stateFilePath, stopRunner, substituteScmUtilsVersion, substrateVersion, syncEnvToCurrentBranch, tierBranchNames, toolForLanguage, tryCreateCatalog, updateEnvConnection, updateWorkflows, uploadDirectory, validateApp, validateCreateInputs, validateWorkflowState, verifyHooks, verifyProject, verifyWorkflows, waitForBranchAuthReady, waitForBranchReady, waitForCi, warmAndVerifyKit, withLakebaseRollback, workflowStateFileExists, writeEnvFile, writePlaywrightTemplates, writeTargets, writeWorkflowState };
|
|
@@ -2518,8 +2518,8 @@ var PKG_NAME = "@databricks-solutions/lakebase-scm-utils";
|
|
|
2518
2518
|
var cached;
|
|
2519
2519
|
function substrateSelfVersion() {
|
|
2520
2520
|
if (cached !== void 0) return cached;
|
|
2521
|
-
if ("0.2.
|
|
2522
|
-
cached = "0.2.
|
|
2521
|
+
if ("0.2.48".length > 0) {
|
|
2522
|
+
cached = "0.2.48";
|
|
2523
2523
|
return cached;
|
|
2524
2524
|
}
|
|
2525
2525
|
cached = "unknown";
|
|
@@ -16241,6 +16241,48 @@ function shaMigratePredicate(mergeCommitSha) {
|
|
|
16241
16241
|
return !!run.headSha && run.headSha === mergeCommitSha;
|
|
16242
16242
|
};
|
|
16243
16243
|
}
|
|
16244
|
+
var PROMOTE_RUNSTATE_CONFLICT = /(^|\/)\.consort\/(features\/[^/]+\/)?pipeline\.json$/;
|
|
16245
|
+
async function reconcilePromoteRunState(projectDir, baseBranch) {
|
|
16246
|
+
const o = { cwd: projectDir, timeout: 3e4 };
|
|
16247
|
+
const dirty = (await exec2("git status --porcelain", o).catch(() => "")).split("\n").map((l) => l.slice(3).trim()).filter(Boolean);
|
|
16248
|
+
const nonRunStateDirty = dirty.filter((p) => !p.startsWith(".consort/"));
|
|
16249
|
+
if (nonRunStateDirty.length > 0) {
|
|
16250
|
+
throw new ScmMergeError(
|
|
16251
|
+
`working tree has uncommitted non-run-state changes (${nonRunStateDirty.slice(0, 5).join(", ")}${nonRunStateDirty.length > 5 ? ", \u2026" : ""}); commit or stash before promoting.`,
|
|
16252
|
+
"promote-conflict"
|
|
16253
|
+
);
|
|
16254
|
+
}
|
|
16255
|
+
if (dirty.length > 0) {
|
|
16256
|
+
await exec2(`git add ${shellEscape2(".consort")}`, o);
|
|
16257
|
+
await exec2(`git commit -m ${shellEscape2("chore(run): checkpoint run state before promotion")}`, o);
|
|
16258
|
+
}
|
|
16259
|
+
await exec2(`git fetch origin ${shellEscape2(baseBranch)}`, o).catch(() => {
|
|
16260
|
+
});
|
|
16261
|
+
let conflicted = false;
|
|
16262
|
+
try {
|
|
16263
|
+
await exec2(`git merge --no-ff -m ${shellEscape2(`merge ${baseBranch} for promotion`)} ${shellEscape2(`origin/${baseBranch}`)}`, o);
|
|
16264
|
+
} catch {
|
|
16265
|
+
conflicted = true;
|
|
16266
|
+
}
|
|
16267
|
+
if (!conflicted) return { reconciled: false };
|
|
16268
|
+
const u = (await exec2("git diff --name-only --diff-filter=U", o).catch(() => "")).split("\n").map((s) => s.trim()).filter(Boolean);
|
|
16269
|
+
const other = u.filter((p) => !PROMOTE_RUNSTATE_CONFLICT.test(p));
|
|
16270
|
+
if (u.length === 0 || other.length > 0) {
|
|
16271
|
+
await exec2("git merge --abort", o).catch(() => {
|
|
16272
|
+
});
|
|
16273
|
+
throw new ScmMergeError(
|
|
16274
|
+
other.length > 0 ? `promotion conflicts on non-ledger file(s): ${other.join(", ")}. Resolve the real divergence manually, then re-run the promote.` : `promotion merge failed with no resolvable conflicts; resolve manually and re-run.`,
|
|
16275
|
+
"promote-conflict"
|
|
16276
|
+
);
|
|
16277
|
+
}
|
|
16278
|
+
for (const p of u) {
|
|
16279
|
+
await exec2(`git checkout --ours -- ${shellEscape2(p)}`, o);
|
|
16280
|
+
await exec2(`git add -- ${shellEscape2(p)}`, o);
|
|
16281
|
+
}
|
|
16282
|
+
await exec2(`git commit -m ${shellEscape2(`merge ${baseBranch} for promotion (pipeline.json ledger kept at run state)`)}`, o);
|
|
16283
|
+
await pushCurrentBranchForPr({ cwd: projectDir });
|
|
16284
|
+
return { reconciled: true, detail: `reconciled ${u.length} ledger path(s) to the run side + pushed` };
|
|
16285
|
+
}
|
|
16244
16286
|
async function defaultRefreshPromoteWorkflows(projectDir) {
|
|
16245
16287
|
const drift = detectWorkflowDrift({ projectDir });
|
|
16246
16288
|
const touched = drift.files.filter((f) => f.status === "drifted").map((f) => f.name);
|
|
@@ -16330,6 +16372,15 @@ async function mergeFeature(args) {
|
|
|
16330
16372
|
);
|
|
16331
16373
|
}
|
|
16332
16374
|
}
|
|
16375
|
+
{
|
|
16376
|
+
const fetchState = args.fetchPrState ?? ((o, h) => getPullRequest(o, h));
|
|
16377
|
+
const prState = await fetchState(ownerRepo, current.branch).catch(() => void 0);
|
|
16378
|
+
if (prState?.mergeableState === "dirty") {
|
|
16379
|
+
const reconcile = args.reconcileRunState ?? ((base) => reconcilePromoteRunState(args.projectDir, base));
|
|
16380
|
+
const r = await reconcile(gitBase);
|
|
16381
|
+
if (r.reconciled) preflightNotes.push(`Reconciled a pipeline.json-ledger promotion conflict to the run side${r.detail ? ` (${r.detail})` : ""}.`);
|
|
16382
|
+
}
|
|
16383
|
+
}
|
|
16333
16384
|
let paired;
|
|
16334
16385
|
try {
|
|
16335
16386
|
paired = await mergePairedPullRequest({
|
|
@@ -17951,6 +18002,7 @@ export {
|
|
|
17951
18002
|
readEnvVar,
|
|
17952
18003
|
readTargets,
|
|
17953
18004
|
readWorkflowState,
|
|
18005
|
+
reconcilePromoteRunState,
|
|
17954
18006
|
reconcileTierToOrigin,
|
|
17955
18007
|
recoverOrphans,
|
|
17956
18008
|
release,
|
|
@@ -79290,8 +79290,8 @@ var PKG_NAME = "@databricks-solutions/lakebase-scm-utils";
|
|
|
79290
79290
|
var cached;
|
|
79291
79291
|
function substrateSelfVersion() {
|
|
79292
79292
|
if (cached !== void 0) return cached;
|
|
79293
|
-
if ("0.2.
|
|
79294
|
-
cached = "0.2.
|
|
79293
|
+
if ("0.2.48".length > 0) {
|
|
79294
|
+
cached = "0.2.48";
|
|
79295
79295
|
return cached;
|
|
79296
79296
|
}
|
|
79297
79297
|
cached = "unknown";
|
|
@@ -393,8 +393,8 @@ var PKG_NAME = "@databricks-solutions/lakebase-scm-utils";
|
|
|
393
393
|
var cached;
|
|
394
394
|
function substrateSelfVersion() {
|
|
395
395
|
if (cached !== void 0) return cached;
|
|
396
|
-
if ("0.2.
|
|
397
|
-
cached = "0.2.
|
|
396
|
+
if ("0.2.48".length > 0) {
|
|
397
|
+
cached = "0.2.48";
|
|
398
398
|
return cached;
|
|
399
399
|
}
|
|
400
400
|
cached = "unknown";
|
|
@@ -79290,8 +79290,8 @@ var PKG_NAME = "@databricks-solutions/lakebase-scm-utils";
|
|
|
79290
79290
|
var cached;
|
|
79291
79291
|
function substrateSelfVersion() {
|
|
79292
79292
|
if (cached !== void 0) return cached;
|
|
79293
|
-
if ("0.2.
|
|
79294
|
-
cached = "0.2.
|
|
79293
|
+
if ("0.2.48".length > 0) {
|
|
79294
|
+
cached = "0.2.48";
|
|
79295
79295
|
return cached;
|
|
79296
79296
|
}
|
|
79297
79297
|
cached = "unknown";
|
|
@@ -393,8 +393,8 @@ var PKG_NAME = "@databricks-solutions/lakebase-scm-utils";
|
|
|
393
393
|
var cached;
|
|
394
394
|
function substrateSelfVersion() {
|
|
395
395
|
if (cached !== void 0) return cached;
|
|
396
|
-
if ("0.2.
|
|
397
|
-
cached = "0.2.
|
|
396
|
+
if ("0.2.48".length > 0) {
|
|
397
|
+
cached = "0.2.48";
|
|
398
398
|
return cached;
|
|
399
399
|
}
|
|
400
400
|
cached = "unknown";
|
|
@@ -79288,8 +79288,8 @@ var PKG_NAME = "@databricks-solutions/lakebase-scm-utils";
|
|
|
79288
79288
|
var cached;
|
|
79289
79289
|
function substrateSelfVersion() {
|
|
79290
79290
|
if (cached !== void 0) return cached;
|
|
79291
|
-
if ("0.2.
|
|
79292
|
-
cached = "0.2.
|
|
79291
|
+
if ("0.2.48".length > 0) {
|
|
79292
|
+
cached = "0.2.48";
|
|
79293
79293
|
return cached;
|
|
79294
79294
|
}
|
|
79295
79295
|
cached = "unknown";
|
|
@@ -389,8 +389,8 @@ var PKG_NAME = "@databricks-solutions/lakebase-scm-utils";
|
|
|
389
389
|
var cached;
|
|
390
390
|
function substrateSelfVersion() {
|
|
391
391
|
if (cached !== void 0) return cached;
|
|
392
|
-
if ("0.2.
|
|
393
|
-
cached = "0.2.
|
|
392
|
+
if ("0.2.48".length > 0) {
|
|
393
|
+
cached = "0.2.48";
|
|
394
394
|
return cached;
|
|
395
395
|
}
|
|
396
396
|
cached = "unknown";
|
|
@@ -79324,8 +79324,8 @@ var PKG_NAME = "@databricks-solutions/lakebase-scm-utils";
|
|
|
79324
79324
|
var cached;
|
|
79325
79325
|
function substrateSelfVersion() {
|
|
79326
79326
|
if (cached !== void 0) return cached;
|
|
79327
|
-
if ("0.2.
|
|
79328
|
-
cached = "0.2.
|
|
79327
|
+
if ("0.2.48".length > 0) {
|
|
79328
|
+
cached = "0.2.48";
|
|
79329
79329
|
return cached;
|
|
79330
79330
|
}
|
|
79331
79331
|
cached = "unknown";
|
|
@@ -427,8 +427,8 @@ var PKG_NAME = "@databricks-solutions/lakebase-scm-utils";
|
|
|
427
427
|
var cached;
|
|
428
428
|
function substrateSelfVersion() {
|
|
429
429
|
if (cached !== void 0) return cached;
|
|
430
|
-
if ("0.2.
|
|
431
|
-
cached = "0.2.
|
|
430
|
+
if ("0.2.48".length > 0) {
|
|
431
|
+
cached = "0.2.48";
|
|
432
432
|
return cached;
|
|
433
433
|
}
|
|
434
434
|
cached = "unknown";
|
|
@@ -79783,8 +79783,8 @@ var PKG_NAME = "@databricks-solutions/lakebase-scm-utils";
|
|
|
79783
79783
|
var cached;
|
|
79784
79784
|
function substrateSelfVersion() {
|
|
79785
79785
|
if (cached !== void 0) return cached;
|
|
79786
|
-
if ("0.2.
|
|
79787
|
-
cached = "0.2.
|
|
79786
|
+
if ("0.2.48".length > 0) {
|
|
79787
|
+
cached = "0.2.48";
|
|
79788
79788
|
return cached;
|
|
79789
79789
|
}
|
|
79790
79790
|
cached = "unknown";
|
|
@@ -864,8 +864,8 @@ var PKG_NAME = "@databricks-solutions/lakebase-scm-utils";
|
|
|
864
864
|
var cached;
|
|
865
865
|
function substrateSelfVersion() {
|
|
866
866
|
if (cached !== void 0) return cached;
|
|
867
|
-
if ("0.2.
|
|
868
|
-
cached = "0.2.
|
|
867
|
+
if ("0.2.48".length > 0) {
|
|
868
|
+
cached = "0.2.48";
|
|
869
869
|
return cached;
|
|
870
870
|
}
|
|
871
871
|
cached = "unknown";
|
|
@@ -88240,8 +88240,8 @@ var PKG_NAME = "@databricks-solutions/lakebase-scm-utils";
|
|
|
88240
88240
|
var cached;
|
|
88241
88241
|
function substrateSelfVersion() {
|
|
88242
88242
|
if (cached !== void 0) return cached;
|
|
88243
|
-
if ("0.2.
|
|
88244
|
-
cached = "0.2.
|
|
88243
|
+
if ("0.2.48".length > 0) {
|
|
88244
|
+
cached = "0.2.48";
|
|
88245
88245
|
return cached;
|
|
88246
88246
|
}
|
|
88247
88247
|
cached = "unknown";
|
|
@@ -9393,8 +9393,8 @@ var PKG_NAME = "@databricks-solutions/lakebase-scm-utils";
|
|
|
9393
9393
|
var cached;
|
|
9394
9394
|
function substrateSelfVersion() {
|
|
9395
9395
|
if (cached !== void 0) return cached;
|
|
9396
|
-
if ("0.2.
|
|
9397
|
-
cached = "0.2.
|
|
9396
|
+
if ("0.2.48".length > 0) {
|
|
9397
|
+
cached = "0.2.48";
|
|
9398
9398
|
return cached;
|
|
9399
9399
|
}
|
|
9400
9400
|
cached = "unknown";
|
|
@@ -86087,6 +86087,84 @@ function wrap(err, context) {
|
|
|
86087
86087
|
}
|
|
86088
86088
|
throw new GitHubPullRequestError(context);
|
|
86089
86089
|
}
|
|
86090
|
+
async function getPullRequest(ownerRepo, headBranch) {
|
|
86091
|
+
try {
|
|
86092
|
+
const { owner, repo } = parseOwnerRepo(ownerRepo);
|
|
86093
|
+
const ok = await octokit();
|
|
86094
|
+
const { data: pulls } = await ok.rest.pulls.list({
|
|
86095
|
+
owner,
|
|
86096
|
+
repo,
|
|
86097
|
+
state: "open",
|
|
86098
|
+
head: `${owner}:${headBranch}`,
|
|
86099
|
+
per_page: 1
|
|
86100
|
+
});
|
|
86101
|
+
if (pulls.length === 0) return void 0;
|
|
86102
|
+
const { data: pr } = await ok.rest.pulls.get({
|
|
86103
|
+
owner,
|
|
86104
|
+
repo,
|
|
86105
|
+
pull_number: pulls[0].number
|
|
86106
|
+
});
|
|
86107
|
+
if (pr.state !== "open") return void 0;
|
|
86108
|
+
let checks = [];
|
|
86109
|
+
let ciStatus = "pending";
|
|
86110
|
+
const headSha = pr.head?.sha;
|
|
86111
|
+
if (headSha) {
|
|
86112
|
+
try {
|
|
86113
|
+
const { data: checksData } = await ok.rest.checks.listForRef({
|
|
86114
|
+
owner,
|
|
86115
|
+
repo,
|
|
86116
|
+
ref: headSha
|
|
86117
|
+
});
|
|
86118
|
+
const runs = checksData.check_runs || [];
|
|
86119
|
+
checks = runs.map((c) => ({
|
|
86120
|
+
name: c.name || "unknown",
|
|
86121
|
+
status: (c.status || "").toUpperCase(),
|
|
86122
|
+
conclusion: (c.conclusion || "").toUpperCase(),
|
|
86123
|
+
detailsUrl: c.details_url || void 0
|
|
86124
|
+
}));
|
|
86125
|
+
ciStatus = parseCiStatus(runs);
|
|
86126
|
+
} catch {
|
|
86127
|
+
ciStatus = "pending";
|
|
86128
|
+
}
|
|
86129
|
+
}
|
|
86130
|
+
return {
|
|
86131
|
+
number: pr.number,
|
|
86132
|
+
title: pr.title,
|
|
86133
|
+
url: pr.html_url || "",
|
|
86134
|
+
state: (pr.state || "open").toUpperCase(),
|
|
86135
|
+
isDraft: pr.draft || false,
|
|
86136
|
+
ciStatus,
|
|
86137
|
+
checks,
|
|
86138
|
+
mergeable: pr.mergeable,
|
|
86139
|
+
mergeableState: pr.mergeable_state,
|
|
86140
|
+
headBranch: pr.head?.ref || headBranch,
|
|
86141
|
+
baseBranch: pr.base?.ref || "",
|
|
86142
|
+
body: pr.body || void 0,
|
|
86143
|
+
additions: pr.additions,
|
|
86144
|
+
deletions: pr.deletions,
|
|
86145
|
+
changedFiles: pr.changed_files
|
|
86146
|
+
};
|
|
86147
|
+
} catch {
|
|
86148
|
+
return void 0;
|
|
86149
|
+
}
|
|
86150
|
+
}
|
|
86151
|
+
function parseCiStatus(rawChecks) {
|
|
86152
|
+
if (rawChecks.length === 0) return "pending";
|
|
86153
|
+
const latestByName = /* @__PURE__ */ new Map();
|
|
86154
|
+
for (const c of rawChecks) {
|
|
86155
|
+
latestByName.set(c.name || "unknown", c);
|
|
86156
|
+
}
|
|
86157
|
+
const states = Array.from(latestByName.values()).map(
|
|
86158
|
+
(c) => (c.conclusion || c.status || "").toUpperCase()
|
|
86159
|
+
);
|
|
86160
|
+
if (states.some((s2) => s2 === "FAILURE" || s2 === "ERROR" || s2 === "ACTION_REQUIRED")) {
|
|
86161
|
+
return "failure";
|
|
86162
|
+
}
|
|
86163
|
+
if (states.every((s2) => s2 === "SUCCESS" || s2 === "NEUTRAL" || s2 === "SKIPPED")) {
|
|
86164
|
+
return "success";
|
|
86165
|
+
}
|
|
86166
|
+
return "pending";
|
|
86167
|
+
}
|
|
86090
86168
|
async function mergePullRequest(args) {
|
|
86091
86169
|
const method = args.method ?? "merge";
|
|
86092
86170
|
const deleteRemoteBranch = args.deleteRemoteBranch !== false;
|
|
@@ -86781,6 +86859,48 @@ function shaMigratePredicate(mergeCommitSha) {
|
|
|
86781
86859
|
return !!run.headSha && run.headSha === mergeCommitSha;
|
|
86782
86860
|
};
|
|
86783
86861
|
}
|
|
86862
|
+
var PROMOTE_RUNSTATE_CONFLICT = /(^|\/)\.consort\/(features\/[^/]+\/)?pipeline\.json$/;
|
|
86863
|
+
async function reconcilePromoteRunState(projectDir, baseBranch) {
|
|
86864
|
+
const o = { cwd: projectDir, timeout: 3e4 };
|
|
86865
|
+
const dirty = (await exec2("git status --porcelain", o).catch(() => "")).split("\n").map((l) => l.slice(3).trim()).filter(Boolean);
|
|
86866
|
+
const nonRunStateDirty = dirty.filter((p) => !p.startsWith(".consort/"));
|
|
86867
|
+
if (nonRunStateDirty.length > 0) {
|
|
86868
|
+
throw new ScmMergeError(
|
|
86869
|
+
`working tree has uncommitted non-run-state changes (${nonRunStateDirty.slice(0, 5).join(", ")}${nonRunStateDirty.length > 5 ? ", \u2026" : ""}); commit or stash before promoting.`,
|
|
86870
|
+
"promote-conflict"
|
|
86871
|
+
);
|
|
86872
|
+
}
|
|
86873
|
+
if (dirty.length > 0) {
|
|
86874
|
+
await exec2(`git add ${shellEscape(".consort")}`, o);
|
|
86875
|
+
await exec2(`git commit -m ${shellEscape("chore(run): checkpoint run state before promotion")}`, o);
|
|
86876
|
+
}
|
|
86877
|
+
await exec2(`git fetch origin ${shellEscape(baseBranch)}`, o).catch(() => {
|
|
86878
|
+
});
|
|
86879
|
+
let conflicted = false;
|
|
86880
|
+
try {
|
|
86881
|
+
await exec2(`git merge --no-ff -m ${shellEscape(`merge ${baseBranch} for promotion`)} ${shellEscape(`origin/${baseBranch}`)}`, o);
|
|
86882
|
+
} catch {
|
|
86883
|
+
conflicted = true;
|
|
86884
|
+
}
|
|
86885
|
+
if (!conflicted) return { reconciled: false };
|
|
86886
|
+
const u = (await exec2("git diff --name-only --diff-filter=U", o).catch(() => "")).split("\n").map((s2) => s2.trim()).filter(Boolean);
|
|
86887
|
+
const other = u.filter((p) => !PROMOTE_RUNSTATE_CONFLICT.test(p));
|
|
86888
|
+
if (u.length === 0 || other.length > 0) {
|
|
86889
|
+
await exec2("git merge --abort", o).catch(() => {
|
|
86890
|
+
});
|
|
86891
|
+
throw new ScmMergeError(
|
|
86892
|
+
other.length > 0 ? `promotion conflicts on non-ledger file(s): ${other.join(", ")}. Resolve the real divergence manually, then re-run the promote.` : `promotion merge failed with no resolvable conflicts; resolve manually and re-run.`,
|
|
86893
|
+
"promote-conflict"
|
|
86894
|
+
);
|
|
86895
|
+
}
|
|
86896
|
+
for (const p of u) {
|
|
86897
|
+
await exec2(`git checkout --ours -- ${shellEscape(p)}`, o);
|
|
86898
|
+
await exec2(`git add -- ${shellEscape(p)}`, o);
|
|
86899
|
+
}
|
|
86900
|
+
await exec2(`git commit -m ${shellEscape(`merge ${baseBranch} for promotion (pipeline.json ledger kept at run state)`)}`, o);
|
|
86901
|
+
await pushCurrentBranchForPr({ cwd: projectDir });
|
|
86902
|
+
return { reconciled: true, detail: `reconciled ${u.length} ledger path(s) to the run side + pushed` };
|
|
86903
|
+
}
|
|
86784
86904
|
async function defaultRefreshPromoteWorkflows(projectDir) {
|
|
86785
86905
|
const drift = detectWorkflowDrift({ projectDir });
|
|
86786
86906
|
const touched = drift.files.filter((f3) => f3.status === "drifted").map((f3) => f3.name);
|
|
@@ -86870,6 +86990,15 @@ async function mergeFeature(args) {
|
|
|
86870
86990
|
);
|
|
86871
86991
|
}
|
|
86872
86992
|
}
|
|
86993
|
+
{
|
|
86994
|
+
const fetchState = args.fetchPrState ?? ((o, h2) => getPullRequest(o, h2));
|
|
86995
|
+
const prState = await fetchState(ownerRepo, current.branch).catch(() => void 0);
|
|
86996
|
+
if (prState?.mergeableState === "dirty") {
|
|
86997
|
+
const reconcile = args.reconcileRunState ?? ((base) => reconcilePromoteRunState(args.projectDir, base));
|
|
86998
|
+
const r2 = await reconcile(gitBase);
|
|
86999
|
+
if (r2.reconciled) preflightNotes.push(`Reconciled a pipeline.json-ledger promotion conflict to the run side${r2.detail ? ` (${r2.detail})` : ""}.`);
|
|
87000
|
+
}
|
|
87001
|
+
}
|
|
86873
87002
|
let paired;
|
|
86874
87003
|
try {
|
|
86875
87004
|
paired = await mergePairedPullRequest({
|
|
@@ -88474,8 +88603,8 @@ var PKG_NAME = "@databricks-solutions/lakebase-scm-utils";
|
|
|
88474
88603
|
var cached;
|
|
88475
88604
|
function substrateSelfVersion() {
|
|
88476
88605
|
if (cached !== void 0) return cached;
|
|
88477
|
-
if ("0.2.
|
|
88478
|
-
cached = "0.2.
|
|
88606
|
+
if ("0.2.48".length > 0) {
|
|
88607
|
+
cached = "0.2.48";
|
|
88479
88608
|
return cached;
|
|
88480
88609
|
}
|
|
88481
88610
|
cached = "unknown";
|