{
  "id": "LC-ADMIN-OVERRIDE-CLOSEDATE",
  "name": "Admin-seeded higher-priority CloseDate default wins over platform seed",
  "description": "Phase-1 Finding-2 Admin-Config regression. The platform pack seeds one _System_ActionFieldDefault row for (convertLead, Opportunity, CloseDate) with priority=0 and formula 'TODAY() + 30'. An admin overrides that by inserting another row with priority=10 and IsCustomized=1. GetActionFieldDefaults sorts by Priority DESC within (TargetObject, FieldAPIName); the resolver honors the first row. Historical drafts of this case used 'TODAY() + 90' for the admin override and asserted CloseDate is_not_null — calendar-drift fragile AND weak (TODAY()+30 would also pass). We now seed a LITERAL future date ('2099-12-31') so the assertion CloseDate eq '2099-12-31' crisply proves the admin row fired AND pack's '+30' did not.",
  "object": "LeadConvert",
  "method": "POST",
  "endpoint": "/services/data/v63.0/actions/standard/convertLead",
  "setup": [
    {
      "type": "sql",
      "sql": "INSERT INTO `_System_ActionFieldDefault` (Id, StandardActionId, TargetObject, FieldAPIName, ValueFormula, Priority, IsCustomized, IsActive, IsDeleted, CreatedDate, LastModifiedDate) VALUES ('afd_convertlead_opportunity_closedate_admin', 'sa_convertlead', 'Opportunity', 'CloseDate', '\\'2099-12-31\\'', 10, 1, 1, 0, NOW(), NOW()) ON DUPLICATE KEY UPDATE ValueFormula=VALUES(ValueFormula), Priority=VALUES(Priority), IsCustomized=1, IsActive=1, IsDeleted=0, LastModifiedDate=NOW()"
    }
  ],
  "payload": {
    "inputs": [
      {
        "leadId": "{seed_Lead_0}",
        "convertedStatus": "Converted",
        "opportunityName": "Admin-Override Opportunity"
      }
    ]
  },
  "expects": {
    "status_code": 200
  },
  "extract": {
    "opportunity_id": "0.outputValues.opportunityId"
  },
  "query_after": {
    "object": "Opportunity",
    "record_id": "{opportunity_id}",
    "assertions": [
      {"field": "Name", "operator": "eq", "value": "Admin-Override Opportunity"},
      {"field": "CloseDate", "operator": "eq", "value": "2099-12-31"}
    ]
  },
  "teardown": [
    {
      "type": "sql",
      "sql": "UPDATE `_System_ActionFieldDefault` SET IsActive=0, IsDeleted=1 WHERE Id = 'afd_convertlead_opportunity_closedate_admin'"
    }
  ],
  "priority": "P0",
  "scene": "lead_convert"
}
