Skip to content

Commit 57f823e

Browse files
committed
fix(V2): stop deep recursion and forward unresolved fields in ownership check
DB-resolved parent records should return early at their own orgUid rather than traversing the full transitive ownership graph. Also forward unresolvedFields from the existing-record ownership check to assertOwnerOrgUidsAreHome so missing parents are caught rather than silently treated as ownership-OK.
1 parent dd28d78 commit 57f823e

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

src/models/v2/staging-v2.model.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ class StagingV2 extends Model {
257257
options,
258258
visited,
259259
depth + 1,
260-
includeParentsForDirectOwner,
260+
false,
261261
unresolvedFields,
262262
new Set(),
263263
)),
@@ -331,12 +331,14 @@ class StagingV2 extends Model {
331331

332332
if (existingRecord) {
333333
const tableExcludedFields = StagingV2.getExcludedFieldsForTable(values.table);
334+
const existingUnresolved = [];
334335
await StagingV2.assertOwnerOrgUidsAreHome(
335336
await StagingV2.collectOwnerOrgUids(
336-
existingRecord, options, new Set(), 0, false, [], tableExcludedFields,
337+
existingRecord, options, new Set(), 0, false, existingUnresolved, tableExcludedFields,
337338
),
338339
values.table,
339340
true,
341+
existingUnresolved,
340342
);
341343
} else if (values.action !== 'UPDATE') {
342344
continue;

0 commit comments

Comments
 (0)