Repository navigation
Commit 7d6d3a6
committed
fix(lab): keep the two exact-own override maps exact
Review feedback on #2077: routing every override map through
`modelRecordValue` was too broad, and for two of them it inverted the very
contract the PR is enforcing.
`modelPreferHostedTools` and `modelOpenRouterRouting` are deliberately exact
at runtime. The adapter reads the first through `hasOwnProperty`
(src/adapters/openai-responses.ts:1001) and `resolveOpenRouterRouting` reads
the second through `Object.hasOwn` (src/providers/openrouter-routing.ts:89);
the type documents the first as "Exact-model hosted tools"
(src/types.ts:1584). Family-resolving them would make the report say a
`gpt-oss` entry applies to `gpt-oss:120b` when the adapter never applies it --
the same divergence this PR removes, pointed the other way.
A bare index is not the answer for those two either: it walks the prototype
chain, which is the defect `modelValue` was changed to fix. `modelOpenRouterRouting`
was still a bare read at behavior.ts:87 and therefore still carried that bug.
Neither existing primitive fits, so this adds a third: `exactOwnValue`.
Split is now nine family-aware maps through `modelValue`, two exact-own maps
through `exactOwnValue`.
Five tests. The two "report agrees" cases are red if either map is sent back
through `modelRecordValue`; the ground-truth and control cases pass either way
by design. Ground truth for the routing half is executable --
`resolveOpenRouterRouting` is exported, and it returns the entry for the exact
key and undefined for the tagged sibling.
Also corrects the docblock's control flow, which the review flagged: the throw
is caught at src/routing/compatibility/subject.ts:125, which returns no route.
`resolvePassiveRouteSubjectId`'s catch is a second backstop and does not see it.1 parent 0ce4935 commit 7d6d3a6
2 files changed
Lines changed: 89 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
53 | 53 | | |
54 | 54 | | |
55 | 55 | | |
56 | | - | |
| 56 | + | |
57 | 57 | | |
58 | 58 | | |
59 | 59 | | |
| |||
62 | 62 | | |
63 | 63 | | |
64 | 64 | | |
65 | | - | |
66 | | - | |
67 | | - | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
68 | 73 | | |
69 | 74 | | |
70 | 75 | | |
71 | 76 | | |
72 | 77 | | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
73 | 96 | | |
74 | 97 | | |
75 | 98 | | |
| |||
84 | 107 | | |
85 | 108 | | |
86 | 109 | | |
87 | | - | |
| 110 | + | |
88 | 111 | | |
89 | 112 | | |
90 | 113 | | |
| |||
199 | 222 | | |
200 | 223 | | |
201 | 224 | | |
202 | | - | |
| 225 | + | |
203 | 226 | | |
204 | 227 | | |
205 | 228 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| 11 | + | |
| 12 | + | |
11 | 13 | | |
12 | 14 | | |
13 | 15 | | |
| |||
138 | 140 | | |
139 | 141 | | |
140 | 142 | | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
0 commit comments