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
{{ message }}
Repository navigation
Enforce HANA cascade-constraint deploy before draft_admin_integrity serves (per-env ordering) #2968
Follow-up to #2909 (PR #2967), which enabled cds.fiori.draft_admin_integrity: true (CAP 10.2 optimized draft deletion). The flag is committed ON, so the next deploy to any environment serves with it on.
The risk (deferred minor from the #2909 whole-branch review)
Per-env safety currently relies on the deployer landing the generated HANA ON DELETE CASCADE constraints (.hdbconstraint, NOT VALIDATED) before the flag serves in that environment. Nothing in code enforces this ordering.
If the runtime serves flag-on before the cascade constraints exist on HANA, draft activation/root-cancellation delete only the DraftAdministrativeData record and the DB does not cascade the child draft rows → orphaned draft rows accumulate in the draft tables.
Impact: draft-table cruft, not active-content data loss.
Mitigations already in place: the migration runbook (docs/developers/reference/tutorials-ims-gotchas.md → "Optimized draft deletion"), the NOT VALIDATED constraint deploy (won't be blocked by pre-existing orphans), and the DEV → test → PROD no-main-hotfix model.
Proposed work
Make the ordering safe without relying on deployer discipline. Options to evaluate:
A deploy-time guard / preflight check that verifies the cascade constraints exist on the target HANA schema before (or as part of) flipping the serving flag.
A one-shot orphan-cleanup pass using cds.fiori.draft_orphan_cleanup: true wired into the migration, then disabled.
A post-deploy smoke/probe that detects orphaned draft rows and alerts.
Resolved by PR #2971 (merged into DEV, Nov 1). srv/lib/draft-integrity-preflight.js runs once at boot on HANA, queries SYS.REFERENTIAL_CONSTRAINTS for the ON DELETE CASCADE FKs on all 26 draft tables, and emits a structured WARN listing any missing tables. Wired in srv/server.js via wireDraftIntegrityPreflight(cds). Unit tests: 14/14. Runbook updated in tutorials-ims-gotchas.md § Optimized draft deletion.
Activity
Merge pull request #2971 from sap-tutorials/worktree-draft-integrity-…
jung-thomas commentedon Nov 2, 2026
Resolved by PR #2971 (merged into DEV, Nov 1).
srv/lib/draft-integrity-preflight.jsruns once at boot on HANA, queriesSYS.REFERENTIAL_CONSTRAINTSfor theON DELETE CASCADEFKs on all 26 draft tables, and emits a structured WARN listing any missing tables. Wired insrv/server.jsviawireDraftIntegrityPreflight(cds). Unit tests: 14/14. Runbook updated intutorials-ims-gotchas.md§ Optimized draft deletion.