bitfab 0.57.3 → 0.57.5
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/assertions.rb +14 -0
- data/lib/bitfab/labels.rb +8 -2
- 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: 92165fa184665398bce1631ce854955ecac99ca5cf867e6c1215131eacf7e62d
|
|
4
|
+
data.tar.gz: 739e4b154e2997e2f891cf1f6f75f0122cf43f2a10b6c971813168dbde89be7a
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 2595c70d4012142a2cee13ccbce4b771559aa69c1a1dab51efa51ff7591345cdcf9ab92cbd1cbf00745782b046d61d71156245a01040db8034b30a01c7d94f40
|
|
7
|
+
data.tar.gz: 43b5a52ab9221eb70c55d13b4d3dcc0cb2934e083439ab75f89ad78a9f01ad8694266ce7132beca8ecaba1a8f129aeb29be963bdeeac74966dd8b669e73c53b9
|
data/lib/bitfab/assertions.rb
CHANGED
|
@@ -3,9 +3,23 @@
|
|
|
3
3
|
require "uri"
|
|
4
4
|
|
|
5
5
|
module Bitfab
|
|
6
|
+
class TraceAssertions
|
|
7
|
+
def initialize(http_client)
|
|
8
|
+
@http_client = http_client
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def get_assertion_evidence(assertion_id)
|
|
12
|
+
encoded_id = URI.encode_www_form_component(assertion_id).gsub("+", "%20")
|
|
13
|
+
@http_client.get("/api/sdk/traces/assertions/#{encoded_id}/evidence")["evidence"]
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
|
|
6
17
|
class Traces
|
|
18
|
+
attr_reader :assertions
|
|
19
|
+
|
|
7
20
|
def initialize(http_client)
|
|
8
21
|
@http_client = http_client
|
|
22
|
+
@assertions = TraceAssertions.new(http_client)
|
|
9
23
|
end
|
|
10
24
|
|
|
11
25
|
def get_assertions(trace_id)
|
data/lib/bitfab/labels.rb
CHANGED
|
@@ -6,17 +6,21 @@ module Bitfab
|
|
|
6
6
|
class Labels
|
|
7
7
|
LABELS_PATH = "/api/sdk/traces/labels"
|
|
8
8
|
HUMAN_LABELS_PATH = "#{LABELS_PATH}/human"
|
|
9
|
+
EVIDENCE_UNSET = Object.new.freeze
|
|
10
|
+
|
|
11
|
+
private_constant :EVIDENCE_UNSET
|
|
9
12
|
|
|
10
13
|
def initialize(http_client)
|
|
11
14
|
@http_client = http_client
|
|
12
15
|
end
|
|
13
16
|
|
|
14
17
|
def save(label:, annotation:, trace_id: nil, original_trace_id: nil, attempt: nil,
|
|
15
|
-
confidence: nil, test_run_id: nil, assertion_id: nil)
|
|
18
|
+
confidence: nil, test_run_id: nil, assertion_id: nil, evidence: EVIDENCE_UNSET)
|
|
16
19
|
update = label_target(trace_id:, original_trace_id:, attempt:, assertion_id:)
|
|
17
20
|
update["label"] = label
|
|
18
21
|
update["annotation"] = annotation
|
|
19
22
|
update["confidence"] = confidence unless confidence.nil?
|
|
23
|
+
update["evidence"] = evidence unless evidence.equal?(EVIDENCE_UNSET)
|
|
20
24
|
save_all([update], test_run_id:).first
|
|
21
25
|
end
|
|
22
26
|
|
|
@@ -36,10 +40,12 @@ module Bitfab
|
|
|
36
40
|
save_all([update.merge("archive" => true)], test_run_id:).first
|
|
37
41
|
end
|
|
38
42
|
|
|
39
|
-
def save_human(label:, annotation:, trace_id:, confidence: nil, assertion_id: nil
|
|
43
|
+
def save_human(label:, annotation:, trace_id:, confidence: nil, assertion_id: nil,
|
|
44
|
+
evidence: EVIDENCE_UNSET)
|
|
40
45
|
update = {"traceId" => trace_id, "label" => label, "annotation" => annotation}
|
|
41
46
|
update["assertionId"] = assertion_id unless assertion_id.nil?
|
|
42
47
|
update["confidence"] = confidence unless confidence.nil?
|
|
48
|
+
update["evidence"] = evidence unless evidence.equal?(EVIDENCE_UNSET)
|
|
43
49
|
save_human_all([update]).first
|
|
44
50
|
end
|
|
45
51
|
|
data/lib/bitfab/version.rb
CHANGED