fix(migrate): 兑换迁移码在双方认领锁下检查目标配额,超出返回 403 migrate_quota_exceeded 且码不消耗
This commit is contained in:
12 files changed
+362
-11
No files matched your search
@@ -79,6 +79,7 @@
|
||||
"account_retired": "This account has been retired — sign in with the account it was migrated to.",
|
||||
"no_migration": "There is no migration in progress.",
|
||||
"not_confirmed": "Confirm it's you in this browser first. A confirmation lasts 10 minutes.",
|
||||
"migrate_quota_exceeded": "The servers this migration brings over don't fit your quota. Ask an admin to raise it, then redeem the same code again before it expires.",
|
||||
"invalid_quota": "A quota must be a whole number from 0 to 2147483647. Leave it empty for unlimited.",
|
||||
"already_confirmed": "This migration has already been confirmed.",
|
||||
"invalid_target": "The migration target must be a different account.",
|
||||
|
||||
@@ -79,6 +79,7 @@
|
||||
"account_retired": "该账户已退役——请使用迁移后的账户登录。",
|
||||
"no_migration": "当前没有进行中的迁移。",
|
||||
"not_confirmed": "请先在当前浏览器完成身份确认,确认 10 分钟内有效。",
|
||||
"migrate_quota_exceeded": "这次迁移带来的服务器超出了你的配额。请管理员调高配额后,在迁移码过期前用同一个码再兑换一次。",
|
||||
"invalid_quota": "配额要填 0 到 2147483647 之间的整数,不限就留空。",
|
||||
"already_confirmed": "该迁移已经确认过了。",
|
||||
"invalid_target": "迁移目标账户不能与来源账户相同。",
|
||||
|
||||
@@ -218,6 +218,12 @@ describe("account migration wire shapes", () => {
|
||||
code: "MIGR-1234",
|
||||
});
|
||||
});
|
||||
|
||||
it("says a redeem over quota can be retried with the same code once the quota fits", () => {
|
||||
expect(humanizeError({ status: 403, code: "migrate_quota_exceeded" })).toBe(
|
||||
"The servers this migration brings over don't fit your quota. Ask an admin to raise it, then redeem the same code again before it expires.",
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
// Pin the GET /fleet wire shape (the SysAdmin cockpit's read). It is the ONLY
|
||||
|
||||
@@ -1184,6 +1184,8 @@ export function humanizeError(e: unknown): string {
|
||||
return t("no_migration");
|
||||
case "not_confirmed":
|
||||
return t("not_confirmed");
|
||||
case "migrate_quota_exceeded":
|
||||
return t("migrate_quota_exceeded");
|
||||
case "invalid_quota":
|
||||
return t("invalid_quota");
|
||||
case "already_confirmed":
|
||||
|
||||
@@ -7685,6 +7685,15 @@ export interface operations {
|
||||
};
|
||||
};
|
||||
401: components["responses"]["Unauthorized"];
|
||||
/** @description The source's servers would push the caller over a quota cap (migrate_quota_exceeded). Nothing moved and the code is unspent; it redeems once the quota fits, until it expires. */
|
||||
403: {
|
||||
headers: {
|
||||
[name: string]: unknown;
|
||||
};
|
||||
content: {
|
||||
"application/json": components["schemas"]["Error"];
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
mySubmissions: {
|
||||
|
||||
Reference in new issue
Block a user