/**
 * A dashboard/API-triggered pipeline request must be scoped so the webhook
 * handler never dispatches an unbounded whole-corpus run. A request is scoped
 * when it pins a release (`perspective`), specific `tasks`, or one or more
 * feature `areas` — a feature area is a bounded set of tasks (the production
 * cron runs area-scoped evals).
 *
 * Both webhook entrypoints — `eval-request-handler.ts` (Cloud Run) and the
 * API gateway's `routes/webhooks.ts` (Vercel) — share this single predicate
 * so their scoping rules can't drift. The dashboard's doc-impact pre-flight
 * gate applies it to the request it is about to derive, so a baseline it lets
 * through is one the webhook will accept.
 */
export function isPipelineRequestScoped(request) {
    const hasPerspective = !!request.perspective;
    const hasTasks = Array.isArray(request.tasks) && request.tasks.length > 0;
    const hasAreas = Array.isArray(request.areas) && request.areas.length > 0;
    return hasPerspective || hasTasks || hasAreas;
}
