{
  "id": "PS-004",
  "name": "PATCH unknown PermissionsX fails with INVALID_FIELD",
  "description": "ApplyPermissionChanges validates each apiName against the active _System_Permission catalog and rejects orphans before any junction write. Guards W1 — closes the pre-P12 footgun where POST with {PermissionsFoobar: true} silently created orphan junction rows.",
  "object": "PermissionSet",
  "method": "PATCH",
  "setup": {
    "method": "POST",
    "endpoint": "/services/data/v63.0/sobjects/PermissionSet",
    "payload": {
      "Name": "E2E_PS_004_OrphanReject",
      "Label": "E2E Orphan Reject"
    }
  },
  "endpoint": "/services/data/v63.0/sobjects/PermissionSet/{setup_id}",
  "payload": {
    "PermissionsFoobar": true
  },
  "expects": {
    "status_code": 400
  },
  "teardown": {
    "method": "DELETE",
    "endpoint": "/services/data/v63.0/sobjects/PermissionSet/{setup_id}"
  },
  "priority": "P0",
  "scene": "permission_set"
}
