1import * as Cloudflare from "@/Cloudflare";
2import * as Provider from "@/Provider";
3import * as Test from "@/Test/Alchemy";
4import { expect } from "alchemy-test";
5import * as Effect from "effect/Effect";
6import { MinimumLogLevel } from "effect/References";
7
8const { test } = Test.make({ providers: Cloudflare.providers() });
9
10const logLevel = Effect.provideService(
11 MinimumLogLevel,
12 process.env.DEBUG ? "Debug" : "Info",
13);
14
15// IndicatorFeedPermission is non-listable (pattern (e)): a grant is keyed by
16// {feedId, accountTag} from the granting account's side, and Cloudflare
17// exposes no provider-side API to enumerate a feed's grantees. The only
18// related collection op (`listIndicatorFeedPermissions`, the
19// `/permissions/view` endpoint) returns feeds the *calling* account can
20// consume — feed metadata with no `accountTag` — which cannot reconstruct the
21// `read` Attributes shape. So `list()` returns `[]` without any cloud call,
22// which means this assertion runs cleanly even on the unentitled testing
23// account (Intel feeds are a paid Cloudforce One add-on:
24// `IndicatorFeedsNotEntitled`, HTTP 403, would gate any real feed lifecycle).
25test.provider(
26 "list returns [] for the non-listable IndicatorFeedPermission",
27 (stack) =>
28 Effect.gen(function* () {
29 yield* stack.destroy();
30
31 const provider = yield* Provider.findProvider(
32 Cloudflare.Intel.IndicatorFeedPermission,
33 );
34 const all = yield* provider.list();
35 expect(all).toEqual([]);
36
37 yield* stack.destroy();
38 }).pipe(logLevel),
39 {
40 tags: ["provider:cloudflare", "provider:cloudflare:intel", "live"],
41 timeout: 120_000,
42 },
43);