/**
 * canary-tasks.ts — The Tier 3 canary set.
 *
 * Five tasks the Tier 3 nightly workflow runs against live LLMs every day.
 * Composition follows the design doc's "weighted toward modes/areas with
 * the most production usage and the highest historical regression rates"
 * recommendation: GROQ and Content Lake (foundational consumer surfaces),
 * Portable Text (historically drift-prone), Studio schema authoring (the
 * second-most-used surface after queries), and a knowledge-probe pairing
 * for cross-mode coverage.
 *
 * Each entry's `rationale` is the canary's load-bearing field — without it,
 * future maintainers can't reason about whether a regression is meaningful
 * or whether the slot has lost value. Update the rationale when you swap a
 * canary entry; never silently replace one.
 *
 * Validated against the live task inventory by `scripts/check-canary-tasks.ts`
 * (`pnpm check`). Dangling task IDs fail the build.
 *
 * @see docs/design-docs/testing-strategy.md — "Tier 3 — Live LLMs"
 * @see .github/workflows/tier-3-nightly.yml — consumer
 */

import { defineCanaryTasks } from "@sanity/ailf-core"

export default defineCanaryTasks({
  tasks: [
    {
      taskId: "groq-blog-queries",
      mode: "literacy",
      rationale:
        "Canonical first-use path for Sanity's most-used API. GROQ is the largest doc surface and the highest-leverage canary slot — drift here means drift in the most-consumed documentation. Filtering and pagination together exercise the largest cross-section of GROQ syntax in a single task.",
    },
    {
      taskId: "content-lake-mutations",
      mode: "literacy",
      rationale:
        "Foundational client API. CRUD is structurally distinct from query reasoning, so this catches regressions in mutation/transaction documentation that GROQ canary slots cannot reach. Every Sanity consumer eventually writes to the Content Lake.",
    },
    {
      taskId: "portable-text-rendering",
      mode: "literacy",
      rationale:
        "Major doc surface flagged as historically drift-prone in the testing audit. React-rendering of Portable Text mixes documentation, type definitions, and worked examples — a regression on any axis surfaces here first.",
    },
    {
      taskId: "studio-blog-schema",
      mode: "literacy",
      rationale:
        "Schema authoring (`defineType` / `defineField`) is the second-most-used surface after queries. Tests structural Studio docs that change shape across versions; pairs naturally with the GROQ canary because consumers typically author schemas before querying them.",
    },
    {
      taskId: "kp-groq-projections",
      mode: "knowledge-probe",
      rationale:
        "Cross-mode coverage. Pairs with `groq-blog-queries` (literacy) so we catch GROQ drift in both implementation (write code) and recall (explain syntax) modes. Knowledge-probe is the only non-literacy mode in the canary today; expand once mcp-server tasks land in the repo.",
    },
    // mcp-server canary slot — add a third mode here when a committed
    // mcp-server task lands under packages/eval/tasks/mcp-server/. Today
    // there are no production mcp-server tasks (only fixtures); the trigger
    // is upstream and adding a placeholder slot would dangle. Surfaced at
    // Phase 5 close (2026-04-27) — see W0116 retrospective.
  ],
})
