feat(network): integrate outbound route module on Ultra1.4 baseline

This commit is contained in:
daniellee2015
2026-04-27 13:25:46 +08:00
parent c98cfd7053
commit 2706d98225
16 changed files with 7979 additions and 26 deletions
+73
View File
@@ -419,6 +419,79 @@ test('verification flow completes step 8 and flags phone verification when add-p
]);
});
test('verification flow keeps step 8 successful when code submit transport fails but auth page already reaches oauth consent', async () => {
const events = [];
const helpers = api.createVerificationFlowHelpers({
addLog: async (message) => {
events.push(['log', message]);
},
chrome: {
tabs: {
update: async () => {},
},
},
CLOUDFLARE_TEMP_EMAIL_PROVIDER: 'cloudflare-temp-email',
completeStepFromBackground: async (_step, payload) => {
events.push(['complete', payload.code]);
},
confirmCustomVerificationStepBypassRequest: async () => ({ confirmed: true }),
getHotmailVerificationPollConfig: () => ({}),
getHotmailVerificationRequestTimestamp: () => 0,
getState: async () => ({}),
getTabId: async () => 1,
HOTMAIL_PROVIDER: 'hotmail-api',
isStopError: () => false,
LUCKMAIL_PROVIDER: 'luckmail-api',
MAIL_2925_VERIFICATION_INTERVAL_MS: 15000,
MAIL_2925_VERIFICATION_MAX_ATTEMPTS: 15,
pollCloudflareTempEmailVerificationCode: async () => ({}),
pollHotmailVerificationCode: async () => ({}),
pollLuckmailVerificationCode: async () => ({}),
sendToContentScript: async () => ({}),
sendToContentScriptResilient: async (_source, message) => {
if (message.type === 'FILL_CODE') {
throw new Error('message channel is closed before a response was received');
}
if (message.type === 'GET_LOGIN_AUTH_STATE') {
return {
state: 'oauth_consent_page',
url: 'https://auth.openai.com/authorize?client_id=test',
};
}
return {};
},
sendToMailContentScriptResilient: async () => ({
code: '654321',
emailTimestamp: 123,
}),
setState: async (payload) => {
events.push(['state', payload.lastLoginCode || payload.lastSignupCode]);
},
setStepStatus: async () => {},
sleepWithStop: async () => {},
throwIfStopped: () => {},
VERIFICATION_POLL_MAX_ROUNDS: 5,
});
const result = await helpers.resolveVerificationStep(
8,
{ email: 'user@example.com', lastLoginCode: null },
{ provider: 'qq', label: 'QQ Mail' },
{}
);
assert.deepStrictEqual(result, {
phoneVerificationRequired: false,
url: 'https://auth.openai.com/authorize?client_id=test',
});
assert.deepStrictEqual(events.filter((entry) => entry[0] !== 'log'), [
['state', '654321'],
['complete', '654321'],
]);
assert.ok(events.some((entry) => entry[0] === 'log' && /通信中断/.test(entry[1])));
});
test('verification flow treats manual step 8 add-phone confirmation as the same fatal add-phone error', async () => {
const helpers = api.createVerificationFlowHelpers({
addLog: async () => {},