ast-merge-git 7.1.10 → 7.1.12

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: 0fd20591b0e3de1b3a8c6765f85cdedc5d3f19fea69e1be9d6490d50af756a54
4
- data.tar.gz: 92b8bbab49809926e97922d7092992ac1c54f1e82bd15f0af1b9e0a0f52d0aea
3
+ metadata.gz: 4523854d5bb3c19256845209060f29dd85579a7e56f590402dc7c24d7f5a7926
4
+ data.tar.gz: 7e53123a47e09df9f904a54caae63915af8225d44dbe01646d32850e5aff2b55
5
5
  SHA512:
6
- metadata.gz: 21e177752270944833a9a50e1fc3845614db43959949b7abdfc46ea3b6b7b840e8c4c1c8d46405d7b7d3299a9f309f8df29060ed133ab093bee5a81f3e324200
7
- data.tar.gz: 21caa075844f315ce7aa7f51a700328ac5f86cb6e03a3bbaa0a18a3e5c945910b4d7548c7253e49b82f93323eb82adc1902bce034a469380c455d3feba152210
6
+ metadata.gz: 0d6e7c302452e7d610b4fd7f000cc376cf0fc176d2805777c9b459d6c38d00814df8abe7e6cb48f614b7f138491c618bf05a738466d72512e018f869638aeb8e
7
+ data.tar.gz: b581d05bb7d63e9cd2899207dc3a5d4119e4e9a89fc9491c08b86d81fb1b1e45b506afbda1213c171cad9cfcd10c1cffafbbc6f1d305058a21bc8b06af498a85
checksums.yaml.gz.sig CHANGED
Binary file
@@ -0,0 +1,114 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'json'
4
+
5
+ module Ast
6
+ module Merge
7
+ module Git
8
+ # Verifies the paired-drivers micro benchmark invariants outside the spec
9
+ # suite. Runs the real benchmark machinery (installed driver, real merge
10
+ # cases), so it is only invoked by the explicit `benchmark:micro` rake
11
+ # task — never by RSpec. See rakelib/benchmark_micro.rake.
12
+ class MicroBenchmarkCheck
13
+ # ok: true when every invariant held; checks: name => true/String(failure detail)
14
+ Result = Struct.new(:ok, :checks, keyword_init: true)
15
+
16
+ CONFLICT_CASE = 'case.merge3.json.independent-fields.v1'
17
+ OWNER_CONFLICT_CASE = 'case.merge3.json.same-owner-conflict.v1'
18
+ MALFORMED_CASE = 'case.merge3.json.malformed-ours.v1'
19
+
20
+ # @param runner [#run] an Ast::Merge::Git::LocalBenchmarkRunner
21
+ # @param options [Hash] reserved for forward compatibility
22
+ def initialize(runner, **options)
23
+ @runner = runner
24
+ @options = options
25
+ end
26
+
27
+ # Builds a runner from explicit paths and verifies the invariants.
28
+ #
29
+ # @param corpus_path [String, Pathname] benchmark corpus JSON
30
+ # @param driver_path [String, Pathname] installed ast-merge-git driver
31
+ # @param tmp_root [String, Pathname] scratch directory for runs
32
+ # @param options [Hash] reserved for forward compatibility
33
+ def self.call(corpus_path:, driver_path:, tmp_root:, **options)
34
+ runner = LocalBenchmarkRunner.new(
35
+ benchmark: LocalBenchmark.load(corpus_path),
36
+ driver_path: driver_path,
37
+ tmp_root: tmp_root
38
+ )
39
+ new(runner, **options).verify
40
+ end
41
+
42
+ # Runs the micro profile (twice, for cache-identity stability) and
43
+ # checks the safety invariants. Never raises for a failed invariant —
44
+ # failures are reported through the returned Result.
45
+ #
46
+ # @return [Result]
47
+ def verify
48
+ cwd_before = Dir.pwd
49
+ runs = Array.new(2) { @runner.run(profile: 'micro') }
50
+ checks = invariant_checks(runs, cwd_before)
51
+ Result.new(ok: checks.values.all?(true), checks: checks)
52
+ rescue LocalBenchmark::Error => e
53
+ Result.new(ok: false, checks: { 'benchmark run' => e.message })
54
+ end
55
+
56
+ private
57
+
58
+ def invariant_checks(runs, cwd_before)
59
+ {
60
+ 'git text conflict becomes a structurally verified clean candidate' =>
61
+ conflict_check(runs.first),
62
+ 'intentional-conflict safety and malformed-input rejection preserved' =>
63
+ safety_check(runs.first),
64
+ 'cwd preserved, JSON-serializable, stable cache identity' =>
65
+ stability_check(runs, cwd_before)
66
+ }
67
+ end
68
+
69
+ def conflict_check(run)
70
+ results = results_for(run, CONFLICT_CASE)
71
+ last = results.last
72
+ outcomes(results) == %w[false_conflict correct_clean] &&
73
+ last.dig('checks', 'parse_validity_only_accepted') == false &&
74
+ last.dig('checks', 'acceptable') == true &&
75
+ last.fetch('deterministic_correctness_rerun') == true
76
+ rescue StandardError
77
+ false
78
+ end
79
+
80
+ def safety_check(run)
81
+ conflict = results_for(run, OWNER_CONFLICT_CASE)
82
+ malformed = results_for(run, MALFORMED_CASE).last
83
+ outcomes(conflict) == %w[true_conflict true_conflict] &&
84
+ malformed['outcome'] == 'correct_clean' &&
85
+ messages_of(malformed).include?('ours parse error')
86
+ rescue StandardError
87
+ false
88
+ end
89
+
90
+ def stability_check(runs, cwd_before)
91
+ first = runs.first
92
+ last = runs.last
93
+ Dir.pwd == cwd_before &&
94
+ first.dig('cache_identity', 'sha256') == last.dig('cache_identity', 'sha256') &&
95
+ !JSON.generate(first).nil?
96
+ rescue StandardError
97
+ false
98
+ end
99
+
100
+ def results_for(run, case_id)
101
+ run.fetch('results').select { |item| item['case_id'] == case_id }
102
+ end
103
+
104
+ def outcomes(records)
105
+ records.map { |item| item['outcome'] }
106
+ end
107
+
108
+ def messages_of(record)
109
+ record.fetch('diagnostics').map { |item| item['message'] }.join
110
+ end
111
+ end
112
+ end
113
+ end
114
+ end
@@ -6,7 +6,7 @@ module Ast
6
6
  # Version namespace for this gem.
