diff --git a/srv/lib/data-subject-resolver.js b/srv/lib/data-subject-resolver.js index 4959ab919..77838de87 100644 --- a/srv/lib/data-subject-resolver.js +++ b/srv/lib/data-subject-resolver.js @@ -15,7 +15,7 @@ * The resolver cannot produce tab IDs without a DB query, so it returns a * nested marker instead of resolved values: * - * { column: 'tab_ID', values: null, nested: true, via: 'DeveloperEnvironmentTabs' } + * { column: 'tab_ID', values: null, nested: true, via: 'com.sap.developers.ims.DeveloperEnvironmentTabs' } * * Task-4 (export handler) and Task-5 (anonymization cascade fix) MUST check * for `result.nested === true` and: @@ -75,12 +75,21 @@ export async function resolveSubjectKeys(user, planEntry) { // DeveloperEnvironmentLinks — linked via parent DeveloperEnvironmentTabs (tab_ID) // Cannot resolve without a DB query; return a nested marker for the caller to handle. + // + // `via` MUST be the fully-qualified CDS name, not the bare "DeveloperEnvironmentTabs". + // The cascade runs inside the AdminService request context (the GDPR actions are + // bound to that served service), where a bare "DeveloperEnvironmentTabs" resolves to + // the AdminService *projection* and CAP emits literal `SELECT ID FROM + // DeveloperEnvironmentTabs` — a table that does not exist (the physical table is + // `com_sap_developers_ims_DeveloperEnvironmentTabs`), producing a 500 + // "no such table: DeveloperEnvironmentTabs". Qualifying the name forces resolution + // to the db-layer entity and the correct namespaced table. if (dataSubjectField === 'tab_ID') { return { column: 'tab_ID', values: null, nested: true, - via: 'DeveloperEnvironmentTabs' + via: 'com.sap.developers.ims.DeveloperEnvironmentTabs' }; } diff --git a/test/unit/anonymization-cascade-authorid-gap.test.js b/test/unit/anonymization-cascade-authorid-gap.test.js index 55900e14d..1290e4b25 100644 --- a/test/unit/anonymization-cascade-authorid-gap.test.js +++ b/test/unit/anonymization-cascade-authorid-gap.test.js @@ -199,8 +199,12 @@ describe('anonymization-cascade: AuthorAiRequests authorId gap', () => { // never runs AND this intermediate SELECT never runs either. // If `resolved.via` were changed to a wrong entity, a different SELECT // would appear instead — both cases cause this assertion to fail. + // capturedRuns stores JSON.stringify(cqn), so it holds the fully-qualified + // CDS name `com.sap.developers.ims.DeveloperEnvironmentTabs` (dotted) — NOT + // the bare "DeveloperEnvironmentTabs", which would collide with the + // AdminService projection and 500 through the served context (#977 CI bug). const nestedSelectFired = capturedRuns.some( - s => s.includes('"DeveloperEnvironmentTabs"') && s.includes('user_ID') && s.includes(userId) + s => s.includes('com.sap.developers.ims.DeveloperEnvironmentTabs') && s.includes('user_ID') && s.includes(userId) ); expect(nestedSelectFired).toBe(true); diff --git a/test/unit/data-subject-resolver.test.js b/test/unit/data-subject-resolver.test.js index 35b28aeb1..27249efd6 100644 --- a/test/unit/data-subject-resolver.test.js +++ b/test/unit/data-subject-resolver.test.js @@ -109,7 +109,7 @@ describe('resolveSubjectKeys', () => { expect(result).not.toBeNull(); expect(result.column).toBe('tab_ID'); expect(result.nested).toBe(true); - expect(result.via).toBe('DeveloperEnvironmentTabs'); + expect(result.via).toBe('com.sap.developers.ims.DeveloperEnvironmentTabs'); // values should be null (caller must resolve the parent Tabs first) expect(result.values).toBeNull(); });