MCPcopy Create free account
hub / github.com/UsefulSoftwareCo/executor / assertReachReadOnly

Function assertReachReadOnly

packages/core/sdk/src/owner-policy.ts:146–162  ·  view source on GitHub ↗
(
  tableName: string,
  access: string,
  context: ExecutorOwnerPolicyContext | undefined,
)

Source from the content-addressed store, hash-verified

144 * and the leftovers would otherwise survive as orphans that agents still see.
145 */
146export const assertReachReadOnly = (
147 tableName: string,
148 access: string,
149 context: ExecutorOwnerPolicyContext | undefined,
150): void => {
151 if (context === undefined) return;
152 if (context.writes === "delete-only") {
153 if (access === "delete") return;
154 policyViolation(
155 `Storage ${access} on table "${tableName}" is not allowed: this context may only delete.`,
156 );
157 }
158 if (context.reach !== "tenant" && context.writes !== "denied") return;
159 policyViolation(
160 `Storage ${access} on table "${tableName}" is not allowed: the platform view is read-only.`,
161 );
162};
163
164/** Assert a create/upsert writes a row inside the bound partition. */
165export const assertOwnerWritable = (

Callers 4

tenantExecutorTableFunction · 0.90
ownedExecutorTableFunction · 0.90
assertOwnerWritableFunction · 0.85
assertOwnerPatchFunction · 0.85

Calls 1

policyViolationFunction · 0.85

Tested by

no test coverage detected