Skip to content

Commit 41ecee5

Browse files
committed
Harden apply guard and completed-org count
1 parent 377e8b0 commit 41ecee5

2 files changed

Lines changed: 4 additions & 1 deletion

File tree

scripts/migration/oneshot-service-split-cli.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,9 @@ const operationKeyPrefix = (integration: string): string =>
214214

215215
const applyOrg = async (sql: SqlClient, org: OrgPlan): Promise<void> => {
216216
if (org.completed) return;
217+
if (org.hardErrors.length > 0) {
218+
throw new Error(`org ${org.tenant} has unresolved policy hard errors; apply is blocked`);
219+
}
217220
await sql.begin(async (tx) => {
218221
const now = new Date();
219222
for (const row of org.integrations.filter((item) => item.action === "create")) {

scripts/migration/oneshot-service-split.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1063,7 +1063,7 @@ export const planMigration = (input: MigrationInput): MigrationPlan => {
10631063
const activeOrgs = orgs.filter((org) => !org.completed && org.hardErrors.length === 0);
10641064
const summary = {
10651065
orgs: orgs.length,
1066-
completedOrgs: orgs.length - activeOrgs.length,
1066+
completedOrgs: orgs.filter((org) => org.completed).length,
10671067
integrationsCreate: activeOrgs
10681068
.flatMap((org) => org.integrations)
10691069
.filter((row) => row.action === "create").length,

0 commit comments

Comments
 (0)