bitfab 0.62.6 → 0.63.0

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: b300b5a65bacd9fd60231bcab3ba96751c111ae7e5f12075a6149c163927cf65
4
- data.tar.gz: b3b61e0146d500bebc4719ca485e42e175bd0e8f78053d3fa451bb256d494407
3
+ metadata.gz: 1294a30cd222eeeb8abc13f1f5cf9b14e0b19ebdc1fe9de174aa146587f28edc
4
+ data.tar.gz: 2636b235d5359ebc72fe0aead7121e5b3ac3363302da51f8b0b5f270713702b5
5
5
  SHA512:
6
- metadata.gz: f16224c7b475fdfea0e847780b18d7e503b100250ec66523382a3f1bfa45e8b60281d52042de6dd0ac5f5b90bfea4a5585481fdaaa94500d019ce346ec81cb1d
7
- data.tar.gz: 836b9a8bdcfd24612213eefef798713e758b337b283ee1ff89ee62b1d17e60f12e8ba883b3532cd2a47430ee3968637e96375f9912f3c35d7df8290f9a7f460d
6
+ metadata.gz: e4695438f4fed3999fa5f0da499f639d94efaa9fcdf084b522c037a5a5129420e28895c9be10f8059cca89f80a26bbbb95f9e0d23d667cf419103b60ad28d951
7
+ data.tar.gz: 5ab3ffe5e5bdc8b826d25d2d809c3f5f2acb53910a7294fc0dc6380e2262711e57df10e5e15974c46fa9fc605967326d70e79203ae4ce7c875d105e2ee67e924
data/lib/bitfab/client.rb CHANGED
@@ -198,7 +198,7 @@ module Bitfab
198
198
  # @return [Hash] with :items, :experiment_id, :experiment_url, and the
199
199
  # deprecated aliases :test_run_id and :test_run_url carrying the same values
200
200
  def replay(receiver, method_name = nil, trace_function_key:, limit: nil, trace_ids: nil, concurrency: nil, max_concurrency: ReplayConcurrency::UNSET,
201
- 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, judge_assertions: false, dry_run: false,
201
+ 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,
202
202
  adapt_inputs: nil, mock_override: nil, db_branch: nil, on_item_start: nil, on_item_finish: nil, on_progress: nil,
203
203
  on_experiment_start: nil, experimental_selective_replay: nil)
204
204
  Replay.run(
@@ -215,6 +215,7 @@ module Bitfab
215
215
  max_concurrency:,
216
216
  attempts:,
217
217
  only_with_assertions:,
218
+ skip_assertion_judging:,
218
219
  judge_assertions:,
219
220
  dry_run:,
220
221
  code_change_description:,
@@ -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, notes: nil, metadata: nil, include_db_branch_lease: false, dataset_ids: nil,
265
- grader_ids: nil, db_branch_settings: nil, attempts: 1, only_with_assertions: false, judge_assertions: false, include_original_metadata: false, experimental_selective_replay: nil)
265
+ 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)
266
266
  payload = {
267
267
  "traceFunctionKey" => trace_function_key
268
268
  }
@@ -288,7 +288,7 @@ module Bitfab
288
288
  payload["graderIds"] = grader_ids unless grader_ids.nil?
289
289
  payload["attempts"] = attempts if attempts > 1
290
290
  payload["onlyWithAssertions"] = true if only_with_assertions
291
- payload["judgeAssertions"] = true if judge_assertions
291
+ payload["judgeAssertions"] = true unless skip_assertion_judging
292
292
  payload["includeOriginalMetadata"] = true if include_original_metadata
293
293
  payload["experimentalSelectiveReplay"] = experimental_selective_replay if experimental_selective_replay
294
294
  payload["dbBranchSettings"] = db_branch_settings unless db_branch_settings.nil?
data/lib/bitfab/replay.rb CHANGED
@@ -144,6 +144,8 @@ module Bitfab
144
144
  CODE_CHANGE_UNSET = Object.new.freeze
145
145
  PERSISTENCE_TIMEOUT_SECONDS = 30.0
146
146
  PERSISTENCE_POLL_SECONDS = 0.1
147
+ JUDGE_ASSERTIONS_DEPRECATION = "judge_assertions is deprecated. Assertion judging is on by default; " \
148
+ "pass skip_assertion_judging: true (--skip-assertion-judging) to turn it off."
147
149
 
148
150
  module_function
149
151
 
@@ -282,9 +284,10 @@ module Bitfab
282
284
  # deprecated aliases :test_run_id and :test_run_url carrying the same values
