ast-merge 7.1.12 → 7.1.13

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: 80e7140a0ddb8ec0ae54489cf6d1ad56abc6dd87551771cddfa5a4d97bdf9d8c
4
- data.tar.gz: e33e8171e7ed4f6ab0b4062dccf7c07f129efaade059aeb4f01e573ba68eb9ee
3
+ metadata.gz: 730351f791a5f7cf56679808a4b0ebe6b26f620830a88964a691bde22099848b
4
+ data.tar.gz: 5e32963fc0858d8bb08f227ae183345809e8d0a23761c0dcc0fc05139a29848c
5
5
  SHA512:
6
- metadata.gz: 8deac7120ad5ec98d8fdcdce26cabf1ed0e3724d3444c826e81f993f48d3a8d39bb1ebf853355893fd1d9bd95deb17d845e21d482730568a6eab3bdf3e22f3c9
7
- data.tar.gz: c0dd9d6f40c2f4b3028afc2655429b11a5818ef9333a658a7455ce3385c5b56c73fd7dd1eeb5d096c4ad82289468da9f487844a656f1cdf0ab8c6aae7d537650
6
+ metadata.gz: 02bec556f4be16e68a8e8eafc1878b6099c108f6361bf66ac22b422ec887e5625f5ea115d4e1ec138ebe0422335c9bf00825eda1beb0a971e348ca76f3241024
7
+ data.tar.gz: a33a3f63afba70a9324847dd4d01e966f4a063144c12cf9de1e7532dea717d86356b29fa6635169ab10ad14e0f218f09a5d916f98610c159dc8bb616c8f5a8cd
checksums.yaml.gz.sig CHANGED
Binary file
@@ -2,6 +2,17 @@
2
2
 
3
3
  # rubocop:disable Metrics/BlockLength -- complete executable provider contract is intentionally shared
4
4
  RSpec.shared_examples 'Ast::Merge::ProviderConformance' do
5
+ def skip_for_tslp_backend
6
+ return unless %w[tslp kreuzberg-language-pack].include?(provider_conformance.fetch(:backend).to_s)
7
+
8
+ skip_for(
9
+ engine: 'ruby',
10
+ versions: 'head',
11
+ reason: 'Ruby head is permanently unsupported by ' \
12
+ "tree_sitter_language_pack's released-ABI-only native gem policy"
13
+ )
14
+ end
15
+
5
16
  let(:provider_capabilities) { provider.capabilities }
6
17
  let(:provider_selectors) do
