Module: Evilution::MCP::MutateTool::ReportTrimmer Private

Defined in:
lib/evilution/mcp/mutate_tool/report_trimmer.rb

This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.

Constant Summary collapse

MINIMAL_KEYS =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

%w[summary survived].freeze
FULL_DIFF_STRIP_KEYS =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

%w[killed neutral equivalent unresolved unparseable].freeze
SUMMARY_DROP_KEYS =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

%w[killed neutral equivalent unparseable].freeze
SUMMARY_HEAVY_FIELDS =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

EV-187j / GH #1169: at summary verbosity, non-survived entries that remain (timed_out, errors, unresolved) shed diff and error_backtrace payload — those two fields dominate response size at scale and aren't actionable for a scanning agent. Survived stays full-detail.

%w[diff error_backtrace].freeze
SUMMARY_TRIM_KEYS =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

%w[timed_out errors unresolved].freeze
ERROR_SAMPLE_LIMIT =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

EV-t7kh / GH #1170: at minimal verbosity we surface a small sample of any errored mutations so agents are not stuck in a diagnose-vs-token-cap deadlock when a run is partly-broken. Bounded to keep the payload tiny.

3
ERROR_BACKTRACE_HEAD_LINES =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

5
ERROR_SAMPLE_KEYS =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

%w[operator file line error_message error_class].freeze

Class Method Summary collapse

Class Method Details

.call(json_string, verbosity:, survived_results:, config:, enricher:, summary: nil) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/evilution/mcp/mutate_tool/report_trimmer.rb', line 28

def self.call(json_string, verbosity:, survived_results:, config:, enricher:, summary: nil)
  data = ::JSON.parse(json_string)
  case verbosity
  when "full"
    FULL_DIFF_STRIP_KEYS.each { |key| strip_diffs(data, key) }
  when "summary"
    SUMMARY_DROP_KEYS.each { |key| data.delete(key) }
    SUMMARY_TRIM_KEYS.each { |key| strip_heavy_fields(data, key) }
  when "minimal"
    apply_minimal(data)
  end
  enricher.call(data, survived_results, config)
  embed_feedback(data, summary) unless verbosity == "minimal"
  embed_setup_warning(data, summary)
  ::JSON.generate(data)
end