283
285
  def run(client, receiver, method_name, trace_function_key:, limit: nil, trace_ids: nil, name: nil, notes: nil, metadata: nil,
284
286
  concurrency: nil, max_concurrency: ReplayConcurrency::UNSET, code_change_description: CODE_CHANGE_UNSET, code_change_files: CODE_CHANGE_UNSET, experiment_group_id: nil,
285
- dataset_id: nil, dataset_ids: nil, grader_ids: nil, mock: "marked", attempts: ReplayConcurrency::UNSET, only_with_assertions: false, judge_assertions: false, dry_run: false,
287
+ 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,
286
288
  adapt_inputs: nil, mock_override: nil, db_branch: nil, on_item_start: nil, on_item_finish: nil, on_progress: nil,
287
289
  on_experiment_start: nil, experimental_selective_replay: nil)
290
+ skip_assertion_judging = resolve_skip_assertion_judging(skip_assertion_judging, judge_assertions)
288
291
  concurrency_options = ReplayConcurrency.resolve(concurrency, attempts, max_concurrency)
289
292
  attempts = concurrency_options.attempts
290
293
  max_concurrency = concurrency_options.max_concurrency
@@ -387,7 +390,7 @@ module Bitfab
387
390
  grader_ids:,
388
391
  attempts:,
389
392
  only_with_assertions:,
390
- judge_assertions:,
393
+ skip_assertion_judging:,
391
394
  include_original_metadata: !adapt_inputs.nil?,
392
395
  db_branch_settings: resolved_db_branch_settings,
393
396
  **(experimental_selective_replay ? {experimental_selective_replay: SelectiveReplay.wire_options(experimental_selective_replay)} : {})
@@ -562,11 +565,17 @@ module Bitfab
562
565
  # via BITFAB_CODE_CHANGE_PATH. Returns [description, files] or nil.
563
566
  # Best-effort: any error (no env var, missing file, bad JSON) yields nil so
564
567
  # the replay proceeds with no code change rather than raising.
565
- TRUNK_CANDIDATES = ["origin/HEAD", "origin/main", "origin/master", "main", "master"].freeze
566
568
  CC_MAX_FILES = 60
567
569
  CC_MAX_FILE_BYTES = 500_000
568
570
  CC_MAX_TOTAL_BYTES = 2_000_000
569
571
 
572
+ def resolve_skip_assertion_judging(skip_assertion_judging, judge_assertions)
573
+ return skip_assertion_judging if judge_assertions.nil?
574
+
575
+ Bitfab.warn_once("judge-assertions-deprecated", JUDGE_ASSERTIONS_DEPRECATION)
576
+ skip_assertion_judging || judge_assertions == false
577
+ end
578
+
570
579
  def resolve_dataset_ids(dataset_id, dataset_ids)
571
580
  if dataset_id && dataset_ids
572
581
  raise ArgumentError,
@@ -618,7 +627,8 @@ module Bitfab
618
627
  # Auto-capture the code change to attach when the caller passed none. Lives
619
628
  # in replay() (the one call guaranteed to run on every replay) so it works no
620
629
  # matter how the replay was launched. Precedence: a BITFAB_CODE_CHANGE_PATH
621
- # override, else the git diff vs trunk. Best-effort: any failure yields nil.
630
+ # override, else the git diff of the working tree vs HEAD (or vs the
631
+ # merge-base with BITFAB_CODE_CHANGE_BASE). Best-effort: any failure yields nil.
622
632
  # An explicit code_change_files always wins over this.
623
633
  def resolve_auto_code_change(label = nil)
624
634
  return nil if ENV["BITFAB_DISABLE_CODE_CHANGE_CAPTURE"]
@@ -657,23 +667,18 @@ module Bitfab
657
667
  !git(root, ["rev-parse", "--verify", "#{ref}^{object}"]).nil?
658
668
  end
659
669
 
660
- # Returns [base, from_trunk]; from_trunk is false on the HEAD fallback.
670
+ # Returns [base, against]. HEAD by default, so only uncommitted edits show;
671
+ # BITFAB_CODE_CHANGE_BASE moves the base to the merge-base with that ref.
661
672
  def cc_resolve_base(root)
662
673
  forced = ENV["BITFAB_CODE_CHANGE_BASE"]
663
674
  if forced && cc_ref_exists?(root, forced)
664
675
  mb = git(root, ["merge-base", "HEAD", forced])
