bitfab 0.75.2 → 0.75.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: 5b80995a3476aa0fd9dd0eb926924081189bd6dc85efbdf9fe5ad0a07f375dae
4
- data.tar.gz: 409f0f9b9837f142aed5233a6307fb30740f5409955dd0d74af8c9d36e27ebc6
3
+ metadata.gz: 0e8124c4242b339613c4f4b714a68305748f2c32e2d894fd884250bc8c1e4036
4
+ data.tar.gz: 9ed475b72f8f55b58334af9fe4feae30b07940aa9847c763fbccba227e21e41c
5
5
  SHA512:
6
- metadata.gz: fe3ae22d0d2da90db167cf4d968cf2fe71bcaba899fa3393ab822a8cc7682961c0fcb8aa9bf842e0630cca46827fbfed433813e1a1b2f0bf191f3766bee708c8
7
- data.tar.gz: 4490e80fdac9fbb0288177e158926e46e5c17f16889d11ce1b241579c98616bf144250a59def158ce771831edfaba80c046f9d2d78604b3079d582f495eb86c1
6
+ metadata.gz: 7b1356376e48cbaf2a8889fdf7c26945ed21050035603ae480e00d6da313acff4292c981d7f9be751b3dcfd37aa954d5ab6619d492a4f0547f8af5f99faddfdb
7
+ data.tar.gz: 15239246da620b92a67d87aa731974b22efe17fa97f2f25103491454a6ddd64327225a3b12f92f6df9ebc1770aceb82a7eb090a938ec31b95d32b0ba63ebd37e
@@ -4,11 +4,9 @@ require "uri"
4
4
 
5
5
  module Bitfab
6
6
  class Traces
7
- CODE_DRAFT_SAVE_TIMEOUT_SECONDS = 300
8
- CODED_KINDS = ["code", "hybrid", :code, :hybrid].freeze
9
7
  CATEGORY_ID_KEYS = ["category_id", :category_id].freeze
10
8
  DEPRECATED_CATEGORY_ID_KEYS = ["category_assertion_id", :category_assertion_id].freeze
11
- private_constant :CODE_DRAFT_SAVE_TIMEOUT_SECONDS, :CODED_KINDS, :CATEGORY_ID_KEYS, :DEPRECATED_CATEGORY_ID_KEYS
9
+ private_constant :CATEGORY_ID_KEYS, :DEPRECATED_CATEGORY_ID_KEYS
12
10
 
13
11
  def initialize(http_client)
14
12
  @http_client = http_client
@@ -31,31 +29,23 @@ module Bitfab
31
29
  # pass nil to clear it. The deprecated "category_assertion_id" is still
32
30
  # accepted and sent as "category_id"; "category_id" wins when both are set.
33
31
  #
34
- # "kind" says who decides the assertion: "judge" (the LLM judge), "code"
35
- # ("code" decides every replay), or "hybrid" ("code" decides what it can
36
- # and returns "defer" for the rest). Send "code" or "hybrid" together with
37
- # "code", {"source" => ..., "spanNames" => [...]}. "source" is the body of
38
- # an async TypeScript (or plain JavaScript) function called with spans
39
- # (each {name, index, hasData}, in start order, without its data), input,
40
- # and output. It reads span data with await named("span name") or await
41
- # span.data(), and returns "pass", "fail", or "defer" (hybrid only), or
42
- # {result, reason}, with one second of compute and the data of at most 50
43
- # spans loaded within ten seconds. "spanNames" lists every span a correct run is
44
- # expected to produce. Code that cannot run on the trace, or that returns
45
- # "defer" for a "code" assertion, is refused. Omit both to keep them, or
46
- # pass "kind" => "judge" to remove the code. Returned assertions carry
47
- # "kind", "code", and "codeBrokenReason".
48
- #
49
- # Send "kind" => "code" or "hybrid" without "code", on an assertion that
50
- # has no code yet, to have Bitfab write the code: the text is checked by
51
- # the guided rewrite (unless skipped), code of that kind is written and run
52
- # on the trace, and the save waits for both, so that entry's "rewrite" is
53
- # already final. Its returned "codeDraft" hash says what happened:
54
- # "requestedKind", "status" ("written", or "not_written" when no working
55
- # code could be written and the assertion was saved as "judge" without
56
- # code), and "reason" (why not, or nil). Every other entry's "codeDraft"
57
- # is nil. At most 10 assertions per save may ask for code this way, and a
58
- # save that asks for any waits up to five minutes.
32
+ # "code" is optional code that decides the assertion on a replay without
33
+ # the LLM judge: {"source" => ..., "spanNames" => [...]}. Send a "code"
34
+ # hash to set it, "code" => nil to remove it, or omit "code" to keep the
35
+ # current code. "source" is the body of an async TypeScript (or plain
36
+ # JavaScript) function called with spans (each {name, index, hasData}, in
37
+ # start order, without its data), input, and output. It reads span data
38
+ # with await named("span name") or await span.data(), with one second of
39
+ # compute and the data of at most 50 spans loaded within ten seconds. It
40
+ # returns "pass" or "fail", which decides the verdict with no judge call,
41
+ # or "defer" to hand the replay to the LLM judge, or {result, reason}. A
42
+ # defer may carry what the code found for the judge to read alongside the
43
+ # run: {result: "defer", reason, data}. A thrown error counts as "defer"
44
+ # with no data. "spanNames" lists every span a correct run is expected to
45
+ # produce. The code is run on the trace before saving and refused when it
46
+ # throws, times out, or returns anything other than a result. Returned
47
+ # assertions carry "code" (nil when the assertion has none) and
48
+ # "codeBrokenReason", which says why the code could not run on a replay.
59
49
  #
60
50
  # By default, after the save, Bitfab checks each assertion's text against its
61
51
  # trace. When the text bundles two claims, adds a condition, points at a
@@ -90,8 +80,7 @@ module Bitfab
90
80
  "updates" => updates.map { |update| with_new_category_key(update) },
91
81
  "source" => source,
92
82
  "guidedRewrite" => !skip_guided_rewrite
93
- },
94
- timeout: save_timeout(updates)
83
+ }
95
84
  )["assertions"]
96
85
  saved.is_a?(Array) ? saved.map { |assertion| with_both_category_keys(assertion) } : saved
97
86
  end
@@ -102,18 +91,6 @@ module Bitfab
102
91
 
103
92
  private
104
93
 
105
- def save_timeout(updates)
106
- asks = updates.any? do |update|
107
- (update["assertions"] || update[:assertions] || []).any? { |assertion| asks_bitfab_to_write_code?(assertion) }
108
- end
109
- asks ? CODE_DRAFT_SAVE_TIMEOUT_SECONDS : nil
110
- end
111
-
112
- def asks_bitfab_to_write_code?(assertion)
113
- kind = assertion["kind"] || assertion[:kind]
114
- CODED_KINDS.include?(kind) && !assertion.key?("code") && !assertion.key?(:code)
115
- end
116
-
117
94
  def assertions_path(trace_id, suffix = "")
118
95
  "/api/sdk/traces/#{URI.encode_www_form_component(trace_id).gsub("+", "%20")}/assertions#{suffix}"
119
96
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Bitfab
4
- VERSION = "0.75.2"
4
+ VERSION = "0.75.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.75.2
4
+ version: 0.75.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Harvest Team