haveapi 0.32.0 → 0.32.2
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 +4 -4
- data/.gitignore +3 -8
- data/README.md +3 -422
- data/Rakefile +17 -7
- data/benchmarks/performance_compare.rb +27 -6
- data/doc/cs/client-examples.md +535 -0
- data/doc/cs/create-client.md +118 -0
- data/doc/cs/json-schema.html +1182 -0
- data/doc/cs/protocol.md +595 -0
- data/doc/cs/readme.md +432 -0
- data/doc/cs/typed-input-validation.md +122 -0
- data/doc/{client-examples.md → en/client-examples.md} +20 -10
- data/doc/{documentation-oauth.md → en/documentation-oauth.md} +40 -9
- data/doc/{documentation-ui.md → en/documentation-ui.md} +42 -6
- data/doc/{performance.md → en/performance.md} +20 -2
- data/doc/{protocol.md → en/protocol.md} +2 -2
- data/doc/en/readme.md +423 -0
- data/haveapi.gemspec +2 -2
- data/lib/haveapi/client_example.rb +18 -5
- data/lib/haveapi/client_examples/curl.rb +5 -5
- data/lib/haveapi/client_examples/dynamic_helpers.rb +10 -10
- data/lib/haveapi/client_examples/go_client.rb +1 -1
- data/lib/haveapi/client_examples/http.rb +4 -4
- data/lib/haveapi/client_examples/js_client.rb +10 -10
- data/lib/haveapi/client_examples/php_client.rb +24 -25
- data/lib/haveapi/client_examples/python_client.rb +11 -11
- data/lib/haveapi/client_examples/ruby_cli.rb +6 -9
- data/lib/haveapi/client_examples/ruby_client.rb +24 -16
- data/lib/haveapi/client_examples/rust_client.rb +1 -1
- data/lib/haveapi/client_examples/ts_generated_client.rb +1 -1
- data/lib/haveapi/documentation_context.rb +14 -2
- data/lib/haveapi/documentation_helpers.rb +92 -15
- data/lib/haveapi/documentation_locale.rb +65 -0
- data/lib/haveapi/documentation_oauth.rb +26 -14
- data/lib/haveapi/documentation_search.rb +5 -5
- data/lib/haveapi/documentation_validators.rb +43 -33
- data/lib/haveapi/locales/cs.yml +468 -0
- data/lib/haveapi/locales/en.yml +467 -0
- data/lib/haveapi/public/css/documentation.css +8 -4
- data/lib/haveapi/public/js/documentation.js +73 -20
- data/lib/haveapi/server.rb +32 -47
- data/lib/haveapi/shared_documentation_helpers.rb +53 -5
- data/lib/haveapi/version.rb +1 -1
- data/lib/haveapi/views/doc_layout.erb +3 -2
- data/lib/haveapi/views/doc_sidebars/create-client.erb +10 -10
- data/lib/haveapi/views/doc_sidebars/json-schema.erb +2 -2
- data/lib/haveapi/views/doc_sidebars/protocol.erb +24 -24
- data/lib/haveapi/views/documentation/search_form.erb +5 -4
- data/lib/haveapi/views/documentation/search_results.erb +6 -6
- data/lib/haveapi/views/index.erb +3 -3
- data/lib/haveapi/views/main_layout.erb +4 -4
- data/lib/haveapi/views/shared_documentation.erb +8 -5
- data/lib/haveapi/views/shared_sidebar.erb +11 -11
- data/lib/haveapi/views/version_page/auth_body.erb +7 -7
- data/lib/haveapi/views/version_page/client_auth.erb +1 -1
- data/lib/haveapi/views/version_page/client_example.erb +1 -1
- data/lib/haveapi/views/version_page/client_init.erb +1 -1
- data/lib/haveapi/views/version_page/client_overview.erb +7 -5
- data/lib/haveapi/views/version_page/example_panels.erb +5 -2
- data/lib/haveapi/views/version_page/resource_body.erb +24 -24
- data/lib/haveapi/views/version_page/resource_directory.erb +2 -2
- data/lib/haveapi/views/version_page/usage.erb +5 -5
- data/lib/haveapi/views/version_page.erb +11 -11
- data/lib/haveapi/views/version_sidebar/auth_nav.erb +2 -2
- data/lib/haveapi/views/version_sidebar/authentication_control.erb +8 -8
- data/lib/haveapi/views/version_sidebar/authentication_status.erb +1 -1
- data/lib/haveapi/views/version_sidebar/brand.erb +16 -5
- data/lib/haveapi/views/version_sidebar.erb +33 -18
- data/spec/client_examples/assets/documentation_test.cjs +107 -9
- data/spec/client_examples/comment_capture.rb +72 -0
- data/spec/client_examples/comments_spec.rb +162 -0
- data/spec/client_examples/context_spec.rb +18 -2
- data/spec/client_examples/detail_spec.rb +68 -0
- data/spec/documentation/client_overview_spec.rb +60 -0
- data/spec/documentation/example_selection_spec.rb +192 -0
- data/spec/documentation/language_settings_spec.rb +132 -0
- data/spec/documentation/locale_spec.rb +367 -0
- data/spec/documentation/navigation_spec.rb +61 -3
- data/spec/documentation/oauth_spec.rb +194 -6
- data/spec/documentation/search_index_routes_spec.rb +8 -4
- data/spec/documentation/search_spec.rb +1 -1
- data/spec/documentation/shared_pages_spec.rb +63 -2
- data/spec/documentation/validators_spec.rb +25 -0
- data/spec/extensions/exception_mailer_spec.rb +2 -2
- data/spec/packaging_spec.rb +68 -9
- data/spec/performance/event_baseline_spec.rb +98 -3
- data/spec/performance/source_versions_spec.rb +111 -2
- metadata +24 -11
- /data/doc/{create-client.md → en/create-client.md} +0 -0
- /data/doc/{json-schema.html → en/json-schema.html} +0 -0
- /data/doc/{typed-input-validation.md → en/typed-input-validation.md} +0 -0
|
@@ -81,6 +81,22 @@ RSpec.describe HaveAPI::PerformanceCI do
|
|
|
81
81
|
expect(result[:push_pair]).to be_nil
|
|
82
82
|
expect(repository).to have_received(:paths).with(base, candidate)
|
|
83
83
|
end
|
|
84
|
+
|
|
85
|
+
it "selects no work for an equal new-branch merge-base with created=#{created}" do
|
|
86
|
+
event.merge!('ref' => 'refs/heads/feature', 'after' => candidate,
|
|
87
|
+
'before' => '0' * 40, 'created' => created)
|
|
88
|
+
allow(repository).to receive(:merge_base).with(candidate, default).and_return(candidate)
|
|
89
|
+
allow(repository).to receive(:paths).with(candidate, candidate).and_return([])
|
|
90
|
+
|
|
91
|
+
expect(resolve('push', event)).to include(schema_version: 1, event_name: 'push', profile: 'quick',
|
|
92
|
+
baseline_sha: candidate, candidate_sha: candidate, captured_default_sha: default,
|
|
93
|
+
relevant: false, changed_paths: [], push_pair: nil,
|
|
94
|
+
reason: /candidate already contained in captured default, no source changes/)
|
|
95
|
+
expect(repository).to have_received(:commit!).with(default)
|
|
96
|
+
expect(repository).to have_received(:commit!).with(candidate)
|
|
97
|
+
expect(repository).to have_received(:release_lineage).with(candidate).at_least(:once)
|
|
98
|
+
expect(repository).to have_received(:ancestor?).with(candidate, candidate)
|
|
99
|
+
end
|
|
84
100
|
end
|
|
85
101
|
|
|
86
102
|
it 'does not guess a fallback when the captured default commit is unavailable' do
|
|
@@ -89,10 +105,58 @@ RSpec.describe HaveAPI::PerformanceCI do
|
|
|
89
105
|
expect { resolve('push', event, default_sha: default) }.to raise_error(described_class::Error, /unavailable default/)
|
|
90
106
|
end
|
|
91
107
|
|
|
92
|
-
it '
|
|
93
|
-
|
|
108
|
+
it 'resolves default and ancestral branch creation without work using real Git history' do
|
|
109
|
+
Dir.mktmpdir('haveapi-new-branch-history-') do |directory|
|
|
110
|
+
git = lambda do |*arguments, input: ''|
|
|
111
|
+
env = { 'GIT_AUTHOR_NAME' => 'Fixture', 'GIT_AUTHOR_EMAIL' => 'fixture@example.test',
|
|
112
|
+
'GIT_COMMITTER_NAME' => 'Fixture', 'GIT_COMMITTER_EMAIL' => 'fixture@example.test' }
|
|
113
|
+
output, error, status = Open3.capture3(env, 'git', '-C', directory, *arguments, stdin_data: input)
|
|
114
|
+
raise error unless status.success?
|
|
115
|
+
|
|
116
|
+
output.strip
|
|
117
|
+
end
|
|
118
|
+
git.call('init', '--quiet', '--initial-branch=master')
|
|
119
|
+
commit = lambda do |body, parent = nil|
|
|
120
|
+
blob = git.call('hash-object', '-w', '--stdin', input: body)
|
|
121
|
+
tree = git.call('mktree', input: "100644 blob #{blob}\tGemfile\n")
|
|
122
|
+
git.call('commit-tree', tree, *[('-p' if parent), parent].compact, input: "fixture\n")
|
|
123
|
+
end
|
|
124
|
+
older = commit.call('older')
|
|
125
|
+
captured = commit.call('default', older)
|
|
126
|
+
changed = commit.call('changed', captured)
|
|
127
|
+
git.call('update-ref', 'refs/remotes/origin/master', captured)
|
|
128
|
+
stub_const('HaveAPI::Performance::REFERENCE', older)
|
|
129
|
+
real_resolver = described_class::Resolver.new(described_class::Repository.new(directory))
|
|
130
|
+
event.merge!('ref' => 'refs/heads/haveapi-0.32', 'before' => '0' * 40, 'created' => true)
|
|
131
|
+
|
|
132
|
+
[captured, older, changed].each do |head|
|
|
133
|
+
result = real_resolver.resolve(event_name: 'push', event: event.merge('after' => head), event_sha: head)
|
|
134
|
+
expect(result).to include(candidate_sha: head, captured_default_sha: captured, release_lineage: nil, push_pair: nil,
|
|
135
|
+
baseline_sha: head == changed ? captured : head,
|
|
136
|
+
relevant: head == changed, changed_paths: head == changed ? ['Gemfile'] : [])
|
|
137
|
+
end
|
|
138
|
+
end
|
|
139
|
+
end
|
|
140
|
+
|
|
141
|
+
it 'retains lineage and ancestry rejection for an equal new-branch merge-base' do
|
|
142
|
+
event.merge!('ref' => 'refs/heads/haveapi-0.30', 'after' => candidate, 'before' => '0' * 40)
|
|
143
|
+
allow(repository).to receive(:merge_base).with(candidate, default).and_return(candidate)
|
|
144
|
+
expect { resolve('push', event) }.to raise_error(described_class::Error, /Unproven/)
|
|
145
|
+
event['ref'] = 'refs/heads/feature'
|
|
146
|
+
allow(repository).to receive(:ancestor?).with(candidate, candidate).and_return(false)
|
|
147
|
+
expect { resolve('push', event) }.to raise_error(described_class::Error, /ancestor/)
|
|
148
|
+
end
|
|
149
|
+
|
|
150
|
+
it 'rejects equal endpoints for PRs and fixed-reference profiles' do
|
|
151
|
+
event['pull_request'] = { 'head' => { 'sha' => candidate }, 'base' => { 'sha' => default } }
|
|
94
152
|
allow(repository).to receive(:merge_base).with(candidate, default).and_return(candidate)
|
|
153
|
+
expect { resolve('pull_request', event) }.to raise_error(described_class::Error, /differ/)
|
|
154
|
+
event.merge!('ref' => 'refs/heads/feature', 'after' => described_class::REFERENCE, 'before' => '0' * 40,
|
|
155
|
+
'inputs' => { 'profile' => 'weekly' })
|
|
156
|
+
allow(repository).to receive(:merge_base).with(described_class::REFERENCE, default).and_return(described_class::REFERENCE)
|
|
95
157
|
expect { resolve('push', event) }.to raise_error(described_class::Error, /differ/)
|
|
158
|
+
expect { resolver.resolve(event_name: 'schedule', event:, event_sha: described_class::REFERENCE) }
|
|
159
|
+
.to raise_error(described_class::Error, /differ/)
|
|
96
160
|
end
|
|
97
161
|
|
|
98
162
|
it 'does not replace an unavailable new-branch merge-base with another commit' do
|
|
@@ -280,7 +344,7 @@ RSpec.describe HaveAPI::PerformanceCI do
|
|
|
280
344
|
%w[flake.lock Gemfile Makefile .ruby-version servers/ruby/benchmarks/endpoints.rb
|
|
281
345
|
servers/ruby/benchmarks/Gemfile servers/ruby/benchmarks/Gemfile.lock servers/ruby/benchmarks/shell.nix
|
|
282
346
|
servers/ruby/test_support/performance_sqlite_fixture.rb clients/ruby/Gemfile clients/rust/Gemfile
|
|
283
|
-
doc/performance.md utils/performance_ci.rb .github/workflows/servers-ruby-performance.yml
|
|
347
|
+
doc/en/performance.md utils/performance_ci.rb .github/workflows/servers-ruby-performance.yml
|
|
284
348
|
servers/ruby/benchmarks/spec/client_examples_spec.rb servers/ruby/test_support/all_client_performance_fixture.rb
|
|
285
349
|
clients/go/lib/haveapi/go_client/documentation.rb clients/typescript/lib/haveapi/typescript_client/documentation.rb
|
|
286
350
|
clients/js/src/client.ts clients/python/haveapi/client.py clients/php/src/Client.php clients/new-client/renderer.rb].each do |path|
|
|
@@ -323,6 +387,37 @@ RSpec.describe HaveAPI::PerformanceCI do
|
|
|
323
387
|
end
|
|
324
388
|
end
|
|
325
389
|
|
|
390
|
+
it 'records no-work without requiring benchmark artifacts or the client contract' do
|
|
391
|
+
path = File.expand_path('../../../../.github/workflows/servers-ruby-performance.yml', __dir__)
|
|
392
|
+
steps = YAML.load_file(path).fetch('jobs').fetch('performance').fetch('steps')
|
|
393
|
+
comparison = steps.find { |step| step['name'] == 'Run the selected pair outside Bundler' }
|
|
394
|
+
expect(comparison.fetch('if')).to eq("steps.resolve.outputs.relevant == 'true'")
|
|
395
|
+
completion = steps.find { |step| step['id'] == 'completion' }
|
|
396
|
+
Dir.mktmpdir('haveapi-no-work-gate-') do |directory|
|
|
397
|
+
File.write(File.join(directory, 'selection.json'), JSON.generate(relevant: false))
|
|
398
|
+
output = File.join(directory, 'output')
|
|
399
|
+
environment = { 'RELEVANT' => 'false', 'CLIENT_CONTRACT' => '',
|
|
400
|
+
'PERFORMANCE_EVIDENCE' => directory, 'GITHUB_OUTPUT' => output }
|
|
401
|
+
_output, _error, status = Open3.capture3(environment, 'bash', '-euo', 'pipefail', '-c', completion.fetch('run'))
|
|
402
|
+
expect(status.success?).to be(true)
|
|
403
|
+
expect(File.read(output)).to eq("outcome=no-work\n")
|
|
404
|
+
File.unlink(File.join(directory, 'selection.json'))
|
|
405
|
+
_output, _error, status = Open3.capture3(environment, 'bash', '-euo', 'pipefail', '-c', completion.fetch('run'))
|
|
406
|
+
expect(status.success?).to be(false)
|
|
407
|
+
end
|
|
408
|
+
end
|
|
409
|
+
|
|
410
|
+
it 'keeps equal endpoints out of the campaign even if marked relevant' do
|
|
411
|
+
Dir.mktmpdir('haveapi-no-work-campaign-') do |directory|
|
|
412
|
+
selection = { 'schema_version' => 1, 'relevant' => true, 'profile' => 'quick', 'event_name' => 'push',
|
|
413
|
+
'candidate_sha' => candidate, 'baseline_sha' => candidate, 'push_pair' => nil }
|
|
414
|
+
campaign = described_class::Campaign.new(repository:, selection:,
|
|
415
|
+
evidence: File.join(directory, 'evidence'), sources: File.join(directory, 'sources'))
|
|
416
|
+
expect { campaign.run }.to raise_error(described_class::Error, /ancestry/)
|
|
417
|
+
expect(File).not_to exist(File.join(directory, 'sources'))
|
|
418
|
+
end
|
|
419
|
+
end
|
|
420
|
+
|
|
326
421
|
it 'fails aggregate shell execution for missing outcomes and cancelled or skipped work' do
|
|
327
422
|
path = File.expand_path('../../../../.github/workflows/servers-ruby-performance.yml', __dir__)
|
|
328
423
|
script = YAML.load_file(path).fetch('jobs').fetch('gate').fetch('steps').first.fetch('run')
|
|
@@ -10,6 +10,8 @@ require_relative 'support/samples'
|
|
|
10
10
|
describe HaveAPI::PerformanceCI::Campaign do
|
|
11
11
|
let(:root) { File.expand_path('../../../..', __dir__) }
|
|
12
12
|
let(:error) { HaveAPI::Performance::ContractError }
|
|
13
|
+
let(:shallow_files) { " s.files = `git ls-files -z`.split(\"\\x0\") + Dir.glob('doc/*')\n" }
|
|
14
|
+
let(:recursive_files) { " s.files = `git ls-files -z`.split(\"\\x0\") + Dir.glob('doc/**/*').select { |path| File.file?(path) }\n" }
|
|
13
15
|
|
|
14
16
|
before do
|
|
15
17
|
# These metadata fixtures evaluate real gemspecs without loading the optional
|
|
@@ -44,6 +46,12 @@ describe HaveAPI::PerformanceCI::Campaign do
|
|
|
44
46
|
end
|
|
45
47
|
end
|
|
46
48
|
|
|
49
|
+
def with_files(contents, statement)
|
|
50
|
+
path = 'servers/ruby/haveapi.gemspec'
|
|
51
|
+
previous = contents.fetch(path).lines.find { |line| line.start_with?(' s.files ') }
|
|
52
|
+
contents.merge(path => contents.fetch(path).sub(previous, statement))
|
|
53
|
+
end
|
|
54
|
+
|
|
47
55
|
def prepare(baseline, candidate)
|
|
48
56
|
Dir.mktmpdir('haveapi-own-versions-') do |directory|
|
|
49
57
|
roots = { baseline: File.join(directory, 'baseline'), candidate: File.join(directory, 'candidate') }
|
|
@@ -82,11 +90,12 @@ describe HaveAPI::PerformanceCI::Campaign do
|
|
|
82
90
|
end
|
|
83
91
|
end
|
|
84
92
|
|
|
85
|
-
def replay_samples(baseline = '0.31.0')
|
|
93
|
+
def replay_samples(baseline = '0.31.0', selections: {}, normalize_files: true)
|
|
86
94
|
samples, budgets = PerformanceSamples.fixture
|
|
87
95
|
samples.fetch('sources').each do |role, source|
|
|
88
96
|
contents = source_contents(role == 'baseline' ? baseline : '0.31.1').slice(*HaveAPI::Performance::SourceVersions::PATHS)
|
|
89
|
-
|
|
97
|
+
contents = with_files(contents, selections.fetch(role)) if selections.has_key?(role)
|
|
98
|
+
receipt = HaveAPI::Performance::SourceVersions.capture(contents, normalize_files:)
|
|
90
99
|
source['files_sha256'].merge!(receipt.fetch('raw_sha256'))
|
|
91
100
|
samples.fetch('observations').each_value do |observation|
|
|
92
101
|
next unless observation.fetch('source').fetch('root') == source.fetch('root')
|
|
@@ -165,4 +174,104 @@ describe HaveAPI::PerformanceCI::Campaign do
|
|
|
165
174
|
samples, budgets = PerformanceSamples.fixture
|
|
166
175
|
expect(compare(samples, JSON.parse(budgets)).fetch('status')).to eq('pass')
|
|
167
176
|
end
|
|
177
|
+
|
|
178
|
+
it 'accepts only the reviewed packaging transition in preparation and live input capture' do
|
|
179
|
+
contents = { baseline: with_files(source_contents('0.31.1'), shallow_files),
|
|
180
|
+
candidate: with_files(source_contents('0.31.1'), recursive_files) }
|
|
181
|
+
prepare(contents[:baseline], contents[:candidate]) do |roots|
|
|
182
|
+
retained = JSON.parse(File.read(File.join(File.dirname(roots[:baseline]), 'dependency-compatibility.json')))
|
|
183
|
+
expect(retained['baseline']['gemspecs']).to eq(retained['candidate']['gemspecs'])
|
|
184
|
+
receipts = retained.values.map { |input| input.fetch('source_versions') }
|
|
185
|
+
expect(receipts.first.fetch('raw_sha256')).not_to eq(receipts.last.fetch('raw_sha256'))
|
|
186
|
+
expect(receipts.first.fetch('normalized_sha256')).to eq(receipts.last.fetch('normalized_sha256'))
|
|
187
|
+
expect(receipts.map { |receipt| receipt.fetch('file_selection') }).to eq(%w[documentation-files-v1 documentation-files-v1])
|
|
188
|
+
|
|
189
|
+
graphs = roots.map do |role, directory|
|
|
190
|
+
%w[HaveAPI::VERSION HaveAPI::Client::VERSION HaveAPI::RustClient::VERSION].each { |constant| stub_const(constant, '0.31.1') }
|
|
191
|
+
inputs = JSON.parse(JSON.generate(HaveAPI::Performance::Worker.inputs(directory, 'quick', benchmark: true)))
|
|
192
|
+
hashes = contents.fetch(role).transform_values { |text| Digest::SHA256.hexdigest(text) }
|
|
193
|
+
expect(inputs.fetch('source_versions')).to eq(retained.fetch(role.to_s).fetch('source_versions'))
|
|
194
|
+
expect do
|
|
195
|
+
HaveAPI::Performance.validate_input_receipts(inputs, { 'files_sha256' => hashes }, profile: 'quick', lineage: nil)
|
|
196
|
+
end.not_to raise_error
|
|
197
|
+
HaveAPI::Performance::Release.graph(inputs)
|
|
198
|
+
end
|
|
199
|
+
expect(graphs.first).to eq(graphs.last)
|
|
200
|
+
end
|
|
201
|
+
end
|
|
202
|
+
|
|
203
|
+
it 'replays the exact old/new packaging pair while retaining raw source hashes' do
|
|
204
|
+
samples, budgets = replay_samples('0.31.1', selections: { 'baseline' => shallow_files, 'candidate' => recursive_files })
|
|
205
|
+
|
|
206
|
+
expect(compare(samples, budgets).fetch('status')).to eq('pass')
|
|
207
|
+
path = 'servers/ruby/haveapi.gemspec'
|
|
208
|
+
expect(samples['sources']['baseline']['files_sha256'][path]).not_to eq(samples['sources']['candidate']['files_sha256'][path])
|
|
209
|
+
end
|
|
210
|
+
|
|
211
|
+
it 'keeps all bytes outside the exact packaging statement and evaluated requirements strict' do
|
|
212
|
+
original = with_files(source_contents('0.31.0'), shallow_files)
|
|
213
|
+
candidate = with_files(source_contents('0.31.1'), recursive_files)
|
|
214
|
+
path = 'servers/ruby/haveapi.gemspec'
|
|
215
|
+
changes = [
|
|
216
|
+
candidate.merge(path => candidate.fetch(path).sub('Framework for creating', 'Framework for describing')),
|
|
217
|
+
candidate.merge(path => candidate.fetch(path).sub("'activesupport', '>= 7.1'", "'activesupport', '>= 7.0'")),
|
|
218
|
+
candidate.merge(path => "#{candidate.fetch(path)}\n# unrelated comment\n"),
|
|
219
|
+
candidate.merge('.ruby-version' => "3.2.1\n")
|
|
220
|
+
]
|
|
221
|
+
changes.each do |changed|
|
|
222
|
+
expect { prepare(original, changed) }.to raise_error(HaveAPI::PerformanceCI::Error, /Dependency inputs differ/)
|
|
223
|
+
end
|
|
224
|
+
end
|
|
225
|
+
|
|
226
|
+
it 'does not normalize unknown, absent, duplicated or modified file statements' do
|
|
227
|
+
contents = source_contents('0.31.1').slice(*HaveAPI::Performance::SourceVersions::PATHS)
|
|
228
|
+
expected = HaveAPI::Performance::SourceVersions.capture(with_files(contents, shallow_files)).fetch('normalized_sha256')
|
|
229
|
+
variants = [
|
|
230
|
+
recursive_files.sub('doc/**/*', 'doc/**'), recursive_files.sub('File.file?', 'File.symlink?'),
|
|
231
|
+
recursive_files.sub("\n", " # additional behavior\n"), '', shallow_files + recursive_files,
|
|
232
|
+
"#{recursive_files} s.files = []\n"
|
|
233
|
+
]
|
|
234
|
+
variants.each do |statement|
|
|
235
|
+
changed = with_files(contents, statement)
|
|
236
|
+
receipt = HaveAPI::Performance::SourceVersions.capture(changed)
|
|
237
|
+
expect(receipt).not_to have_key('file_selection')
|
|
238
|
+
expect(receipt.fetch('normalized_sha256')).not_to eq(expected)
|
|
239
|
+
expect(receipt).to eq(HaveAPI::Performance::SourceVersions.capture(changed, normalize_files: false))
|
|
240
|
+
end
|
|
241
|
+
end
|
|
242
|
+
|
|
243
|
+
it 'rejects tampered or stripped packaging markers and source bindings on replay' do
|
|
244
|
+
%w[marker stripped added raw normalized content source manifest].each do |fault|
|
|
245
|
+
selections = fault == 'added' ? {} : { 'baseline' => shallow_files, 'candidate' => recursive_files }
|
|
246
|
+
samples, budgets = replay_samples(selections:, normalize_files: fault != 'added')
|
|
247
|
+
inputs = samples['observations']['candidate']['inputs']
|
|
248
|
+
receipt = inputs.fetch('source_versions')
|
|
249
|
+
path = 'servers/ruby/haveapi.gemspec'
|
|
250
|
+
case fault
|
|
251
|
+
when 'marker' then receipt['file_selection'] = 'unreviewed-policy'
|
|
252
|
+
when 'stripped' then receipt.delete('file_selection')
|
|
253
|
+
when 'added' then receipt['file_selection'] = 'documentation-files-v1'
|
|
254
|
+
when 'raw' then receipt['raw_sha256'][path] = 'f' * 64
|
|
255
|
+
when 'normalized' then receipt['normalized_sha256'][path] = 'f' * 64
|
|
256
|
+
when 'content' then receipt['contents'][path] += "# changed\n"
|
|
257
|
+
when 'source' then samples['sources']['candidate']['files_sha256'][path] = 'f' * 64
|
|
258
|
+
when 'manifest' then inputs['manifests'][path] = 'f' * 64
|
|
259
|
+
end
|
|
260
|
+
expect { compare(samples, budgets) }.to raise_error(error), fault
|
|
261
|
+
end
|
|
262
|
+
end
|
|
263
|
+
|
|
264
|
+
it 'continues to replay legacy own-version receipts with raw file selection' do
|
|
265
|
+
samples, budgets = replay_samples(normalize_files: false)
|
|
266
|
+
|
|
267
|
+
expect(compare(samples, budgets).fetch('status')).to eq('pass')
|
|
268
|
+
end
|
|
269
|
+
|
|
270
|
+
it 'leaves the historical maintenance packaging comparison strict' do
|
|
271
|
+
contents = source_contents('0.30.1')
|
|
272
|
+
old = HaveAPI::Performance::Release.capture(with_files(contents, shallow_files))
|
|
273
|
+
new = HaveAPI::Performance::Release.capture(with_files(contents, recursive_files))
|
|
274
|
+
|
|
275
|
+
expect(old.fetch('normalized_sha256')).not_to eq(new.fetch('normalized_sha256'))
|
|
276
|
+
end
|
|
168
277
|
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: haveapi
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.32.
|
|
4
|
+
version: 0.32.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Jakub Skokan
|
|
@@ -29,14 +29,14 @@ dependencies:
|
|
|
29
29
|
requirements:
|
|
30
30
|
- - "~>"
|
|
31
31
|
- !ruby/object:Gem::Version
|
|
32
|
-
version: 0.32.
|
|
32
|
+
version: 0.32.2
|
|
33
33
|
type: :runtime
|
|
34
34
|
prerelease: false
|
|
35
35
|
version_requirements: !ruby/object:Gem::Requirement
|
|
36
36
|
requirements:
|
|
37
37
|
- - "~>"
|
|
38
38
|
- !ruby/object:Gem::Version
|
|
39
|
-
version: 0.32.
|
|
39
|
+
version: 0.32.2
|
|
40
40
|
- !ruby/object:Gem::Dependency
|
|
41
41
|
name: i18n
|
|
42
42
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -218,17 +218,24 @@ files:
|
|
|
218
218
|
- benchmarks/performance_compare.rb
|
|
219
219
|
- benchmarks/shell.nix
|
|
220
220
|
- benchmarks/spec/client_examples_spec.rb
|
|
221
|
-
- doc/client-examples.md
|
|
222
|
-
- doc/create-client.md
|
|
223
|
-
- doc/
|
|
224
|
-
- doc/
|
|
221
|
+
- doc/cs/client-examples.md
|
|
222
|
+
- doc/cs/create-client.md
|
|
223
|
+
- doc/cs/json-schema.html
|
|
224
|
+
- doc/cs/protocol.md
|
|
225
|
+
- doc/cs/readme.md
|
|
226
|
+
- doc/cs/typed-input-validation.md
|
|
227
|
+
- doc/en/client-examples.md
|
|
228
|
+
- doc/en/create-client.md
|
|
229
|
+
- doc/en/documentation-oauth.md
|
|
230
|
+
- doc/en/documentation-ui.md
|
|
231
|
+
- doc/en/json-schema.html
|
|
232
|
+
- doc/en/performance.md
|
|
233
|
+
- doc/en/protocol.md
|
|
234
|
+
- doc/en/readme.md
|
|
235
|
+
- doc/en/typed-input-validation.md
|
|
225
236
|
- doc/hooks.erb
|
|
226
237
|
- doc/index.md
|
|
227
|
-
- doc/json-schema.html
|
|
228
|
-
- doc/performance.md
|
|
229
|
-
- doc/protocol.md
|
|
230
238
|
- doc/protocol.png
|
|
231
|
-
- doc/typed-input-validation.md
|
|
232
239
|
- haveapi.gemspec
|
|
233
240
|
- lib/haveapi.rb
|
|
234
241
|
- lib/haveapi/action.rb
|
|
@@ -271,6 +278,7 @@ files:
|
|
|
271
278
|
- lib/haveapi/documentation_clients.rb
|
|
272
279
|
- lib/haveapi/documentation_context.rb
|
|
273
280
|
- lib/haveapi/documentation_helpers.rb
|
|
281
|
+
- lib/haveapi/documentation_locale.rb
|
|
274
282
|
- lib/haveapi/documentation_oauth.rb
|
|
275
283
|
- lib/haveapi/documentation_schema.rb
|
|
276
284
|
- lib/haveapi/documentation_search.rb
|
|
@@ -381,6 +389,8 @@ files:
|
|
|
381
389
|
- spec/client_examples/assets/documentation_test.cjs
|
|
382
390
|
- spec/client_examples/assets/highlighter_test.cjs
|
|
383
391
|
- spec/client_examples/assets/tabs_test.cjs
|
|
392
|
+
- spec/client_examples/comment_capture.rb
|
|
393
|
+
- spec/client_examples/comments_spec.rb
|
|
384
394
|
- spec/client_examples/context_performance_spec.rb
|
|
385
395
|
- spec/client_examples/context_spec.rb
|
|
386
396
|
- spec/client_examples/detail_spec.rb
|
|
@@ -408,12 +418,15 @@ files:
|
|
|
408
418
|
- spec/documentation/client_examples_spec.rb
|
|
409
419
|
- spec/documentation/client_overview_spec.rb
|
|
410
420
|
- spec/documentation/current_user_html_escaping_spec.rb
|
|
421
|
+
- spec/documentation/example_selection_spec.rb
|
|
411
422
|
- spec/documentation/example_variants_spec.rb
|
|
412
423
|
- spec/documentation/examples_spec.rb
|
|
413
424
|
- spec/documentation/fixtures/search_index.json
|
|
414
425
|
- spec/documentation/host_html_escaping_spec.rb
|
|
415
426
|
- spec/documentation/identity_and_guides_spec.rb
|
|
416
427
|
- spec/documentation/identity_context_spec.rb
|
|
428
|
+
- spec/documentation/language_settings_spec.rb
|
|
429
|
+
- spec/documentation/locale_spec.rb
|
|
417
430
|
- spec/documentation/navigation_spec.rb
|
|
418
431
|
- spec/documentation/oauth_fixture_spec.rb
|
|
419
432
|
- spec/documentation/oauth_spec.rb
|
|
File without changes
|
|
File without changes
|
|
File without changes
|