665
- return [mb.strip, true] if mb && !mb.strip.empty?
676
+ return [mb.strip, "vs #{forced}"] if mb && !mb.strip.empty?
666
677
 
667
678
  rp = git(root, ["rev-parse", "--verify", forced])
668
- return (rp && !rp.strip.empty?) ? [rp.strip, true] : nil
669
- end
670
- TRUNK_CANDIDATES.each do |candidate|
671
- next unless cc_ref_exists?(root, candidate)
672
-
673
- mb = git(root, ["merge-base", "HEAD", candidate])
674
- return [mb.strip, true] if mb && !mb.strip.empty?
679
+ return (rp && !rp.strip.empty?) ? [rp.strip, "vs #{forced}"] : nil
675
680
  end
676
- cc_ref_exists?(root, "HEAD") ? ["HEAD", false] : nil
681
+ cc_ref_exists?(root, "HEAD") ? ["HEAD", "uncommitted (vs HEAD)"] : nil
677
682
  end
678
683
 
679
684
  def cc_blob_bytes(root, base, path)
@@ -697,7 +702,7 @@ module Bitfab
697
702
  resolved = cc_resolve_base(root)
698
703
  return nil if resolved.nil?
699
704
 
700
- base, from_trunk = resolved
705
+ base, against = resolved
701
706
 
702
707
  tracked = git(root, ["diff", "--name-status", "--find-renames", "-z", base, "--", ":!.bitfab"]) || ""
703
708
  untracked = git(root, ["ls-files", "--others", "--exclude-standard", "-z", "--", ":!.bitfab"]) || ""
@@ -737,7 +742,6 @@ module Bitfab
737
742
  subject = subject ? subject.strip : ""
738
743
  head = ((label && !label.strip.empty?) ? label.strip : nil) || (subject.empty? ? nil : subject) || "Working-tree change"
739
744
  word = (files.length == 1) ? "file" : "files"
740
- against = from_trunk ? "vs trunk" : "uncommitted (vs HEAD)"
741
745
  ["#{head} (#{files.length} #{word} changed #{against})", files]
742
746
  rescue
743
747
  nil
@@ -21,7 +21,7 @@ module Bitfab
21
21
  OPTION_NAMES = %i[
22
22
  limit trace_ids name notes metadata 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 judge_assertions dry_run on_item_finish
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
 
27
27
  def initialize
@@ -140,6 +140,7 @@ module Bitfab
140
140
  def run(registry, argv: ARGV, stdout: $stdout, stderr: $stderr)
141
141
  args = parse(registry, argv.dup)
142
142
  return SeedCli.run(registry, argv:, stdout:, stderr:) if args[:seed] || args[:from_trace]
143
+ stderr.puts "Bitfab: #{Replay::JUDGE_ASSERTIONS_DEPRECATION}" if args[:judge_assertions]
143
144
 
144
145
  registration = registry.fetch(args.fetch(:pipeline))
145
146
  options = registration.options.dup
@@ -188,7 +189,7 @@ module Bitfab
188
189
  options[:limit] = bound || 10
189
190
  end
190
191
 
191
- %i[name notes metadata max_concurrency experiment_group_id dataset_ids grader_ids mock attempts only_with_assertions judge_assertions dry_run].each do |key|
192
+ %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|
192
193
  options[key] = args[key] unless args[key].nil?
193
194
  end
194
195
 
@@ -325,8 +326,9 @@ module Bitfab
325
326
  options.on("--grader-ids IDS") { |value| args[:grader_ids] = comma_separated("--grader-ids", value) }
326
327
  options.on("--attempts N", Integer) { |value| args[:attempts] = positive_integer("--attempts", value) }
327
328
  options.on("--only-with-assertions") { args[:only_with_assertions] = true }
328
- options.on("--judge-assertions",
329
- "Judge each replay's approved assertions as it finishes (costs model calls)") { args[:judge_assertions] = true }
329
+ options.on("--skip-assertion-judging",
330
+ "Don't judge approved assertions on each replay; judging is on by default and costs model calls") { args[:skip_assertion_judging] = true }
331
+ options.on("--judge-assertions", "Deprecated: judging is on by default") { args[:judge_assertions] = true }
330
332
  options.on("--dry-run") { args[:dry_run] = true }
331
333
  options.on("--fail-on-error",
332
334
  "Exit 1 after printing the result when any replayed item errored. " \
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Bitfab
4
- VERSION = "0.62.6"
4
+ VERSION = "0.63.0"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bitfab
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.62.6
4
+ version: 0.63.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Harvest Team