7
7
  module Version
8
8
  # Current gem version.
9
- VERSION = '7.1.10'
9
+ VERSION = '7.1.12'
10
10
  end
11
11
  # Current gem version exposed at the traditional constant location.
12
12
  VERSION = Version::VERSION # Traditional Constant Location
data/lib/ast/merge/git.rb CHANGED
@@ -13,6 +13,8 @@ module Ast
13
13
  module Git
14
14
  PACKAGE_NAME = 'ast-merge-git'
15
15
  autoload :RustHostProvider, 'ast/merge/git/rust_host_provider'
16
+ # Dev-only benchmark verification; loaded by the benchmark:micro rake task.
17
+ autoload :MicroBenchmarkCheck, 'ast/merge/git/micro_benchmark_check'
16
18
  EXIT_SUCCESS = 0
17
19
  EXIT_CONFLICT = 1
18
20
  EXIT_ERROR = 2
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ast-merge-git
3
3
  version: !ruby/object:Gem::Version
4
- version: 7.1.10
4
+ version: 7.1.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - Peter H. Boling
@@ -43,28 +43,28 @@ dependencies:
43
43
  requirements:
44
44
  - - '='
45
45
  - !ruby/object:Gem::Version
46
- version: 7.1.10
46
+ version: 7.1.12
47
47
  type: :runtime
48
48
  prerelease: false
49
49
  version_requirements: !ruby/object:Gem::Requirement
50
50
  requirements:
51
51
  - - '='
52
52
  - !ruby/object:Gem::Version
53
- version: 7.1.10
53
+ version: 7.1.12
54
54
  - !ruby/object:Gem::Dependency
55
55
  name: tree_haver
56
56
  requirement: !ruby/object:Gem::Requirement
57
57
  requirements:
58
58
  - - '='
59
59
  - !ruby/object:Gem::Version
60
- version: 7.1.10
60
+ version: 7.1.12
61
61
  type: :runtime
62
62
  prerelease: false
63
63
  version_requirements: !ruby/object:Gem::Requirement
64
64
  requirements:
65
65
  - - '='
66
66
  - !ruby/object:Gem::Version
67
- version: 7.1.10
67
+ version: 7.1.12
68
68
  - !ruby/object:Gem::Dependency
69
69
  name: version_gem
70
70
  requirement: !ruby/object:Gem::Requirement
@@ -303,6 +303,7 @@ files:
303
303
  - lib/ast/merge/git/benchmark_adapter.rb
304
304
  - lib/ast/merge/git/corpus.rb
305
305
  - lib/ast/merge/git/local_benchmark.rb
306
+ - lib/ast/merge/git/micro_benchmark_check.rb
306
307
  - lib/ast/merge/git/rust_host_provider.rb
307
308
  - lib/ast/merge/git/version.rb
308
309
  - sig/ast/merge/git.rbs
@@ -312,10 +313,10 @@ licenses:
312
313
  - PolyForm-Small-Business-1.0.0
313
314
  metadata:
314
315
  homepage_uri: https://structuredmerge.org
315
- source_code_uri: https://github.com/structuredmerge/structuredmerge-ruby/tree/v7.1.10
316
- changelog_uri: https://github.com/structuredmerge/structuredmerge-ruby/blob/v7.1.10/CHANGELOG.md
316
+ source_code_uri: https://github.com/structuredmerge/structuredmerge-ruby/tree/v7.1.12
317
+ changelog_uri: https://github.com/structuredmerge/structuredmerge-ruby/blob/v7.1.12/CHANGELOG.md
317
318
  bug_tracker_uri: https://github.com/structuredmerge/structuredmerge-ruby/issues
318
- documentation_uri: https://www.rubydoc.info/gems/ast-merge-git/7.1.10
319
+ documentation_uri: https://www.rubydoc.info/gems/ast-merge-git/7.1.12
319
320
  funding_uri: https://github.com/sponsors/pboling
320
321
  wiki_uri: https://github.com/structuredmerge/structuredmerge-ruby/wiki
321
322
  news_uri: https://www.railsbling.com/tags/ast-merge-git
metadata.gz.sig CHANGED
Binary file