cuke-dedup 0.2.0 → 0.3.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.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,45 @@
3
3
  All notable changes to CukeDedup are documented in this file. The project follows
4
4
  [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
5
5
 
6
+ ## [Unreleased]
7
+
8
+ ## [0.3.0] - 2026-09-14
9
+
10
+ ### Added
11
+
12
+ - `--baseline-from-ref` and the matching Action input compare against a fetched Git revision
13
+ with the current analysis policy, reusing `--fail-on-new` without a committed baseline file.
14
+ Incomplete historical scans are rejected rather than treated as clean baselines.
15
+
16
+ ## [0.2.1] - 2026-09-13
17
+
18
+ ### Changed
19
+
20
+ - Release binaries abort on panic and ship without a symbol table, which reduces the published
21
+ archive for each platform by about 21 percent, from 2,499,615 to 1,972,110 bytes on
22
+ `aarch64-apple-darwin`, with no measured analysis slowdown. Only the binaries this project
23
+ distributes are affected; a crate depending on CukeDedup keeps its own release profile.
24
+ - Handlers whose behavior is a parameterized inline invocation, such as
25
+ `((value) => check(value))(compute())`, are excluded from handler comparison. The arguments
26
+ are not substituted, so the body is never read and two such handlers are not claimed to be
27
+ equivalent. Version 0.2.0 reported a byte-identical pair of that shape as a duplicate; it is
28
+ no longer reported. Zero-parameter invocations are unaffected and still compare normally.
29
+
30
+ ### Fixed
31
+
32
+ - Preserve callback call evidence in near-duplicate analysis without promoting deferred assertions
33
+ to executed behavior, preventing unrelated callback bodies from appearing identical.
34
+ - Clarify that parameterization suggestions preserve expected assertion values and polarity.
35
+ - Near-duplicate analysis now distinguishes assertions targeting different properties, expecting
36
+ different inline or immutable local values, or using opposite chains such as `expect(...).not`,
37
+ while retaining assertion-only duplicate candidates and avoiding misleading handler-overlap
38
+ warnings. Assertion provenance now also respects TypeScript runtime namespaces, erased
39
+ declarations, namespace bindings, and wrapped assertion expressions.
40
+ - Changed-files mode no longer inherits the caller's Git environment. `GIT_DIR`, `GIT_WORK_TREE`,
41
+ `GIT_INDEX_FILE`, and related variables outrank the repository selected per invocation, so
42
+ running CukeDedup from another repository's Git hook resolved revisions, ignore rules, and the
43
+ changed set against the hook's repository instead of the analyzed root.
44
+
6
45
  ## [0.2.0] - 2026-09-10
7
46
 
8
47
  ### Changed
@@ -120,6 +159,8 @@ Initial public release.
120
159
  - Native Cargo and npm distributions for eight supported targets.
121
160
  - A checksum-verified GitHub Action and an agent-oriented CukeDedup skill.
122
161
 
162
+ [0.3.0]: https://github.com/figueiredoluiz/cuke-dedup/compare/v0.2.1...v0.3.0
163
+ [0.2.1]: https://github.com/figueiredoluiz/cuke-dedup/compare/v0.2.0...v0.2.1
123
164
  [0.2.0]: https://github.com/figueiredoluiz/cuke-dedup/compare/v0.1.1...v0.2.0
124
165
  [0.1.1]: https://github.com/figueiredoluiz/cuke-dedup/compare/v0.1.0...v0.1.1
125
166
  [0.1.0]: https://github.com/figueiredoluiz/cuke-dedup/releases/tag/v0.1.0
package/README.md CHANGED
@@ -136,7 +136,7 @@ steps:
136
136
  with:
137
137
  fetch-depth: 0
138
138
  persist-credentials: false
139
- - uses: figueiredoluiz/cuke-dedup@v0.2.0
139
+ - uses: figueiredoluiz/cuke-dedup@v0.3.0
140
140
  with:
141
141
  path: .
142
142
  threshold: 5
@@ -18,9 +18,11 @@ regenerated whenever `Cargo.lock` changes.
18
18
  | anstyle-query | 1.1.5 | MIT OR Apache-2.0 | Not declared | https://github.com/rust-cli/anstyle.git |
19
19
  | anstyle-wincon | 3.0.11 | MIT OR Apache-2.0 | Not declared | https://github.com/rust-cli/anstyle.git |
20
20
  | anyhow | 1.0.104 | MIT OR Apache-2.0 | David Tolnay <dtolnay@gmail.com> | https://github.com/dtolnay/anyhow |
21
+ | bitflags | 2.13.1 | MIT OR Apache-2.0 | The Rust Project Developers | https://github.com/bitflags/bitflags |
21
22
  | bstr | 1.13.1 | MIT OR Apache-2.0 | Andrew Gallant <jamslam@gmail.com> | https://github.com/BurntSushi/bstr |
22
23
  | bytecount | 0.6.9 | Apache-2.0/MIT | Andre Bogus <bogusandre@gmail.de>, Joshua Landau <joshua@landau.ws> | https://github.com/llogiq/bytecount |
23
24
  | cc | 1.4.4 | MIT OR Apache-2.0 | Not declared | https://github.com/rust-lang/cc-rs |
25
+ | cfg-if | 1.0.4 | MIT OR Apache-2.0 | Alex Crichton <alex@alexcrichton.com> | https://github.com/rust-lang/cfg-if |
24
26
  | clap | 4.6.6 | MIT OR Apache-2.0 | Not declared | https://github.com/clap-rs/clap |
25
27
  | clap_builder | 4.6.6 | MIT OR Apache-2.0 | Not declared | https://github.com/clap-rs/clap |
26
28
  | clap_derive | 4.6.4 | MIT OR Apache-2.0 | Not declared | https://github.com/clap-rs/clap |
@@ -35,7 +37,10 @@ regenerated whenever `Cargo.lock` changes.
35
37
  | derive_more-impl | 2.1.1 | MIT | Jelte Fennema <github-tech@jeltef.nl> | https://github.com/JelteF/derive_more |
36
38
  | either | 1.18.0 | MIT OR Apache-2.0 | Not declared | https://github.com/rayon-rs/either |
37
39
  | equivalent | 1.0.2 | Apache-2.0 OR MIT | Not declared | https://github.com/indexmap-rs/equivalent |
40
+ | errno | 0.3.14 | MIT OR Apache-2.0 | Chris Wong <lambda.fairy@gmail.com>, Dan Gohman <dev@sunfishcode.online> | https://github.com/lambda-fairy/rust-errno |
41
+ | fastrand | 2.5.0 | Apache-2.0 OR MIT | Stjepan Glavina <stjepang@gmail.com> | https://github.com/smol-rs/fastrand |
38
42
  | find-msvc-tools | 0.1.11 | MIT OR Apache-2.0 | Not declared | https://github.com/rust-lang/cc-rs |
43
+ | getrandom | 0.4.3 | MIT OR Apache-2.0 | The Rand Project Developers | https://github.com/rust-random/getrandom |
39
44
  | gherkin | 0.16.0 | MIT OR Apache-2.0 | Brendan Molloy <brendan@bbqsrc.net> | https://github.com/cucumber-rs/gherkin |
40
45
  | globset | 0.4.20 | Unlicense OR MIT | Andrew Gallant <jamslam@gmail.com> | https://github.com/BurntSushi/ripgrep/tree/master/crates/globset |
41
46
  | hashbrown | 0.17.1 | MIT OR Apache-2.0 | Not declared | https://github.com/rust-lang/hashbrown |
@@ -44,21 +49,26 @@ regenerated whenever `Cargo.lock` changes.
44
49
  | indexmap | 2.14.1 | Apache-2.0 OR MIT | Not declared | https://github.com/indexmap-rs/indexmap |
45
50
  | is_terminal_polyfill | 1.70.2 | MIT OR Apache-2.0 | Not declared | https://github.com/polyfill-rs/is_terminal_polyfill |
46
51
  | itoa | 1.0.18 | MIT OR Apache-2.0 | David Tolnay <dtolnay@gmail.com> | https://github.com/dtolnay/itoa |
52
+ | libc | 0.2.189 | MIT OR Apache-2.0 | Not declared | https://github.com/rust-lang/libc |
47
53
  | libyaml-rs | 0.3.0 | MIT | David Tolnay <dtolnay@gmail.com>, YAML Organization <noreply@yaml.org> | https://github.com/yaml/libyaml-rs |
54
+ | linux-raw-sys | 0.12.1 | Apache-2.0 WITH LLVM-exception OR Apache-2.0 OR MIT | Dan Gohman <dev@sunfishcode.online> | https://github.com/sunfishcode/linux-raw-sys |
48
55
  | log | 0.4.34 | MIT OR Apache-2.0 | The Rust Project Developers | https://github.com/rust-lang/log |
49
56
  | memchr | 2.8.3 | Unlicense OR MIT | Andrew Gallant <jamslam@gmail.com>, bluss | https://github.com/BurntSushi/memchr |
50
57
  | nom | 8.0.0 | MIT | contact@geoffroycouprie.com | https://github.com/rust-bakery/nom |
51
58
  | nom_locate | 5.0.0 | MIT | Florent FAYOLLE <florent.fayolle69@gmail.com>, Christopher Durham <cad97@cad97.com>, Valentin Lorentz <progval+git@progval.net> | https://github.com/fflorent/nom_locate |
59
+ | once_cell | 1.21.4 | MIT OR Apache-2.0 | Aleksey Kladov <aleksey.kladov@gmail.com> | https://github.com/matklad/once_cell |
52
60
  | once_cell_polyfill | 1.70.2 | MIT OR Apache-2.0 | Not declared | https://github.com/polyfill-rs/once_cell_polyfill |
53
61
  | peg | 0.6.3 | MIT | Kevin Mehall <km@kevinmehall.net> | https://github.com/kevinmehall/rust-peg |
54
62
  | peg-macros | 0.6.3 | MIT | Kevin Mehall <km@kevinmehall.net> | https://github.com/kevinmehall/rust-peg |
55
63
  | peg-runtime | 0.6.3 | MIT | Kevin Mehall <km@kevinmehall.net> | https://github.com/kevinmehall/rust-peg |
56
64
  | proc-macro2 | 1.0.107 | MIT OR Apache-2.0 | David Tolnay <dtolnay@gmail.com>, Alex Crichton <alex@alexcrichton.com> | https://github.com/dtolnay/proc-macro2 |
57
65
  | quote | 1.0.47 | MIT OR Apache-2.0 | David Tolnay <dtolnay@gmail.com> | https://github.com/dtolnay/quote |
66
+ | r-efi | 6.0.0 | MIT OR Apache-2.0 OR LGPL-2.1-or-later | Not declared | https://github.com/r-efi/r-efi |
58
67
  | regex | 1.13.1 | MIT OR Apache-2.0 | The Rust Project Developers, Andrew Gallant <jamslam@gmail.com> | https://github.com/rust-lang/regex |
59
68
  | regex-automata | 0.4.18 | MIT OR Apache-2.0 | The Rust Project Developers, Andrew Gallant <jamslam@gmail.com> | https://github.com/rust-lang/regex |
60
69
  | regex-syntax | 0.8.11 | MIT OR Apache-2.0 | The Rust Project Developers, Andrew Gallant <jamslam@gmail.com> | https://github.com/rust-lang/regex |
61
70
  | rustc_version | 0.4.1 | MIT OR Apache-2.0 | Not declared | https://github.com/djc/rustc-version-rs |
71
+ | rustix | 1.1.4 | Apache-2.0 WITH LLVM-exception OR Apache-2.0 OR MIT | Dan Gohman <dev@sunfishcode.online>, Jakub Konka <kubkon@jakubkonka.com> | https://github.com/bytecodealliance/rustix |
62
72
  | ryu | 1.0.23 | Apache-2.0 OR BSL-1.0 | David Tolnay <dtolnay@gmail.com> | https://github.com/dtolnay/ryu |
63
73
  | same-file | 1.0.6 | Unlicense/MIT | Andrew Gallant <jamslam@gmail.com> | https://github.com/BurntSushi/same-file |
64
74
  | semver | 1.0.28 | MIT OR Apache-2.0 | David Tolnay <dtolnay@gmail.com> | https://github.com/dtolnay/semver |
@@ -72,6 +82,7 @@ regenerated whenever `Cargo.lock` changes.
72
82
  | strsim | 0.11.1 | MIT | Danny Guo <danny@dannyguo.com>, maxbachmann <oss@maxbachmann.de> | https://github.com/rapidfuzz/strsim-rs |
73
83
  | syn | 2.0.119 | MIT OR Apache-2.0 | David Tolnay <dtolnay@gmail.com> | https://github.com/dtolnay/syn |
74
84
  | syn | 3.0.4 | MIT OR Apache-2.0 | David Tolnay <dtolnay@gmail.com> | https://github.com/dtolnay/syn |
85
+ | tempfile | 3.27.0 | MIT OR Apache-2.0 | Steven Allen <steven@stebalien.com>, The Rust Project Developers, Ashley Mannix <ashleymannix@live.com.au>, Jason White <me@jasonwhite.io> | https://github.com/Stebalien/tempfile |
75
86
  | textwrap | 0.16.2 | MIT | Martin Geisler <martin@geisler.net> | https://github.com/mgeisler/textwrap |
76
87
  | thiserror | 2.0.20 | MIT OR Apache-2.0 | David Tolnay <dtolnay@gmail.com> | https://github.com/dtolnay/thiserror |
77
88
  | thiserror-impl | 2.0.20 | MIT OR Apache-2.0 | David Tolnay <dtolnay@gmail.com> | https://github.com/dtolnay/thiserror |
@@ -18,7 +18,7 @@ steps:
18
18
  fetch-depth: 0
19
19
  persist-credentials: false
20
20
 
21
- - uses: figueiredoluiz/cuke-dedup@v0.2.0
21
+ - uses: figueiredoluiz/cuke-dedup@v0.3.0
22
22
  id: cuke-dedup
23
23
  with:
24
24
  path: .
@@ -95,9 +95,9 @@ cuke-dedup . --baseline .cuke-dedup-baseline.json --fail-on-new
95
95
  cuke-dedup . --baseline .cuke-dedup-baseline.json --fail-on-new 3
96
96
  ```
97
97
 
98
- `--fail-on-new` defaults to zero when no count is supplied. It and `--update-baseline` both require
99
- `--baseline` and cannot be combined. The Action exposes the same behavior through `baseline` and
100
- `fail-on-new` inputs.
98
+ `--fail-on-new` defaults to zero when no count is supplied and requires `--baseline` or
99
+ `--baseline-from-ref`. `--update-baseline` requires the file form and cannot be combined with
100
+ `--fail-on-new`. The Action exposes `baseline`, `baseline-from-ref`, and `fail-on-new` inputs.
101
101
 
102
102
  Baselines store sorted semantic fingerprints with multiplicity counts. Renames and unrelated line
103
103
  changes do not make a finding new, while an additional occurrence beyond the recorded count does.
@@ -107,6 +107,48 @@ Version `1` baselines from CukeDedup 0.1 can be replaced by running the version
107
107
  Updates reject `--changed-since` and are skipped after incomplete analysis or an operational error,
108
108
  preventing a partial scan from erasing accepted findings.
109
109
 
110
+ ### Compare against a Git revision (next release)
111
+
112
+ Instead of committing a baseline file, compare with a revision that is already fetched locally:
113
+
114
+ ```sh
115
+ cuke-dedup . --baseline-from-ref origin/main --fail-on-new
116
+ ```
117
+
118
+ The corresponding Action inputs are:
119
+
120
+ ```yaml
121
+ with:
122
+ baseline-from-ref: ${{ github.event.pull_request.base.sha }}
123
+ fail-on-new: "0"
124
+ ```
125
+
126
+ This requires an Action/binary version containing this feature; v0.2.1 does not include it.
127
+ Use checkout with `fetch-depth: 0`, or explicitly fetch the desired revision before analysis.
128
+ The tool does not fetch revisions, initialize submodules, install dependencies, or run project code.
129
+
130
+ The base is scanned in a temporary independent Git checkout using the **current effective
131
+ CukeDedup configuration**, including rule overrides, patterns and suppressions. Historical
132
+ project module metadata and ignore files remain historical inputs. The same repository-relative
133
+ analysis directory must exist in both trees. Missing refs/directories, unsupported submodules,
134
+ base extraction errors, unresolved registrations, zero extraction from discovered sources,
135
+ definitions without a feature corpus, and truncated base comparisons fail with exit code `2`;
136
+ none become an empty accepted baseline. A genuinely empty historical suite is allowed.
137
+ Hooks and configured checkout filters are disabled, so Git LFS content is not hydrated.
138
+ The full repository snapshot is limited to 512 MiB of tracked content and 100,000 files;
139
+ larger repositories can use a committed baseline instead. Git submodules anywhere in that
140
+ snapshot are rejected because their content is not materialized.
141
+
142
+ Matching findings are suppressed using the existing semantic fingerprints and multiplicity
143
+ rules. Current modified/untracked files are analyzed normally. `--baseline-from-ref` conflicts
144
+ with `--baseline` and `--update-baseline`; it writes no baseline file or base reports and leaves
145
+ the current index, branch and worktree registration untouched. Temporary files are removed after
146
+ success or failure. This costs a second scan, not a changed-files-only optimization.
147
+
148
+ The new-finding allowance is an additional gate: it does not disable the duplication threshold
149
+ or independent error rules. Use `--fail-on-incomplete` if incomplete current analysis must also
150
+ fail instead of retaining the normal partial-report behavior.
151
+
110
152
  ## Exit codes
111
153
 
112
154
  | Code | Meaning |
package/docs/rules.md CHANGED
@@ -48,6 +48,8 @@ other pair rules and retains at most 10,000 findings. Reaching a limit marks ana
48
48
 
49
49
  Different effective matchers use the same non-trivial handler after parameter and local-variable
50
50
  normalization. Empty, pending, unresolved, and otherwise non-comparable handlers are excluded.
51
+ Exact handler matches also require equal behavior signatures. Handlers whose assertion arguments
52
+ reference unresolved external values are excluded from handler comparisons; matcher checks still run.
51
53
  Consider one parameterized definition, but retain separate definitions when shared implementation
52
54
  is intentional domain vocabulary.
53
55
 
@@ -57,8 +59,17 @@ Matcher wording is close and meaningful handlers share at least 50% ordered beha
57
59
  compatible structural or canonical-call evidence. Similar prose alone and unrelated actions do
58
60
  not qualify. Review the pair and consolidate only when both definitions express the same behavior.
59
61
 
60
- When handlers are not structurally equivalent, they must share a canonical call action, including
61
- direct and fluent forms such as `page.click()` and `page.locator(...).click()`.
62
+ When handlers are not structurally equivalent, they must share canonical action evidence: either
63
+ a call action, including direct and fluent forms such as `page.click()` and
64
+ `page.locator(...).click()`, or an assertion with the same matcher and subject shape. Expected
65
+ assertion values and polarity remain semantic during final similarity verification.
66
+ Decorated class methods must also have compatible runtime-affecting semantics: async versus sync,
67
+ static versus instance, generator, getter, and setter differences veto a near-duplicate match.
68
+ Call evidence includes inline callback bodies syntactically; deferred assertions are not treated as
69
+ directly executed assertions.
70
+ Deferred assertion sequences must match in value, polarity, and order for a near-duplicate finding.
71
+ Shared wrapper calls cannot compensate for different deferred assertions. This conservatively skips
72
+ fuzzy matches when one callback adds or reorders assertions; exact matcher checks still run.
62
73
 
63
74
  ### parameterization-candidate
64
75
 
@@ -67,6 +78,10 @@ texts are sufficiently similar. Findings remain pair-specific so reports retain
67
78
  literals and matcher text. Replace repeated literals with a parameter when it makes the test
68
79
  vocabulary clearer.
69
80
 
81
+ Expected assertion values and polarity are not erased for this rule. For example,
82
+ `expect(state).toBe('ready')` and `expect(state).toBe('idle')` express distinct expectations and
83
+ do not produce a parameterization suggestion solely because their expected literals differ.
84
+
70
85
  ### unused-definition
71
86
 
72
87
  No successfully parsed concrete feature step matches a definition. This rule is disabled when the
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cuke-dedup",
3
- "version": "0.2.0",
3
+ "version": "0.3.0",
4
4
  "description": "Static analysis for duplicate and reusable Cucumber step definitions",
5
5
  "type": "module",
6
6
  "bin": {
@@ -21,6 +21,7 @@
21
21
  "test": "node --test npm/test/*.test.mjs",
22
22
  "skills:check": "node scripts/check/check-agent-skills.mjs",
23
23
  "check:versions": "node scripts/check/check-release-version.mjs",
24
+ "bump:version": "node scripts/release/bump-version.mjs",
24
25
  "pack:check": "npm pack --dry-run",
25
26
  "corpus:check": "node scripts/check/check-corpus.mjs",
26
27
  "benchmark": "node scripts/benchmark/benchmark-analysis.mjs"
@@ -46,13 +47,13 @@
46
47
  "npm/platforms/*"
47
48
  ],
48
49
  "optionalDependencies": {
49
- "cuke-dedup-darwin-arm64": "0.2.0",
50
- "cuke-dedup-darwin-x64": "0.2.0",
51
- "cuke-dedup-linux-arm64-gnu": "0.2.0",
52
- "cuke-dedup-linux-arm64-musl": "0.2.0",
53
- "cuke-dedup-linux-x64-gnu": "0.2.0",
54
- "cuke-dedup-linux-x64-musl": "0.2.0",
55
- "cuke-dedup-windows-arm64-msvc": "0.2.0",
56
- "cuke-dedup-windows-x64-msvc": "0.2.0"
50
+ "cuke-dedup-darwin-arm64": "0.3.0",
51
+ "cuke-dedup-darwin-x64": "0.3.0",
52
+ "cuke-dedup-linux-arm64-gnu": "0.3.0",
53
+ "cuke-dedup-linux-arm64-musl": "0.3.0",
54
+ "cuke-dedup-linux-x64-gnu": "0.3.0",
55
+ "cuke-dedup-linux-x64-musl": "0.3.0",
56
+ "cuke-dedup-windows-arm64-msvc": "0.3.0",
57
+ "cuke-dedup-windows-x64-msvc": "0.3.0"
57
58
  }
58
59
  }