QA validointivaihe: tarkistaa tiedostojen yhteensopivuuden

Uusi vaihe DevOps-vaiheiden jälkeen: QA tarkistaa että
Dockerfile, docker-compose, README ja testit viittaavat
oikeisiin tiedostoihin ja riippuvuuksiin. Jos ongelmia löytyy,
DevOps korjaa Dockerfilen automaattisesti.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-07 07:43:13 +03:00
parent 743946a391
commit 75310c989e

View File

@@ -2302,6 +2302,45 @@ Files: ${Object.keys(generatedFiles).join(', ')}`;
if (readme) generatedFiles['README.md'] = readme;
pipelineStep('tester', 'README', 'done', 'README.md', readme);
// Validointivaihe: QA tarkistaa kaikkien tiedostojen yhteensopivuuden
const stepV = step8 + 1;
termLog(`\n<span style="color:#3fb950;font-weight:bold">[${stepV}] QA</span> — validointi`);
pipelineStep('qa', 'Validointi', 'active', 'Tarkistetaan yhteensopivuus');
const allFiles = Object.entries(generatedFiles).map(([n, c]) => `--- ${n} ---\n${c}`).join('\n\n');
const validatePrompt = `Check these project files for consistency issues. Report ONLY problems found. If everything is fine, say "OK".
Check:
1. Dockerfile COPY references files that exist in the project
2. Dockerfile dependencies match what the code imports
3. docker-compose.yml services match what the app needs
4. README commands match actual file names and structure
5. Test file imports match actual module names
6. pyproject.toml dependencies cover all imports (if pyproject.toml exists)
Files in project: ${Object.keys(generatedFiles).join(', ')}
${allFiles}`;
const validation = await kpnRun(agentPrompts.qa.model, validatePrompt, false, 256);
pipelineStep('qa', 'Validointi', 'done', 'Yhteensopivuus', validation);
// Jos QA löysi ongelmia, korjataan
if (validation && !validation.toLowerCase().startsWith('ok') && !validation.toLowerCase().includes('no issues') && !validation.toLowerCase().includes('everything is fine')) {
const stepFix = stepV + 1;
termLog(`\n<span style="color:#d29922;font-weight:bold">[${stepFix}] DevOps</span> — korjaukset`);
pipelineStep('tester', 'Korjaukset', 'active', validation);
// Korjataan vain Dockerfile ja docker-compose
const fixPrompt = `Fix ONLY the Dockerfile based on this feedback. Output the corrected Dockerfile, nothing else.
Feedback: ${validation}
Current files: ${Object.keys(generatedFiles).join(', ')}
Current Dockerfile:
${generatedFiles['Dockerfile'] || '(puuttuu)'}`;
const fixedDockerfile = await kpnRun(agentPrompts.tester.model, fixPrompt, false, 256);
if (fixedDockerfile) generatedFiles['Dockerfile'] = fixedDockerfile;
pipelineStep('tester', 'Korjaukset', 'done', 'Dockerfile korjattu', fixedDockerfile);
}
termLog(`\n<span style="color:#a371f7;font-weight:bold">━━━ Pipeline valmis (${Object.keys(generatedFiles).length} tiedostoa) ━━━</span>`);
renderProjectCard(generatedFiles, task);
}