Skip to content

Enforce HANA cascade-constraint deploy before draft_admin_integrity serves (per-env ordering) #2968

Closed

Description

@jung-thomas

Context

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:

  1. 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.
  2. A one-shot orphan-cleanup pass using cds.fiori.draft_orphan_cleanup: true wired into the migration, then disabled.
  3. A post-deploy smoke/probe that detects orphaned draft rows and alerts.

References

Activity

  1. added a commit that references this issue on Nov 1, 2026
  2. jung-thomas commented on Nov 2, 2026

    @jung-thomas
    ContributorAuthor

    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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions