Skip to content

#2993: re-enable draft_admin_integrity via native NOT VALIDATED cascade constraints - #3136

Merged
Thomas Jung (jung-thomas) merged 10 commits into
DEVfrom
worktree-spike-2993-cascade
Nov 16, 2026
Merged

Thomas Jung (jung-thomas) merged 10 commits into
DEVfrom
worktree-spike-2993-cascade

Conversation

@jung-thomas

Copy link
Copy Markdown
Contributor

What & why

Re-enables CAP 10.2 Optimized Draft Deletion correctly, closing the #2909 gap (flag was enabled without the DB cascade, orphaning drafts → 2026-11-02 PROD outage).

Root cause (the real one)

Prior re-enable attempts failed not on HDI make-graph (as #3003/#2993 notes assumed) but because the project root deduped @sap/cds-compiler to 7.0.1 (no draft-constraint code) while cds-dk bundles 7.2.1 (has createDraftAdminDataConstraints). Fixed by a one-line package.json overrides pin to 7.2.1.

Changes

  • 434e401 pin @sap/cds-compiler 7.2.1 (overrides + lockfile) — the fix
  • fcf75c4/1830251 regression test asserting 46 NOT VALIDATED ON DELETE CASCADE draft constraints emit
  • 6a2a17e enable draft_admin_integrity + draft_orphan_cleanup + deleteStrategy: dad (both profiles)
  • 5a188fd/fcba7ff rewrite re-enable runbook + correct CLAUDE.md gotcha to the real root cause
  • design + plan docs under docs/superpowers/

Key facts

  • Constraints are CAP-native and NOT VALIDATED → pre-existing orphans do NOT block deploy (no pre-sweep gate). Independent of assert_integrity.
  • Generation is gated on draft_admin_integrity: true, so constraints + runtime behavior ship in one build (welded — can't get the flag without the constraints).

Verified

  • Local cds build --production emits 46/46 NOT VALIDATED draft cascade constraints (post-7.2.1-install).
  • Lockfile integrity hash == canonical npm registry value.

Pending on DEV (this PR's verification gate — NOT yet done)

  • DEV HANA delta deploy ships 46 constraints; HDI accepts NOT VALIDATED
  • preflight logs verified (46/46)
  • PROD-blocking: audit after('DISCARD')/after('DELETE') reconcile hooks still fire under dad (HANA-level)
  • zero-orphan smoke: Mission draftEdit→discard leaves 0 child draft rows on real HANA

Runbook: docs/developers/operations/draft-integrity-reenable.md

- Bump .deploy/mta.yaml 1.44.2 -> 1.44.3 (patch; deploy source of truth per
  deploy-mta.cjs). Headline: external-content journaling fix (#3130/#3132) --
  schema changes to the 17 external-content tables now actually deploy
  (hdbtable->hdbmigrationtable adopt-in-place, verified zero data loss on DEV).
  Also carries #3131 docs (close #2810 as foundation).

Promotes origin/DEV (8e5283c) to main. Data-loss audit on DEV: 0 row-count
mismatches across 18 external tables, 0 invalid views/procs.
release 1.44.3: external-content journaling fix (#3130) — isolated PROD promotion
Approved design: deliver CAP's native NOT VALIDATED draft cascade
constraints through the hdbmigrationtable build, re-enable
draft_admin_integrity + draft_orphan_cleanup + deleteStrategy:dad,
with a dad handler-firing audit + HANA-level reconcile test.

Spike findings: constraints are CAP-native (46, NOT VALIDATED), the
real blocker was the to.hana/hdbmigrationtable build path (not HDI
make-graph or hand-authoring).
…ntable build

Pin @sap/cds-compiler to 7.2.1 via package.json overrides. The project's
hoisted @sap/cds-compiler was stuck at 7.0.1 (lockfile dedup artifact), which
predates createDraftAdminDataConstraints; so cds build --production emitted 0
draft cascade constraints even with draft_admin_integrity on. Compiler 7.2.1
(bundled under cds-dk, now pinned at root) emits all 46
*_drafts_DraftAdministrativeData.hdbconstraint files (ON DELETE CASCADE,
NOT VALIDATED). draft_admin_integrity stays OFF in both fiori blocks; the
runtime flip is a later task.
Save/restore process.env.CDS_ENV around cds.load + compiler.to.hdi in a
finally block so the production-profile flag does not leak into co-running
unit tests that share the same vitest worker process.
…tegy

Flips the three CAP 10.2 Optimized Draft Deletion flags in both base and
[development] profiles:
- cds.fiori.draft_admin_integrity: true  (emits 46 NOT VALIDATED draft
  cascade constraints at build time; requires the 7.2.1 compiler pin)
- cds.fiori.draft_orphan_cleanup: true   (background orphan sweep)
- cds.drafts.deleteStrategy: dad          (single-cascade draft deletion)

Generation of the cascade constraints is gated on draft_admin_integrity
being true, so constraints + runtime behavior ship together in one build.
Verified: production build emits 46/46 NOT VALIDATED constraints.
DEV HANA deploy + preflight + dad hook audit pending (Tasks 3-6).
@jung-thomas
Thomas Jung (jung-thomas) merged commit 1335f16 into DEV Nov 16, 2026
7 checks passed
@jung-thomas
Thomas Jung (jung-thomas) deleted the worktree-spike-2993-cascade branch November 16, 2026 01:23
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