bitfab 0.10.4 → 0.10.5
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 +11 -2
- data/lib/bitfab/http_client.rb +20 -1
- data/lib/bitfab/replay.rb +13 -2
- 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: b789df310c91a7e9130f3bdb6a35e6237a8ddadede4df49a5f7dc4afc0525e91
|
|
4
|
+
data.tar.gz: 0cd79b9c9bc8bf15ef926625c0aa1aba8f3cf1798062c0d077e371d98b9f6aba
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: fbf62eeabc5741c36ef1b867730f548039f20331d6591ccae7a66cc48882cd4638877edc1b80d57c3a326827edfbedff1d3ec226ed3b4e3358f9041e3405ea5f
|
|
7
|
+
data.tar.gz: 579cb384585a42160d5f1c9941cbf0762f53d35ffda7f109cb40c4c52a291a02d446e113ca664a2c84a08916481fe86912eb386a58956fb5651ff1a6dc108771
|
data/lib/bitfab/client.rb
CHANGED
|
@@ -36,9 +36,18 @@ module Bitfab
|
|
|
36
36
|
# @param limit [Integer] maximum number of traces to replay (default: 5)
|
|
37
37
|
# @param trace_ids [Array<String>, nil] optional list of trace IDs to filter
|
|
38
38
|
# @param max_concurrency [Integer, nil] max threads for parallel replay (default: 10)
|
|
39
|
+
# @param code_change_description [String, nil] optional rationale for the
|
|
40
|
+
# code change being tested in this replay (stored on the experiment)
|
|
41
|
+
# @param code_change_files [Array<Hash>, nil] optional list of edited files,
|
|
42
|
+
# each as { path:, before:, after: } (use "" for new/deleted files)
|
|
39
43
|
# @return [Hash] with :items, :test_run_id, :test_run_url
|
|
40
|
-
def replay(receiver, method_name, trace_function_key:, limit: 5, trace_ids: nil, max_concurrency: 10
|
|
41
|
-
|
|
44
|
+
def replay(receiver, method_name, trace_function_key:, limit: 5, trace_ids: nil, max_concurrency: 10,
|
|
45
|
+
code_change_description: nil, code_change_files: nil)
|
|
46
|
+
Replay.run(
|
|
47
|
+
self, receiver, method_name,
|
|
48
|
+
trace_function_key:, limit:, trace_ids:, max_concurrency:,
|
|
49
|
+
code_change_description:, code_change_files:
|
|
50
|
+
)
|
|
42
51
|
end
|
|
43
52
|
|
|
44
53
|
# Execute a block inside a span context, sending trace data on completion.
|
data/lib/bitfab/http_client.rb
CHANGED
|
@@ -98,12 +98,19 @@ module Bitfab
|
|
|
98
98
|
|
|
99
99
|
# Start a replay session by fetching historical traces.
|
|
100
100
|
# Blocking call. Returns hash with testRunId, testRunUrl, and items array.
|
|
101
|
-
|
|
101
|
+
#
|
|
102
|
+
# @param code_change_description [String, nil] optional rationale for the
|
|
103
|
+
# code change being tested in this replay
|
|
104
|
+
# @param code_change_files [Array<Hash>, nil] optional list of edited files,
|
|
105
|
+
# each as { path:, before:, after: } (use "" for new/deleted files)
|
|
106
|
+
def start_replay(trace_function_key, limit, trace_ids: nil, code_change_description: nil, code_change_files: nil)
|
|
102
107
|
payload = {
|
|
103
108
|
"traceFunctionKey" => trace_function_key,
|
|
104
109
|
"limit" => limit
|
|
105
110
|
}
|
|
106
111
|
payload["traceIds"] = trace_ids if trace_ids
|
|
112
|
+
payload["codeChangeDescription"] = code_change_description unless code_change_description.nil?
|
|
113
|
+
payload["codeChangeFiles"] = normalize_code_change_files(code_change_files) unless code_change_files.nil?
|
|
107
114
|
|
|
108
115
|
request("/api/sdk/replay/start", payload, timeout: 30)
|
|
109
116
|
end
|
|
@@ -129,6 +136,18 @@ module Bitfab
|
|
|
129
136
|
|
|
130
137
|
private
|
|
131
138
|
|
|
139
|
+
# Normalize each entry to a hash with stable string keys, accepting either
|
|
140
|
+
# symbol-keyed or string-keyed hashes from callers.
|
|
141
|
+
def normalize_code_change_files(files)
|
|
142
|
+
files.map do |file|
|
|
143
|
+
{
|
|
144
|
+
"path" => file[:path] || file["path"],
|
|
145
|
+
"before" => file[:before] || file["before"],
|
|
146
|
+
"after" => file[:after] || file["after"]
|
|
147
|
+
}
|
|
148
|
+
end
|
|
149
|
+
end
|
|
150
|
+
|
|
132
151
|
def headers
|
|
133
152
|
{
|
|
134
153
|
"Content-Type" => "application/json",
|
data/lib/bitfab/replay.rb
CHANGED
|
@@ -42,11 +42,22 @@ module Bitfab
|
|
|
42
42
|
# @param limit [Integer] maximum number of traces to replay (default: 5)
|
|
43
43
|
# @param trace_ids [Array<String>, nil] optional list of trace IDs to filter
|
|
44
44
|
# @param max_concurrency [Integer, nil] max threads for parallel replay (default: 10)
|
|
45
|
+
# @param code_change_description [String, nil] optional rationale for the
|
|
46
|
+
# code change being tested in this replay (stored on the experiment)
|
|
47
|
+
# @param code_change_files [Array<Hash>, nil] optional list of edited files,
|
|
48
|
+
# each as { path:, before:, after: } (empty string for new/deleted files)
|
|
45
49
|
# @return [Hash] with :items, :test_run_id, :test_run_url
|
|
46
|
-
def run(client, receiver, method_name, trace_function_key:, limit: 5, trace_ids: nil, max_concurrency: 10
|
|
50
|
+
def run(client, receiver, method_name, trace_function_key:, limit: 5, trace_ids: nil, max_concurrency: 10,
|
|
51
|
+
code_change_description: nil, code_change_files: nil)
|
|
47
52
|
http_client = client.instance_variable_get(:@http_client)
|
|
48
53
|
|
|
49
|
-
replay_data = http_client.start_replay(
|
|
54
|
+
replay_data = http_client.start_replay(
|
|
55
|
+
trace_function_key,
|
|
56
|
+
limit,
|
|
57
|
+
trace_ids:,
|
|
58
|
+
code_change_description:,
|
|
59
|
+
code_change_files:
|
|
60
|
+
)
|
|
50
61
|
test_run_id = replay_data["testRunId"]
|
|
51
62
|
test_run_url = replay_data["testRunUrl"]
|
|
52
63
|
server_items = replay_data["items"] || []
|
data/lib/bitfab/version.rb
CHANGED