Skip to content
This repository was archived by the owner on Oct 14, 2026. It is now read-only.

Commit 97f0d11

Browse files
test(data-access): handle expected RPC-only table permission denials
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent ac6b81b commit 97f0d11

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

‎packages/spacecat-shared-data-access/test/it/postgrest/all-collections-methods-coverage.test.js‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,15 @@ const collectErrorMessages = (error) => {
104104
return messages.join(' | ');
105105
};
106106

107+
// RPC-only tables: data-service revokes every PostgREST table grant and exposes them
108+
// solely through SECURITY DEFINER RPCs, so generic REST reads are denied by design.
109+
const RPC_ONLY_TABLES = {
110+
AbvOnboardingClaim: 'abv_onboarding_claims',
111+
};
112+
113+
const isRpcOnlyDenial = (entityName, error) => RPC_ONLY_TABLES[entityName] !== undefined
114+
&& collectErrorMessages(error).includes(`permission denied for table ${RPC_ONLY_TABLES[entityName]}`);
115+
107116
const isExpectedInvocationError = (error) => {
108117
const message = collectErrorMessages(error);
109118
return EXPECTED_INVOCATION_ERROR_PATTERNS.some((pattern) => message.includes(pattern));
@@ -339,6 +348,10 @@ describe('PostgREST IT - all collections methods coverage', () => {
339348
return;
340349
}
341350

351+
if (isRpcOnlyDenial(entityName, error)) {
352+
return;
353+
}
354+
342355
// For mutating methods and synthetic-argument validation in this smoke test,
343356
// controlled errors are acceptable.
344357
if (isMutatingMethod(methodName) || isExpectedInvocationError(error)) {

0 commit comments

Comments
 (0)