{
  "$schema": "https://farmslot.io/schemas/recipe-v1.schema.json",
  "title": "Perps source-dev snapshot consistency",
  "description": "Uses the optional source-dev Extension background hook to sample bounded Perps market data and compare one generic visible activity-card identity with normalized history.",
  "paramsSchema": {
    "type": "object",
    "additionalProperties": false,
    "properties": {
      "sample_count": {
        "type": "integer",
        "minimum": 2,
        "default": 3
      },
      "sample_interval_ms": {
        "type": "integer",
        "minimum": 100,
        "default": 1000
      },
      "minimum_changed_market_count": {
        "type": "integer",
        "minimum": 0,
        "default": 0,
        "description": "Optional live-price movement assertion. Set above zero only when the proof requires observed market changes."
      },
      "minimum_history_count": {
        "type": "integer",
        "minimum": 1,
        "default": 1
      }
    }
  },
  "workflow": {
    "entry": "open-activity",
    "nodes": {
      "open-activity": {
        "action": "ui.navigate",
        "page": "perps-activity",
        "intent": "Open live Perps activity through visible controls",
        "next": "show-funds-activity"
      },
      "show-funds-activity": {
        "action": "metamask.perps.select_activity_filter",
        "filter": "deposits",
        "intent": "Show visible activity cards before generic identity comparison",
        "next": "sample"
      },
      "sample": {
        "action": "metamask.perps.read_snapshot",
        "include": ["markets", "history"],
        "sampling": {
          "count": "{{params.sample_count}}",
          "interval_ms": "{{params.sample_interval_ms}}"
        },
        "expect": {
          "minimum_changed_market_count": "{{params.minimum_changed_market_count}}",
          "minimum_history_count": "{{params.minimum_history_count}}",
          "require_activity_history_agreement": true
        },
        "max_items_per_section": 100,
        "intent": "Prove bounded market changes and one exact visible activity-to-history identity",
        "next": "capture"
      },
      "capture": {
        "action": "ui.screenshot",
        "path": "screenshots/perps-snapshot-consistency.png",
        "label": "Perps snapshot activity agreement",
        "intent": "Preserve reviewer-visible proof of the compared activity surface",
        "next": "done"
      },
      "done": {
        "action": "end",
        "status": "pass"
      }
    }
  }
}
