Problem/Motivation
Follow-up to #3622400. The contrib Content Lock consult calls fetchLock($entity). That is the 3.x API. Content Lock 8.x-2.x (still installable on Drupal 10, which this module supports) has:
fetchLock($entity_id, $langcode, $form_op = NULL, $entity_type = 'node')
$langcode is required. method_exists(..., 'fetchLock') is true on both majors, so the first governed JSON:API PATCH / tool save / delete on a D10 + Content Lock 2.x site throws ArgumentCountError — including when nothing is locked. That is a 500 on the agent channel, not a 422, and it never writes a content_lock_conflict evidence row.
W&L production uses Content Lock 3.x and is not affected. The optional consult must not take down the write plane on the rest of the support matrix.
Steps to reproduce
- Drupal 10.6, mcp_sentinel 1.x after #3622400, contrib content_lock 8.x-2.x enabled.
- Governed JSON:API PATCH of any existing node (locked or not).
Expected: 2xx or a 422 lock conflict. Actual: 500 ArgumentCountError from McpContentLock::fetchEditorialLock().
Proposed resolution
Dispatch on the number of required parameters (3.x = 1, 2.x = 2). Call the matching signature. Catch \TypeError (ArgumentCountError extends it) and skip the editorial consult rather than taking down the write plane.
Remaining tasks
- Signature-safe fetchLock.
- Unit double whose fetchLock requires ($id, $langcode, ...).
User interface changes
None.
API changes
None.
Data model changes
None.
Comments
Comment #2
jmcerdaCommitted to 1.x. The contrib consult now dispatches on the number of required fetchLock parameters (3.x vs 8.x-2.x) and treats a TypeError as no editorial lock rather than taking down the write plane.