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
74 changes: 60 additions & 14 deletions scripts/product-proof-cloud-playwright.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -625,9 +625,14 @@ function normalizeProductProofRouteNetworkFailureDiagnostic(value) {
value,
'incomplete_class',
);
const hasRealtimeJoinLimitClass =
Object.prototype.hasOwnProperty.call(value, 'topic_class') &&
!Object.prototype.hasOwnProperty.call(value, 'message_class') &&
!Object.prototype.hasOwnProperty.call(value, 'status_class');
const hasRealtimeSystemClass =
Object.prototype.hasOwnProperty.call(value, 'message_class') ||
Object.prototype.hasOwnProperty.call(value, 'topic_class');
(Object.prototype.hasOwnProperty.call(value, 'topic_class') &&
!hasRealtimeJoinLimitClass);
const hasResponseStatusClass = Object.prototype.hasOwnProperty.call(value, 'status_class');
const hasHeadTerminalOrder = Object.prototype.hasOwnProperty.call(
value,
Expand Down Expand Up @@ -669,6 +674,33 @@ function normalizeProductProofRouteNetworkFailureDiagnostic(value) {
reason_code: reasonCode,
});
}
if (hasRealtimeJoinLimitClass) {
if (
!isPlainObject(value) ||
(prototype !== Object.prototype && prototype !== null) ||
!exactKeys(value, ['adapter', 'phase', 'reason_code', 'topic_class'])
) {
return null;
}
const adapter = value.adapter;
const phase = value.phase;
const reasonCode = value.reason_code;
const topicClass = value.topic_class;
if (
adapter !== 'realtime' ||
phase !== 'join' ||
reasonCode !== 'join_limit_exceeded' ||
!realtimeSystemTopicClasses.has(topicClass)
) {
return null;
}
return Object.freeze({
adapter,
phase,
reason_code: reasonCode,
topic_class: topicClass,
});
}
if (hasRealtimeSystemClass) {
if (
!isPlainObject(value) ||
Expand Down Expand Up @@ -1319,6 +1351,7 @@ export function attachProductProofRouteNetworkFailureDiagnostic(error, diagnosti
const requestIdentityMismatch = failureCode === 'live_request_identity_mismatch';
const expectedRequestMissing = failureCode === 'live_expected_request_missing';
const realtimeIncomplete = failureCode === 'live_realtime_incomplete';
const realtimeJoinLimitExceeded = failureCode === 'live_realtime_join_limit_exceeded';
const realtimeSystemInvalid = failureCode === 'live_realtime_system_invalid';
const homeMailboxReadinessFailed = failureCode === 'route_assertion_failed';
const expectedRequestMissingDiagnostic = Object.hasOwn(
Expand All @@ -1333,6 +1366,9 @@ export function attachProductProofRouteNetworkFailureDiagnostic(error, diagnosti
normalized ?? {},
'incomplete_class',
);
const realtimeJoinLimitDiagnostic =
Object.hasOwn(normalized ?? {}, 'topic_class') &&
!Object.hasOwn(normalized ?? {}, 'message_class');
const realtimeSystemDiagnostic = Object.hasOwn(normalized ?? {}, 'message_class');
const requestIdentityMismatchDiagnostic = Object.hasOwn(
normalized ?? {},
Expand All @@ -1347,6 +1383,7 @@ export function attachProductProofRouteNetworkFailureDiagnostic(error, diagnosti
!expectedRequestMissingDiagnostic &&
!homeMailboxReadinessDiagnostic &&
!realtimeIncompleteDiagnostic &&
!realtimeJoinLimitDiagnostic &&
!realtimeSystemDiagnostic &&
!requestIdentityMismatchDiagnostic &&
!headTerminalOrderDiagnostic;
Expand All @@ -1361,6 +1398,7 @@ export function attachProductProofRouteNetworkFailureDiagnostic(error, diagnosti
!requestIdentityMismatch &&
!expectedRequestMissing &&
!realtimeIncomplete &&
!realtimeJoinLimitExceeded &&
!realtimeSystemInvalid &&
!homeMailboxReadinessFailed) ||
normalized === null ||
Expand All @@ -1369,6 +1407,7 @@ export function attachProductProofRouteNetworkFailureDiagnostic(error, diagnosti
requestIdentityMismatch !== requestIdentityMismatchDiagnostic ||
expectedRequestMissing !== expectedRequestMissingDiagnostic ||
realtimeIncomplete !== realtimeIncompleteDiagnostic ||
realtimeJoinLimitExceeded !== realtimeJoinLimitDiagnostic ||
realtimeSystemInvalid !== realtimeSystemDiagnostic ||
homeMailboxReadinessFailed !== homeMailboxReadinessDiagnostic ||
(headTerminalOrderDiagnostic && failureCode !== 'live_request_failed_cdp_aborted_fetch') ||
Expand Down Expand Up @@ -1431,14 +1470,19 @@ export function createProductProofRouteFailureDiagnostic({
networkFailure ?? {},
'endpoint_class',
) && !Object.hasOwn(networkFailure ?? {}, 'identity_class');
const realtimeSystemTopicClass = Object.hasOwn(networkFailure ?? {}, 'message_class')
const realtimeTopicClass = Object.hasOwn(networkFailure ?? {}, 'topic_class')
? networkFailure.topic_class
: null;
const realtimeSystemTopicRouteValid = (() => {
if (realtimeSystemTopicClass === null) return true;
const realtimeSystemTopicClass = Object.hasOwn(networkFailure ?? {}, 'message_class')
? realtimeTopicClass
: null;
const realtimeJoinLimitTopicClass =
networkFailure?.reason_code === 'join_limit_exceeded' ? realtimeTopicClass : null;
const realtimeTopicRouteValid = (() => {
if (realtimeTopicClass === null) return true;
if (!['tenant-a', 'tenant-b'].includes(contextLabel)) return false;
if (realtimeSystemTopicClass === 'workspace-live-invalidation') return true;
if (realtimeSystemTopicClass === 'email-import-status') {
if (realtimeTopicClass === 'workspace-live-invalidation') return true;
if (realtimeTopicClass === 'email-import-status') {
return (
viewportLabel === 'desktop-1440x900' &&
[
Expand All @@ -1453,21 +1497,21 @@ export function createProductProofRouteFailureDiagnostic({
].includes(routeLabel)
);
}
if (realtimeSystemTopicClass === 'drafts-feed') return routeLabel === 'home';
if (realtimeSystemTopicClass === 'channel-setup') {
if (realtimeTopicClass === 'drafts-feed') return routeLabel === 'home';
if (realtimeTopicClass === 'channel-setup') {
return ['channels', 'conversation', 'conversation-after-denial'].includes(routeLabel);
}
if (realtimeSystemTopicClass === 'channel-reliability-evidence') {
if (realtimeTopicClass === 'channel-reliability-evidence') {
return routeLabel === 'channels';
}
if (realtimeSystemTopicClass === 'voice-flagship-scorecard') {
if (realtimeTopicClass === 'voice-flagship-scorecard') {
return ['channels', 'ai-phone'].includes(routeLabel);
}
if (realtimeSystemTopicClass === 'channels-dashboard') return routeLabel === 'channels';
if (realtimeSystemTopicClass === 'ai-phone-calls') return routeLabel === 'ai-phone';
if (realtimeTopicClass === 'channels-dashboard') return routeLabel === 'channels';
if (realtimeTopicClass === 'ai-phone-calls') return routeLabel === 'ai-phone';
if (
['conversation-messages', 'conversation-message-events'].includes(
realtimeSystemTopicClass,
realtimeTopicClass,
)
) {
return ['conversation', 'conversation-after-denial'].includes(routeLabel);
Expand All @@ -1486,7 +1530,9 @@ export function createProductProofRouteFailureDiagnostic({
viewportLabel !== 'desktop-1440x900' ||
code !== 'live_browser_managed_preflight_invalid')) ||
(realtimeSystemTopicClass !== null &&
(code !== 'live_realtime_system_invalid' || !realtimeSystemTopicRouteValid)) ||
(code !== 'live_realtime_system_invalid' || !realtimeTopicRouteValid)) ||
(realtimeJoinLimitTopicClass !== null &&
(code !== 'live_realtime_join_limit_exceeded' || !realtimeTopicRouteValid)) ||
(assertionFailure !== undefined &&
(contextLabel !== 'tenant-a' ||
routeLabel !== 'reviews' ||
Expand Down
Loading