Skip to content

feat(cap): adopt draft_admin_integrity (optimized draft deletion) #2909 - #2967

Merged
jung-thomas merged 4 commits into
DEVfrom
worktree-draft-admin-integrity-2909
Nov 1, 2026
Merged

jung-thomas merged 4 commits into
DEVfrom
worktree-draft-admin-integrity-2909

Conversation

@jung-thomas

Copy link
Copy Markdown
Contributor

Closes #2909

Summary

  • Enables cds.fiori.draft_admin_integrity: true — CAP 10.2 optimized draft deletion. cds build generates ON DELETE CASCADE constraints on each draft table's DraftAdministrativeData_DraftUUID FK; draft activation/root-cancel delete only the admin record and the DB cascades the child draft rows.
  • Adds root after('DISCARD', 'Missions.drafts'|'Groups.drafts') reconcile handlers in AdminService. Under the flag, discarding a draft cascade-deletes child CompletionPathItems/GroupPathItems at the DB level, bypassing the per-row after('DELETE') reconcile. These DISCARD handlers re-fire reconcileEntityForUsers for the active entity's legacyId, restoring Mission/Group rollup correctness. The existing child DELETE handlers stay — they still fire for direct programmatic deletes the cascade doesn't touch.
  • New test test/admin-drafts-discard-reconcile.test.js: DISCARD-reconcile for Missions + Groups (incl. nesting missions), empty-draft no-op, fail-open.
  • Migration runbook (gotchas.md) + Top Gotchas bullet.

Behavior change surfaced (documented)

Under the flag, deleting an active entity immediately after draftActivate can return 403 — a draft exists (seen on SQLite) until the residual draft is discarded first. Updated admin-drafts.test.js cleanup accordingly. This is the documented CAP 10.2 change, not a bug; normal Fiori UX doesn't delete-active-right-after-activate.

⚠️ Deployer callout — constraint ordering (per env)

The flag is committed ON, so the next deploy to any env serves with it on. Land the generated HANA cascade constraints (.hdbconstraint, NOT VALIDATED) BEFORE the flag serves in that env — if the runtime serves flag-on before the constraints exist, the DB won't cascade and orphaned draft rows accumulate (draft-table cruft, not active-content data loss). Follow the runbook's DEV → test → PROD ordering; confirm scope with the maintainer. The actual PROD rollout is a separate authorized deploy.

Test plan

  • test/admin-drafts-discard-reconcile.test.js (new) — 3/3
  • test/admin-drafts.test.js + admin-service-reconcile.test.js — no regression (12/12 total, SQLite)
  • npm run static-guards — 17/17
  • Fresh whole-branch review (Opus) — sound, no Critical/Important
  • Hybrid HANA draft-discard verification on DEV (post-deploy)

…dmin_integrity)

With cds.fiori.draft_admin_integrity on, discarding a Mission/Group draft
cascade-deletes its draft CompletionPathItems/GroupPathItems at the DB level,
bypassing the per-row after('DELETE') reconcile hooks. Adds root
after('DISCARD', '<Entity>.drafts') handlers that fire reconcile for the active
entity's legacyId, restoring rollup correctness. The existing child DELETE
handlers stay (they still fire for direct programmatic deletes).

Also updates admin-drafts.test.js cleanup: under the flag, deleting an active
entity immediately after draftActivate hits "a draft exists" (403) on SQLite
until the residual draft is discarded first.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant