bitfab 0.65.6 → 0.65.7

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: 614f7adf31df970f2961c5ce1bd647d0e875e7e0324e3cad4279846b6a0a2393
4
- data.tar.gz: 9dff87903a5c97d9cf0ea9cc705840b6015c21ee0a03d2f89943a76e694d4226
3
+ metadata.gz: 84d81613e344f01a011f28ac437476d22e73867eb7ab2df04579075730b1c73b
4
+ data.tar.gz: d3bb4d9f79d587dca9ee2ef2e1ee36a41fbeb59da7cb69960bf9fdbe75e8d663
5
5
  SHA512:
6
- metadata.gz: a49875ee7ef5769bd78e1a6faf8095fc25c67aa2edb54dfc945c33dc26788881182204ccc21f9799c060fbba3c6f582293863f459beb3a0eab476fde47ee7979
7
- data.tar.gz: f78dc742e2b597b173a7270d9c49486bbccff14f1439e54f6d9406b67c78fcf88838125ce8d480065f54ccf9d5783381455204ef96b50ab1bc5ffdaf38d39580
6
+ metadata.gz: 18ceec3ef05433309efff835c6bcf050789439e9d0424f9919972a70dd5d5b358eb07641fbed220d36b52e92f503d719dee044ba18003fb1371d77d0dba2e8e3
7
+ data.tar.gz: a6743709c41b9b69597e43e5c1336af5038bf9e5c56d5e3b247051e12fb4527d9732d79bb98e3587f90aedfbc59f7e23ebeae6c0d02e1bfad712f37d6789dd00
@@ -13,7 +13,11 @@ module Bitfab
13
13
  end
14
14
 
15
15
  # Each returned assertion carries "category_id" and, with the same value,
16
- # the deprecated "category_assertion_id".
16
+ # the deprecated "category_assertion_id". It also carries "rewrite", the
17
+ # latest check of its text (the same hash a save returns), or nil when no
18
+ # check ever ran on it. Read a "pending" check from a save back here once
19
+ # it finishes, and save each of its "separateAssertions" as its own
20
+ # assertion.
17
21
  def get_assertions(trace_id)
18
22
  response = @http_client.get(assertions_path(trace_id))
19
23
  return response unless response.is_a?(Hash) && response["assertions"].is_a?(Array)
@@ -24,17 +28,41 @@ module Bitfab
24
28
  # Assertion hashes take "category_id": omit it to keep the assignment, or
25
29
  # pass nil to clear it. The deprecated "category_assertion_id" is still
26
30
  # accepted and sent as "category_id"; "category_id" wins when both are set.
27
- def save_assertions(trace_id, assertions, source: "agent")
28
- save_assertions_all([{"traceId" => trace_id, "assertions" => assertions}], source:)
31
+ #
32
+ # By default, after the save, Bitfab checks each assertion's text against its
33
+ # trace. When the text bundles two claims, adds a condition, points at a
34
+ # value instead of stating it, names an id from the recorded run, or cannot
35
+ # be measured, Bitfab rewrites it and saves the rewritten text in place of
36
+ # the text you sent. This method returns as soon as the text is saved: each
37
+ # checked assertion comes back with "status" "pending", and Bitfab rewrites
38
+ # it in place in the background, usually within a minute. Read the result
39
+ # later with {#get_assertions}, whose assertions carry the same "rewrite"
40
+ # hash. Pass skip_guided_rewrite: true to save the text exactly as sent,
41
+ # with no check.
42
+ #
43
+ # Each returned assertion carries a "rewrite" hash: "status" ("pending",
44
+ # "rewritten", "unchanged", "not_checked", or "check_failed"),
45
+ # "sentAssertion", "changes", "separateAssertions", "unresolved", and
46
+ # "error". A check not finished 15 minutes after the save reads as
47
+ # "check_failed", with the text as sent. Save each of
48
+ # "separateAssertions" as its own assertion, since the saved one keeps
49
+ # only one claim.
50
+ def save_assertions(trace_id, assertions, source: "agent", skip_guided_rewrite: false)
51
+ save_assertions_all([{"traceId" => trace_id, "assertions" => assertions}], source:, skip_guided_rewrite:)
29
52
  end
30
53
 
31
- # Same assertion hash keys as {#save_assertions}, for several traces at once.
32
- def save_assertions_all(updates, source: "agent")
54
+ # Same assertion hash keys, rewrite, and returned "rewrite" hash as
55
+ # {#save_assertions}, for several traces at once.
56
+ def save_assertions_all(updates, source: "agent", skip_guided_rewrite: false)
33
57
  return [] if updates.empty?
34
58
 
35
59
  saved = @http_client.request(
36
60
  "/api/sdk/traces/assertions",
37
- {"updates" => updates.map { |update| with_new_category_key(update) }, "source" => source}
61
+ {
62
+ "updates" => updates.map { |update| with_new_category_key(update) },
63
+ "source" => source,
64
+ "guidedRewrite" => !skip_guided_rewrite
65
+ }
38
66
  )["assertions"]
39
67
  saved.is_a?(Array) ? saved.map { |assertion| with_both_category_keys(assertion) } : saved
40
68
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Bitfab
4
- VERSION = "0.65.6"
4
+ VERSION = "0.65.7"
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.65.6
4
+ version: 0.65.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Harvest Team