7
18
  {
@@ -31,6 +42,7 @@ RSpec.shared_examples 'Ast::Merge::ProviderConformance' do
31
42
  end
32
43
 
33
44
  it 'executes every advertised operation with its required source roles' do
45
+ skip_for_tslp_backend
34
46
  provider_conformance.fetch(:requests).each do |operation, request|
35
47
  result = Ast::Merge.dispatch_provider(operation, provider_selectors.merge(request))
36
48
 
@@ -53,6 +65,7 @@ RSpec.shared_examples 'Ast::Merge::ProviderConformance' do
53
65
  end
54
66
 
55
67
  it 'reports a source-role parse diagnostic' do
68
+ skip_for_tslp_backend if provider_conformance[:invalid_merge3]
56
69
  if provider_conformance[:invalid_merge3]
57
70
  invalid = provider_conformance.fetch(:invalid_merge3)
58
71
  result = Ast::Merge.dispatch_provider(:merge3, provider_selectors.merge(invalid))
@@ -65,6 +78,7 @@ RSpec.shared_examples 'Ast::Merge::ProviderConformance' do
65
78
  end
66
79
 
67
80
  it 'uses the base in an adversarial merge3 that merge2 substitution gets wrong' do
81
+ skip_for_tslp_backend
68
82
  adversarial = provider_conformance.fetch(:base_adversarial_merge3)
69
83
  proof = Ast::Merge::RSpec::ProviderConformance.new(
70
84
  provider: provider,
@@ -80,6 +94,7 @@ RSpec.shared_examples 'Ast::Merge::ProviderConformance' do
80
94
  end
81
95
 
82
96
  it 'reports source preservation, synthesis, reparsing, and semantic verification' do
97
+ skip_for_tslp_backend if provider_conformance[:synthesized_merge3]
83
98
  if provider_conformance[:synthesized_merge3]
84
99
  synthesis = provider_conformance.fetch(:synthesized_merge3)
85
100
  result = Ast::Merge.dispatch_provider(:merge3, provider_selectors.merge(synthesis.fetch(:request)))
@@ -5,7 +5,7 @@ module Ast
5
5
  # Version namespace for this gem.
6
6
  module Version
7
7
  # Current gem version.
8
- VERSION = '7.1.12'
8
+ VERSION = '7.1.13'
9
9
  end
10
10
  # Current gem version exposed at the traditional constant location.
11
11
  VERSION = Version::VERSION # Traditional Constant Location
data/lib/ast/merge.rb CHANGED
@@ -15,7 +15,44 @@ module Ast
15
15
  MERGE_ENGINE_ENVIRONMENT_VARIABLE = 'SMORG_MERGE_ENGINE'
16
16
  TEMPLATE_TOKEN_CONFIG = Token::Resolver::Config.new(separators: ['|', ':']).freeze
17
17
 
18
- class Error < StandardError; end
18
+ # Base exception contract for concise user output and complete diagnostics.
19
+ # Ruby's exception cause chain remains the source of truth for wrapped failures.
20
+ class Error < StandardError
21
+ attr_reader :summary, :context
22
+
23
+ def initialize(message = nil, summary: nil, context: {})
24
+ super(summary || message)
25
+ @summary = (summary || message || self.class.name).to_s
26
+ @context = context.to_h.freeze
27
+ end
28
+
29
+ # Raise this error class while preserving the original exception as Ruby's cause.
30
+ def self.raise_with_cause(summary, cause:, context: {})
31
+ raise new(summary, context: context), cause: cause
32
+ end
33
+
34
+ # Structured exception and cause data for logs or verbose output.
35
+ def diagnostic_chain
36
+ exception = self
37
+ chain = []
38
+ while exception
39
+ chain << {
40
+ class: exception.class.name,
41
+ message: exception.message,
42
+ backtrace: exception.backtrace || []
43
+ }.freeze
44
+ exception = exception.cause
45
+ end
46
+ chain.freeze
47
+ end
48
+
49
+ def render_diagnostic
50
+ diagnostic_chain.map do |entry|
51
+ lines = entry[:backtrace]
52
+ ["#{entry[:class]}: #{entry[:message]}", *lines.map { |line| " from #{line}" }].join("\n")
53
+ end.join("\nCaused by: ")
54
+ end
55
+ end
19
56
 
20
57
  class ParseError < Error
21
58
  attr_reader :errors, :content
data/sig/ast/merge.rbs CHANGED
@@ -16,6 +16,13 @@ module Ast
16
16
  end
17
17
 
18
18
  class Error < StandardError
19
+ attr_reader summary: String
20
+ attr_reader context: Hash[Symbol, untyped]
21
+
22
+ def initialize: (?String message, ?summary: String?, ?context: Hash[Symbol, untyped]) -> void
23
+ def self.raise_with_cause: (String summary, cause: Exception, ?context: Hash[Symbol, untyped]) -> bot
24
+ def diagnostic_chain: () -> Array[Hash[Symbol, untyped]]
25
+ def render_diagnostic: () -> String
19
26
  end
20
27
 
21
28
  module PortableBenchmarkContract
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ast-merge
3
3
  version: !ruby/object:Gem::Version
4
- version: 7.1.12
4
+ version: 7.1.13
5
5
  platform: ruby
6
6
  authors:
7
7
  - Peter H. Boling
@@ -77,14 +77,14 @@ dependencies:
77
77
  requirements:
78
78
  - - '='
79
79
  - !ruby/object:Gem::Version
80
- version: 7.1.12
80
+ version: 7.1.13
81
81
  type: :runtime
82
82
  prerelease: false
83
83
  version_requirements: !ruby/object:Gem::Requirement
84
84
  requirements:
85
85
  - - '='
86
86
  - !ruby/object:Gem::Version
87
- version: 7.1.12
87
+ version: 7.1.13
88
88
  - !ruby/object:Gem::Dependency
89
89
  name: version_gem
90
90
  requirement: !ruby/object:Gem::Requirement
@@ -500,10 +500,10 @@ licenses:
500
500
  - PolyForm-Small-Business-1.0.0
501
501
  metadata:
502
502
  homepage_uri: https://structuredmerge.org
503
- source_code_uri: https://github.com/structuredmerge/structuredmerge-ruby/tree/v7.1.12
504
- changelog_uri: https://github.com/structuredmerge/structuredmerge-ruby/blob/v7.1.12/CHANGELOG.md
503
+ source_code_uri: https://github.com/structuredmerge/structuredmerge-ruby/tree/v7.1.13
504
+ changelog_uri: https://github.com/structuredmerge/structuredmerge-ruby/blob/v7.1.13/CHANGELOG.md
505
505
  bug_tracker_uri: https://github.com/structuredmerge/structuredmerge-ruby/issues
506
- documentation_uri: https://www.rubydoc.info/gems/ast-merge/7.1.12
506
+ documentation_uri: https://www.rubydoc.info/gems/ast-merge/7.1.13
507
507
  funding_uri: https://github.com/sponsors/pboling
508
508
  wiki_uri: https://github.com/structuredmerge/structuredmerge-ruby/wiki
509
509
  news_uri: https://www.railsbling.com/tags/ast-merge
metadata.gz.sig CHANGED
Binary file