fix(sync): normalize section separators in regenerate()
CI — Test & Build / 🧪 Run Tests & Generate Reports (push) Waiting to run
CI — Test & Build / 🏗️ Build Docker Image (push) Blocked by required conditions

A previous run could merge the '---' separator with the next section
header (---##  Befejezett), breaking section detection. Prefix/suffix
are now trimmed and rejoined with fixed separators. Regression test
added; also create Plane issues for local-only completed work
(MITHOME-28 Custom CMS, MITHOME-29 Webmail) to avoid ID collisions.
This commit is contained in:
Do Siki
2026-08-17 13:29:25 +02:00
parent 35bf43798d
commit 52f4f524c5
3 changed files with 35 additions and 9 deletions
+22
View File
@@ -162,3 +162,25 @@ test('buildTable sorts rows by sequence number', () => {
assert.equal(lines[2], '| MITHOME-1 | A | ✅ |');
assert.equal(lines[3], '| MITHOME-15 | B | ✅ |');
});
// Regression: a previous run dropping the blank line after `---` must not merge
// the separator with the section header (`---## ✅ Befejezett`).
test('regenerate always separates `---` from section headers', () => {
const planeIssues = [
{ sequence_id: 1, name: 'Kezdőlap', state: { group: 'completed' } },
{ sequence_id: 13, name: 'CI pipeline', state: { group: 'unstarted' } },
{ sequence_id: 17, name: 'Winston logger + Loki integráció', state: { group: 'started' } },
{ sequence_id: 19, name: 'Accessibility', state: { group: 'backlog' } }
];
const { rows } = parseTodoFile(SAMPLE_TODO);
const buildData = buildDiscrepancies(planeIssues, rows, 'MITHOME');
const decisions = { moveToPlane: new Set(), keepOrphan: new Set(), addNew: new Set() };
const final = buildFinalSections(buildData, decisions);
const corrupted = SAMPLE_TODO.replace('---\n\n## ✅ Befejezett', '---## ✅ Befejezett');
const output = regenerate(corrupted, final);
assert.ok(output.includes('---\n\n## ✅ Befejezett'), 'header must be separated from ---');
assert.ok(!output.includes('---##'), 'no merged separator+header');
assert.ok(output.includes('## ✅ Befejezett'));
});