browser_review_gate 0.4.1 → 0.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ac053b24d64d38c70581bbfc8aef9b1a1419174634ce4a2bca58f1119bc639b2
4
- data.tar.gz: 14819ac0b43719c11b0ad53f61ee588cdb27743071326d0e037e4fee1c076fea
3
+ metadata.gz: 613338c89efb766c0c87cb095303d2be780955ddcd2fa42e3cc3458e9eb8166c
4
+ data.tar.gz: 51eaa23740b23a5180932d71023b6009f8f9d805436f867efd0356f8c842fa75
5
5
  SHA512:
6
- metadata.gz: d752841217a09af9f3514b1aabcc5abd23639ce43994ea13d59ca7b54267e66ae42855d6ba529584aeb0868394cee9d78e9a6f23f174ca51e439e0bea86e0747
7
- data.tar.gz: 3c87aa88d8db31546e476f7e8fa11688272005875e266d5cbefc156c3ea5a4577861b975629eee8252bc5dad53442e3038855123ed85f7e8224f5d79efa745ef
6
+ metadata.gz: d0923b47163f93927cc0c5eee3467de838ee41730b1d8ca9b5d5c62e44479333ac7fb4b69462e2ebe9234efaee9d0f93748c32d7003239abc86f0c5f69820678
7
+ data.tar.gz: 5af1651dc4f58fe782fdcc598d2ddf58831d66c6a546b2f65754199c80170e28caa970c65b9f29f5e1edbf32c2c4cbfb6a4a449dd787fc5103bbbe3a7191feab
data/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.4.2
4
+
5
+ - Evidence files are kept in the git directory only once a run is accepted; a refused run leaves
6
+ nothing behind.
7
+ - A trace without network requests says how to record one: with snapshots on.
8
+
3
9
  ## 0.4.1
4
10
 
5
11
  - The `.network` log Playwright MCP writes with `browser_start_tracing`/`browser_stop_tracing` is
@@ -34,6 +34,7 @@ module BrowserReviewGate
34
34
  comments = @github.trusted_comments(number)
35
35
  ensure_browser_run_wanted!(number, comments, local_sha)
36
36
  report = merged_report(data, comments)
37
+ keep_evidence
37
38
 
38
39
  complete = report.passed?
39
40
  labelled = pull_request.fetch("labels").any? { |label| label["name"] == @config.label }
@@ -58,6 +59,7 @@ module BrowserReviewGate
58
59
  ensure_environment!(data)
59
60
  report = Report.new(data.merge("verified_by" => "pending"), config: @config)
60
61
  ensure_acceptable!(report)
62
+ keep_evidence
61
63
 
62
64
  saved_report = SavedReport.new(sha: local_sha, shell: @shell)
63
65
  saved_report.write(data)
@@ -93,19 +95,22 @@ module BrowserReviewGate
93
95
  raise Error, "No saved browser verification report for the current commit"
94
96
  end
95
97
 
96
- # Evidence files are read here, next to the report, and kept in the git directory by digest.
98
+ # Evidence files are read here, next to the report. They are kept only once the run is accepted.
97
99
  def read_report_file
98
100
  raise Error, "A report file is required" unless @report_path
99
101
 
100
102
  data = JSON.parse(File.read(@report_path))
101
- evidence = Evidence.new(base_dir: File.dirname(File.expand_path(@report_path)), config: @config)
102
- processed = evidence.process(data)
103
- evidence.keep(SavedReport.evidence_dir(shell: @shell))
104
- processed
103
+ @evidence = Evidence.new(base_dir: File.dirname(File.expand_path(@report_path)), config: @config)
104
+ @evidence.process(data)
105
105
  rescue SystemCallError => error
106
106
  raise Error, "Cannot read report file #{@report_path}: #{error.message}"
107
107
  end
108
108
 
109
+ # Files of an accepted run are kept in the git directory by digest; a refused run leaves nothing.
110
+ def keep_evidence
111
+ @evidence&.keep(SavedReport.evidence_dir(shell: @shell))
112
+ end
113
+
109
114
  # A run names the environment it used; with environments configured it must be one of them.
110
115
  def ensure_environment!(data)
111
116
  name = data["environment"]
@@ -31,7 +31,7 @@ module BrowserReviewGate
31
31
  end
32
32
  findings << "the case's page #{url} was not requested" if @settings["check_pages"] && url && !page_requested?(requests, url)
33
33
  findings.concat(time_findings(requests, started_at, finished_at))
34
- findings << "the trace has no network requests" if requests.empty?
34
+ findings << "the trace has no network requests; record it with snapshots on (Playwright: tracing.start({ snapshots: true }))" if requests.empty?
35
35
 
36
36
  { "status" => findings.empty? ? "verified" : "failed", "revision" => matched && tested_sha[0, 12],
37
37
  "requests" => requests.size, "findings" => findings.first(5) }.compact
@@ -1,3 +1,3 @@
1
1
  module BrowserReviewGate
2
- VERSION = "0.4.1"
2
+ VERSION = "0.4.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: browser_review_gate
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.1
4
+ version: 0.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Islam Gagiev