lib/Langertha/Skeid/NodeFiles.pm

filter: Statementstmt 100% 132 / 132 Branchbran 85.5% 77 / 90 Conditioncond 67.0% 53 / 79 MC/DCmcdc 42.8% 18 / 42 Subroutinesub 100% 13 / 13 Podpod 100% 3 / 3 totaltotal 82.4% 296 / 359 CC 77 SCAR 32.6
CC
77
Cov
87%
check
40.2
normalize_config
27.5
read_file
11.7
CRAP 26.1
« lib/Langertha/Skeid/OpenAPI.pm ↑ Summary lib/Langertha/Skeid/Protocol/Anthropic/Stream.pm »
1 package Langertha::Skeid::NodeFiles;
2 127 our $VERSION = '0.005';
3 # ABSTRACT: Nodes from a second, less trusted file, under the constraints the main config sets
4 127 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 127 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 127 ▶use Carp qw(croak);
Subroutine BEGIN: called CC=1 SCAR=0.0
7 127 ▶use Mojo::URL;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 127 ▶use YAML::PP;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 127 ▶use Scalar::Util qw(blessed refaddr);
Subroutine BEGIN: called CC=1 SCAR=0.0
10 127 ▶use Langertha::Skeid::Protocol::Documents;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 127 ▶use Langertha::Skeid::Protocol::Rerank;
Subroutine BEGIN: called CC=1 SCAR=0.0
12 # The node vocabulary (trust) is the control plane's; it loads this module too, so no import.
13 127 ▶use Langertha::Skeid ();
Subroutine BEGIN: called CC=1 SCAR=0.0
14  
15  
16 # The fields a node from a node file may carry. `capacity` is left out: a probe makes Skeid poll
17 # a URL of the node's choosing, and a custom probe names code.
18 127 my %FIELD = map { $_ => 1 } qw(
19 id url model engine weight max_conns healthy tags metadata
20 api_key_env api_key_ref api_key_header kind rerank_format trust
21 );
22  
23  
24 28 ▶sub normalize_config {
Subroutine normalize_config: called CC=26 SCAR=33.1
Pod documented
25 28 my ($class, $list) = @_;
26 28 ▶ croak 'node_files must be a list' unless ref($list) eq 'ARRAY';
Branch: 1 branch
BranchTrueFalseTotal
unless ref $list eq "ARRAY" 1 27 28
27 27 my (@entries, %seen);
28 27 for my $i (0 .. $#$list) {
29 28 my $raw = $list->[$i];
30 28 my $at = "node_files[$i]";
31 28 ▶ croak "$at must be a mapping" unless ref($raw) eq 'HASH';
Branch: 1 branch
BranchTrueFalseTotal
unless ref $raw eq "HASH" 0 28 28
32 28 my $path = $raw->{path};
33 28 ▶ croak "$at: path required" unless defined($path) && !ref($path) && length($path);
Branch: 1 branch
BranchTrueFalseTotal
unless defined $path and not ref $path and length $path 1 27 28
Condition66%4/6
defined $path and not ref $path and length $path
!ll&&!rl&&r
1027
defined $path and not ref $path
!ll&&!rl&&r
1027
MC/DC33%1/3
defined $path and not ref $path and length $path
defined $path not ref $path length $path
Truth table50%2/4
A and not(B) and C
A= defined $pathB= not ref $pathC= length $path
ABCresult
0XX0
10X0
1100
1111
34 27 ▶ croak "$at: path $path is listed twice" if $seen{$path}++;
Branch: 1 branch
BranchTrueFalseTotal
if $seen{$path}++ 1 26 27
35  
36 26 my $env_re;
37 26 ▶ if (defined(my $re = $raw->{allow_api_key_env})) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined(my $re = $raw->{"allow_api_key_env"})) 12 14 26
38 12 ▶ croak "$at: allow_api_key_env must be a regular expression" if ref $re;
Branch: 1 branch
BranchTrueFalseTotal
if ref $re 0 12 12
39 12 ▶ $env_re = eval { qr/$re/ } or croak "$at: allow_api_key_env is not a valid regular expression";
Branch: 1 branch
BranchTrueFalseTotal
$env_re = eval { do { qr/$re/ } } or croak("${at}: allow_api_key_env is not a valid regular expression") 11 1 12
40 }
41  
42 25 my $hosts = $raw->{allow_url_hosts};
43 25 ▶ croak "$at: allow_url_hosts must list at least one host pattern"
Branch: 1 branch
BranchTrueFalseTotal
unless ref $hosts eq "ARRAY" and @$hosts 1 24 25
Condition66%2/3
ref $hosts eq "ARRAY" and @$hosts
!ll&&!rl&&r
1024
MC/DC50%1/2
ref $hosts eq "ARRAY" and @$hosts
ref $hosts eq "ARRAY" @$hosts
Truth table66%2/3
A and B
A= ref $hosts eq "ARRAY"B= @$hosts
ABresult
0X0
100
111
44 unless ref($hosts) eq 'ARRAY' && @$hosts;
45 24 my @host_res;
46 24 for my $pattern (@$hosts) {
47 25 ▶ croak "$at: allow_url_hosts holds a pattern that is no host name"
Branch: 1 branch
BranchTrueFalseTotal
unless defined $pattern and not ref $pattern and $pattern =~ /\A[A-Za-z0-9*][A-Za-z0-9*.\-]*\z/ 1 24 25
Condition50%3/6
defined $pattern and not ref $pattern and $pattern =~ /\A[A-Za-z0-9*][A-Za-z0-9*.\-]*\z/
!ll&&!rl&&r
0124
defined $pattern and not ref $pattern
!ll&&!rl&&r
0025
MC/DC33%1/3
defined $pattern and not ref $pattern and $pattern =~ /\A[A-Za-z0-9*][A-Za-z0-9*.\-]*\z/
defined $pattern not ref $pattern $pattern =~ /\A[A-Za-z0-9*][A-Za-z0-9*.\-]*\z/
Truth table50%2/4
A and not(B) and C
A= defined $patternB= not ref $patternC= $pattern =~ /\A[A-Za-z0-9*][A-Za-z0-9*.\-]*\z/
ABCresult
0XX0
10X0
1100
1111
48 unless defined($pattern) && !ref($pattern) && $pattern =~ /\A[A-Za-z0-9*][A-Za-z0-9*.\-]*\z/;
49 24 ▶ my $re = join '\.', map { $_ eq '*' ? '[^.]+' : quotemeta($_) } split /\./, lc $pattern, -1;
Branch: 1 branch
BranchTrueFalseTotal
$_ eq '*' ? : 20 48 68
50 24 push @host_res, qr/\A$re\z/;
51 }
52  
53 23 ▶ my $kinds = exists($raw->{allow_kinds}) ? $raw->{allow_kinds} : ['chat'];
Branch: 1 branch
BranchTrueFalseTotal
exists $raw->{'allow_kinds'} ? : 8 15 23
54 23 ▶ croak "$at: allow_kinds must be a list" unless ref($kinds) eq 'ARRAY';
Branch: 1 branch
BranchTrueFalseTotal
unless ref $kinds eq "ARRAY" 0 23 23
55 23 my %kinds;
56 23 for my $kind (@$kinds) {
57 my $norm = (defined($kind) && lc($kind) eq 'chat') ? ''
58 30 ▶ : eval { Langertha::Skeid::Protocol::Documents->normalize_kind($kind) };
Branch: 1 branch
BranchTrueFalseTotal
defined $kind && lc $kind eq 'chat' ? : 22 8 30
Condition66%2/3
defined $kind and lc $kind eq "chat"
!ll&&!rl&&r
0822
MC/DC50%1/2
defined $kind and lc $kind eq "chat"
defined $kind lc $kind eq "chat"
Truth table66%2/3
A and B
A= defined $kindB= lc $kind eq "chat"
ABresult
0X0
100
111
59 30 ▶ croak "$at: allow_kinds names an unknown kind" unless defined $norm;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $norm 1 29 30
60 29 $kinds{$norm} = 1;
61 }
62  
63 22 ▶ my $trust = eval { Langertha::Skeid->normalize_trust($raw->{trust}) }
Condition100%2/2
eval { do { "Langertha::Skeid"->normalize_trust($raw->{"trust"}) } } // croak("${at}: trust must be internal or external")
l!l
211
MC/DC100%1/1
eval { do { "Langertha::Skeid"->normalize_trust($raw->{"trust"}) } } // croak("${at}: trust must be internal or external")
eval { do { "Langertha::Skeid"->normalize_trust($raw->{"trust"}) } }
Truth table100%2/2
A
A= eval { do { "Langertha::Skeid"->normalize_trust($raw->{"trust"}) } }
Aresult
11
00
64 // croak "$at: trust must be internal or external";
65  
66 push @entries, {
67 path => "$path",
68 trust => $trust,
69 allow_api_key_env => $env_re,
70 21 ▶ allow_api_key_ref => ($raw->{allow_api_key_ref} ? 1 : 0),
Branch: 1 branch
BranchTrueFalseTotal
$raw->{'allow_api_key_ref'} ? : 0 21 21
71 allow_url_hosts => \@host_res,
72 allow_kinds => \%kinds,
73 };
74 }
75 20 return \@entries;
76 }
77  
78  
79 # A node file is a list of a few hundred nodes at most. Its writer is less trusted, so what it
80 # may cost to read is bounded: the bytes, the nesting, and no YAML alias -- an alias shares a
81 # structure, and a few hundred bytes of nested aliases expand to more than any walk of it can
82 # afford (the config digest walks every node on the event loop).
83 127 my $MAX_BYTES = 1024 * 1024;
84 127 my $MAX_DEPTH = 16;
85  
86 18 ▶sub read_file {
Subroutine read_file: called CC=11 SCAR=24.6
Pod documented
87 18 my ($class, $path) = @_;
88 18 my $size = -s $path;
89 18 ▶ die "node file $path is larger than $MAX_BYTES bytes\n" if defined($size) && $size > $MAX_BYTES;
Branch: 1 branch
BranchTrueFalseTotal
if defined $size and $size > $MAX_BYTES 0 18 18
Condition33%1/3
defined $size and $size > $MAX_BYTES
!ll&&!rl&&r
0180
MC/DC0%0/2
defined $size and $size > $MAX_BYTES
defined $size $size > $MAX_BYTES
Truth table33%1/3
A and B
A= defined $sizeB= $size > $MAX_BYTES
ABresult
0X0
100
111
90 18 my $data;
91 18 ▶ unless (eval { $data = YAML::PP->new->load_file($path); 1 }) {
Branch: 1 branch
BranchTrueFalseTotal
unless (eval { do { $data = "YAML::PP"->new->load_file($path); 1 } }) 1 17 18
92 1 my ($line) = ($@ =~ /line:?\s*(\d+)/i);
93 1 ▶ die "node file $path is not valid YAML" . (defined $line ? " (line $line)" : '') . "\n";
Branch: 1 branch
BranchTrueFalseTotal
defined $line ? : 1 0 1
94 }
95 17 ▶ return [] unless defined $data;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $data 0 17 17
96 17 my $problem = _shape_problem($data);
97 17 ▶ die "node file $path $problem\n" if $problem;
Branch: 1 branch
BranchTrueFalseTotal
if $problem 2 15 17
98 15 ▶ if (ref($data) eq 'HASH') {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $data eq "HASH") 3 12 15
99 3 ▶ die "node file $path may hold only nodes\n" if grep { $_ ne 'nodes' } keys %$data;
Branch: 1 branch
BranchTrueFalseTotal
if grep {$_ ne "nodes";} keys %$data 1 2 3
100 2 ▶ $data = $data->{nodes} // [];
Condition50%1/2
$data->{"nodes"} // []
l!l
20
MC/DC0%0/1
$data->{"nodes"} // []
$data->{"nodes"}
Truth table50%1/2
A
A= $data->{"nodes"}
Aresult
11
00
101 }
102 14 ▶ die "node file $path must be a list of nodes\n" unless ref($data) eq 'ARRAY';
Branch: 1 branch
BranchTrueFalseTotal
unless ref $data eq "ARRAY" 0 14 14
103 14 return $data;
104 }
105  
106 # Why a loaded structure is not acceptable from a less trusted writer, or undef: a structure
107 # reached twice (a YAML alias), or nesting deeper than $MAX_DEPTH.
108 17 ▶sub _shape_problem {
Subroutine _shape_problem: called CC=8 SCAR=20.8
109 17 my ($data) = @_;
110 17 my %seen;
111 17 my @todo = ([ $data, 0 ]);
112 17 ▶ while (my $item = pop @todo) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $item = pop @todo) 160 15 175
113 160 my ($node, $depth) = @$item;
114 160 ▶ next unless ref $node;
Branch: 1 branch
BranchTrueFalseTotal
unless ref $node 84 76 160
115 76 ▶ next if blessed($node);
Branch: 1 branch
BranchTrueFalseTotal
if builtin::blessed($node) 0 76 76
116 76 ▶ return 'uses a YAML alias or anchor' if $seen{refaddr $node}++;
Branch: 1 branch
BranchTrueFalseTotal
if $seen{builtin::refaddr($node)}++ 1 75 76
117 75 ▶ return "nests deeper than $MAX_DEPTH levels" if $depth > $MAX_DEPTH;
Branch: 1 branch
BranchTrueFalseTotal
if $depth > $MAX_DEPTH 1 74 75
118 74 ▶ my @children = ref($node) eq 'HASH' ? values %$node : ref($node) eq 'ARRAY' ? @$node : ();
Branch: 2 branches
BranchTrueFalseTotal
ref $node eq 'HASH' ? : 35 39 74
ref $node eq 'ARRAY' ? : 39 0 39
119 74 push @todo, map { [ $_, $depth + 1 ] } @children;
120 }
121 15 return undef;
122 }
123  
124  
125 37 ▶sub check {
Subroutine check: called CC=35 SCAR=37.0
Pod documented
126 37 my ($class, $skeid, $entry, $node) = @_;
127 37 ▶ return 'entry' unless ref($node) eq 'HASH';
Branch: 1 branch
BranchTrueFalseTotal
unless ref $node eq "HASH" 1 36 37
128 36 ▶ return 'field' if grep { !$FIELD{$_} } keys %$node;
Branch: 1 branch
BranchTrueFalseTotal
if grep {not $FIELD{$_};} keys %$node 1 35 36
129 35 ▶ return 'id' unless defined($node->{id}) && !ref($node->{id}) && length($node->{id});
Branch: 1 branch
BranchTrueFalseTotal
unless defined $node->{"id"} and not ref $node->{"id"} and length $node->{"id"} 1 34 35
Condition66%4/6
defined $node->{"id"} and not ref $node->{"id"} and length $node->{"id"}
!ll&&!rl&&r
1034
defined $node->{"id"} and not ref $node->{"id"}
!ll&&!rl&&r
1034
MC/DC33%1/3
defined $node->{"id"} and not ref $node->{"id"} and length $node->{"id"}
defined $node->{"id"} not ref $node->{"id"} length $node->{"id"}
Truth table50%2/4
A and not(B) and C
A= defined $node->{"id"}B= not ref $node->{"id"}C= length $node->{"id"}
ABCresult
0XX0
10X0
1100
1111
130 34 ▶ return 'url' unless defined($node->{url}) && !ref($node->{url}) && length($node->{url});
Branch: 1 branch
BranchTrueFalseTotal
unless defined $node->{"url"} and not ref $node->{"url"} and length $node->{"url"} 0 34 34
Condition33%2/6
defined $node->{"url"} and not ref $node->{"url"} and length $node->{"url"}
!ll&&!rl&&r
0034
defined $node->{"url"} and not ref $node->{"url"}
!ll&&!rl&&r
0034
MC/DC0%0/3
defined $node->{"url"} and not ref $node->{"url"} and length $node->{"url"}
defined $node->{"url"} not ref $node->{"url"} length $node->{"url"}
Truth table25%1/4
A and not(B) and C
A= defined $node->{"url"}B= not ref $node->{"url"}C= length $node->{"url"}
ABCresult
0XX0
10X0
1100
1111
131  
132 34 my $url = Mojo::URL->new($node->{url});
133 34 ▶ my $scheme = lc($url->scheme // '');
Condition50%1/2
$url->scheme // ""
l!l
340
MC/DC0%0/1
$url->scheme // ""
$url->scheme
Truth table50%1/2
A
A= $url->scheme
Aresult
11
00
134 34 ▶ my $host = lc($url->host // '');
Condition50%1/2
$url->host // ""
l!l
340
MC/DC0%0/1
$url->host // ""
$url->host
Truth table50%1/2
A
A= $url->host
Aresult
11
00
135 return 'url_host' unless ($scheme eq 'http' || $scheme eq 'https') && length($host)
136 && !defined($url->userinfo)
137 34 ▶ && grep { $host =~ $_ } @{$entry->{allow_url_hosts}};
Branch: 1 branch
BranchTrueFalseTotal
unless $scheme eq "http" || $scheme eq "https" and length $host and not defined $url->userinfo and grep {$host =~ /$_/;} @{$$entry{"allow_url_hosts"};} 8 26 34
Condition91%11/12
$scheme eq "http" || $scheme eq "https" and length $host and not defined $url->userinfo and grep {$host =~ /$_/;} @{$$entry{"allow_url_hosts"};}
!ll&&!rl&&r
2626
$scheme eq "http" || $scheme eq "https" and length $host and not defined $url->userinfo
!ll&&!rl&&r
1132
$scheme eq "http" || $scheme eq "https" and length $host
!ll&&!rl&&r
1033
$scheme eq "http" or $scheme eq "https"
l!l&&r!l&&!r
3121
MC/DC80%4/5
$scheme eq "http" || $scheme eq "https" and length $host and not defined $url->userinfo and grep {$host =~ /$_/;} @{$$entry{"allow_url_hosts"};}
$scheme eq "http" $scheme eq "https" length $host not defined $url->userinfo grep {$host =~ /$_/;} @{$$entry{"allow_url_hosts"};}
Truth table66%6/9
A or B and C and not(D) and E
A= $scheme eq "http"B= $scheme eq "https"C= length $hostD= not defined $url->userinfoE= grep {$host =~ /$_/;} @{$$entry{"allow_url_hosts"};}
ABCDEresult
00XXX0
1X0XX0
010XX0
1X10X0
0110X0
1X1100
011100
1X1111
011111
138  
139 26 ▶ if (defined($node->{api_key_env}) && length($node->{api_key_env})) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $node->{"api_key_env"} and length $node->{"api_key_env"}) 6 20 26
Condition66%2/3
defined $node->{"api_key_env"} and length $node->{"api_key_env"}
!ll&&!rl&&r
2006
MC/DC50%1/2
defined $node->{"api_key_env"} and length $node->{"api_key_env"}
defined $node->{"api_key_env"} length $node->{"api_key_env"}
Truth table66%2/3
A and B
A= defined $node->{"api_key_env"}B= length $node->{"api_key_env"}
ABresult
0X0
100
111
140 6 my $re = $entry->{allow_api_key_env};
141 6 ▶ return 'api_key_env' if ref($node->{api_key_env}) || !$re || $node->{api_key_env} !~ /\A(?:$re)\z/;
Branch: 1 branch
BranchTrueFalseTotal
if ref $node->{"api_key_env"} or not $re or not $node->{"api_key_env"} =~ /\A(?:$re)\z/ 2 4 6
Condition83%5/6
ref $node->{"api_key_env"} or not $re or not $node->{"api_key_env"} =~ /\A(?:$re)\z/
l!l&&r!l&&!r
114
ref $node->{"api_key_env"} or not $re
l!l&&r!l&&!r
015
MC/DC66%2/3
ref $node->{"api_key_env"} or not $re or not $node->{"api_key_env"} =~ /\A(?:$re)\z/
ref $node->{"api_key_env"} not $re not $node->{"api_key_env"} =~ /\A(?:$re)\z/
Truth table75%3/4
A or not(B) or not(C)
A= ref $node->{"api_key_env"}B= not $reC= not $node->{"api_key_env"} =~ /\A(?:$re)\z/
ABCresult
1XX1
01X1
0011
0000
142 }
143 return 'api_key_ref'
144 24 ▶ if defined($node->{api_key_ref}) && length($node->{api_key_ref}) && !$entry->{allow_api_key_ref};
Branch: 1 branch
BranchTrueFalseTotal
if defined $node->{"api_key_ref"} and length $node->{"api_key_ref"} and not $entry->{"allow_api_key_ref"} 1 23 24
Condition66%4/6
defined $node->{"api_key_ref"} and length $node->{"api_key_ref"} and not $entry->{"allow_api_key_ref"}
!ll&&!rl&&r
2301
defined $node->{"api_key_ref"} and length $node->{"api_key_ref"}
!ll&&!rl&&r
2301
MC/DC33%1/3
defined $node->{"api_key_ref"} and length $node->{"api_key_ref"} and not $entry->{"allow_api_key_ref"}
defined $node->{"api_key_ref"} length $node->{"api_key_ref"} not $entry->{"allow_api_key_ref"}
Truth table50%2/4
A and B and not(C)
A= defined $node->{"api_key_ref"}B= length $node->{"api_key_ref"}C= not $entry->{"allow_api_key_ref"}
ABCresult
0XX0
10X0
1100
1111
145  
146 # The zone is the main config's to grant (ADR 0032): a node may repeat its entry's trust, and
147 # anything else -- a wider zone, a narrower one, a value that is none -- rejects it. An
148 # external node without a key of its own is what the main config refuses to load; here it is
149 # this node that is left out, not the load that fails.
150 23 ▶ my $trust = $entry->{trust} // 'external';
Condition50%1/2
$entry->{"trust"} // "external"
l!l
230
MC/DC0%0/1
$entry->{"trust"} // "external"
$entry->{"trust"}
Truth table50%1/2
A
A= $entry->{"trust"}
Aresult
11
00
151 23 ▶ if (exists $node->{trust}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $node->{"trust"}) 4 19 23
152 4 my $named = eval { $skeid->normalize_trust($node->{trust}) };
153 4 ▶ return 'trust' unless defined($named) && $named eq $trust;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $named and $named eq $trust 2 2 4
Condition66%2/3
defined $named and $named eq $trust
!ll&&!rl&&r
022
MC/DC50%1/2
defined $named and $named eq $trust
defined $named $named eq $trust
Truth table66%2/3
A and B
A= defined $namedB= $named eq $trust
ABresult
0X0
100
111
154 }
155 21 ▶ return 'key_required' if $trust eq 'external' && !$skeid->node_has_key_source($node);
Branch: 1 branch
BranchTrueFalseTotal
if $trust eq "external" and not $skeid->node_has_key_source($node) 1 20 21
Condition100%3/3
$trust eq "external" and not $skeid->node_has_key_source($node)
!ll&&!rl&&r
1821
MC/DC100%2/2
$trust eq "external" and not $skeid->node_has_key_source($node)
$trust eq "external" not $skeid->node_has_key_source($node)
Truth table100%3/3
A and not(B)
A= $trust eq "external"B= not $skeid->node_has_key_source($node)
ABresult
0X0
100
111
156  
157 20 my $kind = eval { Langertha::Skeid::Protocol::Documents->normalize_kind($node->{kind}) };
158 20 ▶ return 'invalid' unless defined $kind;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $kind 0 20 20
159 20 ▶ return 'kind' unless $entry->{allow_kinds}{$kind};
Branch: 1 branch
BranchTrueFalseTotal
unless $entry->{"allow_kinds"}{$kind} 0 20 20
160  
161 20 ▶ return 'invalid' unless eval {
Branch: 1 branch
BranchTrueFalseTotal
unless eval { do { $skeid->normalize_engine_id(defined $node->{"engine"} && length $node->{"engine"} ? $node->{"engine"} : "OpenAIBase"); $skeid->normalize_tags($node->{"tags"}); "Langertha::Skeid::Protocol::Rerank"->normalize_format($node->{"rerank_format"}); "Langertha::Skeid::Protocol::Documents"->normalize_key_header($node->{"api_key_header"}); 1 } } 1 19 20
162 20 ▶ $skeid->normalize_engine_id((defined($node->{engine}) && length($node->{engine})) ? $node->{engine} : 'OpenAIBase');
Branch: 1 branch
BranchTrueFalseTotal
defined $node->{'engine'} && length $node->{'engine'} ? : 1 19 20
Condition66%2/3
defined $node->{"engine"} and length $node->{"engine"}
!ll&&!rl&&r
1901
MC/DC50%1/2
defined $node->{"engine"} and length $node->{"engine"}
defined $node->{"engine"} length $node->{"engine"}
Truth table66%2/3
A and B
A= defined $node->{"engine"}B= length $node->{"engine"}
ABresult
0X0
100
111
163 19 $skeid->normalize_tags($node->{tags});
164 19 Langertha::Skeid::Protocol::Rerank->normalize_format($node->{rerank_format});
165 19 Langertha::Skeid::Protocol::Documents->normalize_key_header($node->{api_key_header});
166 19 1;
167 };
168 19 return undef;
169 }
170  
171 127 1;
172  
173 __END__
« lib/Langertha/Skeid/OpenAPI.pm ↑ Summary lib/Langertha/Skeid/Protocol/Anthropic/Stream.pm »