File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11import type { BrowserInstallFacts } from "../browser/installFacts.js" ;
2+ import type { StopCode } from "../utils/checkPipeline.js" ;
23import type { OutputResolutionIssueKind } from "@hyperframes/core" ;
34import { redactTelemetryString } from "@hyperframes/core/telemetry-redaction" ;
45import type { SubTimelineWaitOutcome } from "@hyperframes/engine" ;
@@ -1193,8 +1194,7 @@ export function trackCheckReport(props: {
11931194 contrastPoints : number ;
11941195 ok : boolean ;
11951196 exitCode : number ;
1196- /** The code of the finding that stopped the check, one of a closed set (checkPipeline's STOP_CODES). */
1197- stopCode ?: string ;
1197+ stopCode ?: StopCode ;
11981198 runId ?: string ;
11991199} ) : void {
12001200 trackEvent ( "check_report" , {
Original file line number Diff line number Diff line change @@ -2130,7 +2130,9 @@ function buildReport(
21302130 contrastPoints : browser . contrastChecked ,
21312131 ok : report . ok ,
21322132 exitCode : checkExitCode ( report ) ,
2133- stopCode : browser . runtimeFindings . find ( ( finding ) => STOP_CODES . has ( finding . code ) ) ?. code ,
2133+ stopCode : browser . runtimeFindings
2134+ . map ( ( finding ) => finding . code )
2135+ . find ( ( code ) : code is StopCode => ( STOP_CODES as readonly string [ ] ) . includes ( code ) ) ,
21342136 runId : getRunId ( ) ,
21352137 } ) ;
21362138 return filterComponentReport ( report , options ) ;
@@ -2265,12 +2267,12 @@ function emptyBrowserResult(): CheckBrowserResult {
22652267 } ;
22662268}
22672269
2268- /** The codes `runtimeFailure` gives a finding that ends the browser check early; `check_report` sends the first one. */
2269- const STOP_CODES : ReadonlySet < string > = new Set ( [
2270+ export const STOP_CODES = [
22702271 "media_copies_unfinished" ,
22712272 "check_budget_reached" ,
22722273 "check_runtime_failure" ,
2273- ] ) ;
2274+ ] as const ;
2275+ export type StopCode = ( typeof STOP_CODES ) [ number ] ;
22742276
22752277function runtimeFailure ( error : unknown , code ?: string ) : CheckFinding {
22762278 return findingAtRoot (
You can’t perform that action at this time.
0 commit comments