fix: #3582961 fail closed when tool input is invalid or missing

Closes #3582961

Summary

  • catch InvalidArgumentException while ToolBase::access() obtains executable input values;
  • return FALSE for the boolean form and a generic forbidden result for the object form;
  • make the input-dependent denial uncacheable and avoid exposing raw validation details;
  • align the implementation's $return_as_object type with ToolInterface;
  • align the AI connector's missing-input regression test with the new access-denied path while retaining its repair-oriented input schema.

Verification

  • php -l src/Tool/ToolBase.php
  • php -l tests/src/Kernel/Tool/ToolBaseTest.php
  • php -l modules/tool_ai_connector/tests/src/Kernel/ToolPluginBaseStructuredOutputTest.php
  • focused standalone smoke of invalid boolean/object access, generic reason, max-age 0, and valid delegation
  • composer validate --no-check-publish
  • git diff --check

Pipeline 915961 surfaced the connector's former execution-error expectation and initial PHPStan union narrowing. Pipelines 915965 and 915981 passed PHPUnit while refining PHPStan's interface-specific narrowing for reason and cache methods. Commits b68c903, 33e7a24, and ba9db19 address those contracts. Pipeline 915985 passed, including PHPStan and PHPUnit.

The Kernel tests were not executed locally because this isolated worktree has no installed Drupal/PHPUnit runtime. They ran in the project's Drupal CI matrix.

AI-assisted code: AI helped implement and review this change. The behavior and follow-ups were independently reviewed and smoke-tested; full Kernel execution is provided by upstream CI.

Edited by Alex Urevick-Ackelsberg

Merge request reports

Loading