jobpayload 0.1.0
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 +7 -0
- data/CHANGELOG.md +52 -0
- data/LICENSE +21 -0
- data/README.md +622 -0
- data/exe/jobpayload +6 -0
- data/lib/jobpayload/boot.rb +49 -0
- data/lib/jobpayload/canonical.rb +87 -0
- data/lib/jobpayload/case_registry.rb +86 -0
- data/lib/jobpayload/checker.rb +187 -0
- data/lib/jobpayload/cli.rb +221 -0
- data/lib/jobpayload/errors.rb +16 -0
- data/lib/jobpayload/exception_classifier.rb +88 -0
- data/lib/jobpayload/finding.rb +82 -0
- data/lib/jobpayload/fixture.rb +94 -0
- data/lib/jobpayload/fixture_loader.rb +36 -0
- data/lib/jobpayload/formatter/json.rb +27 -0
- data/lib/jobpayload/formatter/text.rb +82 -0
- data/lib/jobpayload/formatter.rb +19 -0
- data/lib/jobpayload/result.rb +60 -0
- data/lib/jobpayload/snapshotter.rb +122 -0
- data/lib/jobpayload/version.rb +5 -0
- data/lib/jobpayload.rb +61 -0
- metadata +89 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: a6a279c0d7d4f97b7ba76677146e0d73ebd7b65df8db221b93b61a6e69e1d30a
|
|
4
|
+
data.tar.gz: 4dc6bc66b1296cf30bf03e1ebad5d68797868f6cfc84117edc9246b555a63881
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: e7b0ffe7184e08ca69623c383dd9ebb4f323408ea7a343d3a31accb0c310009c672e00af66411e78583d66545780c326956f098ce70ce86315fef4f1b3f9d10e
|
|
7
|
+
data.tar.gz: 2dba7bc4c7dbb0786367ae438d94accedf7312f99f9c3733dfc7a3845f2fcf6153e72d260edcfca8fb486fb62f15327fe2008a44bfa9a3f6fe5c50fdf726e093
|
data/CHANGELOG.md
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project are documented in this file.
|
|
4
|
+
|
|
5
|
+
## 0.1.0
|
|
6
|
+
|
|
7
|
+
Initial release. The single question v0.1.0 answers is: *can the current
|
|
8
|
+
application deserialize this previously serialized Active Job payload?*
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
|
|
12
|
+
- `jobpayload snapshot`: evaluates snapshot cases declared with
|
|
13
|
+
`JobPayload.define { fixture "name" { SomeJob.new(...) } }` and writes one
|
|
14
|
+
JSON fixture per case from `ActiveJob::Base#serialize`.
|
|
15
|
+
- Fixture schema v1 (`jobpayload_schema: 1`) with `name`, `source` versions and the
|
|
16
|
+
serialized `job` hash.
|
|
17
|
+
- Volatile metadata (`job_id`, `provider_job_id`, `enqueued_at`, `executions`,
|
|
18
|
+
`exception_executions`, non-nil `scheduled_at`) is normalized to fixed values;
|
|
19
|
+
custom keys added by a job's own `#serialize` are kept.
|
|
20
|
+
- Byte-for-byte deterministic output: recursively sorted keys, fixed
|
|
21
|
+
two-space layout independent of the json gem version, UTF-8, LF, final newline,
|
|
22
|
+
atomic writes, fixtures processed in name order.
|
|
23
|
+
- Existing fixtures are never overwritten unless `--update` is given.
|
|
24
|
+
- `jobpayload check`: boots the application once and, for every fixture, runs
|
|
25
|
+
`ActiveJob::Base.deserialize` and `ActiveJob::Arguments.deserialize` on fresh
|
|
26
|
+
copies of the payload. Jobs are never performed, enqueued or retried.
|
|
27
|
+
- Stable finding codes: `AJP001` fixture_invalid, `AJP101` unknown_job_class,
|
|
28
|
+
`AJP102` job_deserialize_failed, `AJP201` argument_deserialize_failed,
|
|
29
|
+
`AJP202` globalid_record_missing (inconclusive), `AJP900` environment_error.
|
|
30
|
+
- GlobalID records missing from the test database are reported as inconclusive
|
|
31
|
+
(exit 0 by default, exit 1 with `--fail-on-inconclusive`). `AJP202` is only
|
|
32
|
+
used when the failing argument is an Active Job GlobalID reference
|
|
33
|
+
(`{"_aj_globalid": ...}`) and a record-missing exception is in the cause chain;
|
|
34
|
+
any other argument failure is `AJP201`, even when `RecordNotFound` appears in
|
|
35
|
+
the cause chain (for example a custom serializer's `find_by!`).
|
|
36
|
+
- Exception classification by class and cause chain (cycle-safe), not by message text.
|
|
37
|
+
- Failing argument location (`arguments[1]`, `arguments[0]["batch"][1]`, ...); every
|
|
38
|
+
failing argument gets its own finding, so an inconclusive missing record cannot
|
|
39
|
+
hide a breaking argument next to it.
|
|
40
|
+
- Text output and JSON output schema v1; `--debug` adds backtraces to text output.
|
|
41
|
+
JSON vocabulary: top-level `status` is `pass` / `fail` / `tool_error`; fixture
|
|
42
|
+
`status` is `pass` / `fail` / `inconclusive` / `tool_error`; finding `severity`
|
|
43
|
+
is `error` (compatibility break) / `warning` (inconclusive) / `fatal`
|
|
44
|
+
(tool/environment failure); `summary` counts `compatible`, `incompatible`,
|
|
45
|
+
`inconclusive` and `tool_errors`. Exception messages, fixture file names and
|
|
46
|
+
paths are always emitted as valid UTF-8.
|
|
47
|
+
- Exit codes: 0 compatible, 1 compatibility failure, 2 usage/configuration/boot/tool error.
|
|
48
|
+
- Options: `--boot`, `--environment` (default `test`), `--cases`, `--output`,
|
|
49
|
+
`--fixtures`, `--update`, `--format text|json`, `--fail-on-inconclusive`, `--debug`.
|
|
50
|
+
- `require "jobpayload"` does not load Active Job; Active Job (and the json
|
|
51
|
+
library) is only loaded after the host application has booted.
|
|
52
|
+
- Supported: Ruby 3.3, 3.4, 4.0 with Active Job 7.2, 8.0, 8.1.
|
data/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 cottondesu
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|