bitfab 0.58.2 → 0.58.4
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/lib/bitfab/client.rb +25 -3
- data/lib/bitfab/http_client.rb +2 -1
- data/lib/bitfab/replay.rb +2 -1
- data/lib/bitfab/replay_registry.rb +1 -1
- data/lib/bitfab/span_context.rb +2 -1
- data/lib/bitfab/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 13b552211978874936f8b732245e948396758a5adf6d0485859cf98748bf4933
|
|
4
|
+
data.tar.gz: 612bbee201e37c8c425c5aa42bbcc6f713ca848e5cf43ad7eae5797beeefd660
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 7150bd10acde90cfe101845b6b6da248ae4cfb57a3742d8a33ef8d045e93d0ebfa6eaf6672376304f957206801c4f0b6ae60707d881d7621dce2d61b887405d4
|
|
7
|
+
data.tar.gz: beb42456465d624c22fc12d2294011be076748011bfac9dfad6a6397083bcebf6902a2fd7f7fadbdfa2c8e88c2df6b862c3a1f1bff0afb3f947e45256c68cc28
|
data/lib/bitfab/client.rb
CHANGED
|
@@ -185,7 +185,7 @@ module Bitfab
|
|
|
185
185
|
# queued work from in-flight work. A raising callback never crashes the run.
|
|
186
186
|
# @return [Hash] with :items, :test_run_id, :test_run_url
|
|
187
187
|
def replay(receiver, method_name = nil, trace_function_key:, limit: nil, trace_ids: nil, concurrency: nil, max_concurrency: ReplayConcurrency::UNSET,
|
|
188
|
-
name: nil, code_change_description: Replay::CODE_CHANGE_UNSET, code_change_files: Replay::CODE_CHANGE_UNSET, experiment_group_id: nil, dataset_id: nil, dataset_ids: nil, grader_ids: nil, mock: "marked", attempts: ReplayConcurrency::UNSET, only_with_assertions: false, dry_run: false,
|
|
188
|
+
name: nil, code_change_description: Replay::CODE_CHANGE_UNSET, code_change_files: Replay::CODE_CHANGE_UNSET, experiment_group_id: nil, dataset_id: nil, dataset_ids: nil, grader_ids: nil, mock: "marked", attempts: ReplayConcurrency::UNSET, only_with_assertions: false, judge_assertions: false, dry_run: false,
|
|
189
189
|
adapt_inputs: nil, mock_override: nil, db_branch: nil, on_item_start: nil, on_item_finish: nil, on_progress: nil)
|
|
190
190
|
Replay.run(
|
|
191
191
|
self,
|
|
@@ -199,6 +199,7 @@ module Bitfab
|
|
|
199
199
|
max_concurrency:,
|
|
200
200
|
attempts:,
|
|
201
201
|
only_with_assertions:,
|
|
202
|
+
judge_assertions:,
|
|
202
203
|
dry_run:,
|
|
203
204
|
code_change_description:,
|
|
204
205
|
code_change_files:,
|
|
@@ -424,6 +425,13 @@ module Bitfab
|
|
|
424
425
|
span_id = SecureRandom.uuid
|
|
425
426
|
parent_span_id = parent&.dig(:span_id)
|
|
426
427
|
is_root_span = parent_span_id.nil?
|
|
428
|
+
ancestor_span_id = nearest_captured_ancestor_span_id
|
|
429
|
+
open_instrumentation = (surface == :trace) ? "trace" : "span"
|
|
430
|
+
sends_on_completion = lambda do
|
|
431
|
+
is_root_span || declared_node || !content_off_by_simulation_plan?(
|
|
432
|
+
trace_id:, trace_function_key:, span_name:, instrumentation: open_instrumentation
|
|
433
|
+
)
|
|
434
|
+
end
|
|
427
435
|
started_at = Bitfab.now_iso_timestamp
|
|
428
436
|
resolved_test_run_id = replay_ctx ? replay_ctx[:test_run_id] : test_run_id
|
|
429
437
|
resolved_input_source_span_id = replay_ctx&.dig(:input_source_span_id)
|
|
@@ -549,6 +557,7 @@ module Bitfab
|
|
|
549
557
|
span_data: content_off ? span_data.merge("content_off_by_simulation_plan" => true) : span_data,
|
|
550
558
|
instrumentation: recorded_instrumentation,
|
|
551
559
|
declared_node:,
|
|
560
|
+
nearest_captured_ancestor_span_id: ancestor_span_id,
|
|
552
561
|
trace_function_key:,
|
|
553
562
|
trace_id:,
|
|
554
563
|
span_id:,
|
|
@@ -617,7 +626,8 @@ module Bitfab
|
|
|
617
626
|
span_id:,
|
|
618
627
|
explicit_span_receiver:,
|
|
619
628
|
explicit_span_method_name: explicit_span_method_name&.to_sym,
|
|
620
|
-
surface:, recording_override:, content_withheld
|
|
629
|
+
surface:, recording_override:, content_withheld:,
|
|
630
|
+
sends_on_completion: sends_on_completion
|
|
621
631
|
) do
|
|
622
632
|
invoke = -> { around_body ? around_body.call { yield } : yield }
|
|
623
633
|
result = if explicit_span_receiver
|
|
@@ -682,6 +692,14 @@ module Bitfab
|
|
|
682
692
|
raise ArgumentError, "id must be a valid Bitfab span ID" unless id.is_a?(String) && UUID_PATTERN.match?(id)
|
|
683
693
|
end
|
|
684
694
|
|
|
695
|
+
def nearest_captured_ancestor_span_id
|
|
696
|
+
SpanContext.stack.reverse_each do |entry|
|
|
697
|
+
sends = entry[:sends_on_completion]
|
|
698
|
+
return entry[:span_id] if sends.nil? || sends.call
|
|
699
|
+
end
|
|
700
|
+
nil
|
|
701
|
+
end
|
|
702
|
+
|
|
685
703
|
def content_off_by_simulation_plan?(trace_id:, trace_function_key:, span_name:, instrumentation: "span")
|
|
686
704
|
return false if SimulationPlan::FRAMEWORKS.include?(instrumentation)
|
|
687
705
|
|
|
@@ -926,7 +944,8 @@ module Bitfab
|
|
|
926
944
|
def send_span(trace_function_key:, trace_id:, span_id:, parent_span_id:,
|
|
927
945
|
span_name:, span_type:, function_name:, contexts:, prompt:, args:, kwargs:, result:, error:,
|
|
928
946
|
started_at:, ended_at:, test_run_id: nil, input_source_span_id: nil, mocked: false,
|
|
929
|
-
mock_target: nil, mock_source: nil, span_data: {}, instrumentation: "span", declared_node: false
|
|
947
|
+
mock_target: nil, mock_source: nil, span_data: {}, instrumentation: "span", declared_node: false,
|
|
948
|
+
nearest_captured_ancestor_span_id: nil)
|
|
930
949
|
extra_span_data = span_data
|
|
931
950
|
# If drop() was called on this trace, suppress the span PAYLOAD upload for
|
|
932
951
|
# every span that completes after the flag was set. The trace completion
|
|
@@ -982,6 +1001,9 @@ module Bitfab
|
|
|
982
1001
|
"span_origin" => Bitfab.make_span_origin(instrumentation)
|
|
983
1002
|
}
|
|
984
1003
|
raw_span["parent_id"] = parent_span_id if parent_span_id
|
|
1004
|
+
if nearest_captured_ancestor_span_id && nearest_captured_ancestor_span_id != parent_span_id
|
|
1005
|
+
raw_span["nearest_captured_ancestor_id"] = nearest_captured_ancestor_span_id
|
|
1006
|
+
end
|
|
985
1007
|
raw_span["input_source_span_id"] = input_source_span_id if input_source_span_id
|
|
986
1008
|
|
|
987
1009
|
payload = {
|
data/lib/bitfab/http_client.rb
CHANGED
|
@@ -262,7 +262,7 @@ module Bitfab
|
|
|
262
262
|
# same org and trace function or the server rejects the replay
|
|
263
263
|
def start_replay(trace_function_key, limit, trace_ids: nil, code_change_description: nil,
|
|
264
264
|
code_change_files: nil, experiment_group_id: nil, name: nil, include_db_branch_lease: false, dataset_ids: nil,
|
|
265
|
-
grader_ids: nil, db_branch_settings: nil, attempts: 1, only_with_assertions: false, include_original_metadata: false)
|
|
265
|
+
grader_ids: nil, db_branch_settings: nil, attempts: 1, only_with_assertions: false, judge_assertions: false, include_original_metadata: false)
|
|
266
266
|
payload = {
|
|
267
267
|
"traceFunctionKey" => trace_function_key
|
|
268
268
|
}
|
|
@@ -286,6 +286,7 @@ module Bitfab
|
|
|
286
286
|
payload["graderIds"] = grader_ids unless grader_ids.nil?
|
|
287
287
|
payload["attempts"] = attempts if attempts > 1
|
|
288
288
|
payload["onlyWithAssertions"] = true if only_with_assertions
|
|
289
|
+
payload["judgeAssertions"] = true if judge_assertions
|
|
289
290
|
payload["includeOriginalMetadata"] = true if include_original_metadata
|
|
290
291
|
payload["dbBranchSettings"] = db_branch_settings unless db_branch_settings.nil?
|
|
291
292
|
git_state = GitState.resolved
|
data/lib/bitfab/replay.rb
CHANGED
|
@@ -258,7 +258,7 @@ module Bitfab
|
|
|
258
258
|
# @return [Hash] with :items, :test_run_id, :test_run_url
|
|
259
259
|
def run(client, receiver, method_name, trace_function_key:, limit: nil, trace_ids: nil, name: nil,
|
|
260
260
|
concurrency: nil, max_concurrency: ReplayConcurrency::UNSET, code_change_description: CODE_CHANGE_UNSET, code_change_files: CODE_CHANGE_UNSET, experiment_group_id: nil,
|
|
261
|
-
dataset_id: nil, dataset_ids: nil, grader_ids: nil, mock: "marked", attempts: ReplayConcurrency::UNSET, only_with_assertions: false, dry_run: false,
|
|
261
|
+
dataset_id: nil, dataset_ids: nil, grader_ids: nil, mock: "marked", attempts: ReplayConcurrency::UNSET, only_with_assertions: false, judge_assertions: false, dry_run: false,
|
|
262
262
|
adapt_inputs: nil, mock_override: nil, db_branch: nil, on_item_start: nil, on_item_finish: nil, on_progress: nil)
|
|
263
263
|
concurrency_options = ReplayConcurrency.resolve(concurrency, attempts, max_concurrency)
|
|
264
264
|
attempts = concurrency_options.attempts
|
|
@@ -354,6 +354,7 @@ module Bitfab
|
|
|
354
354
|
grader_ids:,
|
|
355
355
|
attempts:,
|
|
356
356
|
only_with_assertions:,
|
|
357
|
+
judge_assertions:,
|
|
357
358
|
include_original_metadata: !adapt_inputs.nil?,
|
|
358
359
|
db_branch_settings: resolved_db_branch_settings
|
|
359
360
|
)
|
|
@@ -21,7 +21,7 @@ module Bitfab
|
|
|
21
21
|
OPTION_NAMES = %i[
|
|
22
22
|
limit trace_ids name concurrency max_concurrency code_change_description
|
|
23
23
|
code_change_files experiment_group_id dataset_id dataset_ids grader_ids mock
|
|
24
|
-
mock_override adapt_inputs db_branch attempts only_with_assertions dry_run on_item_finish
|
|
24
|
+
mock_override adapt_inputs db_branch attempts only_with_assertions judge_assertions dry_run on_item_finish
|
|
25
25
|
].freeze
|
|
26
26
|
|
|
27
27
|
def initialize
|
data/lib/bitfab/span_context.rb
CHANGED
|
@@ -150,8 +150,9 @@ module Bitfab
|
|
|
150
150
|
|
|
151
151
|
# Execute a block with a new span pushed onto the stack.
|
|
152
152
|
# The span is automatically popped when the block completes.
|
|
153
|
-
def with_span(trace_id:, span_id:, explicit_span_receiver: nil, explicit_span_method_name: nil, surface: nil, recording_override: nil, content_withheld: nil)
|
|
153
|
+
def with_span(trace_id:, span_id:, explicit_span_receiver: nil, explicit_span_method_name: nil, surface: nil, recording_override: nil, content_withheld: nil, sends_on_completion: nil)
|
|
154
154
|
entry = {trace_id:, span_id:}
|
|
155
|
+
entry[:sends_on_completion] = sends_on_completion if sends_on_completion
|
|
155
156
|
entry[:surface] = surface if surface
|
|
156
157
|
entry[:recording_override] = recording_override if recording_override
|
|
157
158
|
entry[:content_withheld] = content_withheld if content_withheld
|
data/lib/bitfab/version.rb
CHANGED