Skip to content

DPI follow-up (#977): decide on one-off AuthorAiRequests orphan sweep for users anonymized before the cascade fix #3144

Closed as not planned

Description

Summary

Follow-up from #977 (PR #3139). The DPI work fixed a live anonymization-cascade erasure gap: AuthorAiRequests rows are keyed on authorId (the XSUAA id string, e.g. Users.sapId), not user_ID, so the old cascade (WHERE <field> = user.ID) never matched them — those rows (sourceMarkdown, variants) survived user anonymization as FK-ghosts. The fix (via the shared data-subject-resolver.js) now resolves authorId correctly, so erasure works going forward.

Open question (this issue): users anonymized before the fix shipped may still have surviving AuthorAiRequests rows attributable to them. Decide whether a one-off repair sweep is needed before (or shortly after) PROD.

Scope the exposure

Run against PROD (and DEV) to see if any candidate ghosts exist:

-- AuthorAiRequests whose authorId no longer maps to a live (non-anonymized) user
SELECT COUNT(*) FROM com_sap_developers_ims_AuthorAiRequests a
WHERE NOT EXISTS (
  SELECT 1 FROM com_sap_developers_ims_Users u WHERE u.sapId = a.authorId
);

(Refine against whatever marks an anonymized user — the anonymization replaces identifying fields, so the join may need to target the anonymized-placeholder pattern rather than row absence. Confirm the exact anonymized-user signature before trusting the count.)

If the count is 0, close this — no backfill needed. If > 0, decide:

  • delete those rows (matches the intended erasure semantics), or
  • leave them if policy says pre-fix data is out of scope.

Notes

Activity

  1. jung-thomas commented on Nov 20, 2026

    @jung-thomas
    ContributorAuthor

    Scoping result: 0 candidate ghosts in both PROD and DEV → no backfill sweep needed

    Ran the exposure scoping against real HANA via cds bind --exec (read-only, no writes) on 2026-11-20.

    AuthorAiRequests is empty in both environments — the table is deployed but has never been written to:

    Env Users (sanity) Tutorials (sanity) AuthorAiRequests total
    PROD 826,055 3,010 0
    DEV 789,106 2,975 0

    (Distinct user/tutorial counts confirm the two queries hit genuinely different HDI containers, not the same one twice.)

    Since total rows = 0, every derived count is trivially 0: naive-query ghosts, true orphans (no Users match by sapId or uuid), and anonymized-user ghosts (match an ANONYMIZED user via uuid) are all 0.

    A correction to the proposed query

    The issue's NOT EXISTS (... u.sapId = a.authorId) is overbroad and would mislead if the table were non-empty. Anonymization (srv/lib/anonymization.js) does an identity-replace in place, not a row delete: it sets sapId = NULL, email = NULL, names → 'ANONYMIZED', but keeps uuid and keeps the row. Meanwhile the forward-path resolver (data-subject-resolver.js: authorIdCandidates) matches authorId against both sapId and uuid.

    So the correct pre-fix-ghost signature is:

    • true orphan: authorId matches no user by sapId OR uuid, or
    • anonymized-user ghost: authorId matches a user via uuid where sapId IS NULL AND displayName = 'ANONYMIZED' (still carrying sourceMarkdown/variants).

    Matching only on sapId would false-positive on every live user whose login claim is stored in uuid (the documented provider divergence).

    Recommendation

    Close as "no action required." The feature (feature='os-variants' author AI, SAP-employee authors only) has produced zero rows in PROD, so no pre-fix user anonymization could have left an AuthorAiRequests ghost. The forward-path fix (merged with #977) covers any future rows. No one-off sweep is warranted before or after PROD cutover.

    If the team still wants a belt-and-braces safety net, the cheapest option is a cron assertion (not a one-off migration): fail/alert if anonymized_user_ghosts_with_content > 0 ever becomes non-zero — but given 0 rows total, even that is optional.

  2. jung-thomas commented on Nov 20, 2026

    @jung-thomas
    ContributorAuthor

    Closing per scoping above: 0 AuthorAiRequests rows in PROD and DEV, so no pre-fix orphan ghosts exist. No backfill sweep needed. Forward-path fix (#977) covers future rows.

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