فینورا پرو - سامانه جامع حسابداری و صدور فاکتور

fix(A02): block missing parent datasets in source invoice graph

davoodmehraban89 committed Oct 17, 2026 at 02:02 UTC 2505c24ff72841fccfb4ffe0e9d6296311dfe3e2
1 file changed +10 -1
src/core/HolooMigrationPreflight.mjs
+10 -1
@@ -105,7 +105,16 @@ export function previewHolooExtract(input = {}, { maxIssues = 100 } = {}) {
105 for (const { table, key, parent } of references) {
106 const rows = datasets[table] || [];
107 const mapped = mappings[table]?.[key];
108 - if (!rows.length || !mapped || !counts[parent] || !mappings[parent]?.sourceId) continue;
108 + if (!rows.length || !mapped) continue;
109 + // A missing parent table cannot silently be treated as a clean migration.
110 + // Real migrations require all referenced master-data exports to be present.
111 + if (!counts[parent] || !mappings[parent]?.sourceId) {
112 + if (rows.some(record => record && typeof record === 'object' &&
113 + identity(field(table, record, key)))) {
114 + add('REFERENCE_PARENT_DATASET_REQUIRED', table);
115 + }
116 + continue;
117 + }
118 rows.forEach((record, i) => {
119 if (!record || typeof record !== 'object' || Array.isArray(record)) return;
120 const id = identity(field(table, record, key));