Issue #3586271: Clean up CCC inconsistencies and DX issues before rc1 (part 3)

Description

This MR includes the following changes, each in separate commits

  • 3c - final added to 9 framework-instantiated leaf classes with no extension use case.
  • 3f - 15 classes converted from traditional constructor + property + assignment to PHP 8.1 constructor promotion.
  • 2f - Normalized camelCase local variables and private-method parameters to snake_case in the 6 files named in the issue (AiContextSelector, AiContextRequestFactory, AiContextScopeResolver, AiContextRequest, AiContextRequestParamsData, AiContextResult), with two corrections from an earlier version of this description: AiContextRequest is a pure value object with only promoted constructor properties, so it had no applicable locals to normalize; and AiContextResult's one parameter rename (getSelectedItems($fullData)) was reverted back to camelCase after review, since it has no interface and the name is part of its public contract. No public method signature changed as a net result of this item — every parameter reachable via named arguments (AiContextRequestFactory::fromAgent()/isLoopAware()/findAgentConfig()/getResult()/getRenderedContext(), AiContextScopeResolver::prefilterItemIdsByScope()/filterByScope()/scoreAndSort()/calculateScopeScore()) was kept or restored to its original camelCase name. Only local variables and private-method parameters (never externally callable) were renamed.
  • 3d (Last 2 commits) - Added AiContextRendererInterface, AiContextScopeResolverInterface, following the existing AiContextSelectorInterface pattern (interface + alias registration in ai_context.services.yml). Internal consumers updated to type-hint against the interfaces. AiContextRequestFactory included later in separated commit 205e1a37.

Testing instructions

Acceptance criteria

  • 9 leaf classes marked final; no extension-point classes sealed
  • Remaining ~15 traditional constructors converted to promotion; parent::__construct() order preserved in forms
  • camelCase locals normalized in Service/Model targets (or sub-tasks filed if split)
  • At least one new service interface added following AiContextSelectorInterface pattern (or sub-tasks filed for remaining)
  • phpcs --standard=Drupal,DrupalPractice src/ tests/ clean
  • phpstan analyze clean on touched files
  • Existing test suite passes (Unit, Kernel, Functional)

AI Compliance

Note

Check the one that best describes your usage, or leave all unchecked if AI was not significantly used.

  • AI Assisted Code
    Mainly written by a human; AI used for autocomplete or partial generation under full human supervision.
  • AI Generated Code
    Mainly generated by AI, reviewed and approved by a human before this MR was created.
  • Vibe Coded
    Generated by AI and only functionally reviewed before this MR was created.

Closes #3586271

Edited by Juan Correa

Merge request reports

Loading