branchproof 0.3.0 → 0.5.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 54d2cbd08336e8e70fa291f82e821043d06572485a57c0aa500656b29500688f
4
- data.tar.gz: 805857b4b676e3d3cef1627890a2ab62fb7e7cda404b43907e9b2b1db2bbedca
3
+ metadata.gz: c5b31682254d1c9db4be1d61e11743be038c65f859c730be05d1acae138e673c
4
+ data.tar.gz: 59a6f30a1586c0783283f32e16d1ed5626f702f3ec152ec15dfe271cfbc0c0b1
5
5
  SHA512:
6
- metadata.gz: 44aed1ac067e6d1f0d2a5858b1b3ba14f102805f0b16c3b63cfdb9a605fb2df26bc113a1d70c53236ce1023aa991b05ae1c600439b89cb35297134883a0b5b86
7
- data.tar.gz: d003e7b90e2413d20b788f9717f6df5512611bfbd4e3b1e8a0695b55bc9d62fbbbb3c10097905653f03119c2eb30a47d098051e5e0579a58ef51c0ce5b9dbcba
6
+ metadata.gz: 061d18741787eaeb57f5f1ec90a5e68d658fa8d9344fee52ecfa54fd70a69fcc909affe4890785031403a46379c90e11ac8a63c01766bd8477e2d7963ca14172
7
+ data.tar.gz: 144e5b02c3a380133015402e9ad2b47b52bc3a4d624c2f13728015159cd7ec6287fe7b3d1f167fb2ce745b3d953d5f271628a740c0912ae36af3fa7f72e13fb9
data/CHANGELOG.md CHANGED
@@ -1,5 +1,24 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [0.5.0] - 2026-09-10
4
+
5
+ - Show source filenames beside diagnostics in decision, condition, and test
6
+ views, including reports rendered from saved JSON.
7
+ - Explain when a selected file has no supported conditions to instrument and
8
+ include unsupported syntax reasons when its decisions cannot be instrumented.
9
+
10
+ ## [0.4.0] - 2026-09-10
11
+
12
+ - Added `branchproof` as the primary CLI command while retaining `mcdc` as a
13
+ compatibility alias.
14
+ - Added condition-focused and test-focused terminal views, including relative
15
+ source locations, evaluated and short-circuited observations, and analyzer
16
+ witness ownership.
17
+ - Added opt-in saved JSON reports, offline rendering, and exact-condition
18
+ comparisons with gained/lost proof and changed-source context.
19
+ - Added `--fail-on-regression` comparison status handling and documented the
20
+ local `.branchproof/` artifact directory and explicit baseline workflow.
21
+
3
22
  ## [0.3.0] - 2026-09-10
4
23
 
5
24
  - 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 is named `branchproof`; its command and compatibility namespace are
10
- `mcdc` and `MCDC`.
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 `mcdc analyze` with the source files or globs to inspect, followed by
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
- mcdc analyze 'lib/**/*.rb' --test 'test/**/*_test.rb' \
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 mcdc analyze 'lib/**/*.rb' --project ruby --test 'test/**/*_test.rb'
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 mcdc analyze 'app/**/*.rb' --project rails --test 'test/**/*_test.rb'
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.3.0
100
+ Branchproof 0.5.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 mcdc analyze 'lib/**/*.rb' --missing-only
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
- mcdc analyze 'lib/**/*.rb' --level 1 -- --seed 9001 -n /checkout/
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.
@@ -14,11 +14,21 @@ 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
+
25
+ ### `diagnostic_message(diagnostic)` <a id="method-i-diagnostic_message"></a> <a id="diagnostic_message-instance_method"></a>
26
+ Formats source context consistently in live and saved terminal views.
27
+
18
28
  ### `exit_code()` <a id="method-i-exit_code"></a> <a id="exit_code-instance_method"></a>
19
29
  Not documented.
20
30
 
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>
31
+ ### `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
32
  - **@raise** [ArgumentError]
23
33
  - **@return** [Report] a new instance of Report
24
34
 
@@ -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,24 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [0.5.0] - 2026-09-10
4
+
5
+ - Show source filenames beside diagnostics in decision, condition, and test
6
+ views, including reports rendered from saved JSON.
7
+ - Explain when a selected file has no supported conditions to instrument and
8
+ include unsupported syntax reasons when its decisions cannot be instrumented.
9
+
10
+ ## [0.4.0] - 2026-09-10
11
+
12
+ - Added `branchproof` as the primary CLI command while retaining `mcdc` as a
13
+ compatibility alias.
14
+ - Added condition-focused and test-focused terminal views, including relative
15
+ source locations, evaluated and short-circuited observations, and analyzer
16
+ witness ownership.
17
+ - Added opt-in saved JSON reports, offline rendering, and exact-condition
18
+ comparisons with gained/lost proof and changed-source context.
19
+ - Added `--fail-on-regression` comparison status handling and documented the
20
+ local `.branchproof/` artifact directory and explicit baseline workflow.
21
+
3
22
  ## [0.3.0] - 2026-09-10
4
23
 
5
24
  - 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 is named `branchproof`; its command and compatibility namespace are
10
- `mcdc` and `MCDC`.
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 `mcdc analyze` with the source files or globs to inspect, followed by
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
- mcdc analyze 'lib/**/*.rb' --test 'test/**/*_test.rb' \
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 mcdc analyze 'lib/**/*.rb' --project ruby --test 'test/**/*_test.rb'
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 mcdc analyze 'app/**/*.rb' --project rails --test 'test/**/*_test.rb'
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.3.0
100
+ Branchproof 0.5.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 mcdc analyze 'lib/**/*.rb' --missing-only
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
- mcdc analyze 'lib/**/*.rb' --level 1 -- --seed 9001 -n /checkout/
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
data/exe/branchproof ADDED
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ $LOAD_PATH.unshift File.expand_path("../lib", __dir__)
5
+ require "branchproof"
6
+ exit Branchproof::CLI.new(stdout: $stdout, stderr: $stderr).call(ARGV)