Repository navigation
Commit 91dc04c
committed
Address review: reuse shared abort-signal helpers; warn on dropped API key
Replace the local raceWithAbortSignal/createAbortError pair with the
shared utils/abort-signal exports (rejectOnAbort +
createAbortError(providerName)), matching openai-codex.ts. The shared
helpers are strictly better shaped: the already-aborted branch
detaches a rejection handler from the pending promise, the listener
registers with { once: true }, and the error carries the provider
name (The Ollama request was aborted) per the series contract. Call
sites that may see an undefined signal (no metadata signal; merged
signal undefined when neither an external signal nor a positive
timeout applies) keep the no-race path explicit. The local helpers
and their dedicated unit block are removed; the shared helpers are
covered by utils/__tests__/abort-signal.spec.ts.
The plain-HTTP credential gate now console.warns when ollamaApiKey
is set but the endpoint is neither https nor loopback, so a bare 401
behind an auth proxy is diagnosable; the warning never echoes the
key. New tests pin the warning (content mentions ollamaApiKey, not
the key) and its absence on secure endpoints. Negative controls:
removing the warn fails exactly the remote-HTTP test (isolated);
mutating the ported provider name fails exactly the already-aborted
completePrompt test.
Verification at this head: 87/87 green in native-ollama.spec.ts; tsc
--noEmit 0 errors; eslint --max-warnings=0 clean with suppression
counts unchanged; prettier clean.1 parent fa64caf commit 91dc04c
2 files changed
Lines changed: 51 additions & 113 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
| 5 | + | |
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| |||
973 | 973 | | |
974 | 974 | | |
975 | 975 | | |
976 | | - | |
| 976 | + | |
977 | 977 | | |
978 | 978 | | |
979 | 979 | | |
| |||
1000 | 1000 | | |
1001 | 1001 | | |
1002 | 1002 | | |
1003 | | - | |
| 1003 | + | |
1004 | 1004 | | |
1005 | 1005 | | |
1006 | 1006 | | |
| |||
2201 | 2201 | | |
2202 | 2202 | | |
2203 | 2203 | | |
2204 | | - | |
| 2204 | + | |
2205 | 2205 | | |
2206 | 2206 | | |
2207 | 2207 | | |
| 2208 | + | |
2208 | 2209 | | |
2209 | 2210 | | |
2210 | 2211 | | |
| |||
2219 | 2220 | | |
2220 | 2221 | | |
2221 | 2222 | | |
| 2223 | + | |
| 2224 | + | |
| 2225 | + | |
| 2226 | + | |
| 2227 | + | |
| 2228 | + | |
| 2229 | + | |
| 2230 | + | |
| 2231 | + | |
| 2232 | + | |
| 2233 | + | |
| 2234 | + | |
| 2235 | + | |
| 2236 | + | |
| 2237 | + | |
| 2238 | + | |
| 2239 | + | |
| 2240 | + | |
| 2241 | + | |
| 2242 | + | |
| 2243 | + | |
| 2244 | + | |
2222 | 2245 | | |
2223 | 2246 | | |
2224 | 2247 | | |
| |||
2280 | 2303 | | |
2281 | 2304 | | |
2282 | 2305 | | |
2283 | | - | |
2284 | | - | |
2285 | | - | |
2286 | | - | |
2287 | | - | |
2288 | | - | |
2289 | | - | |
2290 | | - | |
2291 | | - | |
2292 | | - | |
2293 | | - | |
2294 | | - | |
2295 | | - | |
2296 | | - | |
2297 | | - | |
2298 | | - | |
2299 | | - | |
2300 | | - | |
2301 | | - | |
2302 | | - | |
2303 | | - | |
2304 | | - | |
2305 | | - | |
2306 | | - | |
2307 | | - | |
2308 | | - | |
2309 | | - | |
2310 | | - | |
2311 | | - | |
2312 | | - | |
2313 | | - | |
2314 | | - | |
2315 | | - | |
2316 | | - | |
2317 | | - | |
2318 | | - | |
2319 | | - | |
2320 | | - | |
2321 | | - | |
2322 | | - | |
2323 | | - | |
2324 | | - | |
2325 | | - | |
2326 | | - | |
2327 | | - | |
2328 | | - | |
2329 | | - | |
2330 | | - | |
2331 | | - | |
2332 | | - | |
2333 | | - | |
2334 | | - | |
2335 | | - | |
2336 | | - | |
2337 | | - | |
2338 | | - | |
2339 | | - | |
2340 | | - | |
2341 | | - | |
2342 | 2306 | | |
2343 | 2307 | | |
2344 | 2308 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | | - | |
| 9 | + | |
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | | - | |
54 | | - | |
55 | | - | |
56 | | - | |
57 | | - | |
58 | | - | |
59 | | - | |
60 | | - | |
61 | | - | |
62 | | - | |
63 | | - | |
64 | | - | |
65 | | - | |
66 | | - | |
67 | | - | |
68 | | - | |
69 | | - | |
70 | | - | |
71 | | - | |
72 | | - | |
73 | 32 | | |
74 | 33 | | |
75 | 34 | | |
| |||
304 | 263 | | |
305 | 264 | | |
306 | 265 | | |
307 | | - | |
308 | | - | |
309 | | - | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
310 | 278 | | |
311 | 279 | | |
312 | 280 | | |
| |||
474 | 442 | | |
475 | 443 | | |
476 | 444 | | |
477 | | - | |
| 445 | + | |
478 | 446 | | |
479 | 447 | | |
480 | 448 | | |
| |||
494 | 462 | | |
495 | 463 | | |
496 | 464 | | |
497 | | - | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
498 | 468 | | |
499 | 469 | | |
500 | 470 | | |
| |||
537 | 507 | | |
538 | 508 | | |
539 | 509 | | |
540 | | - | |
| 510 | + | |
541 | 511 | | |
542 | 512 | | |
543 | 513 | | |
| |||
715 | 685 | | |
716 | 686 | | |
717 | 687 | | |
718 | | - | |
| 688 | + | |
719 | 689 | | |
720 | 690 | | |
721 | 691 | | |
| |||
736 | 706 | | |
737 | 707 | | |
738 | 708 | | |
739 | | - | |
| 709 | + | |
| 710 | + | |
| 711 | + | |
| 712 | + | |
| 713 | + | |
740 | 714 | | |
741 | 715 | | |
742 | 716 | | |
| |||
0 commit comments