bitfab 0.64.22 → 0.64.25
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 +8 -2
- data/lib/bitfab/cloudReplay.py +3 -5
- data/lib/bitfab/http_client.rb +5 -1
- data/lib/bitfab/labels.rb +12 -1
- data/lib/bitfab/replay.rb +11 -2
- data/lib/bitfab/replay_registry.rb +7 -3
- 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: 6be3e712951d897d0cd849ae85155eb7276e170799228d7d84b190d40f376b3c
|
|
4
|
+
data.tar.gz: fd8221b81baa82065582036be59042b2b0faff64e09e173b6f754ca4b3c592c5
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: de63a2a365d14b3bc59d6cf3b4e427203f56d2963d760732444cee78bdc03d45e57f4da9b7ffd26fb30ad71f7f0d5d9d7df35fad9873bf5a7d8e59de12ba1f13
|
|
7
|
+
data.tar.gz: fd21103ff0706e5e3200c35a8cd1fa65b4df2404882f9d6a35c4676d790e9d512bb2dae4aabb0aec4c2ff8820901b74bd0632d953367fc3c029bdcd26495f8fc
|
data/lib/bitfab/client.rb
CHANGED
|
@@ -137,7 +137,12 @@ module Bitfab
|
|
|
137
137
|
# each as { path:, before:, after: } (use "" for new/deleted files).
|
|
138
138
|
# Omit to capture automatically, or pass nil to suppress file capture.
|
|
139
139
|
# @param experiment_group_id [String, nil] optional UUID grouping multiple
|
|
140
|
-
# replay runs into a single experiment batch
|
|
140
|
+
# replay runs into a single experiment batch. The run joins that group,
|
|
141
|
+
# and an id no group has yet creates it
|
|
142
|
+
# @param experiment_group_name [String, nil] optional display name for the
|
|
143
|
+
# experiment group, applied when this replay creates the group or the group
|
|
144
|
+
# has no name yet. A group that already has a name keeps it. Requires
|
|
145
|
+
# experiment_group_id; passing it alone raises ArgumentError
|
|
141
146
|
# @param dataset_ids [Array<String>, nil] optional UUIDs of the datasets this
|
|
142
147
|
# replay runs against, for benchmarking one method against several corpora
|
|
143
148
|
# in a single run; mutually exclusive with dataset_id. Passing trace_ids
|
|
@@ -196,7 +201,7 @@ module Bitfab
|
|
|
196
201
|
# @return [Hash] with :items, :experiment_id, :experiment_url, and the
|
|
197
202
|
# deprecated aliases :test_run_id and :test_run_url carrying the same values
|
|
198
203
|
def replay(receiver, method_name = nil, trace_function_key:, limit: nil, trace_ids: nil, concurrency: nil, max_concurrency: ReplayConcurrency::UNSET,
|
|
199
|
-
name: nil, notes: nil, metadata: 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, skip_assertion_judging: false, judge_assertions: nil, dry_run: false,
|
|
204
|
+
name: nil, notes: nil, metadata: nil, code_change_description: Replay::CODE_CHANGE_UNSET, code_change_files: Replay::CODE_CHANGE_UNSET, experiment_group_id: nil, experiment_group_name: nil, dataset_id: nil, dataset_ids: nil, grader_ids: nil, mock: "marked", attempts: ReplayConcurrency::UNSET, only_with_assertions: false, skip_assertion_judging: false, judge_assertions: nil, dry_run: false,
|
|
200
205
|
adapt_inputs: nil, mock_override: nil, db_branch: nil, on_item_start: nil, on_item_finish: nil, on_progress: nil,
|
|
201
206
|
on_experiment_start: nil, experimental_selective_replay: nil)
|
|
202
207
|
Replay.run(
|
|
@@ -219,6 +224,7 @@ module Bitfab
|
|
|
219
224
|
code_change_description:,
|
|
220
225
|
code_change_files:,
|
|
221
226
|
experiment_group_id:,
|
|
227
|
+
experiment_group_name:,
|
|
222
228
|
dataset_id:,
|
|
223
229
|
dataset_ids:,
|
|
224
230
|
grader_ids:,
|
data/lib/bitfab/cloudReplay.py
CHANGED
|
@@ -1896,7 +1896,7 @@ def check_out_snapshot_base(root, commit, branch):
|
|
|
1896
1896
|
base = git(root, "rev-parse", "--verify", "-q", f"{commit}^")
|
|
1897
1897
|
except CommandError:
|
|
1898
1898
|
print(
|
|
1899
|
-
"This checkout does not include the commit the snapshot was taken on, so the experiment records no code change; set fetch-depth: 2 on the workflow's
|
|
1899
|
+
"This checkout does not include the commit the snapshot was taken on, so the experiment records no code change and the snapshot commit instead of your branch; set fetch-depth: 2 on the workflow's checkout step, or run bitfab-replay --cloud-update",
|
|
1900
1900
|
flush=True,
|
|
1901
1901
|
)
|
|
1902
1902
|
return None
|
|
@@ -2900,7 +2900,7 @@ def raise_checkout_depth(lines, start, end):
|
|
|
2900
2900
|
def add_checkout_depth(lines):
|
|
2901
2901
|
for index, line in enumerate(lines):
|
|
2902
2902
|
match = re.match(
|
|
2903
|
-
r'([ \t]*)(- +)?"?uses"?[ \t]*:[ \t]*"?
|
|
2903
|
+
r'([ \t]*)(- +)?"?uses"?[ \t]*:[ \t]*"?[\w.-]+/checkout@',
|
|
2904
2904
|
without_yaml_comment(line),
|
|
2905
2905
|
)
|
|
2906
2906
|
if not match:
|
|
@@ -3063,9 +3063,7 @@ def update_workflow(root, path, *, remove_old_key_secrets=False):
|
|
|
3063
3063
|
"Checked out the commit each snapshot is taken on, so experiments record the code change"
|
|
3064
3064
|
)
|
|
3065
3065
|
elif depth == "by hand":
|
|
3066
|
-
by_hand.append(
|
|
3067
|
-
f"fetch-depth: {CHECKOUT_DEPTH} in the actions/checkout step's with"
|
|
3068
|
-
)
|
|
3066
|
+
by_hand.append(f"fetch-depth: {CHECKOUT_DEPTH} in the checkout step's with")
|
|
3069
3067
|
if updated:
|
|
3070
3068
|
target.write_text("\n".join(lines))
|
|
3071
3069
|
steps = []
|
data/lib/bitfab/http_client.rb
CHANGED
|
@@ -254,6 +254,9 @@ module Bitfab
|
|
|
254
254
|
# each as { path:, before:, after: } (use "" for new/deleted files)
|
|
255
255
|
# @param experiment_group_id [String, nil] optional UUID grouping multiple
|
|
256
256
|
# replay runs into a single experiment batch
|
|
257
|
+
# @param experiment_group_name [String, nil] optional display name for the
|
|
258
|
+
# experiment group, applied when this replay creates the group or the group
|
|
259
|
+
# has no name yet; only sent together with experiment_group_id
|
|
257
260
|
# @param name [String, nil] optional display name for the resulting
|
|
258
261
|
# experiment
|
|
259
262
|
# @param dataset_ids [Array<String>, nil] optional UUIDs of the datasets this
|
|
@@ -266,7 +269,7 @@ module Bitfab
|
|
|
266
269
|
# runnable graders at completion; each must be an active/live grader in the
|
|
267
270
|
# same org and trace function or the server rejects the replay
|
|
268
271
|
def start_replay(trace_function_key, limit, trace_ids: nil, code_change_description: nil,
|
|
269
|
-
code_change_files: nil, experiment_group_id: nil, name: nil, notes: nil, metadata: nil, include_db_branch_lease: false, dataset_ids: nil,
|
|
272
|
+
code_change_files: nil, experiment_group_id: nil, experiment_group_name: nil, name: nil, notes: nil, metadata: nil, include_db_branch_lease: false, dataset_ids: nil,
|
|
270
273
|
grader_ids: nil, db_branch_settings: nil, attempts: 1, only_with_assertions: false, skip_assertion_judging: false, include_original_metadata: false, experimental_selective_replay: nil, dry_run: false, invocation: nil)
|
|
271
274
|
payload = {
|
|
272
275
|
"traceFunctionKey" => trace_function_key
|
|
@@ -281,6 +284,7 @@ module Bitfab
|
|
|
281
284
|
payload["codeChangeDescription"] = code_change_description unless code_change_description.nil?
|
|
282
285
|
payload["codeChangeFiles"] = normalize_code_change_files(code_change_files) unless code_change_files.nil?
|
|
283
286
|
payload["experimentGroupId"] = experiment_group_id unless experiment_group_id.nil?
|
|
287
|
+
payload["experimentGroupName"] = experiment_group_name unless experiment_group_name.nil?
|
|
284
288
|
payload["includeDbBranchLease"] = true if include_db_branch_lease
|
|
285
289
|
payload["lazyDbBranchLease"] = true if include_db_branch_lease
|
|
286
290
|
unless dataset_ids.nil?
|
data/lib/bitfab/labels.rb
CHANGED
|
@@ -44,6 +44,17 @@ module Bitfab
|
|
|
44
44
|
save_all([update], experiment_id:).first
|
|
45
45
|
end
|
|
46
46
|
|
|
47
|
+
# Records that the evidence does not show the part of the run this assertion checks, so there was
|
|
48
|
+
# nothing to judge. Counted as a fail in every pass rate, but stored and read back as an abstention,
|
|
49
|
+
# apart from a fail. +annotation:+ says what the evidence would have had to show.
|
|
50
|
+
def abstain(assertion_id:, trace_id: nil, original_trace_id: nil, attempt: nil, experiment_id: nil,
|
|
51
|
+
test_run_id: nil, annotation: nil)
|
|
52
|
+
experiment_id = Bitfab.resolve_experiment_id(experiment_id, test_run_id)
|
|
53
|
+
update = label_target(trace_id:, original_trace_id:, attempt:, assertion_id:).merge("abstain" => true)
|
|
54
|
+
update["annotation"] = annotation unless annotation.nil?
|
|
55
|
+
save_all([update], experiment_id:).first
|
|
56
|
+
end
|
|
57
|
+
|
|
47
58
|
def archive(trace_id: nil, original_trace_id: nil, attempt: nil, experiment_id: nil, assertion_id: nil, test_run_id: nil)
|
|
48
59
|
experiment_id = Bitfab.resolve_experiment_id(experiment_id, test_run_id)
|
|
49
60
|
update = label_target(trace_id:, original_trace_id:, attempt:, assertion_id:)
|
|
@@ -91,7 +102,7 @@ module Bitfab
|
|
|
91
102
|
|
|
92
103
|
targets = unscoped.map { |entry| entry_value(entry, "traceId") || entry_value(entry, "originalTraceId") }
|
|
93
104
|
raise ArgumentError, "Agent verdicts must name an assertion: #{targets.join(", ")}. " \
|
|
94
|
-
"Pass the assertion_id of the assertion each verdict scores to labels.save, save_all, and
|
|
105
|
+
"Pass the assertion_id of the assertion each verdict scores to labels.save, save_all, skip, and abstain. " \
|
|
95
106
|
"Only archive may omit it, to clear an old whole-trace verdict."
|
|
96
107
|
end
|
|
97
108
|
|
data/lib/bitfab/replay.rb
CHANGED
|
@@ -235,7 +235,12 @@ module Bitfab
|
|
|
235
235
|
# each as { path:, before:, after: } (empty string for new/deleted files).
|
|
236
236
|
# Omit to capture automatically, or pass nil to suppress file capture.
|
|
237
237
|
# @param experiment_group_id [String, nil] optional UUID grouping multiple
|
|
238
|
-
# replay runs into a single experiment batch
|
|
238
|
+
# replay runs into a single experiment batch. The run joins that group,
|
|
239
|
+
# and an id no group has yet creates it
|
|
240
|
+
# @param experiment_group_name [String, nil] optional display name for the
|
|
241
|
+
# experiment group, applied when this replay creates the group or the group
|
|
242
|
+
# has no name yet. A group that already has a name keeps it. Requires
|
|
243
|
+
# experiment_group_id; passing it alone raises ArgumentError
|
|
239
244
|
# @param dataset_id [String, nil] optional UUID of the dataset this replay
|
|
240
245
|
# runs against, stored on the resulting experiment for durable attribution;
|
|
241
246
|
# mutually exclusive with dataset_ids. Alone it replays the dataset's full
|
|
@@ -295,7 +300,7 @@ module Bitfab
|
|
|
295
300
|
# The experiment fields are nil for a dry run, which creates no experiment,
|
|
296
301
|
# and progress events then carry a nil :experiment_id too.
|
|
297
302
|
def run(client, receiver, method_name, trace_function_key:, limit: nil, trace_ids: nil, name: nil, notes: nil, metadata: nil,
|
|
298
|
-
concurrency: nil, max_concurrency: ReplayConcurrency::UNSET, code_change_description: CODE_CHANGE_UNSET, code_change_files: CODE_CHANGE_UNSET, experiment_group_id: nil,
|
|
303
|
+
concurrency: nil, max_concurrency: ReplayConcurrency::UNSET, code_change_description: CODE_CHANGE_UNSET, code_change_files: CODE_CHANGE_UNSET, experiment_group_id: nil, experiment_group_name: nil,
|
|
299
304
|
dataset_id: nil, dataset_ids: nil, grader_ids: nil, mock: "marked", attempts: ReplayConcurrency::UNSET, only_with_assertions: false, skip_assertion_judging: false, judge_assertions: nil, dry_run: false,
|
|
300
305
|
adapt_inputs: nil, mock_override: nil, db_branch: nil, on_item_start: nil, on_item_finish: nil, on_progress: nil,
|
|
301
306
|
on_experiment_start: nil, experimental_selective_replay: nil)
|
|
@@ -319,6 +324,9 @@ module Bitfab
|
|
|
319
324
|
unless attempts.is_a?(Integer) && attempts.between?(1, 100)
|
|
320
325
|
raise ArgumentError, "attempts must be an integer from 1 to 100."
|
|
321
326
|
end
|
|
327
|
+
if experiment_group_name && experiment_group_id.nil?
|
|
328
|
+
raise ArgumentError, "experiment_group_name only applies with experiment_group_id. Pass it together with experiment_group_id."
|
|
329
|
+
end
|
|
322
330
|
item_finish_callback = on_item_finish || on_progress
|
|
323
331
|
if trace_ids
|
|
324
332
|
raise ArgumentError, "trace_ids must contain at least one trace ID." if trace_ids.empty?
|
|
@@ -398,6 +406,7 @@ module Bitfab
|
|
|
398
406
|
code_change_description:,
|
|
399
407
|
code_change_files:,
|
|
400
408
|
experiment_group_id:,
|
|
409
|
+
experiment_group_name:,
|
|
401
410
|
include_db_branch_lease:,
|
|
402
411
|
dataset_ids: resolved_dataset_ids,
|
|
403
412
|
grader_ids:,
|
|
@@ -20,7 +20,7 @@ module Bitfab
|
|
|
20
20
|
class ReplayRegistry
|
|
21
21
|
OPTION_NAMES = %i[
|
|
22
22
|
limit trace_ids name notes metadata concurrency max_concurrency code_change_description
|
|
23
|
-
code_change_files experiment_group_id dataset_id dataset_ids grader_ids mock
|
|
23
|
+
code_change_files experiment_group_id experiment_group_name dataset_id dataset_ids grader_ids mock
|
|
24
24
|
mock_override adapt_inputs db_branch attempts only_with_assertions skip_assertion_judging judge_assertions dry_run on_item_finish
|
|
25
25
|
].freeze
|
|
26
26
|
|
|
@@ -190,7 +190,7 @@ module Bitfab
|
|
|
190
190
|
options[:limit] = bound || 10
|
|
191
191
|
end
|
|
192
192
|
|
|
193
|
-
%i[name notes metadata max_concurrency experiment_group_id dataset_ids grader_ids mock attempts only_with_assertions skip_assertion_judging dry_run].each do |key|
|
|
193
|
+
%i[name notes metadata max_concurrency experiment_group_id experiment_group_name dataset_ids grader_ids mock attempts only_with_assertions skip_assertion_judging dry_run].each do |key|
|
|
194
194
|
options[key] = args[key] unless args[key].nil?
|
|
195
195
|
end
|
|
196
196
|
|
|
@@ -339,7 +339,11 @@ module Bitfab
|
|
|
339
339
|
args[:max_concurrency] = positive_integer("--max-concurrency", value)
|
|
340
340
|
end
|
|
341
341
|
options.on("--code-change PATH") { |value| args[:code_change] = value }
|
|
342
|
-
options.on("--experiment-group-id UUID"
|
|
342
|
+
options.on("--experiment-group-id UUID",
|
|
343
|
+
"Add this run to an experiment group. A UUID no group has yet creates the group.") { |value| args[:experiment_group_id] = value }
|
|
344
|
+
options.on("--experiment-group-name NAME",
|
|
345
|
+
"Name the experiment group when this run creates it or it has no name yet. " \
|
|
346
|
+
"A group that already has a name keeps it. Requires --experiment-group-id.") { |value| args[:experiment_group_name] = value }
|
|
343
347
|
options.on("--dataset-ids IDS", "--dataset-id IDS") { |value| args[:dataset_ids] = comma_separated("--dataset-ids", value) }
|
|
344
348
|
options.on("--grader-ids IDS") { |value| args[:grader_ids] = comma_separated("--grader-ids", value) }
|
|
345
349
|
options.on("--attempts N", Integer) { |value| args[:attempts] = positive_integer("--attempts", value) }
|
data/lib/bitfab/version.rb
CHANGED