branchproof 0.3.0 → 0.4.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 +12 -0
- data/README.md +98 -9
- data/doc/Branchproof/Comparison.md +26 -0
- data/doc/Branchproof/ComparisonReport.md +19 -0
- data/doc/Branchproof/CoverageIndex.md +19 -0
- data/doc/Branchproof/FocusedReport.md +16 -0
- data/doc/Branchproof/Report.md +8 -1
- data/doc/Branchproof/SavedReport.md +32 -0
- data/doc/Branchproof.md +6 -1
- data/doc/CHANGELOG.md +12 -0
- data/doc/README.md +98 -9
- data/exe/branchproof +6 -0
- data/lib/branchproof/cli.rb +152 -7
- data/lib/branchproof/comparison.rb +363 -0
- data/lib/branchproof/comparison_report.rb +119 -0
- data/lib/branchproof/coverage_index.rb +187 -0
- data/lib/branchproof/focused_report.rb +205 -0
- data/lib/branchproof/report.rb +58 -5
- data/lib/branchproof/saved_report.rb +366 -0
- data/lib/branchproof/source.rb +1 -0
- data/lib/branchproof/version.rb +1 -1
- data/lib/branchproof.rb +5 -0
- data/llms.txt +6 -1
- data/sig/branchproof.rbs +30 -1
- metadata +13 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: a76f20e6504affb4e614eeca901b0ef515f8bbb0785a641cf437263cac2df418
|
|
4
|
+
data.tar.gz: 87373206990831eeba3c1a2317049a4679343b4e4770015fb3e322710c7035e9
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 97b1aca56ec2e2ed60f683e7647ce91ec85f3b8a2bbe457cf6844b0bd7db9b6117a126bce8ec74f04e4805dc147beef6b58fa003f74d73bd6e18884973115833
|
|
7
|
+
data.tar.gz: 1aac59c7cc767f9ef805cdcfecbe8e5e6628e25ea09cc8d862b32b0518f9aad89f6f8204b69d4183c75af1938e94a61e3ba980f6fa396bbff542b464bf371896
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
## [Unreleased]
|
|
2
2
|
|
|
3
|
+
## [0.4.0] - 2026-09-10
|
|
4
|
+
|
|
5
|
+
- Added `branchproof` as the primary CLI command while retaining `mcdc` as a
|
|
6
|
+
compatibility alias.
|
|
7
|
+
- Added condition-focused and test-focused terminal views, including relative
|
|
8
|
+
source locations, evaluated and short-circuited observations, and analyzer
|
|
9
|
+
witness ownership.
|
|
10
|
+
- Added opt-in saved JSON reports, offline rendering, and exact-condition
|
|
11
|
+
comparisons with gained/lost proof and changed-source context.
|
|
12
|
+
- Added `--fail-on-regression` comparison status handling and documented the
|
|
13
|
+
local `.branchproof/` artifact directory and explicit baseline workflow.
|
|
14
|
+
|
|
3
15
|
## [0.3.0] - 2026-09-10
|
|
4
16
|
|
|
5
17
|
- Add `--missing-only` to focus terminal reports on unproven conditions.
|
data/README.md
CHANGED
|
@@ -6,8 +6,8 @@ modifier, and ordinary ternary (`?:`) decisions, records observed vectors,
|
|
|
6
6
|
and reports independence evidence, missing counterpart constraints, and
|
|
7
7
|
smaller supporting test sets.
|
|
8
8
|
|
|
9
|
-
The gem
|
|
10
|
-
`
|
|
9
|
+
The gem and primary command are named `branchproof`. The `mcdc` command and
|
|
10
|
+
`MCDC` namespace remain compatibility aliases with the same behavior.
|
|
11
11
|
|
|
12
12
|
## Installation
|
|
13
13
|
|
|
@@ -30,12 +30,12 @@ instead of being counted as coverage.
|
|
|
30
30
|
|
|
31
31
|
## Analyze a test run
|
|
32
32
|
|
|
33
|
-
Run `
|
|
33
|
+
Run `branchproof analyze` with the source files or globs to inspect, followed by
|
|
34
34
|
options. A second `--` separates Branchproof options from arguments passed to
|
|
35
35
|
Minitest unchanged:
|
|
36
36
|
|
|
37
37
|
```sh
|
|
38
|
-
|
|
38
|
+
branchproof analyze 'lib/**/*.rb' --test 'test/**/*_test.rb' \
|
|
39
39
|
--level 3 \
|
|
40
40
|
--format terminal \
|
|
41
41
|
--output tmp/branchproof.txt \
|
|
@@ -47,14 +47,14 @@ For a plain Ruby application, select the project policy explicitly when
|
|
|
47
47
|
running from the application root:
|
|
48
48
|
|
|
49
49
|
```sh
|
|
50
|
-
bundle exec
|
|
50
|
+
bundle exec branchproof analyze 'lib/**/*.rb' --project ruby --test 'test/**/*_test.rb'
|
|
51
51
|
```
|
|
52
52
|
|
|
53
53
|
For a Rails application, run the same command from the application root so
|
|
54
54
|
the application's bundle and Rails version remain in effect:
|
|
55
55
|
|
|
56
56
|
```sh
|
|
57
|
-
bundle exec
|
|
57
|
+
bundle exec branchproof analyze 'app/**/*.rb' --project rails --test 'test/**/*_test.rb'
|
|
58
58
|
```
|
|
59
59
|
|
|
60
60
|
For a project rooted at the current directory, `--project auto` is the
|
|
@@ -97,7 +97,7 @@ For example, running the contents of the small `decision.rb` /
|
|
|
97
97
|
with the terminal format produces a summary like this:
|
|
98
98
|
|
|
99
99
|
```text
|
|
100
|
-
Branchproof 0.
|
|
100
|
+
Branchproof 0.4.0
|
|
101
101
|
Tests: PASSED (3 tests, 0 failed, 0 skipped)
|
|
102
102
|
MC/DC: 100.0% (2/2 conditions proven)
|
|
103
103
|
Analysis: COMPLETE
|
|
@@ -132,7 +132,7 @@ Use `--missing-only` to focus the terminal report on conditions that still
|
|
|
132
132
|
lack independence evidence:
|
|
133
133
|
|
|
134
134
|
```sh
|
|
135
|
-
bundle exec
|
|
135
|
+
bundle exec branchproof analyze 'lib/**/*.rb' --missing-only
|
|
136
136
|
```
|
|
137
137
|
|
|
138
138
|
This keeps the overall summary and diagnostics, hides proven conditions and
|
|
@@ -185,6 +185,95 @@ test suite. A failed, unsupported, or incomplete run is reported with its
|
|
|
185
185
|
status and diagnostics and cannot become a successful coverage result by
|
|
186
186
|
changing the display level.
|
|
187
187
|
|
|
188
|
+
### Focused condition and test views
|
|
189
|
+
|
|
190
|
+
Use `--view conditions` to group the report by condition. Each condition shows
|
|
191
|
+
its expression, decision, and project-relative source location with the
|
|
192
|
+
condition's own 1-based start line. The view separates tests that evaluated
|
|
193
|
+
the condition true or false from tests where it was short-circuited. Level 3
|
|
194
|
+
also shows the canonical witness observations selected by the analyzer and
|
|
195
|
+
their owning tests.
|
|
196
|
+
|
|
197
|
+
```sh
|
|
198
|
+
bundle exec branchproof analyze 'lib/**/*.rb' --view conditions
|
|
199
|
+
bundle exec branchproof analyze 'lib/**/*.rb' --view conditions --missing-only
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
Use `--view tests` to group the same evidence by test. Rows include each
|
|
203
|
+
exercised condition, its relative source location, observed values, and the
|
|
204
|
+
recorded `setup`, `body`, or `teardown` phases. Tests with no completed
|
|
205
|
+
condition observation remain visible, as do unattributed and unexecuted
|
|
206
|
+
conditions. A test that evaluates both Boolean values is evidence of execution;
|
|
207
|
+
it is a proof contributor only when the analyzer's independent witness pair
|
|
208
|
+
uses its observations.
|
|
209
|
+
|
|
210
|
+
`--view` changes terminal grouping and does not change instrumentation or test
|
|
211
|
+
execution. JSON output always contains the complete evidence document, so an
|
|
212
|
+
explicit view cannot be combined with `--format json`. The `mcdc` executable
|
|
213
|
+
accepts the same arguments for existing scripts.
|
|
214
|
+
|
|
215
|
+
### Saved reports and offline comparison
|
|
216
|
+
|
|
217
|
+
Reports are saved only when requested. Create a local artifact directory and
|
|
218
|
+
write a complete JSON baseline with the existing atomic `--output` option:
|
|
219
|
+
|
|
220
|
+
```sh
|
|
221
|
+
mkdir -p .branchproof
|
|
222
|
+
bundle exec branchproof analyze 'lib/**/*.rb' --format json \
|
|
223
|
+
--output .branchproof/baseline.json
|
|
224
|
+
bundle exec branchproof report .branchproof/baseline.json --view conditions
|
|
225
|
+
bundle exec branchproof report .branchproof/baseline.json --view tests
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
The output's parent directory must already exist. Replacing a baseline is an
|
|
229
|
+
explicit `analyze --format json --output` operation; keep CI snapshots as
|
|
230
|
+
artifacts when you need to retain multiple runs.
|
|
231
|
+
|
|
232
|
+
The `report` command reads the saved document without loading the application
|
|
233
|
+
or running tests. It uses locations and metadata captured in the report, so
|
|
234
|
+
rendering remains useful after the original checkout has moved or been
|
|
235
|
+
removed. Level 1 reports observations; levels 2 and 3 require corresponding
|
|
236
|
+
analysis in the saved report. The repository ignores `.branchproof/`; choose a
|
|
237
|
+
different path and CI artifact policy when a project needs to retain reports.
|
|
238
|
+
Saved JSON includes existing raw metadata such as test names and expressions;
|
|
239
|
+
relative terminal labels do not mean every legacy JSON field is sanitized.
|
|
240
|
+
|
|
241
|
+
To compare two explicitly saved runs:
|
|
242
|
+
|
|
243
|
+
```sh
|
|
244
|
+
bundle exec branchproof analyze 'lib/**/*.rb' --format json \
|
|
245
|
+
--output .branchproof/current.json
|
|
246
|
+
bundle exec branchproof compare .branchproof/baseline.json \
|
|
247
|
+
.branchproof/current.json
|
|
248
|
+
bundle exec branchproof compare .branchproof/baseline.json \
|
|
249
|
+
.branchproof/current.json --fail-on-regression
|
|
250
|
+
```
|
|
251
|
+
|
|
252
|
+
Comparison matches exact condition identities from unchanged source files.
|
|
253
|
+
Changed source files, changed selection or runtime context, incomplete runs,
|
|
254
|
+
and legacy reports missing comparison metadata are reported as partial or
|
|
255
|
+
incomplete context rather than guessed regressions. The output distinguishes
|
|
256
|
+
gained proof, lost proof, changed sources, newly selected files, and files no
|
|
257
|
+
longer present in a report. Previous witness values and owner names are shown
|
|
258
|
+
for lost proof; an absent owner is described as `not observed in current run`,
|
|
259
|
+
not as a deleted test. A different test population under unchanged discovery
|
|
260
|
+
patterns is valid comparison context, and seed differences are disclosed.
|
|
261
|
+
|
|
262
|
+
`compare` exits 0 for a complete comparison, including one with coverage
|
|
263
|
+
changes; `--fail-on-regression` exits 1 when a complete comparable run loses
|
|
264
|
+
proof. Invalid input or an incomplete comparison exits 2, which takes
|
|
265
|
+
precedence. Reports are explicit snapshots: comparison never creates history,
|
|
266
|
+
promotes a baseline, or overwrites either input.
|
|
267
|
+
|
|
268
|
+
MC/DC has two related questions. Evaluation asks whether a condition was
|
|
269
|
+
observed with a value, including short-circuiting. Independent proof asks
|
|
270
|
+
whether the analyzer found a pair of observations where that condition changes
|
|
271
|
+
the decision outcome under the masking criterion. Other conditions may be
|
|
272
|
+
short-circuited or masked rather than fixed to the same observed values. For example,
|
|
273
|
+
`left && right` observed as `[TT]` and `[F-]` evaluates `right` once and
|
|
274
|
+
short-circuits it once, but does not prove `right`; `[TF]` is also required.
|
|
275
|
+
The condition and test views preserve that distinction.
|
|
276
|
+
|
|
188
277
|
### Supported conditional forms
|
|
189
278
|
|
|
190
279
|
Ordinary Ruby ternaries use the same predicate instrumentation and `&&`/`||`
|
|
@@ -230,7 +319,7 @@ Everything after the argument separator is passed as individual arguments to
|
|
|
230
319
|
the serial Minitest runner. This is useful for seeds and name filters:
|
|
231
320
|
|
|
232
321
|
```sh
|
|
233
|
-
|
|
322
|
+
branchproof analyze 'lib/**/*.rb' --level 1 -- --seed 9001 -n /checkout/
|
|
234
323
|
```
|
|
235
324
|
|
|
236
325
|
The 0.2 release supports serial Minitest execution in plain Ruby projects and
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# Class Branchproof::Comparison <a id="class-Branchproof-Comparison"></a>
|
|
2
|
+
|
|
3
|
+
| | |
|
|
4
|
+
| --- | --- |
|
|
5
|
+
| **Inherits** | Object |
|
|
6
|
+
| **Defined in** | lib/branchproof/comparison.rb |
|
|
7
|
+
|
|
8
|
+
Compares two complete report documents without loading or executing the
|
|
9
|
+
project.
|
|
10
|
+
|
|
11
|
+
## Constants
|
|
12
|
+
### `CRITERION_VERSION` <a id="constant-CRITERION_VERSION"></a> <a id="CRITERION_VERSION-constant"></a>
|
|
13
|
+
Not documented.
|
|
14
|
+
|
|
15
|
+
### `SCHEMA_VERSION` <a id="constant-SCHEMA_VERSION"></a> <a id="SCHEMA_VERSION-constant"></a>
|
|
16
|
+
Not documented.
|
|
17
|
+
|
|
18
|
+
### `SUPPORTED_REPORT_SCHEMAS` <a id="constant-SUPPORTED_REPORT_SCHEMAS"></a> <a id="SUPPORTED_REPORT_SCHEMAS-constant"></a>
|
|
19
|
+
Not documented.
|
|
20
|
+
|
|
21
|
+
## Public Instance Methods
|
|
22
|
+
### `call()` <a id="method-i-call"></a> <a id="call-instance_method"></a>
|
|
23
|
+
Not documented.
|
|
24
|
+
|
|
25
|
+
### `initialize(before:, after:)` <a id="method-i-initialize"></a> <a id="initialize-instance_method"></a>
|
|
26
|
+
- **@return** [Comparison] a new instance of Comparison
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# Class Branchproof::ComparisonReport <a id="class-Branchproof-ComparisonReport"></a>
|
|
2
|
+
|
|
3
|
+
| | |
|
|
4
|
+
| --- | --- |
|
|
5
|
+
| **Inherits** | Object |
|
|
6
|
+
| **Defined in** | lib/branchproof/comparison_report.rb |
|
|
7
|
+
|
|
8
|
+
Renders the offline document returned by Comparison.
|
|
9
|
+
|
|
10
|
+
## Public Instance Methods
|
|
11
|
+
### `exit_code(fail_on_regression: = false)` <a id="method-i-exit_code"></a> <a id="exit_code-instance_method"></a>
|
|
12
|
+
Not documented.
|
|
13
|
+
|
|
14
|
+
### `initialize(document:)` <a id="method-i-initialize"></a> <a id="initialize-instance_method"></a>
|
|
15
|
+
- **@raise** [ArgumentError]
|
|
16
|
+
- **@return** [ComparisonReport] a new instance of ComparisonReport
|
|
17
|
+
|
|
18
|
+
### `write(io:, format:)` <a id="method-i-write"></a> <a id="write-instance_method"></a>
|
|
19
|
+
- **@raise** [ArgumentError]
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# Class Branchproof::CoverageIndex <a id="class-Branchproof-CoverageIndex"></a>
|
|
2
|
+
|
|
3
|
+
| | |
|
|
4
|
+
| --- | --- |
|
|
5
|
+
| **Inherits** | Object |
|
|
6
|
+
| **Defined in** | lib/branchproof/coverage_index.rb |
|
|
7
|
+
|
|
8
|
+
Derives condition- and test-oriented rows from one report document.
|
|
9
|
+
|
|
10
|
+
## Attributes
|
|
11
|
+
### `conditions` [R] <a id="attribute-i-conditions"></a> <a id="conditions-instance_method"></a>
|
|
12
|
+
Returns the value of attribute conditions.
|
|
13
|
+
|
|
14
|
+
### `tests` [R] <a id="attribute-i-tests"></a> <a id="tests-instance_method"></a>
|
|
15
|
+
Returns the value of attribute tests.
|
|
16
|
+
|
|
17
|
+
## Public Instance Methods
|
|
18
|
+
### `initialize(document:)` <a id="method-i-initialize"></a> <a id="initialize-instance_method"></a>
|
|
19
|
+
- **@return** [CoverageIndex] a new instance of CoverageIndex
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# Class Branchproof::FocusedReport <a id="class-Branchproof-FocusedReport"></a>
|
|
2
|
+
|
|
3
|
+
| | |
|
|
4
|
+
| --- | --- |
|
|
5
|
+
| **Inherits** | Object |
|
|
6
|
+
| **Defined in** | lib/branchproof/focused_report.rb |
|
|
7
|
+
|
|
8
|
+
Terminal renderings grouped around conditions or tests.
|
|
9
|
+
|
|
10
|
+
## Public Instance Methods
|
|
11
|
+
### `initialize(document:, view:, level:, missing_only: = false)` <a id="method-i-initialize"></a> <a id="initialize-instance_method"></a>
|
|
12
|
+
- **@raise** [ArgumentError]
|
|
13
|
+
- **@return** [FocusedReport] a new instance of FocusedReport
|
|
14
|
+
|
|
15
|
+
### `render()` <a id="method-i-render"></a> <a id="render-instance_method"></a>
|
|
16
|
+
Not documented.
|
data/doc/Branchproof/Report.md
CHANGED
|
@@ -14,11 +14,18 @@ Not documented.
|
|
|
14
14
|
### `SCHEMA_VERSION` <a id="constant-SCHEMA_VERSION"></a> <a id="SCHEMA_VERSION-constant"></a>
|
|
15
15
|
Not documented.
|
|
16
16
|
|
|
17
|
+
## Public Class Methods
|
|
18
|
+
### `from_document(document:, level: = nil, view: = :decisions, missing_only: = false)` <a id="method-c-from_document"></a> <a id="from_document-class_method"></a>
|
|
19
|
+
Not documented.
|
|
20
|
+
|
|
17
21
|
## Public Instance Methods
|
|
22
|
+
### `condition_explanation(decision_id:, condition_id:)` <a id="method-i-condition_explanation"></a> <a id="condition_explanation-instance_method"></a>
|
|
23
|
+
Shares the existing missing-case wording with focused terminal views.
|
|
24
|
+
|
|
18
25
|
### `exit_code()` <a id="method-i-exit_code"></a> <a id="exit_code-instance_method"></a>
|
|
19
26
|
Not documented.
|
|
20
27
|
|
|
21
|
-
### `initialize(inventory:, evidence:, analysis:, minima:, baseline:, diagnostics:, level: = 3, missing_only: = false)` <a id="method-i-initialize"></a> <a id="initialize-instance_method"></a>
|
|
28
|
+
### `initialize(inventory:, evidence:, analysis:, minima:, baseline:, diagnostics:, level: = 3, missing_only: = false, view: = :decisions, run_metadata: = {}, saved_document: = nil)` <a id="method-i-initialize"></a> <a id="initialize-instance_method"></a>
|
|
22
29
|
- **@raise** [ArgumentError]
|
|
23
30
|
- **@return** [Report] a new instance of Report
|
|
24
31
|
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# Class Branchproof::SavedReport <a id="class-Branchproof-SavedReport"></a>
|
|
2
|
+
|
|
3
|
+
| | |
|
|
4
|
+
| --- | --- |
|
|
5
|
+
| **Inherits** | Object |
|
|
6
|
+
| **Defined in** | lib/branchproof/saved_report.rb |
|
|
7
|
+
|
|
8
|
+
Reads and validates a persisted JSON report without loading the project.
|
|
9
|
+
|
|
10
|
+
## Constants
|
|
11
|
+
### `COMPLETENESS_FIELDS` <a id="constant-COMPLETENESS_FIELDS"></a> <a id="COMPLETENESS_FIELDS-constant"></a>
|
|
12
|
+
Not documented.
|
|
13
|
+
|
|
14
|
+
### `CRITERION_VERSION` <a id="constant-CRITERION_VERSION"></a> <a id="CRITERION_VERSION-constant"></a>
|
|
15
|
+
Not documented.
|
|
16
|
+
|
|
17
|
+
### `REQUIRED_FIELDS` <a id="constant-REQUIRED_FIELDS"></a> <a id="REQUIRED_FIELDS-constant"></a>
|
|
18
|
+
Not documented.
|
|
19
|
+
|
|
20
|
+
### `SUPPORTED_SCHEMAS` <a id="constant-SUPPORTED_SCHEMAS"></a> <a id="SUPPORTED_SCHEMAS-constant"></a>
|
|
21
|
+
Not documented.
|
|
22
|
+
|
|
23
|
+
## Public Class Methods
|
|
24
|
+
### `read(path)` <a id="method-c-read"></a> <a id="read-class_method"></a>
|
|
25
|
+
Not documented.
|
|
26
|
+
|
|
27
|
+
## Public Instance Methods
|
|
28
|
+
### `initialize(document)` <a id="method-i-initialize"></a> <a id="initialize-instance_method"></a>
|
|
29
|
+
- **@return** [SavedReport] a new instance of SavedReport
|
|
30
|
+
|
|
31
|
+
### `validate!()` <a id="method-i-validate-21"></a> <a id="validate!-instance_method"></a>
|
|
32
|
+
Not documented.
|
data/doc/Branchproof.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
| | |
|
|
4
4
|
| --- | --- |
|
|
5
|
-
| **Defined in** | lib/branchproof.rb, lib/branchproof/cli.rb, lib/branchproof/limits.rb, lib/branchproof/loader.rb, lib/branchproof/report.rb, lib/branchproof/source.rb, lib/branchproof/worker.rb, lib/branchproof/project.rb, lib/branchproof/records.rb, lib/branchproof/runtime.rb, lib/branchproof/version.rb, lib/branchproof/analyzer.rb, lib/branchproof/evidence.rb, lib/branchproof/minimizer.rb, lib/branchproof/instrumenter.rb, lib/branchproof/rails_support.rb, lib/branchproof/minitest_adapter.rb |
|
|
5
|
+
| **Defined in** | lib/branchproof.rb, lib/branchproof/cli.rb, lib/branchproof/limits.rb, lib/branchproof/loader.rb, lib/branchproof/report.rb, lib/branchproof/source.rb, lib/branchproof/worker.rb, lib/branchproof/project.rb, lib/branchproof/records.rb, lib/branchproof/runtime.rb, lib/branchproof/version.rb, lib/branchproof/analyzer.rb, lib/branchproof/evidence.rb, lib/branchproof/minimizer.rb, lib/branchproof/comparison.rb, lib/branchproof/instrumenter.rb, lib/branchproof/saved_report.rb, lib/branchproof/rails_support.rb, lib/branchproof/coverage_index.rb, lib/branchproof/focused_report.rb, lib/branchproof/minitest_adapter.rb, lib/branchproof/comparison_report.rb |
|
|
6
6
|
|
|
7
7
|
Public namespace for source inventory and one-run MC/DC reporting.
|
|
8
8
|
|
|
@@ -14,8 +14,12 @@ Not documented.
|
|
|
14
14
|
|
|
15
15
|
- [Branchproof/Analyzer.md](Branchproof/Analyzer.md)
|
|
16
16
|
- [Branchproof/CLI.md](Branchproof/CLI.md)
|
|
17
|
+
- [Branchproof/Comparison.md](Branchproof/Comparison.md)
|
|
18
|
+
- [Branchproof/ComparisonReport.md](Branchproof/ComparisonReport.md)
|
|
19
|
+
- [Branchproof/CoverageIndex.md](Branchproof/CoverageIndex.md)
|
|
17
20
|
- [Branchproof/Error.md](Branchproof/Error.md)
|
|
18
21
|
- [Branchproof/Evidence.md](Branchproof/Evidence.md)
|
|
22
|
+
- [Branchproof/FocusedReport.md](Branchproof/FocusedReport.md)
|
|
19
23
|
- [Branchproof/Instrumenter.md](Branchproof/Instrumenter.md)
|
|
20
24
|
- [Branchproof/Limits.md](Branchproof/Limits.md)
|
|
21
25
|
- [Branchproof/Loader.md](Branchproof/Loader.md)
|
|
@@ -27,6 +31,7 @@ Not documented.
|
|
|
27
31
|
- [Branchproof/Records.md](Branchproof/Records.md)
|
|
28
32
|
- [Branchproof/Report.md](Branchproof/Report.md)
|
|
29
33
|
- [Branchproof/Runtime.md](Branchproof/Runtime.md)
|
|
34
|
+
- [Branchproof/SavedReport.md](Branchproof/SavedReport.md)
|
|
30
35
|
- [Branchproof/Source.md](Branchproof/Source.md)
|
|
31
36
|
- [Branchproof/Worker.md](Branchproof/Worker.md)
|
|
32
37
|
- [CHANGELOG.md](CHANGELOG.md)
|
data/doc/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
## [Unreleased]
|
|
2
2
|
|
|
3
|
+
## [0.4.0] - 2026-09-10
|
|
4
|
+
|
|
5
|
+
- Added `branchproof` as the primary CLI command while retaining `mcdc` as a
|
|
6
|
+
compatibility alias.
|
|
7
|
+
- Added condition-focused and test-focused terminal views, including relative
|
|
8
|
+
source locations, evaluated and short-circuited observations, and analyzer
|
|
9
|
+
witness ownership.
|
|
10
|
+
- Added opt-in saved JSON reports, offline rendering, and exact-condition
|
|
11
|
+
comparisons with gained/lost proof and changed-source context.
|
|
12
|
+
- Added `--fail-on-regression` comparison status handling and documented the
|
|
13
|
+
local `.branchproof/` artifact directory and explicit baseline workflow.
|
|
14
|
+
|
|
3
15
|
## [0.3.0] - 2026-09-10
|
|
4
16
|
|
|
5
17
|
- Add `--missing-only` to focus terminal reports on unproven conditions.
|
data/doc/README.md
CHANGED
|
@@ -6,8 +6,8 @@ modifier, and ordinary ternary (`?:`) decisions, records observed vectors,
|
|
|
6
6
|
and reports independence evidence, missing counterpart constraints, and
|
|
7
7
|
smaller supporting test sets.
|
|
8
8
|
|
|
9
|
-
The gem
|
|
10
|
-
`
|
|
9
|
+
The gem and primary command are named `branchproof`. The `mcdc` command and
|
|
10
|
+
`MCDC` namespace remain compatibility aliases with the same behavior.
|
|
11
11
|
|
|
12
12
|
## Installation
|
|
13
13
|
|
|
@@ -30,12 +30,12 @@ instead of being counted as coverage.
|
|
|
30
30
|
|
|
31
31
|
## Analyze a test run
|
|
32
32
|
|
|
33
|
-
Run `
|
|
33
|
+
Run `branchproof analyze` with the source files or globs to inspect, followed by
|
|
34
34
|
options. A second `--` separates Branchproof options from arguments passed to
|
|
35
35
|
Minitest unchanged:
|
|
36
36
|
|
|
37
37
|
```sh
|
|
38
|
-
|
|
38
|
+
branchproof analyze 'lib/**/*.rb' --test 'test/**/*_test.rb' \
|
|
39
39
|
--level 3 \
|
|
40
40
|
--format terminal \
|
|
41
41
|
--output tmp/branchproof.txt \
|
|
@@ -47,14 +47,14 @@ For a plain Ruby application, select the project policy explicitly when
|
|
|
47
47
|
running from the application root:
|
|
48
48
|
|
|
49
49
|
```sh
|
|
50
|
-
bundle exec
|
|
50
|
+
bundle exec branchproof analyze 'lib/**/*.rb' --project ruby --test 'test/**/*_test.rb'
|
|
51
51
|
```
|
|
52
52
|
|
|
53
53
|
For a Rails application, run the same command from the application root so
|
|
54
54
|
the application's bundle and Rails version remain in effect:
|
|
55
55
|
|
|
56
56
|
```sh
|
|
57
|
-
bundle exec
|
|
57
|
+
bundle exec branchproof analyze 'app/**/*.rb' --project rails --test 'test/**/*_test.rb'
|
|
58
58
|
```
|
|
59
59
|
|
|
60
60
|
For a project rooted at the current directory, `--project auto` is the
|
|
@@ -97,7 +97,7 @@ For example, running the contents of the small `decision.rb` /
|
|
|
97
97
|
with the terminal format produces a summary like this:
|
|
98
98
|
|
|
99
99
|
```text
|
|
100
|
-
Branchproof 0.
|
|
100
|
+
Branchproof 0.4.0
|
|
101
101
|
Tests: PASSED (3 tests, 0 failed, 0 skipped)
|
|
102
102
|
MC/DC: 100.0% (2/2 conditions proven)
|
|
103
103
|
Analysis: COMPLETE
|
|
@@ -132,7 +132,7 @@ Use `--missing-only` to focus the terminal report on conditions that still
|
|
|
132
132
|
lack independence evidence:
|
|
133
133
|
|
|
134
134
|
```sh
|
|
135
|
-
bundle exec
|
|
135
|
+
bundle exec branchproof analyze 'lib/**/*.rb' --missing-only
|
|
136
136
|
```
|
|
137
137
|
|
|
138
138
|
This keeps the overall summary and diagnostics, hides proven conditions and
|
|
@@ -185,6 +185,95 @@ test suite. A failed, unsupported, or incomplete run is reported with its
|
|
|
185
185
|
status and diagnostics and cannot become a successful coverage result by
|
|
186
186
|
changing the display level.
|
|
187
187
|
|
|
188
|
+
### Focused condition and test views
|
|
189
|
+
|
|
190
|
+
Use `--view conditions` to group the report by condition. Each condition shows
|
|
191
|
+
its expression, decision, and project-relative source location with the
|
|
192
|
+
condition's own 1-based start line. The view separates tests that evaluated
|
|
193
|
+
the condition true or false from tests where it was short-circuited. Level 3
|
|
194
|
+
also shows the canonical witness observations selected by the analyzer and
|
|
195
|
+
their owning tests.
|
|
196
|
+
|
|
197
|
+
```sh
|
|
198
|
+
bundle exec branchproof analyze 'lib/**/*.rb' --view conditions
|
|
199
|
+
bundle exec branchproof analyze 'lib/**/*.rb' --view conditions --missing-only
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
Use `--view tests` to group the same evidence by test. Rows include each
|
|
203
|
+
exercised condition, its relative source location, observed values, and the
|
|
204
|
+
recorded `setup`, `body`, or `teardown` phases. Tests with no completed
|
|
205
|
+
condition observation remain visible, as do unattributed and unexecuted
|
|
206
|
+
conditions. A test that evaluates both Boolean values is evidence of execution;
|
|
207
|
+
it is a proof contributor only when the analyzer's independent witness pair
|
|
208
|
+
uses its observations.
|
|
209
|
+
|
|
210
|
+
`--view` changes terminal grouping and does not change instrumentation or test
|
|
211
|
+
execution. JSON output always contains the complete evidence document, so an
|
|
212
|
+
explicit view cannot be combined with `--format json`. The `mcdc` executable
|
|
213
|
+
accepts the same arguments for existing scripts.
|
|
214
|
+
|
|
215
|
+
### Saved reports and offline comparison
|
|
216
|
+
|
|
217
|
+
Reports are saved only when requested. Create a local artifact directory and
|
|
218
|
+
write a complete JSON baseline with the existing atomic `--output` option:
|
|
219
|
+
|
|
220
|
+
```sh
|
|
221
|
+
mkdir -p .branchproof
|
|
222
|
+
bundle exec branchproof analyze 'lib/**/*.rb' --format json \
|
|
223
|
+
--output .branchproof/baseline.json
|
|
224
|
+
bundle exec branchproof report .branchproof/baseline.json --view conditions
|
|
225
|
+
bundle exec branchproof report .branchproof/baseline.json --view tests
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
The output's parent directory must already exist. Replacing a baseline is an
|
|
229
|
+
explicit `analyze --format json --output` operation; keep CI snapshots as
|
|
230
|
+
artifacts when you need to retain multiple runs.
|
|
231
|
+
|
|
232
|
+
The `report` command reads the saved document without loading the application
|
|
233
|
+
or running tests. It uses locations and metadata captured in the report, so
|
|
234
|
+
rendering remains useful after the original checkout has moved or been
|
|
235
|
+
removed. Level 1 reports observations; levels 2 and 3 require corresponding
|
|
236
|
+
analysis in the saved report. The repository ignores `.branchproof/`; choose a
|
|
237
|
+
different path and CI artifact policy when a project needs to retain reports.
|
|
238
|
+
Saved JSON includes existing raw metadata such as test names and expressions;
|
|
239
|
+
relative terminal labels do not mean every legacy JSON field is sanitized.
|
|
240
|
+
|
|
241
|
+
To compare two explicitly saved runs:
|
|
242
|
+
|
|
243
|
+
```sh
|
|
244
|
+
bundle exec branchproof analyze 'lib/**/*.rb' --format json \
|
|
245
|
+
--output .branchproof/current.json
|
|
246
|
+
bundle exec branchproof compare .branchproof/baseline.json \
|
|
247
|
+
.branchproof/current.json
|
|
248
|
+
bundle exec branchproof compare .branchproof/baseline.json \
|
|
249
|
+
.branchproof/current.json --fail-on-regression
|
|
250
|
+
```
|
|
251
|
+
|
|
252
|
+
Comparison matches exact condition identities from unchanged source files.
|
|
253
|
+
Changed source files, changed selection or runtime context, incomplete runs,
|
|
254
|
+
and legacy reports missing comparison metadata are reported as partial or
|
|
255
|
+
incomplete context rather than guessed regressions. The output distinguishes
|
|
256
|
+
gained proof, lost proof, changed sources, newly selected files, and files no
|
|
257
|
+
longer present in a report. Previous witness values and owner names are shown
|
|
258
|
+
for lost proof; an absent owner is described as `not observed in current run`,
|
|
259
|
+
not as a deleted test. A different test population under unchanged discovery
|
|
260
|
+
patterns is valid comparison context, and seed differences are disclosed.
|
|
261
|
+
|
|
262
|
+
`compare` exits 0 for a complete comparison, including one with coverage
|
|
263
|
+
changes; `--fail-on-regression` exits 1 when a complete comparable run loses
|
|
264
|
+
proof. Invalid input or an incomplete comparison exits 2, which takes
|
|
265
|
+
precedence. Reports are explicit snapshots: comparison never creates history,
|
|
266
|
+
promotes a baseline, or overwrites either input.
|
|
267
|
+
|
|
268
|
+
MC/DC has two related questions. Evaluation asks whether a condition was
|
|
269
|
+
observed with a value, including short-circuiting. Independent proof asks
|
|
270
|
+
whether the analyzer found a pair of observations where that condition changes
|
|
271
|
+
the decision outcome under the masking criterion. Other conditions may be
|
|
272
|
+
short-circuited or masked rather than fixed to the same observed values. For example,
|
|
273
|
+
`left && right` observed as `[TT]` and `[F-]` evaluates `right` once and
|
|
274
|
+
short-circuits it once, but does not prove `right`; `[TF]` is also required.
|
|
275
|
+
The condition and test views preserve that distinction.
|
|
276
|
+
|
|
188
277
|
### Supported conditional forms
|
|
189
278
|
|
|
190
279
|
Ordinary Ruby ternaries use the same predicate instrumentation and `&&`/`||`
|
|
@@ -230,7 +319,7 @@ Everything after the argument separator is passed as individual arguments to
|
|
|
230
319
|
the serial Minitest runner. This is useful for seeds and name filters:
|
|
231
320
|
|
|
232
321
|
```sh
|
|
233
|
-
|
|
322
|
+
branchproof analyze 'lib/**/*.rb' --level 1 -- --seed 9001 -n /checkout/
|
|
234
323
|
```
|
|
235
324
|
|
|
236
325
|
The 0.2 release supports serial Minitest execution in plain Ruby projects and
|