@@ -457,8 +457,31 @@ public record Report(
457457 string ? MinimizedStackFunctionLinesSha256 ,
458458 string ? ToolName ,
459459 string ? ToolVersion ,
460- string ? OnefuzzVersion
461- ) : IReport ;
460+ string ? OnefuzzVersion ,
461+ Uri ? ReportUrl
462+ ) : IReport , ITruncatable < Report > {
463+ public Report Truncate ( int maxLength ) {
464+ return this with {
465+ Executable = Executable [ ..maxLength ] ,
466+ CrashType = CrashType [ ..Math . Min ( maxLength , CrashType . Length ) ] ,
467+ CrashSite = CrashSite [ ..Math . Min ( maxLength , CrashSite . Length ) ] ,
468+ CallStack = TruncateUtils . TruncateList ( CallStack , maxLength ) ,
469+ CallStackSha256 = CallStackSha256 [ ..Math . Min ( maxLength , CallStackSha256 . Length ) ] ,
470+ InputSha256 = InputSha256 [ ..Math . Min ( maxLength , InputSha256 . Length ) ] ,
471+ AsanLog = AsanLog ? [ ..Math . Min ( maxLength , AsanLog . Length ) ] ,
472+ ScarinessDescription = ScarinessDescription ? [ ..Math . Min ( maxLength , ScarinessDescription . Length ) ] ,
473+ MinimizedStack = MinimizedStack != null ? TruncateUtils . TruncateList ( MinimizedStack , maxLength ) : MinimizedStack ,
474+ MinimizedStackSha256 = MinimizedStackSha256 ? [ ..Math . Min ( maxLength , MinimizedStackSha256 . Length ) ] ,
475+ MinimizedStackFunctionNames = MinimizedStackFunctionNames != null ? TruncateUtils . TruncateList ( MinimizedStackFunctionNames , maxLength ) : MinimizedStackFunctionNames ,
476+ MinimizedStackFunctionNamesSha256 = MinimizedStackFunctionNamesSha256 ? [ ..Math . Min ( maxLength , MinimizedStackFunctionNamesSha256 . Length ) ] ,
477+ MinimizedStackFunctionLines = MinimizedStackFunctionLines != null ? TruncateUtils . TruncateList ( MinimizedStackFunctionLines , maxLength ) : MinimizedStackFunctionLines ,
478+ MinimizedStackFunctionLinesSha256 = MinimizedStackFunctionLinesSha256 ? [ ..Math . Min ( maxLength , MinimizedStackFunctionLinesSha256 . Length ) ] ,
479+ ToolName = ToolName ? [ ..Math . Min ( maxLength , ToolName . Length ) ] ,
480+ ToolVersion = ToolVersion ? [ ..Math . Min ( maxLength , ToolVersion . Length ) ] ,
481+ OnefuzzVersion = OnefuzzVersion ? [ ..Math . Min ( maxLength , OnefuzzVersion . Length ) ] ,
482+ } ;
483+ }
484+ }
462485
463486public record NoReproReport (
464487 string InputSha ,
@@ -468,18 +491,40 @@ public record NoReproReport(
468491 Guid JobId ,
469492 long Tries ,
470493 string ? Error
471- ) ;
494+ ) : ITruncatable < NoReproReport > {
495+ public NoReproReport Truncate ( int maxLength ) {
496+ return this with {
497+ Executable = Executable ? [ ..maxLength ] ,
498+ Error = Error ? [ ..maxLength ]
499+ } ;
500+ }
501+ }
472502
473503public record CrashTestResult (
474504 Report ? CrashReport ,
475505 NoReproReport ? NoReproReport
476- ) ;
506+ ) : ITruncatable < CrashTestResult > {
507+ public CrashTestResult Truncate ( int maxLength ) {
508+ return new CrashTestResult (
509+ CrashReport ? . Truncate ( maxLength ) ,
510+ NoReproReport ? . Truncate ( maxLength )
511+ ) ;
512+ }
513+ }
477514
478515public record RegressionReport (
479516 CrashTestResult CrashTestResult ,
480- CrashTestResult ? OriginalCrashTestResult
481- ) : IReport ;
482-
517+ CrashTestResult ? OriginalCrashTestResult ,
518+ Uri ? ReportUrl
519+ ) : IReport , ITruncatable < RegressionReport > {
520+ public RegressionReport Truncate ( int maxLength ) {
521+ return new RegressionReport (
522+ CrashTestResult . Truncate ( maxLength ) ,
523+ OriginalCrashTestResult ? . Truncate ( maxLength ) ,
524+ ReportUrl
525+ ) ;
526+ }
527+ }
483528
484529[ JsonConverter ( typeof ( NotificationTemplateConverter ) ) ]
485530#pragma warning disable CA1715
@@ -968,3 +1013,7 @@ public record TemplateRenderContext(
9681013 string ReportFilename ,
9691014 string ReproCmd
9701015) ;
1016+
1017+ public interface ITruncatable < T > {
1018+ public T Truncate ( int maxLength ) ;
1019+ }
0 commit comments