branchproof 0.9.0 → 0.11.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 +4 -4
- data/CHANGELOG.md +42 -0
- data/README.md +230 -28
- data/doc/Branchproof/Configuration.md +28 -0
- data/doc/Branchproof/CoveragePolicy.md +27 -0
- data/doc/Branchproof/Evidence.md +3 -0
- data/doc/Branchproof/FocusedReport.md +1 -1
- data/doc/Branchproof/Project.md +4 -1
- data/doc/Branchproof/RSpecAdapter/ClassRunnerGuard.md +11 -0
- data/doc/Branchproof/RSpecAdapter/ContextLifecycle.md +14 -0
- data/doc/Branchproof/RSpecAdapter/DefaultDiscovery.md +11 -0
- data/doc/Branchproof/RSpecAdapter/ExampleLifecycle.md +11 -0
- data/doc/Branchproof/RSpecAdapter/RunnerGuard.md +11 -0
- data/doc/Branchproof/RSpecAdapter/UnsupportedRunner.md +12 -0
- data/doc/Branchproof/RSpecAdapter.md +47 -0
- data/doc/Branchproof/RailsSupport.md +35 -2
- data/doc/Branchproof/Report.md +11 -2
- data/doc/Branchproof/ReportSelection.md +42 -0
- data/doc/Branchproof/Runtime.md +3 -0
- data/doc/Branchproof/Worker.md +8 -1
- data/doc/Branchproof.md +11 -1
- data/doc/CHANGELOG.md +42 -0
- data/doc/README.md +230 -28
- data/lib/branchproof/cli.rb +191 -38
- data/lib/branchproof/comparison.rb +58 -7
- data/lib/branchproof/configuration.rb +111 -0
- data/lib/branchproof/coverage_policy.rb +169 -0
- data/lib/branchproof/evidence.rb +41 -2
- data/lib/branchproof/focused_report.rb +149 -27
- data/lib/branchproof/project.rb +49 -2
- data/lib/branchproof/rails_support.rb +101 -0
- data/lib/branchproof/report.rb +118 -10
- data/lib/branchproof/report_selection.rb +158 -0
- data/lib/branchproof/rspec_adapter.rb +423 -0
- data/lib/branchproof/runtime.rb +4 -0
- data/lib/branchproof/saved_report.rb +38 -5
- data/lib/branchproof/version.rb +1 -1
- data/lib/branchproof/worker.rb +75 -15
- data/lib/branchproof.rb +4 -0
- data/llms.txt +11 -1
- data/sig/branchproof.rbs +63 -4
- metadata +16 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 3667120528803b1ceeb8c17313f66391b38633ed452757cb6e532f938d8cfd2a
|
|
4
|
+
data.tar.gz: ebdab6b41dde4697eff2634fe022c18e7c86e7abf4a317235fc94f24ec6070ad
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 226da6639e0f9aedc3345073e76b8bd78c23921ea0c5664d4230cf1712d25984a8b97168b2d721658e50c552dab54e6ad5cac71ae8bfccf5222c4eb89cf8471e
|
|
7
|
+
data.tar.gz: 7ff352e0d1ec9aca08a67d0ed9c6246a37f1560f16777a0c89b01ad04ad94fff7af99a2abb3b09135990f1d67b33e58cff3ce4209e0e0a5a808f72ff59a52c07
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,47 @@
|
|
|
1
1
|
## [Unreleased]
|
|
2
2
|
|
|
3
|
+
## [0.11.0] - 2026-09-25
|
|
4
|
+
|
|
5
|
+
- Add validated coverage policies for Decision, Condition, Condition/Decision,
|
|
6
|
+
MC/DC, and Decision Table criteria. Repeatable `--minimum criterion=threshold`
|
|
7
|
+
options override matching project or saved-report policy entries, compare
|
|
8
|
+
exact counts, and distinguish failed gates from unavailable or incomplete
|
|
9
|
+
evidence in exit status and JSON.
|
|
10
|
+
- Persist policy decisions in live schema `1.4` reports while keeping saved
|
|
11
|
+
schemas `1.0` through `1.3` readable; offline policy overrides do not load
|
|
12
|
+
project configuration or mutate snapshots.
|
|
13
|
+
- Add terminal-only `--focus PATH[:LINE]` and `--top N` selection for analyze
|
|
14
|
+
and report views. Selection uses captured source spans and deterministic source
|
|
15
|
+
order while leaving global summaries, gates, diagnostics, and exit status
|
|
16
|
+
unchanged.
|
|
17
|
+
- Document a GitHub Actions artifact workflow that creates the output directory
|
|
18
|
+
and uploads reports after gate failures.
|
|
19
|
+
- Preserve setup, body, and teardown phase totals when independent evidence runs
|
|
20
|
+
are merged, keeping phase attribution complete in combined snapshots.
|
|
21
|
+
- Add declarative `.branchproof.json` project configuration with CLI precedence,
|
|
22
|
+
source exclusions, and comparison metadata for repeatable coverage runs.
|
|
23
|
+
- Add a pipeline benchmark harness that exposes timing dimensions for future
|
|
24
|
+
measurements of coverage feedback costs.
|
|
25
|
+
|
|
26
|
+
## [0.10.0] - 2026-09-21
|
|
27
|
+
|
|
28
|
+
- Add the first-release RSpec execution path for plain Ruby and Rails projects.
|
|
29
|
+
It supports RSpec 3.13, including Rails 8.1 with rspec-rails 8.x on CRuby 3.4.
|
|
30
|
+
Integration is verified against rspec-rails 8.0.4 and native RSpec behavior.
|
|
31
|
+
- Add `--framework auto|minitest|rspec`, native RSpec discovery that respects
|
|
32
|
+
exclusions and custom patterns, full-description labels, and status mapping for pending,
|
|
33
|
+
skipped, fixed pending, and failed examples.
|
|
34
|
+
- Keep Rails helper ownership with the application after Branchproof's loader;
|
|
35
|
+
transaction behavior, in-process specs, and context/suite/unattributed
|
|
36
|
+
evidence are recorded explicitly.
|
|
37
|
+
- Allow focused pure-Ruby specs inside Rails projects without requiring Rails boot.
|
|
38
|
+
- Match RSpec examples across saved reports only when spec and declaration
|
|
39
|
+
revisions agree, preventing false matches after examples are inserted or reordered.
|
|
40
|
+
- Stream test progress to stderr, show quoted RSpec rerun commands, and explain
|
|
41
|
+
unmatched test globs, empty suites, and filters selecting no examples.
|
|
42
|
+
- Document repeated ordinary and shared-example benchmarks with allocations
|
|
43
|
+
and peak process memory; end-to-end overhead remains substantial.
|
|
44
|
+
|
|
3
45
|
## [0.9.0] - 2026-09-18
|
|
4
46
|
|
|
5
47
|
- Measure contextual predicates, guarded pattern selection, dynamic case splat
|
data/README.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# Branchproof
|
|
2
2
|
|
|
3
3
|
Branchproof measures decision, condition, modified condition/decision (MC/DC),
|
|
4
|
-
and decision-table coverage from one serial Minitest run. It discovers Ruby
|
|
4
|
+
and decision-table coverage from one serial Minitest or RSpec run. It discovers Ruby
|
|
5
5
|
decisions through Prism, records their runtime paths, and attributes evidence
|
|
6
6
|
to tests. Boolean decisions receive the coverage ladder; `case`, pattern
|
|
7
7
|
alternatives, safe navigation, and conditional assignments receive alternative
|
|
@@ -22,10 +22,13 @@ Or add it to a bundle:
|
|
|
22
22
|
bundle add branchproof
|
|
23
23
|
```
|
|
24
24
|
|
|
25
|
-
Branchproof targets CRuby 3.3 and 3.4, Minitest 5.x, and Prism 1.x. The
|
|
26
|
-
published core runtime matrix is the CI matrix. Rails
|
|
27
|
-
|
|
28
|
-
|
|
25
|
+
Branchproof targets CRuby 3.3 and 3.4, Minitest 5.x, RSpec 3.13, and Prism 1.x. The
|
|
26
|
+
published core runtime matrix is the CI matrix. Rails/RSpec execution is limited
|
|
27
|
+
to Rails 8.1.x, rspec-rails 8.x, RSpec 3.13.x, and CRuby 3.4.x; passing core
|
|
28
|
+
tests on Ruby 4.0 does not imply Rails/RSpec support. Integration has been checked
|
|
29
|
+
with Rails 8.1.3.1, rspec-rails 8.0.4, RSpec Core 3.13.6, and CRuby 3.4.7.
|
|
30
|
+
Rails and RSpec are optional dependencies supplied by the application.
|
|
31
|
+
Minitest 5.x remains a runtime dependency of this gem.
|
|
29
32
|
Unsupported syntax and incomplete observations remain visible in the report
|
|
30
33
|
instead of being counted as coverage.
|
|
31
34
|
|
|
@@ -33,7 +36,7 @@ instead of being counted as coverage.
|
|
|
33
36
|
|
|
34
37
|
Run `branchproof analyze` with the source files or globs to inspect, followed by
|
|
35
38
|
options. A second `--` separates Branchproof options from arguments passed to
|
|
36
|
-
|
|
39
|
+
the selected test framework:
|
|
37
40
|
|
|
38
41
|
```sh
|
|
39
42
|
branchproof analyze 'lib/**/*.rb' --test 'test/**/*_test.rb' \
|
|
@@ -58,22 +61,126 @@ the application's bundle and Rails version remain in effect:
|
|
|
58
61
|
bundle exec branchproof analyze 'app/**/*.rb' --project rails --test 'test/**/*_test.rb'
|
|
59
62
|
```
|
|
60
63
|
|
|
64
|
+
Choose the test framework independently from project kind:
|
|
65
|
+
|
|
66
|
+
```sh
|
|
67
|
+
bundle exec branchproof analyze 'app/**/*.rb' --project rails --framework rspec
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
`--framework auto|minitest|rspec` is explicit about the adapter. Auto mode
|
|
71
|
+
selects RSpec when `.rspec` or `spec/**/*_spec.rb` markers exist and Minitest
|
|
72
|
+
when `test/**/*_test.rb` or `test/**/test_*.rb` markers exist. If both are
|
|
73
|
+
present, specify the framework. RSpec discovery uses `spec/**/*_spec.rb`; an
|
|
74
|
+
explicit `--test` selection remains authoritative. Project roots are resolved
|
|
75
|
+
explicitly, and report paths are relative to that root so reports from
|
|
76
|
+
different checkouts can be compared.
|
|
77
|
+
|
|
78
|
+
Install `rspec` in the application's test bundle; Rails applications also need
|
|
79
|
+
`rspec-rails`. RSpec reads its usual option files and `SPEC_OPTS`, including
|
|
80
|
+
helper requires, filters, ordering, and file or example-ID selectors. Selectors
|
|
81
|
+
from RSpec configuration replace default discovery. Combining those selectors
|
|
82
|
+
with an explicit Branchproof `--test` is rejected as ambiguous; ordinary filters
|
|
83
|
+
such as `--tag` and `--example` can accompany `--test`.
|
|
84
|
+
|
|
85
|
+
RSpec before hooks, eager `let!`, and around-hook prefixes own setup evidence.
|
|
86
|
+
The example body and helpers evaluated there own body evidence; after hooks,
|
|
87
|
+
mock cleanup, and around-hook suffixes own teardown evidence. Suite and context
|
|
88
|
+
hooks remain unattributed. Pending and skipped examples do not invent execution;
|
|
89
|
+
an unexpectedly passing pending example remains a failure.
|
|
90
|
+
|
|
91
|
+
RSpec support is serial: dry-run, bisect, DRb, custom runners, nested runs, and
|
|
92
|
+
repeated example attempts are rejected. Rails/RSpec supports Rails 8.1.x with
|
|
93
|
+
rspec-rails 8.x on CRuby 3.4.x. Feature and system specs use the in-process
|
|
94
|
+
Capybara `rack_test` driver; browser drivers require execution-context support
|
|
95
|
+
outside this release. Capybara is optional for apps that do not use those specs.
|
|
96
|
+
|
|
61
97
|
For a project rooted at the current directory, `--project auto` is the
|
|
62
98
|
default. It selects Rails only when both `config/application.rb` and
|
|
63
99
|
`config/environment.rb` exist; otherwise it selects a plain Ruby project.
|
|
64
100
|
Use `--project ruby` or `--project rails` to override detection. An explicit
|
|
65
101
|
Rails project without both boot files is a usage error.
|
|
66
102
|
|
|
67
|
-
|
|
103
|
+
Minitest defaults discover the sorted, de-duplicated union of
|
|
68
104
|
`test/**/*_test.rb` and `test/**/test_*.rb`. Helper, support, and fixture files
|
|
69
105
|
are excluded from that default set. `--test` remains authoritative when test
|
|
70
106
|
files are selected explicitly. The worker prepends the project's `lib` and
|
|
71
|
-
`test` directories to its child load path, so application `require` calls
|
|
107
|
+
`test` directories (`lib` and `spec` for RSpec) to its child load path, so application `require` calls
|
|
72
108
|
resolve without changing the parent process.
|
|
73
109
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
110
|
+
Project defaults can be checked into `.branchproof.json` at the project root:
|
|
111
|
+
|
|
112
|
+
```json
|
|
113
|
+
{
|
|
114
|
+
"schema_version": 1,
|
|
115
|
+
"project": "rails",
|
|
116
|
+
"framework": "minitest",
|
|
117
|
+
"sources": ["app/**/*.rb"],
|
|
118
|
+
"tests": ["test/**/*_test.rb"],
|
|
119
|
+
"exclude": ["app/generated/**/*.rb"],
|
|
120
|
+
"minimum": { "mcdc": 80 }
|
|
121
|
+
}
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
`project` accepts `auto`, `ruby`, or `rails`; `framework` accepts `auto`,
|
|
125
|
+
`minitest`, or `rspec`. `sources` and `tests` replace their corresponding
|
|
126
|
+
defaults, while `exclude` removes matching source files before inventory. A
|
|
127
|
+
configuration file may live elsewhere when passed with `--config PATH`; its
|
|
128
|
+
patterns are still resolved from the project root. Use `--no-config` to disable
|
|
129
|
+
the default file. Command-line project, framework, source, and test selections
|
|
130
|
+
take precedence over the file. Configured `exclude` patterns are applied
|
|
131
|
+
before source inventory and are recorded in run metadata for comparison.
|
|
132
|
+
`--config` and `--no-config` cannot be used together. RSpec configuration
|
|
133
|
+
selectors continue to conflict with an explicit test selection, including one
|
|
134
|
+
supplied by this file.
|
|
135
|
+
|
|
136
|
+
The `minimum` values are validated percentages from 0 through 100 for the five
|
|
137
|
+
supported criteria: `decision`, `condition`, `condition_decision`, `mcdc`, and
|
|
138
|
+
`decision_table`. A policy is evaluated against the exact numerator and
|
|
139
|
+
denominator counts in the report, so a value such as `66.67` is not rounded
|
|
140
|
+
before it is compared. The policy is recorded in JSON under
|
|
141
|
+
`coverage_policy`.
|
|
142
|
+
|
|
143
|
+
The command line can add or replace individual policy entries with repeatable
|
|
144
|
+
`--minimum` options. Use `criterion=threshold`, for example:
|
|
145
|
+
|
|
146
|
+
```sh
|
|
147
|
+
bundle exec branchproof analyze 'lib/**/*.rb' --minimum mcdc=80 \
|
|
148
|
+
--minimum decision_table=75
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
CLI values take precedence over matching `minimum` keys from `.branchproof.json`.
|
|
152
|
+
Specifying the same criterion more than once on the command line is an error.
|
|
153
|
+
The five criteria are evaluated independently. A threshold met exactly passes;
|
|
154
|
+
a result below it fails. A requested gate with a zero denominator, unavailable
|
|
155
|
+
coverage, or incomplete observations or analysis is `unavailable`, and exits
|
|
156
|
+
with status 2. A below-threshold gate exits 1. A failed test run makes
|
|
157
|
+
requested policy gates unavailable and exits 2; without a policy, a failed test
|
|
158
|
+
run retains the existing exit status 1. With no policy, the existing report
|
|
159
|
+
exit behavior remains unchanged.
|
|
160
|
+
|
|
161
|
+
For a Minitest project, a focused configuration can select the library and
|
|
162
|
+
test trees directly:
|
|
163
|
+
|
|
164
|
+
```json
|
|
165
|
+
{ "schema_version": 1, "framework": "minitest",
|
|
166
|
+
"sources": ["lib/**/*.rb"], "tests": ["test/**/*_test.rb"] }
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
For an RSpec project, use its spec patterns instead:
|
|
170
|
+
|
|
171
|
+
```json
|
|
172
|
+
{ "schema_version": 1, "framework": "rspec",
|
|
173
|
+
"sources": ["app/**/*.rb"], "tests": ["spec/**/*_spec.rb"] }
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
Rails analysis boots the application inside the isolated worker after
|
|
177
|
+
Branchproof's loader and the selected framework hooks are installed. The
|
|
178
|
+
application's `rails_helper` owns requiring and configuring `rspec/rails` after
|
|
179
|
+
the loader; the helper must not require `branchproof` again. Selected specs
|
|
180
|
+
may require only `spec_helper` and run without booting Rails,
|
|
181
|
+
even when project detection selects Rails. Once Rails is loaded, Branchproof
|
|
182
|
+
requires an initialized application and enforces the Rails/RSpec support limits.
|
|
183
|
+
The child receives `RAILS_ENV=test`, `RACK_ENV=test`, `PARALLEL_WORKERS=1`,
|
|
77
184
|
`DISABLE_BOOTSNAP=1`, and `DISABLE_SPRING=1`; the invoking process environment
|
|
78
185
|
is unchanged. The Rails metadata in the report identifies the selected
|
|
79
186
|
project and Rails version.
|
|
@@ -93,6 +200,17 @@ the witness pair or missing counterpart constraints beside each condition;
|
|
|
93
200
|
Level 2 and Level 3 also list named supporting tests. Repeated supporting-set
|
|
94
201
|
rows are collapsed in terminal output only.
|
|
95
202
|
|
|
203
|
+
RSpec owners use the example's `full_description` and positional `example_id`.
|
|
204
|
+
Terminal views include quoted rerun commands, including selectors for shared
|
|
205
|
+
examples. These selectors apply to the recorded spec revision. Comparisons
|
|
206
|
+
require matching spec and declaration digests before matching example owners;
|
|
207
|
+
changed specs and older reports without digests are treated conservatively.
|
|
208
|
+
Runner output streams to stderr while JSON reports remain on stdout.
|
|
209
|
+
Pending, skipped, fixed-pending, and failed examples map to the corresponding
|
|
210
|
+
baseline statuses; suite and context lifecycle events remain visible, and
|
|
211
|
+
observations without a test owner are counted as unattributed. The same levels
|
|
212
|
+
and terminal views are available for both adapters.
|
|
213
|
+
|
|
96
214
|
For example, running the contents of the small `decision.rb` /
|
|
97
215
|
`test_decision_test.rb` fixture from a project `lib/` and `test/` directory
|
|
98
216
|
with the terminal format produces a summary like this:
|
|
@@ -156,6 +274,15 @@ that did evaluate count toward Condition Coverage even when their value was
|
|
|
156
274
|
masked by another condition. Here, the two observations prove independence
|
|
157
275
|
for `logged_in?`; `admin?` still needs `[TF] => F`.
|
|
158
276
|
|
|
277
|
+
This is also a compact test-design walkthrough. A test that records
|
|
278
|
+
`[F-] => F` proves the false branch of `logged_in?`; a test that records
|
|
279
|
+
`[TT] => T` proves the true branch and establishes the current positive path.
|
|
280
|
+
Adding a test that records `[TF] => F` evaluates `admin?` false while
|
|
281
|
+
`logged_in?` stays true, so it supplies the missing independence witness and
|
|
282
|
+
improves the condition, Condition/Decision, MC/DC, and applicable decision-table
|
|
283
|
+
results. The report names the missing vector and its owning test when it is
|
|
284
|
+
observed.
|
|
285
|
+
|
|
159
286
|
Decision and Condition Coverage are calculated independently from the captured
|
|
160
287
|
evidence. Condition/Decision requires both; MC/DC adds independence evidence.
|
|
161
288
|
Decision Table Coverage is calculated independently of all of them: MC/DC asks
|
|
@@ -449,6 +576,34 @@ execution. JSON output always contains the complete evidence document, so an
|
|
|
449
576
|
explicit view cannot be combined with `--format json`. The `mcdc` executable
|
|
450
577
|
accepts the same arguments for existing scripts.
|
|
451
578
|
|
|
579
|
+
Terminal reports can be narrowed with `--focus PATH[:LINE]` and bounded with
|
|
580
|
+
`--top N`, where `N` is a positive integer. These options are accepted by
|
|
581
|
+
`analyze` and `report`, and are terminal-only. Focus matches the source spans
|
|
582
|
+
captured in the report; rendering does not reopen or need the original source
|
|
583
|
+
file. `--focus` and `--top` affect displayed detail only: the coverage summary,
|
|
584
|
+
policy gates, diagnostics, exit status, and global counts remain unchanged.
|
|
585
|
+
|
|
586
|
+
The default view limits decisions. In `--view decision-tables`, the units are
|
|
587
|
+
decision tables; in `--view conditions`, condition and alternative rows; and
|
|
588
|
+
in `--view tests`, test rows. Rows are ordered deterministically by project-
|
|
589
|
+
relative path and source line, with deterministic tie-breakers for each view:
|
|
590
|
+
decisions use column and stable ID; decision tables use decision ID; conditions
|
|
591
|
+
and alternatives use column, decision ID, and condition or alternative index;
|
|
592
|
+
tests use test name and ID. `--top` follows that source order; it does not rank
|
|
593
|
+
rows by risk or coverage. For example:
|
|
594
|
+
|
|
595
|
+
```sh
|
|
596
|
+
bundle exec branchproof analyze 'lib/**/*.rb' --focus lib/access.rb:12 --top 5
|
|
597
|
+
bundle exec branchproof report .branchproof/current.json --view conditions \
|
|
598
|
+
--focus lib/access.rb --top 10
|
|
599
|
+
```
|
|
600
|
+
|
|
601
|
+
Focus and top selections never create a new test run or alter policy scope.
|
|
602
|
+
They also do not generate tests. RSpec rerun labels remain the existing
|
|
603
|
+
recorded selectors and commands. The main finding rows respect the selection;
|
|
604
|
+
supplemental unexecuted, unattributed, and unsupported sections retain their
|
|
605
|
+
run-wide counts rather than expanding into all detail rows.
|
|
606
|
+
|
|
452
607
|
### Saved reports and offline comparison
|
|
453
608
|
|
|
454
609
|
Reports are saved only when requested. Create a local artifact directory and
|
|
@@ -466,13 +621,26 @@ The output's parent directory must already exist. Replacing a baseline is an
|
|
|
466
621
|
explicit `analyze --format json --output` operation; keep CI snapshots as
|
|
467
622
|
artifacts when you need to retain multiple runs.
|
|
468
623
|
|
|
469
|
-
The `report` command reads the saved document without loading the application
|
|
470
|
-
or running tests. It uses locations and metadata
|
|
471
|
-
rendering remains useful after the original
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
624
|
+
The `report` command reads the saved document without loading the application,
|
|
625
|
+
project configuration, or running tests. It uses locations and metadata
|
|
626
|
+
captured in the report, so rendering remains useful after the original
|
|
627
|
+
checkout has moved or been removed. A saved report's policy is inherited by
|
|
628
|
+
default. Repeatable `--minimum criterion=threshold` options override matching
|
|
629
|
+
saved policy entries for that rendering without changing the snapshot file;
|
|
630
|
+
other saved thresholds remain inherited. Offline rendering never consults the
|
|
631
|
+
current `.branchproof.json`.
|
|
632
|
+
|
|
633
|
+
New live JSON reports use schema `1.4` and include the required
|
|
634
|
+
`coverage_policy` object with the normalized requested minima and recomputed
|
|
635
|
+
gate results. The report validates those results from its exact coverage
|
|
636
|
+
counts rather than trusting a persisted percentage. Readers continue to accept
|
|
637
|
+
schemas `1.0` through `1.3`; an offline policy overlay is optional and
|
|
638
|
+
preserves the input snapshot's schema version, including for legacy reports.
|
|
639
|
+
New snapshots retain the ladder at every level. Legacy snapshots without
|
|
640
|
+
analysis can still be rendered at Level 1; levels 2 and 3 require analysis in
|
|
641
|
+
the saved report.
|
|
642
|
+
The repository ignores `.branchproof/`; choose a different path and CI artifact
|
|
643
|
+
policy when a project needs to retain reports.
|
|
476
644
|
Saved JSON includes existing raw metadata such as test names and expressions;
|
|
477
645
|
relative terminal labels do not mean every legacy JSON field is sanitized.
|
|
478
646
|
|
|
@@ -508,6 +676,29 @@ Invalid input or an incomplete comparison exits 2, which takes
|
|
|
508
676
|
precedence. Reports are explicit snapshots: comparison never creates history,
|
|
509
677
|
promotes a baseline, or overwrites either input.
|
|
510
678
|
|
|
679
|
+
### GitHub Actions artifacts
|
|
680
|
+
|
|
681
|
+
A coverage policy can fail a job while still preserving the report for review.
|
|
682
|
+
Create the output directory before invoking Branchproof and upload the report
|
|
683
|
+
with `if: always()` so failed gates and failed test runs leave an artifact:
|
|
684
|
+
|
|
685
|
+
```yaml
|
|
686
|
+
- name: Branchproof coverage
|
|
687
|
+
run: |
|
|
688
|
+
mkdir -p .branchproof
|
|
689
|
+
bundle exec branchproof analyze 'lib/**/*.rb' --test 'test/**/*_test.rb' \
|
|
690
|
+
--format json --output .branchproof/coverage.json \
|
|
691
|
+
--minimum mcdc=80 --minimum decision_table=75
|
|
692
|
+
|
|
693
|
+
- name: Upload Branchproof report
|
|
694
|
+
if: always()
|
|
695
|
+
uses: actions/upload-artifact@v4
|
|
696
|
+
with:
|
|
697
|
+
name: branchproof-coverage
|
|
698
|
+
path: .branchproof/coverage.json
|
|
699
|
+
if-no-files-found: warn
|
|
700
|
+
```
|
|
701
|
+
|
|
511
702
|
MC/DC has two related questions. Evaluation asks whether a condition was
|
|
512
703
|
observed with a value, including short-circuiting. Independent proof asks
|
|
513
704
|
whether the analyzer found a pair of observations where that condition changes
|
|
@@ -618,8 +809,8 @@ Ruby-defined custom `!` methods keep their runtime behavior;
|
|
|
618
809
|
evidence that contradicts Boolean negation is rejected instead of proving
|
|
619
810
|
coverage with an invalid logical model.
|
|
620
811
|
|
|
621
|
-
New reports use schema `1.
|
|
622
|
-
remain readable. Comparison distinguishes decision-table coverage movement
|
|
812
|
+
New reports use schema `1.4`; saved schema `1.0`, `1.1`, `1.2`, and `1.3`
|
|
813
|
+
reports remain readable. Comparison distinguishes decision-table coverage movement
|
|
623
814
|
(`rule coverage gained`, `rule coverage lost`) from analysis movement
|
|
624
815
|
(`rule reachability changed`), and treats a structurally changed decision as a
|
|
625
816
|
changed decision-table context instead of guessing which old rule a new rule
|
|
@@ -654,12 +845,14 @@ the serial Minitest runner. This is useful for seeds and name filters:
|
|
|
654
845
|
branchproof analyze 'lib/**/*.rb' --level 1 -- --seed 9001 -n /checkout/
|
|
655
846
|
```
|
|
656
847
|
|
|
657
|
-
The
|
|
658
|
-
Rails applications. Rails lazy and eager loading are supported
|
|
659
|
-
application does not enable reloading for the test run.
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
848
|
+
The first release supports serial Minitest and RSpec execution in plain Ruby
|
|
849
|
+
projects and Rails applications. Rails lazy and eager loading are supported
|
|
850
|
+
when the application does not enable reloading for the test run. Transactions
|
|
851
|
+
and in-process specs are supported within the serial process policy. Parallel
|
|
852
|
+
or forked runners, remote or threaded browser drivers, mutation execution,
|
|
853
|
+
Rails system/browser tests, custom Rails test commands, generated tests, and
|
|
854
|
+
reloading configurations are explicitly unsupported and produce diagnostics
|
|
855
|
+
rather than a passing analysis.
|
|
663
856
|
|
|
664
857
|
## Library entry points
|
|
665
858
|
|
|
@@ -672,10 +865,15 @@ Branchproof::Records.id(name: "stable identity")
|
|
|
672
865
|
|
|
673
866
|
`require "mcdc"` and `MCDC` are compatibility aliases for the same public
|
|
674
867
|
namespace. The CLI is the supported way to run a complete analysis;
|
|
675
|
-
`Branchproof::Project` exposes project selection and
|
|
868
|
+
`Branchproof::Project` exposes project and framework selection and
|
|
869
|
+
child-environment policy,
|
|
676
870
|
and `Branchproof::RailsSupport` is the optional Rails boot boundary. The library
|
|
677
871
|
classes expose the source, runtime, evidence, analysis, and report contracts
|
|
678
|
-
for adapters and integrations.
|
|
872
|
+
for adapters and integrations. `Branchproof::CoveragePolicy#call` evaluates a
|
|
873
|
+
normalized `minimum` hash against a report document. `Report#coverage_policy`
|
|
874
|
+
returns the recomputed policy record, and `Report#coverage_policy_lines`
|
|
875
|
+
returns its terminal lines; both are available to integrations that need the
|
|
876
|
+
same gate result as the CLI.
|
|
679
877
|
|
|
680
878
|
## Development
|
|
681
879
|
|
|
@@ -705,6 +903,10 @@ Run the commands with the Ruby executable you intend to validate. The checked
|
|
|
705
903
|
release environments are CRuby 3.3.6 and 3.4.5. Each runtime
|
|
706
904
|
must provide the declared Minitest 5.x and Prism 1.x dependencies.
|
|
707
905
|
|
|
906
|
+
The repeatable native-versus-instrumented adapter benchmark and its captured
|
|
907
|
+
Ruby 3.4.7 result are in
|
|
908
|
+
[`docs/benchmarks/rspec-adapter.md`](docs/benchmarks/rspec-adapter.md).
|
|
909
|
+
|
|
708
910
|
## License
|
|
709
911
|
|
|
710
912
|
Branchproof is available under the [Apache License, Version 2.0](LICENSE.txt).
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# Class Branchproof::Configuration <a id="class-Branchproof-Configuration"></a>
|
|
2
|
+
|
|
3
|
+
| | |
|
|
4
|
+
| --- | --- |
|
|
5
|
+
| **Inherits** | Object |
|
|
6
|
+
| **Defined in** | lib/branchproof/configuration.rb |
|
|
7
|
+
|
|
8
|
+
Loads and validates the project-local .branchproof.json policy.
|
|
9
|
+
|
|
10
|
+
## Constants
|
|
11
|
+
### `FIELDS` <a id="constant-FIELDS"></a> <a id="FIELDS-constant"></a>
|
|
12
|
+
Not documented.
|
|
13
|
+
|
|
14
|
+
### `FRAMEWORKS` <a id="constant-FRAMEWORKS"></a> <a id="FRAMEWORKS-constant"></a>
|
|
15
|
+
Not documented.
|
|
16
|
+
|
|
17
|
+
### `MINIMUM_CRITERIA` <a id="constant-MINIMUM_CRITERIA"></a> <a id="MINIMUM_CRITERIA-constant"></a>
|
|
18
|
+
Not documented.
|
|
19
|
+
|
|
20
|
+
### `PROJECTS` <a id="constant-PROJECTS"></a> <a id="PROJECTS-constant"></a>
|
|
21
|
+
Not documented.
|
|
22
|
+
|
|
23
|
+
### `SCHEMA_VERSION` <a id="constant-SCHEMA_VERSION"></a> <a id="SCHEMA_VERSION-constant"></a>
|
|
24
|
+
Not documented.
|
|
25
|
+
|
|
26
|
+
## Public Class Methods
|
|
27
|
+
### `load(path:, root:, explicit: = false, disabled: = false)` <a id="method-c-load"></a> <a id="load-class_method"></a>
|
|
28
|
+
Not documented.
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# Class Branchproof::CoveragePolicy <a id="class-Branchproof-CoveragePolicy"></a>
|
|
2
|
+
|
|
3
|
+
| | |
|
|
4
|
+
| --- | --- |
|
|
5
|
+
| **Inherits** | Object |
|
|
6
|
+
| **Defined in** | lib/branchproof/coverage_policy.rb |
|
|
7
|
+
|
|
8
|
+
Evaluates configured coverage thresholds against the aggregate Analyzer
|
|
9
|
+
coverage counts without relying on rounded percentage fields.
|
|
10
|
+
|
|
11
|
+
## Constants
|
|
12
|
+
### `COMPLETENESS_FIELDS` <a id="constant-COMPLETENESS_FIELDS"></a> <a id="COMPLETENESS_FIELDS-constant"></a>
|
|
13
|
+
Not documented.
|
|
14
|
+
|
|
15
|
+
### `CRITERIA` <a id="constant-CRITERIA"></a> <a id="CRITERIA-constant"></a>
|
|
16
|
+
Not documented.
|
|
17
|
+
|
|
18
|
+
## Public Class Methods
|
|
19
|
+
### `normalize(minimum)` <a id="method-c-normalize"></a> <a id="normalize-class_method"></a>
|
|
20
|
+
- **@raise** [ArgumentError]
|
|
21
|
+
|
|
22
|
+
## Public Instance Methods
|
|
23
|
+
### `call(document:)` <a id="method-i-call"></a> <a id="call-instance_method"></a>
|
|
24
|
+
Not documented.
|
|
25
|
+
|
|
26
|
+
### `initialize(minimum:)` <a id="method-i-initialize"></a> <a id="initialize-instance_method"></a>
|
|
27
|
+
- **@return** [CoveragePolicy] a new instance of CoveragePolicy
|
data/doc/Branchproof/Evidence.md
CHANGED
|
@@ -12,7 +12,7 @@ Terminal renderings grouped around conditions or tests.
|
|
|
12
12
|
Not documented.
|
|
13
13
|
|
|
14
14
|
## Public Instance Methods
|
|
15
|
-
### `initialize(document:, view:, level:, missing_only: = false, coordinator: = nil)` <a id="method-i-initialize"></a> <a id="initialize-instance_method"></a>
|
|
15
|
+
### `initialize(document:, view:, level:, missing_only: = false, coordinator: = nil, focus: = nil, top: = nil, selection: = nil)` <a id="method-i-initialize"></a> <a id="initialize-instance_method"></a>
|
|
16
16
|
- **@return** [FocusedReport] a new instance of FocusedReport
|
|
17
17
|
|
|
18
18
|
### `render()` <a id="method-i-render"></a> <a id="render-instance_method"></a>
|
data/doc/Branchproof/Project.md
CHANGED
|
@@ -8,6 +8,9 @@
|
|
|
8
8
|
Resolves the project policy used by the isolated analysis worker.
|
|
9
9
|
|
|
10
10
|
## Constants
|
|
11
|
+
### `FRAMEWORKS` <a id="constant-FRAMEWORKS"></a> <a id="FRAMEWORKS-constant"></a>
|
|
12
|
+
Not documented.
|
|
13
|
+
|
|
11
14
|
### `MODES` <a id="constant-MODES"></a> <a id="MODES-constant"></a>
|
|
12
15
|
Not documented.
|
|
13
16
|
|
|
@@ -15,7 +18,7 @@ Not documented.
|
|
|
15
18
|
Not documented.
|
|
16
19
|
|
|
17
20
|
## Public Instance Methods
|
|
18
|
-
### `initialize(root:, mode: = "auto")` <a id="method-i-initialize"></a> <a id="initialize-instance_method"></a>
|
|
21
|
+
### `initialize(root:, mode: = "auto", framework: = "auto")` <a id="method-i-initialize"></a> <a id="initialize-instance_method"></a>
|
|
19
22
|
- **@raise** [ArgumentError]
|
|
20
23
|
- **@return** [Project] a new instance of Project
|
|
21
24
|
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# Module Branchproof::RSpecAdapter::ClassRunnerGuard <a id="module-Branchproof-RSpecAdapter-ClassRunnerGuard"></a>
|
|
2
|
+
|
|
3
|
+
| | |
|
|
4
|
+
| --- | --- |
|
|
5
|
+
| **Defined in** | lib/branchproof/rspec_adapter.rb |
|
|
6
|
+
|
|
7
|
+
Rejects additional class-level runner entry points.
|
|
8
|
+
|
|
9
|
+
## Public Instance Methods
|
|
10
|
+
### `run(*args)` <a id="method-i-run"></a> <a id="run-instance_method"></a>
|
|
11
|
+
Not documented.
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# Module Branchproof::RSpecAdapter::ContextLifecycle <a id="module-Branchproof-RSpecAdapter-ContextLifecycle"></a>
|
|
2
|
+
|
|
3
|
+
| | |
|
|
4
|
+
| --- | --- |
|
|
5
|
+
| **Defined in** | lib/branchproof/rspec_adapter.rb |
|
|
6
|
+
|
|
7
|
+
Keeps group-level hooks outside individual example ownership.
|
|
8
|
+
|
|
9
|
+
## Public Instance Methods
|
|
10
|
+
### `run_after_context_hooks(*args)` <a id="method-i-run_after_context_hooks"></a> <a id="run_after_context_hooks-instance_method"></a>
|
|
11
|
+
Not documented.
|
|
12
|
+
|
|
13
|
+
### `run_before_context_hooks(*args)` <a id="method-i-run_before_context_hooks"></a> <a id="run_before_context_hooks-instance_method"></a>
|
|
14
|
+
Not documented.
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# Module Branchproof::RSpecAdapter::DefaultDiscovery <a id="module-Branchproof-RSpecAdapter-DefaultDiscovery"></a>
|
|
2
|
+
|
|
3
|
+
| | |
|
|
4
|
+
| --- | --- |
|
|
5
|
+
| **Defined in** | lib/branchproof/rspec_adapter.rb |
|
|
6
|
+
|
|
7
|
+
Restores CLI directory discovery when RSpec runs inside the worker.
|
|
8
|
+
|
|
9
|
+
## Public Instance Methods
|
|
10
|
+
### `configure(configuration)` <a id="method-i-configure"></a> <a id="configure-instance_method"></a>
|
|
11
|
+
Not documented.
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# Module Branchproof::RSpecAdapter::ExampleLifecycle <a id="module-Branchproof-RSpecAdapter-ExampleLifecycle"></a>
|
|
2
|
+
|
|
3
|
+
| | |
|
|
4
|
+
| --- | --- |
|
|
5
|
+
| **Defined in** | lib/branchproof/rspec_adapter.rb |
|
|
6
|
+
|
|
7
|
+
Assigns observation phases while the reporter owns test registration.
|
|
8
|
+
|
|
9
|
+
## Public Instance Methods
|
|
10
|
+
### `run(*args)` <a id="method-i-run"></a> <a id="run-instance_method"></a>
|
|
11
|
+
Not documented.
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# Module Branchproof::RSpecAdapter::RunnerGuard <a id="module-Branchproof-RSpecAdapter-RunnerGuard"></a>
|
|
2
|
+
|
|
3
|
+
| | |
|
|
4
|
+
| --- | --- |
|
|
5
|
+
| **Defined in** | lib/branchproof/rspec_adapter.rb |
|
|
6
|
+
|
|
7
|
+
Allows only the worker-owned native runner instance.
|
|
8
|
+
|
|
9
|
+
## Public Instance Methods
|
|
10
|
+
### `run(*args)` <a id="method-i-run"></a> <a id="run-instance_method"></a>
|
|
11
|
+
Not documented.
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# Class Branchproof::RSpecAdapter::UnsupportedRunner <a id="class-Branchproof-RSpecAdapter-UnsupportedRunner"></a>
|
|
2
|
+
|
|
3
|
+
| | |
|
|
4
|
+
| --- | --- |
|
|
5
|
+
| **Inherits** | ArgumentError |
|
|
6
|
+
| **Defined in** | lib/branchproof/rspec_adapter.rb |
|
|
7
|
+
|
|
8
|
+
Identifies runner capabilities that cannot produce supported evidence.
|
|
9
|
+
|
|
10
|
+
## Public Instance Methods
|
|
11
|
+
### `diagnostic_code()` <a id="method-i-diagnostic_code"></a> <a id="diagnostic_code-instance_method"></a>
|
|
12
|
+
Not documented.
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# Class Branchproof::RSpecAdapter <a id="class-Branchproof-RSpecAdapter"></a>
|
|
2
|
+
|
|
3
|
+
| | |
|
|
4
|
+
| --- | --- |
|
|
5
|
+
| **Inherits** | Object |
|
|
6
|
+
| **Defined in** | lib/branchproof/rspec_adapter.rb |
|
|
7
|
+
|
|
8
|
+
Bridges one serial RSpec run to Runtime lifecycle ownership.
|
|
9
|
+
|
|
10
|
+
## Constants
|
|
11
|
+
### `FORBIDDEN_OPTIONS` <a id="constant-FORBIDDEN_OPTIONS"></a> <a id="FORBIDDEN_OPTIONS-constant"></a>
|
|
12
|
+
Not documented.
|
|
13
|
+
|
|
14
|
+
## Attributes
|
|
15
|
+
### `active_adapter` [RW] <a id="attribute-c-active_adapter"></a> <a id="active_adapter-class_method"></a>
|
|
16
|
+
Returns the value of attribute active_adapter.
|
|
17
|
+
|
|
18
|
+
### `runner_adapter` [RW] <a id="attribute-c-runner_adapter"></a> <a id="runner_adapter-class_method"></a>
|
|
19
|
+
Returns the value of attribute runner_adapter.
|
|
20
|
+
|
|
21
|
+
### `late_execution_error` [R] <a id="attribute-i-late_execution_error"></a> <a id="late_execution_error-instance_method"></a>
|
|
22
|
+
Returns the value of attribute late_execution_error.
|
|
23
|
+
|
|
24
|
+
### `tests` [R] <a id="attribute-i-tests"></a> <a id="tests-instance_method"></a>
|
|
25
|
+
Returns the value of attribute tests.
|
|
26
|
+
|
|
27
|
+
## Public Instance Methods
|
|
28
|
+
### `enter_runner!(runner)` <a id="method-i-enter_runner-21"></a> <a id="enter_runner!-instance_method"></a>
|
|
29
|
+
Not documented.
|
|
30
|
+
|
|
31
|
+
### `example_finished(notification)` <a id="method-i-example_finished"></a> <a id="example_finished-instance_method"></a>
|
|
32
|
+
Not documented.
|
|
33
|
+
|
|
34
|
+
### `example_started(notification)` <a id="method-i-example_started"></a> <a id="example_started-instance_method"></a>
|
|
35
|
+
Not documented.
|
|
36
|
+
|
|
37
|
+
### `initialize(runtime:)` <a id="method-i-initialize"></a> <a id="initialize-instance_method"></a>
|
|
38
|
+
- **@return** [RSpecAdapter] a new instance of RSpecAdapter
|
|
39
|
+
|
|
40
|
+
### `reject_execution!(message)` <a id="method-i-reject_execution-21"></a> <a id="reject_execution!-instance_method"></a>
|
|
41
|
+
- **@raise** [@run_error]
|
|
42
|
+
|
|
43
|
+
### `run(test_files:, runner_args:, on_complete:, before_load: = nil, after_load: = nil, test_selection_explicit: = false)` <a id="method-i-run"></a> <a id="run-instance_method"></a>
|
|
44
|
+
rubocop:disable-next Metrics/ParameterLists
|
|
45
|
+
|
|
46
|
+
### `validate_runner!()` <a id="method-i-validate_runner-21"></a> <a id="validate_runner!-instance_method"></a>
|
|
47
|
+
Not documented.
|