branchproof 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/CHANGELOG.md +36 -0
- data/CODE_OF_CONDUCT.md +10 -0
- data/LICENSE.txt +202 -0
- data/NOTICE +3 -0
- data/README.md +242 -0
- data/doc/Branchproof/Analyzer.md +26 -0
- data/doc/Branchproof/CLI.md +15 -0
- data/doc/Branchproof/Error.md +6 -0
- data/doc/Branchproof/Evidence.md +46 -0
- data/doc/Branchproof/Instrumenter.md +18 -0
- data/doc/Branchproof/Limits.md +21 -0
- data/doc/Branchproof/Loader.md +25 -0
- data/doc/Branchproof/Minimizer.md +15 -0
- data/doc/Branchproof/MinitestAdapter.md +28 -0
- data/doc/Branchproof/Project.md +23 -0
- data/doc/Branchproof/RailsSupport/Error.md +6 -0
- data/doc/Branchproof/RailsSupport.md +32 -0
- data/doc/Branchproof/Records.md +38 -0
- data/doc/Branchproof/Report.md +26 -0
- data/doc/Branchproof/Runtime.md +37 -0
- data/doc/Branchproof/Source.md +23 -0
- data/doc/Branchproof/Worker.md +45 -0
- data/doc/Branchproof.md +33 -0
- data/doc/CHANGELOG.md +36 -0
- data/doc/README.md +242 -0
- data/exe/mcdc +6 -0
- data/lib/branchproof/analyzer.rb +454 -0
- data/lib/branchproof/cli.rb +266 -0
- data/lib/branchproof/evidence.rb +484 -0
- data/lib/branchproof/instrumenter.rb +150 -0
- data/lib/branchproof/limits.rb +44 -0
- data/lib/branchproof/loader.rb +140 -0
- data/lib/branchproof/minimizer.rb +198 -0
- data/lib/branchproof/minitest_adapter.rb +245 -0
- data/lib/branchproof/project.rb +53 -0
- data/lib/branchproof/rails_support.rb +74 -0
- data/lib/branchproof/records.rb +76 -0
- data/lib/branchproof/report.rb +412 -0
- data/lib/branchproof/runtime.rb +171 -0
- data/lib/branchproof/source.rb +238 -0
- data/lib/branchproof/version.rb +5 -0
- data/lib/branchproof/worker.rb +145 -0
- data/lib/branchproof.rb +24 -0
- data/lib/mcdc.rb +3 -0
- data/llms.txt +33 -0
- data/sig/branchproof.rbs +116 -0
- metadata +132 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: c5027104f6aeb6181f75ccc463ef93d6cf78489ba28e8c6824308d13546a5586
|
|
4
|
+
data.tar.gz: 442f07bf0dc87e1f3ed5bcc371d130da1612afd91f69837f8869b81fdf7c95f6
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 707ca0fff8681d36f7a0e635513c3914ed403ddaf0e96c1ddec646574abee54daf50e60f05c16a79d2b522a7f568a09ee99da3807161dd471646291442f80323
|
|
7
|
+
data.tar.gz: 3c446a3c71dd5a89cc0f12fa77ef61ef96a339a81bffd744dad86db4d2d7044f28c34a294342b29868b2ed848be1892892d8e28eff29f4e55f9b72a4ee57be62
|
data/CHANGELOG.md
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
## [Unreleased]
|
|
2
|
+
|
|
3
|
+
## [0.2.0] - 2026-09-09
|
|
4
|
+
|
|
5
|
+
- Prepared the initial public-release candidate.
|
|
6
|
+
- Embedded evidence snapshots now report the package version used to produce them.
|
|
7
|
+
|
|
8
|
+
- Added the `mcdc analyze` command for one serial Minitest run.
|
|
9
|
+
- Added Levels 1–3 reports for observations, supporting sets, and MC/DC
|
|
10
|
+
independence evidence in terminal and JSON formats.
|
|
11
|
+
- Added bounded analysis limits and explicit diagnostics for unsupported or
|
|
12
|
+
incomplete evidence.
|
|
13
|
+
- Added automatic and explicit Ruby and Rails project selection for
|
|
14
|
+
`mcdc analyze`.
|
|
15
|
+
- Added deterministic Minitest discovery for both `*_test.rb` and `test_*.rb`
|
|
16
|
+
files.
|
|
17
|
+
- Added isolated Rails test boot with serial, test-environment defaults and
|
|
18
|
+
Rails project metadata in reports.
|
|
19
|
+
- Added support documentation for plain Ruby and Rails projects, including
|
|
20
|
+
the tested Rails 8.1 integration boundary.
|
|
21
|
+
- Added support for ordinary Ruby ternary (`condition ? left : right`)
|
|
22
|
+
predicates, including existing `&&`/`||` condition trees and predicate
|
|
23
|
+
outcome semantics independent of the selected branch value.
|
|
24
|
+
- Improved terminal reports with readable decision and condition labels,
|
|
25
|
+
test names, compact collision-safe IDs, witness and constraint details, and
|
|
26
|
+
named supporting-test sets while preserving the full JSON report.
|
|
27
|
+
- Fixed nested predicate selection so executed ternary decisions are recorded
|
|
28
|
+
across all nested levels without instrumenting unchosen branches.
|
|
29
|
+
- Changed the project license to Apache-2.0; packaged `LICENSE.txt` and
|
|
30
|
+
`NOTICE`.
|
|
31
|
+
- Renamed the gem and public namespace to `branchproof` and `Branchproof`;
|
|
32
|
+
retained `mcdc` and `MCDC` as compatibility surfaces.
|
|
33
|
+
|
|
34
|
+
## [0.1.0] - 2026-09-09 (unpublished internal milestone)
|
|
35
|
+
|
|
36
|
+
- Initial analytical core and Minitest instrumentation milestone.
|
data/CODE_OF_CONDUCT.md
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# Code of Conduct
|
|
2
|
+
|
|
3
|
+
"branchproof" follows [The Ruby Community Conduct Guideline](https://www.ruby-lang.org/en/conduct) in all "collaborative space", which is defined as community communications channels (such as mailing lists, submitted patches, commit comments, etc.):
|
|
4
|
+
|
|
5
|
+
* Participants will be tolerant of opposing views.
|
|
6
|
+
* Participants must ensure that their language and actions are free of personal attacks and disparaging personal remarks.
|
|
7
|
+
* When interpreting the words and actions of others, participants should always assume good intentions.
|
|
8
|
+
* Behaviour which can be reasonably considered harassment will not be tolerated.
|
|
9
|
+
|
|
10
|
+
If you have any concerns about behaviour within this project, please contact us at ["lucianghinda@users.noreply.github.com"](mailto:"lucianghinda@users.noreply.github.com").
|
data/LICENSE.txt
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
data/NOTICE
ADDED
data/README.md
ADDED
|
@@ -0,0 +1,242 @@
|
|
|
1
|
+
# Branchproof
|
|
2
|
+
|
|
3
|
+
Branchproof measures modified condition/decision coverage (MC/DC) from one
|
|
4
|
+
serial Minitest run. It inventories supported `if`, `unless`, `elsif`,
|
|
5
|
+
modifier, and ordinary ternary (`?:`) decisions, records observed vectors,
|
|
6
|
+
and reports independence evidence, missing counterpart constraints, and
|
|
7
|
+
smaller supporting test sets.
|
|
8
|
+
|
|
9
|
+
The gem is named `branchproof`; its command and compatibility namespace are
|
|
10
|
+
`mcdc` and `MCDC`.
|
|
11
|
+
|
|
12
|
+
## Installation
|
|
13
|
+
|
|
14
|
+
```sh
|
|
15
|
+
gem install branchproof
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
Or add it to a bundle:
|
|
19
|
+
|
|
20
|
+
```sh
|
|
21
|
+
bundle add branchproof
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
Branchproof targets CRuby 3.3 and 3.4, Minitest 5.x, and Prism 1.x. The
|
|
25
|
+
published core runtime matrix is the CI matrix. Rails support is optional and
|
|
26
|
+
has been locally checked against Rails 8.1.3.1 on CRuby 3.4.5; Rails is
|
|
27
|
+
supplied by the application and is not a runtime dependency of this gem.
|
|
28
|
+
Unsupported syntax and incomplete observations remain visible in the report
|
|
29
|
+
instead of being counted as coverage.
|
|
30
|
+
|
|
31
|
+
## Analyze a test run
|
|
32
|
+
|
|
33
|
+
Run `mcdc analyze` with the source files or globs to inspect, followed by
|
|
34
|
+
options. A second `--` separates Branchproof options from arguments passed to
|
|
35
|
+
Minitest unchanged:
|
|
36
|
+
|
|
37
|
+
```sh
|
|
38
|
+
mcdc analyze 'lib/**/*.rb' --test 'test/**/*_test.rb' \
|
|
39
|
+
--level 3 \
|
|
40
|
+
--format terminal \
|
|
41
|
+
--output tmp/branchproof.txt \
|
|
42
|
+
--limits branchproof-limits.json \
|
|
43
|
+
-- --seed 1234
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
For a plain Ruby application, select the project policy explicitly when
|
|
47
|
+
running from the application root:
|
|
48
|
+
|
|
49
|
+
```sh
|
|
50
|
+
bundle exec mcdc analyze 'lib/**/*.rb' --project ruby --test 'test/**/*_test.rb'
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
For a Rails application, run the same command from the application root so
|
|
54
|
+
the application's bundle and Rails version remain in effect:
|
|
55
|
+
|
|
56
|
+
```sh
|
|
57
|
+
bundle exec mcdc analyze 'app/**/*.rb' --project rails --test 'test/**/*_test.rb'
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
For a project rooted at the current directory, `--project auto` is the
|
|
61
|
+
default. It selects Rails only when both `config/application.rb` and
|
|
62
|
+
`config/environment.rb` exist; otherwise it selects a plain Ruby project.
|
|
63
|
+
Use `--project ruby` or `--project rails` to override detection. An explicit
|
|
64
|
+
Rails project without both boot files is a usage error.
|
|
65
|
+
|
|
66
|
+
Project defaults discover the sorted, de-duplicated union of
|
|
67
|
+
`test/**/*_test.rb` and `test/**/test_*.rb`. Helper, support, and fixture files
|
|
68
|
+
are excluded from that default set. `--test` remains authoritative when test
|
|
69
|
+
files are selected explicitly. The worker prepends the project's `lib` and
|
|
70
|
+
`test` directories to its child load path, so application `require` calls
|
|
71
|
+
resolve without changing the parent process.
|
|
72
|
+
|
|
73
|
+
Rails analysis boots `config/environment.rb` and `rails/test_help` inside the
|
|
74
|
+
isolated worker after Branchproof's loader and Minitest hooks are installed. The
|
|
75
|
+
child receives `RAILS_ENV=test`, `RACK_ENV=test`, `PARALLEL_WORKERS=1`,
|
|
76
|
+
`DISABLE_BOOTSNAP=1`, and `DISABLE_SPRING=1`; the invoking process environment
|
|
77
|
+
is unchanged. The Rails metadata in the report identifies the selected
|
|
78
|
+
project and Rails version.
|
|
79
|
+
|
|
80
|
+
`--output` writes the report through an atomic replacement. Without it, the
|
|
81
|
+
report is written to standard output. `--format` accepts `terminal` (the
|
|
82
|
+
default) or `json`. JSON includes source identities, criterion and schema
|
|
83
|
+
versions, baseline status, diagnostics, completeness, observations, and
|
|
84
|
+
analysis fields.
|
|
85
|
+
|
|
86
|
+
The terminal format is a compact reading view of the same report. It keeps
|
|
87
|
+
JSON's full stable identifiers and schema unchanged, while shortening IDs to
|
|
88
|
+
eight-character prefixes (extending a prefix when two IDs collide) and
|
|
89
|
+
displaying known Minitest owners as `ClassName#test_method`. When test
|
|
90
|
+
metadata is unavailable, the owner falls back to its short ID. Level 3 adds
|
|
91
|
+
the witness pair or missing counterpart constraints beside each condition;
|
|
92
|
+
Level 2 and Level 3 also list named supporting tests. Repeated supporting-set
|
|
93
|
+
rows are collapsed in terminal output only.
|
|
94
|
+
|
|
95
|
+
For example, running the contents of the small `decision.rb` /
|
|
96
|
+
`test_decision_test.rb` fixture from a project `lib/` and `test/` directory
|
|
97
|
+
with the terminal format produces a summary like this:
|
|
98
|
+
|
|
99
|
+
```text
|
|
100
|
+
Branchproof 0.2.0
|
|
101
|
+
Tests: PASSED (3 tests, 0 failed, 0 skipped)
|
|
102
|
+
MC/DC: 100.0% (2/2 conditions proven)
|
|
103
|
+
Analysis: COMPLETE
|
|
104
|
+
Decisions: 1 supported, 0 excluded, 0 unexecuted (1 discovered)
|
|
105
|
+
Observations: 3 completed, 0 aborted, 0 unattributed
|
|
106
|
+
Values: T=true, F=false, -=short-circuited
|
|
107
|
+
Scope: supported decisions and conditions
|
|
108
|
+
|
|
109
|
+
Decision dde7aede lib/decision.rb:7
|
|
110
|
+
Decision: left && right
|
|
111
|
+
Status: SUPPORTED
|
|
112
|
+
Condition 0: left
|
|
113
|
+
PROVEN (witness 484eab21 + 8908881e)
|
|
114
|
+
Condition 1: right
|
|
115
|
+
PROVEN (witness e5ec8058 + 8908881e)
|
|
116
|
+
Vector e5ec8058 [TF] => F owners=CliFixtureTest#test_true_false_vector
|
|
117
|
+
Vector 8908881e [TT] => T owners=CliFixtureTest#test_true_true_vector
|
|
118
|
+
Vector 484eab21 [F-] => F owners=CliFixtureTest#test_false_true_vector
|
|
119
|
+
|
|
120
|
+
Supporting sets:
|
|
121
|
+
Vectors (EXACT_MINIMUM, decisions: [dde7aede]): 484eab21, 8908881e, e5ec8058
|
|
122
|
+
Tests (EXACT_MINIMUM, decisions: [dde7aede]): CliFixtureTest#test_true_true_vector, CliFixtureTest#test_false_true_vector, CliFixtureTest#test_true_false_vector
|
|
123
|
+
Additional tests outside this MC/DC evidence set may improve coverage.
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
The test execution still runs once for the selected level. Use `--format
|
|
127
|
+
json` when a consumer needs the complete identifiers and versioned schema.
|
|
128
|
+
|
|
129
|
+
The levels select how much of the one-run result is displayed:
|
|
130
|
+
|
|
131
|
+
* Level 1 reports observed vectors grouped by their raw decision outcomes.
|
|
132
|
+
* Level 2 includes the smallest supporting sets found for vectors and tests.
|
|
133
|
+
* Level 3 (the default) includes condition independence witnesses and
|
|
134
|
+
counterpart constraints, as well as the Level 1 and 2 evidence.
|
|
135
|
+
|
|
136
|
+
Level 2 and Level 3 compute from the same captured run. They do not rerun the
|
|
137
|
+
test suite. A failed, unsupported, or incomplete run is reported with its
|
|
138
|
+
status and diagnostics and cannot become a successful coverage result by
|
|
139
|
+
changing the display level.
|
|
140
|
+
|
|
141
|
+
### Supported conditional forms
|
|
142
|
+
|
|
143
|
+
Ordinary Ruby ternaries use the same predicate instrumentation and `&&`/`||`
|
|
144
|
+
condition trees as supported `if` decisions. For example:
|
|
145
|
+
|
|
146
|
+
```ruby
|
|
147
|
+
value = ready ? false : true
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
Branchproof records `ready` as the ternary predicate. The decision outcome is
|
|
151
|
+
therefore the truth value of `ready`, even though the selected branch returns
|
|
152
|
+
`false` or `true`; branch selection, returned values, object identity, and
|
|
153
|
+
evaluation order are unchanged. Ternaries nested inside other predicates are
|
|
154
|
+
also inventoried at their own level, including all executed nested levels.
|
|
155
|
+
Expanding the supported syntax increases the eligible-condition denominator,
|
|
156
|
+
so percentages should be compared with that changed scope in mind.
|
|
157
|
+
|
|
158
|
+
The existing predicate exclusions and analysis limits still apply. Keyword
|
|
159
|
+
`and`/`or` expressions, contextual syntax, unsafe or ambiguous predicates,
|
|
160
|
+
and limit overflows remain diagnostics rather than eligible coverage.
|
|
161
|
+
|
|
162
|
+
### Limits
|
|
163
|
+
|
|
164
|
+
`--limits` accepts a JSON object containing positive integer overrides. The
|
|
165
|
+
available keys are `conditions_per_decision`, `vectors_per_decision`,
|
|
166
|
+
`owner_associations_per_run`, `tests_per_run`, `exact_candidates`,
|
|
167
|
+
`exact_search_nodes`, and `constraint_search_states`.
|
|
168
|
+
|
|
169
|
+
```json
|
|
170
|
+
{
|
|
171
|
+
"vectors_per_decision": 4096,
|
|
172
|
+
"exact_search_nodes": 50000
|
|
173
|
+
}
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
Unknown keys and non-positive values are usage errors. When a limit is
|
|
177
|
+
reached, the report says that evidence or analysis is incomplete; it does not
|
|
178
|
+
claim a complete result from truncated data.
|
|
179
|
+
|
|
180
|
+
### Runner arguments
|
|
181
|
+
|
|
182
|
+
Everything after the argument separator is passed as individual arguments to
|
|
183
|
+
the serial Minitest runner. This is useful for seeds and name filters:
|
|
184
|
+
|
|
185
|
+
```sh
|
|
186
|
+
mcdc analyze 'lib/**/*.rb' --level 1 -- --seed 9001 -n /checkout/
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
The 0.2 release supports serial Minitest execution in plain Ruby projects and
|
|
190
|
+
Rails applications. Rails lazy and eager loading are supported when the
|
|
191
|
+
application does not enable reloading for the test run. RSpec, parallel or
|
|
192
|
+
forked runners, mutation execution, Rails system/browser tests, custom Rails
|
|
193
|
+
test commands, generated tests, and reloading configurations are outside this
|
|
194
|
+
release and produce diagnostics rather than a passing analysis.
|
|
195
|
+
|
|
196
|
+
## Library entry points
|
|
197
|
+
|
|
198
|
+
```ruby
|
|
199
|
+
require "branchproof"
|
|
200
|
+
|
|
201
|
+
Branchproof::Limits.default
|
|
202
|
+
Branchproof::Records.id(name: "stable identity")
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
`require "mcdc"` and `MCDC` are compatibility aliases for the same public
|
|
206
|
+
namespace. The CLI is the supported way to run a complete analysis;
|
|
207
|
+
`Branchproof::Project` exposes project selection and child-environment policy,
|
|
208
|
+
and `Branchproof::RailsSupport` is the optional Rails boot boundary. The library
|
|
209
|
+
classes expose the source, runtime, evidence, analysis, and report contracts
|
|
210
|
+
for adapters and integrations.
|
|
211
|
+
|
|
212
|
+
## Development
|
|
213
|
+
|
|
214
|
+
Use an explicit Ruby executable on systems with multiple Rubies. Clearing
|
|
215
|
+
inherited gem paths prevents one Ruby installation from loading another's
|
|
216
|
+
gems:
|
|
217
|
+
|
|
218
|
+
```sh
|
|
219
|
+
bundle install
|
|
220
|
+
bundle exec rake
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
To run the real Rails integration locally, install the optional test bundle
|
|
224
|
+
and set its required flag:
|
|
225
|
+
|
|
226
|
+
```sh
|
|
227
|
+
BRANCHPROOF_RAILS_INTEGRATION=1 bundle install
|
|
228
|
+
BRANCHPROOF_RAILS_INTEGRATION=1 bundle exec ruby -Ilib:test test/test_rails_integration.rb
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
The flag makes a missing Rails dependency a failure in the integration job;
|
|
232
|
+
the core suite does not require Rails. Bootsnap is disabled for the child
|
|
233
|
+
Rails process so its compilation cache cannot own the load path during an
|
|
234
|
+
analysis.
|
|
235
|
+
|
|
236
|
+
Run the commands with the Ruby executable you intend to validate. The checked
|
|
237
|
+
release environments are CRuby 3.3.6 and 3.4.5. Each runtime
|
|
238
|
+
must provide the declared Minitest 5.x and Prism 1.x dependencies.
|
|
239
|
+
|
|
240
|
+
## License
|
|
241
|
+
|
|
242
|
+
Branchproof is available under the [Apache License, Version 2.0](LICENSE.txt).
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# Class Branchproof::Analyzer <a id="class-Branchproof-Analyzer"></a>
|
|
2
|
+
|
|
3
|
+
| | |
|
|
4
|
+
| --- | --- |
|
|
5
|
+
| **Inherits** | Object |
|
|
6
|
+
| **Defined in** | lib/branchproof/analyzer.rb |
|
|
7
|
+
|
|
8
|
+
Performs the Boolean, occurrence-level masking analysis. It deliberately
|
|
9
|
+
accepts plain records so the core does not depend on Minitest or Runtime.
|
|
10
|
+
|
|
11
|
+
## Constants
|
|
12
|
+
### `CRITERION` <a id="constant-CRITERION"></a> <a id="CRITERION-constant"></a>
|
|
13
|
+
Not documented.
|
|
14
|
+
|
|
15
|
+
## Public Instance Methods
|
|
16
|
+
### `call()` <a id="method-i-call"></a> <a id="call-instance_method"></a>
|
|
17
|
+
Not documented.
|
|
18
|
+
|
|
19
|
+
### `initialize(inventory:, evidence:, limits:)` <a id="method-i-initialize"></a> <a id="initialize-instance_method"></a>
|
|
20
|
+
- **@return** [Analyzer] a new instance of Analyzer
|
|
21
|
+
|
|
22
|
+
### `missing(decision_id:, condition_index:)` <a id="method-i-missing"></a> <a id="missing-instance_method"></a>
|
|
23
|
+
Not documented.
|
|
24
|
+
|
|
25
|
+
### `pair?(decision_id:, condition_index:, left:, right:)` <a id="method-i-pair-3F"></a> <a id="pair?-instance_method"></a>
|
|
26
|
+
- **@return** [Boolean]
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# Class Branchproof::CLI <a id="class-Branchproof-CLI"></a>
|
|
2
|
+
|
|
3
|
+
| | |
|
|
4
|
+
| --- | --- |
|
|
5
|
+
| **Inherits** | Object |
|
|
6
|
+
| **Defined in** | lib/branchproof/cli.rb |
|
|
7
|
+
|
|
8
|
+
Coordinates source inventory, isolated test execution, and report output.
|
|
9
|
+
|
|
10
|
+
## Public Instance Methods
|
|
11
|
+
### `call(argv)` <a id="method-i-call"></a> <a id="call-instance_method"></a>
|
|
12
|
+
Not documented.
|
|
13
|
+
|
|
14
|
+
### `initialize(stdout:, stderr:)` <a id="method-i-initialize"></a> <a id="initialize-instance_method"></a>
|
|
15
|
+
- **@return** [CLI] a new instance of CLI
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# Class Branchproof::Evidence <a id="class-Branchproof-Evidence"></a>
|
|
2
|
+
|
|
3
|
+
| | |
|
|
4
|
+
| --- | --- |
|
|
5
|
+
| **Inherits** | Object |
|
|
6
|
+
| **Defined in** | lib/branchproof/evidence.rb |
|
|
7
|
+
|
|
8
|
+
Validates, groups, and merges adapter-neutral execution evidence. Stores
|
|
9
|
+
validated observations and merges compatible worker snapshots.
|
|
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
|
+
### `TOOL_VERSION` <a id="constant-TOOL_VERSION"></a> <a id="TOOL_VERSION-constant"></a>
|
|
19
|
+
Not documented.
|
|
20
|
+
|
|
21
|
+
## Attributes
|
|
22
|
+
### `inventory` [R] <a id="attribute-i-inventory"></a> <a id="inventory-instance_method"></a>
|
|
23
|
+
Returns the value of attribute inventory.
|
|
24
|
+
|
|
25
|
+
### `run_id` [R] <a id="attribute-i-run_id"></a> <a id="run_id-instance_method"></a>
|
|
26
|
+
Returns the value of attribute run_id.
|
|
27
|
+
|
|
28
|
+
## Public Instance Methods
|
|
29
|
+
### `diagnose(diagnostic:)` <a id="method-i-diagnose"></a> <a id="diagnose-instance_method"></a>
|
|
30
|
+
Not documented.
|
|
31
|
+
|
|
32
|
+
### `initialize(inventory:, limits:, run_id:)` <a id="method-i-initialize"></a> <a id="initialize-instance_method"></a>
|
|
33
|
+
- **@raise** [ArgumentError]
|
|
34
|
+
- **@return** [Evidence] a new instance of Evidence
|
|
35
|
+
|
|
36
|
+
### `merge(snapshot:)` <a id="method-i-merge"></a> <a id="merge-instance_method"></a>
|
|
37
|
+
Not documented.
|
|
38
|
+
|
|
39
|
+
### `record(execution:)` <a id="method-i-record"></a> <a id="record-instance_method"></a>
|
|
40
|
+
Not documented.
|
|
41
|
+
|
|
42
|
+
### `register_test(test:)` <a id="method-i-register_test"></a> <a id="register_test-instance_method"></a>
|
|
43
|
+
Not documented.
|
|
44
|
+
|
|
45
|
+
### `snapshot()` <a id="method-i-snapshot"></a> <a id="snapshot-instance_method"></a>
|
|
46
|
+
Not documented.
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# Class Branchproof::Instrumenter <a id="class-Branchproof-Instrumenter"></a>
|
|
2
|
+
|
|
3
|
+
| | |
|
|
4
|
+
| --- | --- |
|
|
5
|
+
| **Inherits** | Object |
|
|
6
|
+
| **Defined in** | lib/branchproof/instrumenter.rb |
|
|
7
|
+
|
|
8
|
+
Applies the smallest possible source edits around inventoried expressions. The
|
|
9
|
+
edits are deliberately textual: Prism owns the ranges, while this class never
|
|
10
|
+
evaluates application code or introduces a Ruby scope.
|
|
11
|
+
|
|
12
|
+
## Constants
|
|
13
|
+
### `RUNTIME` <a id="constant-RUNTIME"></a> <a id="RUNTIME-constant"></a>
|
|
14
|
+
Not documented.
|
|
15
|
+
|
|
16
|
+
## Public Instance Methods
|
|
17
|
+
### `rewrite(unit:)` <a id="method-i-rewrite"></a> <a id="rewrite-instance_method"></a>
|
|
18
|
+
Not documented.
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# Module Branchproof::Limits <a id="module-Branchproof-Limits"></a>
|
|
2
|
+
|
|
3
|
+
| | |
|
|
4
|
+
| --- | --- |
|
|
5
|
+
| **Defined in** | lib/branchproof/limits.rb |
|
|
6
|
+
|
|
7
|
+
Defines bounded storage and search limits for one analysis.
|
|
8
|
+
|
|
9
|
+
## Constants
|
|
10
|
+
### `DEFAULTS` <a id="constant-DEFAULTS"></a> <a id="DEFAULTS-constant"></a>
|
|
11
|
+
Not documented.
|
|
12
|
+
|
|
13
|
+
### `KEYS` <a id="constant-KEYS"></a> <a id="KEYS-constant"></a>
|
|
14
|
+
Not documented.
|
|
15
|
+
|
|
16
|
+
## Public Class Methods
|
|
17
|
+
### `default()` <a id="method-c-default"></a> <a id="default-class_method"></a>
|
|
18
|
+
Not documented.
|
|
19
|
+
|
|
20
|
+
### `normalize(overrides = {})` <a id="method-c-normalize"></a> <a id="normalize-class_method"></a>
|
|
21
|
+
- **@raise** [ArgumentError]
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# Class Branchproof::Loader <a id="class-Branchproof-Loader"></a>
|
|
2
|
+
|
|
3
|
+
| | |
|
|
4
|
+
| --- | --- |
|
|
5
|
+
| **Inherits** | Object |
|
|
6
|
+
| **Defined in** | lib/branchproof/loader.rb |
|
|
7
|
+
|
|
8
|
+
Owns the process-local CRuby compilation hook when the VM exposes it.
|
|
9
|
+
|
|
10
|
+
## Constants
|
|
11
|
+
### `STATUS_KEYS` <a id="constant-STATUS_KEYS"></a> <a id="STATUS_KEYS-constant"></a>
|
|
12
|
+
Not documented.
|
|
13
|
+
|
|
14
|
+
## Public Instance Methods
|
|
15
|
+
### `diagnostics()` <a id="method-i-diagnostics"></a> <a id="diagnostics-instance_method"></a>
|
|
16
|
+
Not documented.
|
|
17
|
+
|
|
18
|
+
### `initialize(inventory:, instrumenter:)` <a id="method-i-initialize"></a> <a id="initialize-instance_method"></a>
|
|
19
|
+
- **@return** [Loader] a new instance of Loader
|
|
20
|
+
|
|
21
|
+
### `install()` <a id="method-i-install"></a> <a id="install-instance_method"></a>
|
|
22
|
+
Not documented.
|
|
23
|
+
|
|
24
|
+
### `load_iseq(path)` <a id="method-i-load_iseq"></a> <a id="load_iseq-instance_method"></a>
|
|
25
|
+
Not documented.
|