check: accept quota-only providers without model transport (#654)
scripts/check.mjs accepts a provider that declares auth.usage, an empty
model map and no npm or api (a quota-only provider). Its loader is still
required, and a provider with models, npm or api is still checked as
before. Tests in scripts/check.test.mjs cover the accepted case, the three
incomplete configurations and a missing loader. (sunny0826, split out of
#653 as asked there.)
Run at the reviewed head bc57c1362e, rebased on main d40a074, on mote
(Bun 1.4.2, temp HOME):
- bun test scripts/check.test.mjs: 11 pass, 0 fail
- bun test (whole repo): 4890 pass, 14 skip, 0 fail
- bun scripts/check.mjs: exit 0, no package marked ✗
- Broken by hand: dropping `&& !usageOnly` from the condition turns the
quota-only test red (10 pass, 1 fail).
This commit is contained in:
+2
-1
@@ -70,7 +70,8 @@ for (const name of readdirSync(root)) {
|
||||
await hooks.config(cfg)
|
||||
const p = cfg.provider[auth.provider]
|
||||
const signInOnly = hooks.tool && p?.models && !Object.keys(p.models).length && !p.npm
|
||||
if (p && !signInOnly) {
|
||||
const usageOnly = typeof auth.usage === "function" && p?.models && !Object.keys(p.models).length && !p.npm && !p.api
|
||||
if (p && !signInOnly && !usageOnly) {
|
||||
needsLoader = true
|
||||
if (!p.npm || !p.models || !Object.keys(p.models).length) problems.push(`${fn.name}: config gives ${auth.provider} no npm or models`)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user