From 8edab4638b60a1b1345b52436ef187dfa58e2edb Mon Sep 17 00:00:00 2001 From: Maxim Dolgolyov Date: Sat, 30 May 2026 16:53:09 +0300 Subject: [PATCH] =?UTF-8?q?fix(lab-content-engine):=20phase=205=20test=20s?= =?UTF-8?q?eed=20=E2=80=94=20=D1=84=D0=B8=D0=BB=D1=8C=D1=82=D1=80=20=D0=BD?= =?UTF-8?q?=D0=B5=D1=81=D1=83=D1=89=D0=B5=D1=81=D1=82=D0=B2=D1=83=D1=8E?= =?UTF-8?q?=D1=89=D0=B8=D1=85=20=D0=BA=D0=BE=D0=BB=D0=BE=D0=BD=D0=BE=D0=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit seedRow падал 'table topics has no column named slug': в схеме topics нет slug (дрейф между ветками). seedRow теперь оставляет ТОЛЬКО ключи-реальные колонки (PRAGMA table_info) и доливает required NOT NULL. lab-links 18/18, оба файла 29/29. + PLAN: строка Фазы 5 = done. Co-Authored-By: Claude Opus 4.8 (1M context) --- backend/tests/lab-links.test.js | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/backend/tests/lab-links.test.js b/backend/tests/lab-links.test.js index 42459f5..e1e1c68 100644 --- a/backend/tests/lab-links.test.js +++ b/backend/tests/lab-links.test.js @@ -21,11 +21,16 @@ after(() => cleanup()); */ function seedRow(table, provided) { const cols = db.prepare(`PRAGMA table_info(${table})`).all(); - const row = { ...provided }; + const colNames = new Set(cols.map(c => c.name)); + // Keep ONLY keys that are real columns (drops fields absent in this schema — + // robust to drift, e.g. topics may lack slug/subject_id on some branches). + const row = {}; + for (const k of Object.keys(provided)) if (colNames.has(k)) row[k] = provided[k]; + // Fill any required (NOT NULL, no default) column the caller didn't provide. for (const c of cols) { - if (c.pk) continue; // skip primary key (autoincrement) - if (c.name in row) continue; // caller-provided - if (c.notnull && c.dflt_value === null) { // required, no default → fill placeholder + if (c.pk) continue; + if (c.name in row) continue; + if (c.notnull && c.dflt_value === null) { row[c.name] = /INT|REAL|NUM/i.test(c.type) ? 0 : ''; } }