perchfall 0.3.1 → 0.3.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 +4 -4
- data/CHANGELOG.md +12 -1
- data/lib/perchfall/client.rb +19 -3
- data/lib/perchfall/playwright_invoker.rb +1 -6
- data/lib/perchfall/version.rb +1 -1
- data/lib/perchfall.rb +13 -3
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: b71c5cd92df55f4c28471df0920f19be7c4b81586d52c76e0704a2d1a605265a
|
|
4
|
+
data.tar.gz: 2dbe1f2b439949f7d7ed2cff08a2a51979e8c02cf1cd7c74c701f3de3a428e01
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 2372a6936e06871d890e272e7c722b5dc59e4a2c2ac86e08e882479f3537f85ef3a66bf68b0a913a24029c300740183126437dda332934b975f9bc84fc64146e
|
|
7
|
+
data.tar.gz: fd02d5e014638c12695932361995443ad1f1c6a66aa104c0db360b931e55291cfca1a176aa2353a16267e73c3e651325a94c5ce4bb1f334b3ee4cdadb6ebc6ff
|
data/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [0.3.2] - 2026-03-19
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
|
|
14
|
+
- `Perchfall.run!` — like `.run` but raises `PageLoadError` when the report is not ok. Use in scripts or jobs that should abort on any page failure.
|
|
15
|
+
|
|
16
|
+
### Changed
|
|
17
|
+
|
|
18
|
+
- `Perchfall.run` now always returns a `Report`, even when the page has unignored errors. Callers check `report.ok?` and handle failures themselves. This makes notification workflows possible without rescuing exceptions.
|
|
19
|
+
|
|
10
20
|
## [0.3.1] - 2026-03-19
|
|
11
21
|
|
|
12
22
|
### Changed
|
|
@@ -64,7 +74,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
64
74
|
- Full dependency injection throughout — test suite runs in ~0.4 s with no browser, Node, or network required
|
|
65
75
|
- GitHub Actions CI workflow (unit suite) and manual Playwright smoke check workflow
|
|
66
76
|
|
|
67
|
-
[Unreleased]: https://github.com/beflagrant/perchfall/compare/v0.3.
|
|
77
|
+
[Unreleased]: https://github.com/beflagrant/perchfall/compare/v0.3.2...HEAD
|
|
78
|
+
[0.3.2]: https://github.com/beflagrant/perchfall/compare/v0.3.1...v0.3.2
|
|
68
79
|
[0.3.1]: https://github.com/beflagrant/perchfall/compare/v0.2.0...v0.3.1
|
|
69
80
|
[0.2.0]: https://github.com/beflagrant/perchfall/compare/v0.1.0...v0.2.0
|
|
70
81
|
[0.1.0]: https://github.com/beflagrant/perchfall/releases/tag/v0.1.0
|
data/lib/perchfall/client.rb
CHANGED
|
@@ -55,20 +55,36 @@ module Perchfall
|
|
|
55
55
|
end
|
|
56
56
|
|
|
57
57
|
# Run a synthetic browser check against the given URL.
|
|
58
|
+
# Always returns a Report — callers must check report.ok? to determine success.
|
|
58
59
|
#
|
|
59
60
|
# @param url [String] the URL to check (required, must be http or https)
|
|
60
61
|
# @param timeout_ms [Integer] ms before Playwright gives up (default 30_000)
|
|
61
62
|
# @param scenario_name [String, nil] optional label included in the report
|
|
62
63
|
# @param timestamp [Time] override the run timestamp (default Time.now.utc)
|
|
63
|
-
# @return [Report]
|
|
64
|
+
# @return [Report]
|
|
64
65
|
# @raise [ArgumentError] if the URL is not http/https
|
|
65
66
|
# @raise [Errors::ConcurrencyLimitError] if the concurrency cap is reached
|
|
66
67
|
# @raise [Errors::InvocationError] if Node could not be started
|
|
67
68
|
# @raise [Errors::ScriptError] if the Node script exited non-zero
|
|
68
69
|
# @raise [Errors::ParseError] if the script output was not valid JSON
|
|
69
|
-
|
|
70
|
+
def run(url:, **opts)
|
|
71
|
+
invoke(url: url, **opts)
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
# Like #run, but raises PageLoadError if the report is not ok.
|
|
75
|
+
# Use this in scripts or jobs that should abort on any page failure.
|
|
76
|
+
#
|
|
77
|
+
# @return [Report] only if report.ok?
|
|
78
|
+
# @raise [Errors::PageLoadError] if the page failed to load or has unignored errors
|
|
79
|
+
def run!(url:, **opts)
|
|
80
|
+
report = invoke(url: url, **opts)
|
|
81
|
+
raise Errors::PageLoadError.new(report) unless report.ok?
|
|
82
|
+
report
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
private
|
|
70
86
|
|
|
71
|
-
def
|
|
87
|
+
def invoke(url:, ignore: [], wait_until: "load", timeout_ms: 30_000, scenario_name: nil, timestamp: Time.now.utc, cache_profile: :query_bust)
|
|
72
88
|
profile = resolve_cache_profile!(cache_profile)
|
|
73
89
|
validate_wait_until!(wait_until)
|
|
74
90
|
validate_timeout_ms!(timeout_ms)
|
|
@@ -27,9 +27,7 @@ module Perchfall
|
|
|
27
27
|
def run(url:, timestamp:, timeout_ms: 30_000, wait_until: "load", scenario_name: nil, ignore: [], original_url: nil, extra_headers: {}, cache_profile: nil)
|
|
28
28
|
parser = build_parser(ignore)
|
|
29
29
|
result = execute(build_command(url: url, timeout_ms: timeout_ms, wait_until: wait_until, extra_headers: extra_headers))
|
|
30
|
-
|
|
31
|
-
raise_if_page_load_error(report)
|
|
32
|
-
report
|
|
30
|
+
parse(result, parser: parser, scenario_name: scenario_name, timestamp: timestamp, original_url: original_url || url, cache_profile: cache_profile)
|
|
33
31
|
end
|
|
34
32
|
|
|
35
33
|
private
|
|
@@ -62,8 +60,5 @@ module Perchfall
|
|
|
62
60
|
parser.parse(result.stdout, **opts)
|
|
63
61
|
end
|
|
64
62
|
|
|
65
|
-
def raise_if_page_load_error(report)
|
|
66
|
-
raise Errors::PageLoadError.new(report) unless report.ok?
|
|
67
|
-
end
|
|
68
63
|
end
|
|
69
64
|
end
|
data/lib/perchfall/version.rb
CHANGED
data/lib/perchfall.rb
CHANGED
|
@@ -43,9 +43,8 @@ module Perchfall
|
|
|
43
43
|
@default_limiter ||= ConcurrencyLimiter.new(limit: 5)
|
|
44
44
|
end
|
|
45
45
|
|
|
46
|
-
#
|
|
47
|
-
#
|
|
48
|
-
# no shared state between invocations.
|
|
46
|
+
# Returns a Report always — callers check report.ok? to determine success.
|
|
47
|
+
# Use this when you want to handle or notify on failures yourself.
|
|
49
48
|
#
|
|
50
49
|
# @param url [String]
|
|
51
50
|
# @param opts [Hash] forwarded to Client#run
|
|
@@ -53,4 +52,15 @@ module Perchfall
|
|
|
53
52
|
def self.run(url:, **opts)
|
|
54
53
|
Client.new.run(url: url, **opts)
|
|
55
54
|
end
|
|
55
|
+
|
|
56
|
+
# Like .run, but raises PageLoadError if the report is not ok.
|
|
57
|
+
# Use this in scripts or jobs that should abort on any page failure.
|
|
58
|
+
#
|
|
59
|
+
# @param url [String]
|
|
60
|
+
# @param opts [Hash] forwarded to Client#run!
|
|
61
|
+
# @return [Report] only if report.ok?
|
|
62
|
+
# @raise [Errors::PageLoadError]
|
|
63
|
+
def self.run!(url:, **opts)
|
|
64
|
+
Client.new.run!(url: url, **opts)
|
|
65
|
+
end
|
|
56
66
|
end
|