Repository navigation
feat(#977): local data-subject DPI export + fix anonymization-cascade erasure gap - #3139
Conversation
…lveTutorialAuthor
…-pass resolvedMap, pass definitions param - LOG.warn when _selectRows finds a declared personalField not in entity elements (GDPR safety, fix 1) - Build resolvedMap in pre-scan and reuse in main loop to avoid double resolveSubjectKeys calls (fix 2) - Resolve definitions once in _handleExport and pass as parameter to _selectRows (fix 3) - Add unit test asserting LOG.warn fires AND row still exports with real columns (fix 1 test)
- Add DataPrivacyService rows to testing-endpoints.md (path /admin/data-privacy, auth XSUAA + Admin, exportDataSubject(userId) function) - srv-qa cp-list audit: check-srv-qa-cp-list.ts reports OK — 0 transitive srv/* dependencies from srv-qa entry points; new files (data-subject-resolver.js, data-privacy-service.js) are not reachable from srv-qa/server.js via static import analysis. No mta.yaml change needed.
… log strings, nested-cols note
|
The CI diff is entirely:
No Fix tracked separately (regenerate the snapshot with the new compiler, direct to DEV): see the linked infra issue. This check should go green on rebase once that lands. Everything else here is sound — PR is MERGEABLE and the unit |
|
Tracking issue for the staging-check toolchain drift: #3140 |
What & why (#977)
Enables Data Privacy Integration (DPI) for the end-of-July PROD cutover, as a local build rather than adopting
@cap-js/data-privacy. The plugin couldn't do selective exposure (all three consumers — data-privacy, audit-logging, and the customanonymization-cascade.js— gate on the same shared@PersonalData.EntitySemantics, and CAP gives them one shared CSN), and the confirmed need is export + erasure only (no SAP ILM retention, no Fiori DPP app). We already own erasure; this adds the export and fixes a real gap in the erasure.Design + plan:
docs/superpowers/specs/2026-11-13-dpi-local-export-design.md,docs/superpowers/plans/2026-11-16-dpi-local-export.md.Changes
DataPrivacyService(@path:/admin/data-privacy,@requires:'Admin') —exportDataSubject(userId) returns LargeString: a JSON document of all personal data held for aUserssubject, assembled by walking the existing@PersonalDataannotations viagetCascadePlan()(single source of truth). Admin/DPO-only; emits aSecurityEventaudit (DataSubjectExport).srv/lib/data-subject-resolver.js— maps aUsersrow to the three DataSubjectID shapes (user_ID; theUsersscalarID; the non-usercasesauthorIdand nestedtab_ID). Reused by both the export and the cascade.anonymization-cascade.js—AuthorAiRequests(keyed onauthorId, an XSUAA-id string) andDeveloperEnvironmentLinks(keyed via parenttab_ID) were never matched by the oldWHERE <field> = user.IDlogic, so their personal data survived user anonymization. Now resolved correctly on both read (export) and erase (cascade), through the one shared resolver.sapIdAND nulluuidpreviously producedWHERE … IN (), a HANA syntax error that would abort the whole anonymization cascade mid-run. Now an empty-candidates guard +LOG.warnon both the cascade and export paths.@cap-js/data-privacyentirely — no dependency, no import, nocds.requiresentry (confirmed by whole-branch review). No@PersonalDataannotation weakened — audit-logging + cascade keep reading them unchanged.Testing
cds build --productionexit 0.@PersonalDataentities — export and cascade agree on subject keying for every one.test/hybrid/tests already exercise these exactLargeStringcolumns against real HANA —code-check.test.js(submittedCode),validate-answer-anonymize.test.js(submittedAnswer+ anonymization cascade),author-service-os-variants.test.js(sourceMarkdown/variants).Follow-up (non-blocking)
test/hybrid/dpi-export.test.jsexercising the export + authorId-cascade fix against real HANA (template:validate-answer-anonymize.test.js). Deferred by agreement; existing hybrid coverage de-risks the NCLOB/cascade paths in the meantime.AuthorAiRequestsrows (anonymized before this fix) may warrant a one-off repair sweep — flag if PROD data shows any.Built via subagent-driven development: Task 4 took one fix round (GDPR silent-drop →
LOG.warn); Task 5 took two (theIN ()crash guard, then isolation-testing the nested DELETE). Full decision ledger available on request.