You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(model-apps): never delete a generative page's files ourselves
Review caught a real data-loss path in the genpage teardown step: it
deleted the uxagentprojectfile rows first and the uxagentproject row
second. If the project delete was then dependency-blocked and skipped,
the files were already gone -- leaving the app that still referenced the
page pointing at an empty shell.
Measured against a live environment, which is what makes this concrete:
- The project row IS dependency-tracked (component type 10372). On
pages an app sitemap references it reports 1 dependent and DELETE
returns 400 "cannot be deleted because it is referenced by 1 other
components".
- Its files are NOT. Across 20 files of 5 such referenced pages,
RetrieveDependenciesForDelete returned 0 for every single one, so
each would have deleted cleanly.
- The uxagentproject -> uxagentprojectfile relationship is
CascadeConfiguration Delete=Cascade, so the file loop was never
needed in the first place.
The fix is therefore a deletion: delete only the project row and let the
platform cascade. A dependency block now happens before anything has
been written, so a skipped page is left completely intact. This also removes a
second defect the reviewer flagged -- a not-found thrown mid-loop aborted
before the project delete while deleteStep recorded the whole page as
successfully deleted, reporting a page gone that was still there.
Both regression tests were verified red against the old ordering before
being taken green; the skip test deliberately supplies files so it cannot
pass vacuously.
Also removes stale comments and test scaffolding describing the cross-app
sitemap scan that was replaced by platform arbitration, and corrects an
assertion message that still claimed deleteAppCascade removes genpages.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 731c1111-d9b6-4fd7-b9d3-347f762ca7f5
Copy file name to clipboardExpand all lines: plugins/model-apps/scripts/tests/sdk-teardown.test.js
+50-41Lines changed: 50 additions & 41 deletions
Original file line number
Diff line number
Diff line change
@@ -447,7 +447,7 @@ test('app teardown resolves via resolveArtifact and delegates the full cascade t
447
447
awaith.del(sdk,items[0]);
448
448
assert.strictEqual(cascadeCalls.length,1,'deleteAppCascade called once');
449
449
assert.strictEqual(cascadeCalls[0].appModuleId,'app-1','app module id passed');
450
-
assert.strictEqual(cascadeCalls[0].appModuleIdUnique,'u-1','unique id passed (deleteAppCascade handles sitemap + genpage internally)');
450
+
assert.strictEqual(cascadeCalls[0].appModuleIdUnique,'u-1','unique id passed (deleteAppCascade removes the sitemap; generative pages are a separate step)');
451
451
});
452
452
453
453
test('app teardown skips when app not found (resolve returns [])',async()=>{
@@ -992,19 +992,18 @@ test('planTeardown trims the persona name in the role step (matches the SDK-crea
992
992
// owns that decision for the pages IT authored. These pin who deletes what, and when it backs off.
0 commit comments