Skip to content

fix(#977): qualify DeveloperEnvironmentTabs via-name to fix anonymize 'no such table' in CI - #3164

Merged
Thomas Jung (jung-thomas) merged 1 commit into
DEVfrom
worktree-fix-unit-test-pollution-977
Nov 21, 2026
Merged

Thomas Jung (jung-thomas) merged 1 commit into
DEVfrom
worktree-fix-unit-test-pollution-977

Conversation

@jung-thomas

Copy link
Copy Markdown
Contributor

The real root cause (supersedes #3160)

PR #3160 was merged but did not fix the red unit tests — it changed a test's deploy on a disproven cross-file-pollution theory. The actual bug is in the GDPR anonymize cascade.

srv/lib/data-subject-resolver.js returned the nested-marker with a bare entity name:

{ column: 'tab_ID', values: null, nested: true, via: 'DeveloperEnvironmentTabs' }

The GDPR anonymize actions (anonymizeUser/anonymizeByDsrRequest) are bound to the served AdminService. In that request context, the cascade's SELECT.from('DeveloperEnvironmentTabs') resolves to the AdminService projection of that name, and CAP emits literal:

SELECT ID FROM DeveloperEnvironmentTabs WHERE user_ID = ?

There is no such physical table (it's com_sap_developers_ims_DeveloperEnvironmentTabs) → 500 'no such table: DeveloperEnvironmentTabs', failing admin-service.test.js and anonymize-dsr-request-number.test.js.

Why it was CI-only / green in isolation

The resolver's own unit tests exercise the cascade against cds.db directly, where the bare name resolves to the db entity and works. Only the served OData path (which the two failing files use via cds.test('serve')) mis-resolves the bare name against the service projection. I verified both names run fine against the direct db; only the served context diverges.

Fix

Qualify via to the full CDS name com.sap.developers.ims.DeveloperEnvironmentTabs, which resolves to the db-layer entity (correct namespaced table) in both contexts. Updated the two tests that asserted the old bare marker / CQN.

Verification

  • 80/80 green locally across data-subject-resolver, anonymization-cascade-authorid-gap, admin-service, anonymize-dsr-request-number, data-privacy-export, data-privacy-model.
  • The real confirmation is the full unit CI on this PR (the failure is served-context + CI-specific; I could not reproduce it in local scoped subsets, consistent with the mechanism).

Follow-ups (not in this PR)

🤖 Generated with Claude Code

…cade

The data-subject resolver returned the nested-marker `via: 'DeveloperEnvironmentTabs'`
(bare name). The GDPR anonymize actions are bound to the served AdminService, so
the cascade's `SELECT.from('DeveloperEnvironmentTabs')` resolved to the AdminService
*projection* in that request context and CAP emitted literal
`SELECT ID FROM DeveloperEnvironmentTabs` — a table that does not exist (the physical
table is com_sap_developers_ims_DeveloperEnvironmentTabs). Result: 500 'no such table:
DeveloperEnvironmentTabs' in anonymizeUser/anonymizeByDsrRequest, reddening the unit
suite on CI (green in isolation / direct-db unit context, where the bare name resolves
to the db entity).

Qualify `via` to the full CDS name so it always resolves to the db-layer entity and the
correct namespaced table, in both the served and direct-db contexts. Update the two
tests that asserted the old bare marker/SQL.

🤖 Generated with [Claude Code](https://claude.com/claude-code)
@jung-thomas
Thomas Jung (jung-thomas) merged commit 14e9053 into DEV Nov 21, 2026
5 of 6 checks passed
@jung-thomas
Thomas Jung (jung-thomas) deleted the worktree-fix-unit-test-pollution-977 branch November 21, 2026 18:12
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