bitfab 0.33.2 → 0.33.3

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: f3dd02ac43d3ed65f11a6dcf52aa0d0d3a331fa428fb568a74147f5007fc9e22
4
- data.tar.gz: 94b0cc1645fc42ce929a4fd1363de7ededc908f20dd411d3e7f8fd68d3bed0f8
3
+ metadata.gz: 44ebaac53c01dd84f179de5559eb3f00836c6c1a51f15520b8f10085bcfd6021
4
+ data.tar.gz: b7255113aef3706aefd3a1017520f24e6127503418965a0db23e70573fdd3d0e
5
5
  SHA512:
6
- metadata.gz: b3a07fecf4731278963e8db381a0bfc6b4677d17bd2464f36f1d5ccfd455a8d3f066273502674158c3ac3b99a180f3017b0c5185f8e6ff3795c87b7fd2c612cb
7
- data.tar.gz: 38e33c8a2dc6ab7e2e6a4c416bea15828a81724eb8ffe4b0fb440088e3b05fea53abaded2fa46bf2e852f7fd307cd5216d149b296b321a5399861861b08bd8d1
6
+ metadata.gz: de1b1c86dc8660477b87632d766e6f8fdf858d682248c9bd53d024fb3b423acc18d02d877ff567344e5a80aa686d0ad3e72bb02e8cc7dd099612e28ccdc02ad2
7
+ data.tar.gz: bb0ea7013f448acffa4644a359c0c38198ce9c74caf2b77c3d4d4c80a3f5b6f6f0bd73591ffd653b97c99af6518bc0c12460d69ac65314faf5d047541d731d1c
data/lib/bitfab/client.rb CHANGED
@@ -76,9 +76,14 @@ module Bitfab
76
76
  # @param trace_ids [Array<String>, nil] optional list of trace IDs to replay (max 100)
77
77
  # @param max_concurrency [Integer, nil] max threads for parallel replay (default: 10)
78
78
  # @param code_change_description [String, nil] optional rationale for the
79
- # code change being tested in this replay (stored on the experiment)
79
+ # code change being tested in this replay (stored on the experiment).
80
+ # When supplied without code_change_files, this text is preserved while
81
+ # the SDK automatically captures the files.
82
+ # Pass nil when the replay should have no description; use
83
+ # code_change_files: nil to suppress automatic file capture.
80
84
  # @param code_change_files [Array<Hash>, nil] optional list of edited files,
81
- # each as { path:, before:, after: } (use "" for new/deleted files)
85
+ # each as { path:, before:, after: } (use "" for new/deleted files).
86
+ # Omit to capture automatically, or pass nil to suppress file capture.
82
87
  # @param experiment_group_id [String, nil] optional UUID grouping multiple
83
88
  # replay runs into a single experiment batch
84
89
  # @param dataset_id [String, nil] optional UUID of the dataset this replay
@@ -118,7 +123,7 @@ module Bitfab
118
123
  # A raising callback never crashes the run.
119
124
  # @return [Hash] with :items, :test_run_id, :test_run_url
120
125
  def replay(receiver, method_name, trace_function_key:, limit: nil, trace_ids: nil, max_concurrency: 10,
121
- name: nil, code_change_description: nil, code_change_files: nil, experiment_group_id: nil, dataset_id: nil, grader_ids: nil, mock: "marked",
126
+ name: nil, code_change_description: Replay::CODE_CHANGE_UNSET, code_change_files: Replay::CODE_CHANGE_UNSET, experiment_group_id: nil, dataset_id: nil, grader_ids: nil, mock: "marked",
122
127
  adapt_inputs: nil, mock_override: nil, db_branch: nil, on_progress: nil)
123
128
  Replay.run(
124
129
  self, receiver, method_name,
data/lib/bitfab/replay.rb CHANGED
@@ -81,6 +81,8 @@ module Bitfab
81
81
 
82
82
  # Replay historical traces through a traced method and create a test run.
83
83
  module Replay
84
+ CODE_CHANGE_UNSET = Object.new.freeze
85
+
84
86
  module_function
85
87
 
86
88
  # Replay historical traces through a method and create a test run.
@@ -99,9 +101,14 @@ module Bitfab
99
101
  # @param name [String, nil] optional display name for the resulting experiment/test run
100
102
  # @param max_concurrency [Integer, nil] max threads for parallel replay (default: 10)
101
103
  # @param code_change_description [String, nil] optional rationale for the
102
- # code change being tested in this replay (stored on the experiment)
104
+ # code change being tested in this replay (stored on the experiment).
105
+ # When supplied without code_change_files, this text is preserved while
106
+ # the SDK automatically captures the files.
107
+ # Pass nil when the replay should have no description; use
108
+ # code_change_files: nil to suppress automatic file capture.
103
109
  # @param code_change_files [Array<Hash>, nil] optional list of edited files,
104
- # each as { path:, before:, after: } (empty string for new/deleted files)
110
+ # each as { path:, before:, after: } (empty string for new/deleted files).
111
+ # Omit to capture automatically, or pass nil to suppress file capture.
105
112
  # @param experiment_group_id [String, nil] optional UUID grouping multiple
106
113
  # replay runs into a single experiment batch
107
114
  # @param dataset_id [String, nil] optional UUID of the dataset this replay
@@ -140,7 +147,7 @@ module Bitfab
140
147
  # crashes the run.
141
148
  # @return [Hash] with :items, :test_run_id, :test_run_url
142
149
  def run(client, receiver, method_name, trace_function_key:, limit: nil, trace_ids: nil, name: nil,
143
- max_concurrency: 10, code_change_description: nil, code_change_files: nil, experiment_group_id: nil,
150
+ max_concurrency: 10, code_change_description: CODE_CHANGE_UNSET, code_change_files: CODE_CHANGE_UNSET, experiment_group_id: nil,
144
151
  dataset_id: nil, grader_ids: nil, mock: "marked",
145
152
  adapt_inputs: nil, mock_override: nil, db_branch: nil, on_progress: nil)
146
153
  unless MOCK_STRATEGIES.include?(mock.to_s)
@@ -187,18 +194,18 @@ module Bitfab
187
194
 
188
195
  include_db_branch_lease = !db_branch.nil?
189
196
 
190
- # An explicit code change always wins; only when the caller passed neither
191
- # field do we fall back to the payload the replay wrapper captured from git
192
- # and handed over via BITFAB_CODE_CHANGE_PATH. This is what makes an
193
- # experiment show its diff even when the run happened outside the
194
- # assistant's make-change rails.
195
- if code_change_description.nil? && code_change_files.nil?
197
+ # code_change_files controls capture: omitted auto-captures, an array
198
+ # wins, and explicit nil opts out. Preserve a caller-supplied description
199
+ # while filling only the omitted files.
200
+ if code_change_files.equal?(CODE_CHANGE_UNSET)
196
201
  captured = resolve_auto_code_change(name)
197
202
  unless captured.nil?
198
- code_change_description = captured[0]
199
203
  code_change_files = captured[1]
204
+ code_change_description = captured[0] if code_change_description.equal?(CODE_CHANGE_UNSET)
200
205
  end
201
206
  end
207
+ code_change_description = nil if code_change_description.equal?(CODE_CHANGE_UNSET)
208
+ code_change_files = nil if code_change_files.equal?(CODE_CHANGE_UNSET)
202
209
 
203
210
  resolved_db_branch_settings = db_branch_settings(db_branch)
204
211
  replay_data = http_client.start_replay(
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Bitfab
4
- VERSION = "0.33.2"
4
+ VERSION = "0.33.3"
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.33.2
4
+ version: 0.33.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Harvest Team