fix: an array of route paths is several operations, pages are none, and the prompt-pool build says what it did
Some checks failed
Forgejo Docker Build / Root app tests (push) Successful in 51s
Forgejo Docker Build / Build Docker image (push) Successful in 8s
Forgejo Docker Build / End-to-end (browser) (push) Failing after 7s

app.get(['/', '/index.html', '/assistant']) reached the OpenAPI generator as
one route whose path was the array, joined with commas; the e2e reachability
check then probed "/,/index.html,/assistant" and found a 404. Each path is
now its own route, and routes outside /api/ are left out: the document
describes what a client calls, and a client does not call index.html.

The starter-question pool logs when a build starts, what each category kept,
and how long it took, so a build that produces nothing can be traced.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Dv6sqaY6Vq3ChZHMem3cnU
This commit is contained in:
Daniel 2026-09-13 06:35:25 +02:00
parent 444fa44444
commit 75f5486beb
3 changed files with 20 additions and 4 deletions

View file

@ -322,6 +322,10 @@ function createClinicalPromptPool(opts) {
var taxonomy = taxonomyWithQuotas(target);
var chatModel = await opts.getSetting('clinical_assistant.prompt_model', '') || process.env.CLINICAL_ASSISTANT_PROMPT_MODEL || await opts.getSetting('clinical_assistant.chat_model', '') || await opts.getSetting('models.default', '');
var generated = [];
var startedAt = Date.now();
// A build that produced nothing used to vanish without a word; now it says
// what it did per category, so an empty pool can be traced to its cause.
console.info('[clinical-assistant] prompt pool build started: ' + taxonomy.length + ' categories, target ' + target + ', model ' + (chatModel || 'default'));
for (var t = 0; t < taxonomy.length && generated.length < target; t++) {
var item = taxonomy[t];
var snippets = await collectPromptSeedSnippets(item);
@ -348,7 +352,9 @@ function createClinicalPromptPool(opts) {
categoryExamples = normalizeGeneratedExamples(categoryExamples.concat(parsed.questions || []), item).slice(0, item.quota);
}
generated = normalizeGeneratedExamples(generated.concat(categoryExamples));
console.info('[clinical-assistant] prompt pool ' + item.category + ': ' + categoryExamples.length + ' kept of quota ' + item.quota + ' (' + snippets.length + ' snippets)');
}
console.info('[clinical-assistant] prompt pool build finished: ' + generated.length + ' questions in ' + Math.round((Date.now() - startedAt) / 1000) + 's');
if (generated.length < 8) return [];
return generated.slice(0, target);
}

View file

@ -92,10 +92,19 @@ function routes(app) {
}
function addRoute(found, base, route) {
var full = (base + route.path).replace(/\/+/g, '/').replace(/(.)\/$/, '$1');
Object.keys(route.methods || {}).forEach(function (method) {
if (method === '_all') return;
found.push({ method: method.toUpperCase(), path: full, tag: tagFor(full) });
// app.get(['/', '/index.html', '/assistant'], …) is one layer with three
// paths; joined with commas it became the operation "/,/index.html,/assistant",
// which the reachability check then found answering 404.
var paths = Array.isArray(route.path) ? route.path : [route.path];
paths.forEach(function (path) {
var full = (base + path).replace(/\/+/g, '/').replace(/(.)\/$/, '$1');
// Pages are not API operations. The document describes what a client
// calls, and a client does not call index.html.
if (full.indexOf('/api/') !== 0 && full !== '/api') return;
Object.keys(route.methods || {}).forEach(function (method) {
if (method === '_all') return;
found.push({ method: method.toUpperCase(), path: full, tag: tagFor(full) });
});
});
}

View file

@ -29,6 +29,7 @@ function syntheticApp() {
app.use('/api/auth', users);
app.use('/api/auth', also);
app.get('/api/health', (req, res) => res.end()); // straight on the app
app.get(['/', '/index.html', '/assistant'], (req, res) => res.end()); // pages, not API
return app;
}