Skip to content

fix(cap): disable draft_admin_integrity — missing HANA cascade corrupted mission drafts (#2909) - #2992

Merged
jung-thomas merged 1 commit into
DEVfrom
worktree-fix-draft-integrity-2909
Nov 2, 2026
Merged

jung-thomas merged 1 commit into
DEVfrom
worktree-fix-draft-integrity-2909

Conversation

@jung-thomas

Copy link
Copy Markdown
Contributor

Problem (PROD down)

CAP 10.2 cds.fiori.draft_admin_integrity was enabled for production in #2909, but the required ON DELETE CASCADE .hdbconstraint files were never generated or deployed (fd -HI hdbconstraint = empty repo-wide). With the flag ON and no cascade:

  • Every mission draft activate/discard left orphaned draft rows (draft row survives, its DraftAdministrativeData parent is gone).
  • FE then returns DRAFT_ALREADY_EXISTS + Not Found on draftEdit, and the discard affordance never renders → missions permanently un-editable in PROD.

Reported live today (2026-11-02) on mission 1eaf780c-97c4-496d-88e2-b0e3da2d3f8f.

Root cause confirmed

  1. Flag ON for prod (package.json top-level true, only [development] set false).
  2. Runtime CDS_* env override does NOT work on the deployed build — verified 3 ways (CDS_FIORI JSON, escaped CDS_FIORI_DRAFT__ADMIN__INTEGRITY, CDS_CONFIG); all flip the flag locally, all ignored by the running app. So this must be a code change.
  3. draft-integrity-preflight.js was checking non-existent table names (com_sap_developers_ims_*_drafts); the real tables are ADMINSERVICE_*_DRAFTS. The preflight reported "26/26 missing" and validated nothing — it never would have caught this.

Changes

  • package.json — cds.fiori.draft_admin_integrity: false (prod + all profiles). Reverts to the proven pre-10.2 draft-deletion path.
  • srv/lib/draft-integrity-preflight.js — rewrote checkDraftCascadeConstraints to discover the real draft tables from SYS.TABLE_COLUMNS at runtime (can't drift), handle the empty-schema case, and report dynamic total.
  • test/unit/draft-integrity-preflight.test.js — updated for the two-query discovery contract. 14 pass; 114 draft/mission/rollup unit tests pass overall.

PROD remediation already applied (manual, today)

  • Disabled the flag via env + restart (ineffective — see root cause feat: add slug mapping endpoint and getEventProgress fallback #2) then cleaned orphans directly in HANA.
  • Deleted 57 orphaned rows: 1 ADMINSERVICE_MISSIONS_DRAFTS root + 32 COMPLETIONPATHITEMS + 11 COMPLETIONPATHS + 7 MISSIONTAGS + 6 MISSIONCATEGORIES. The 11 live draft admin rows were preserved (scan excludes rows with a live DraftAdministrativeData parent). Re-scan = 0 orphans.

Follow-ups (not in this PR)

  • The stale PROD env vars (CDS_CONFIG etc.) should be unset after release.
  • If optimized draft deletion is still wanted, re-enable the flag only after generating + deploying the real ADMINSERVICE_*_DRAFTS cascade .hdbconstraint files and confirming the (now-fixed) preflight reports them present.

🤖 Generated with Claude Code

… cascade constraints corrupted drafts (#2909)

The CAP 10.2 cds.fiori.draft_admin_integrity flag was enabled for production
(#2909) but the required ON DELETE CASCADE .hdbconstraint files were never
generated/deployed. With the flag ON and no cascade, every mission draft
activate/discard left ORPHANED draft rows (draft row survives, its
DraftAdministrativeData parent is gone). FE then 404s on draftEdit
(DRAFT_ALREADY_EXISTS + 'Not Found'), and the discard affordance never renders
— making missions permanently un-editable in PROD.

Changes:
- package.json: flip cds.fiori.draft_admin_integrity to false (prod + all
  profiles) — reverts to the proven pre-10.2 draft-deletion behavior. The
  runtime CDS_* env override does NOT work on the deployed build (verified),
  so this must be a code change.
- draft-integrity-preflight.js: the DRAFT_TABLES list used non-existent
  com_sap_developers_ims_*_drafts names. The real tables are
  ADMINSERVICE_*_DRAFTS, so the preflight reported 26/26 'missing' and
  validated NOTHING. Rewrote checkDraftCascadeConstraints to DISCOVER the real
  draft tables from SYS.TABLE_COLUMNS at runtime so the check can never drift.
- Updated unit tests for the two-query discovery contract (14 pass).

PROD orphan cleanup (57 rows: 1 MISSIONS_DRAFTS root + 32 COMPLETIONPATHITEMS +
11 COMPLETIONPATHS + 7 MISSIONTAGS + 6 MISSIONCATEGORIES) was done directly in
HANA; live drafts (11 admin rows) preserved.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
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