AI Search tests is failing on next minor

Created on 1 September 2025, about 1 month ago

Problem/Motivation

Currently PHPUnit next minor is failing with the following issue

    Ai Search Setup My Sql (Drupal\Tests\ai_search\Functional\AiSearchSetupMySql)
     ✘ Field indexing options
       ┐
       ├ Behat\Mink\Exception\ResponseTextException: The text "[Chocolate Cake](/web/node/1)" was not found anywhere in the text of the current page.
       │
       │ /builds/project/ai/vendor/behat/mink/src/WebAssert.php:907
       │ /builds/project/ai/vendor/behat/mink/src/WebAssert.php:293
       │ /builds/project/ai/web/core/tests/Drupal/Tests/WebAssert.php:981
       │ /builds/project/ai/modules/ai_search/tests/src/Functional/AiSearchSetupMySqlTest.php:234
       ┴
     ✘ Search view
       ┐
       ├ Row 1 contains "cake".                                                   
       ├ Failed asserting that 'Member for 0 seconds Submitted by ch6a6ed3 on Mon, 1 Sep 2025 - 17:08 gpwhoy2d7tne6o0rppnexhjosiaw1u8u' [ASCII](length: 102) contains "Strawberry Cheese Cake" [ASCII](length: 22).
       │
       │ /builds/project/ai/modules/ai_search/tests/src/Functional/AiSearchSetupMySqlTest.php:320

We need to verify if this is a real issue or a testing issue before Drupal 11.3 is released.

Proposed resolution

Try to replicate the error using a setup with Drupal 11.3
If not, try to figure out what is failing in the test.

🐛 Bug report
Status

Active

Version

1.2

Component

AI Search

Created by

🇩🇪Germany marcus_johansson

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @marcus_johansson
  • 🇬🇧United Kingdom littlepixiez

    It is failing here:

    $this->assertSession()->pageTextContains('[Chocolate Cake](' . $this->nodes[0]->toUrl()->toString() . ')');
    

    However, in Drupal 11.2, this is how the markup appears:

    And in Drupal 11.3, this is how the markup appears:

    I can't quite figure out where Drupal core has made a change that is effecting this. The actual value is missing completely, so the rendered item in 11.2 is:

    <article>
    
      
          <h2>
          <a href="/node/1" rel="bookmark">
    <span>Chocolate Cake</span>
    </a>
        </h2>
        
    
          <footer>
          <article>
      <div class="js-form-item form-item js-form-type-item form-item- js-form-item- form-no-label">
            <h4 class="label">Member for</h4> 0 seconds
            </div>
    </article>
    
          <div>
            Submitted by 
    <span><span>ct7lb84o</span></span>
     on 
    <span><time datetime="2025-09-02T07:29:43+10:00" title="Tuesday, 2 September 2025 - 07:29">Tue, 2 Sep 2025 - 07:29</time>
    </span>
          </div>
        </footer>
      
      <div>
        
                <div><p>d53u1fapp20u9xclhptuqr7cm83p5cp5</p>
    </div>
          
      </div>
    
    </article>

    And the rendered item in 11.3 is:

    
    <article>
    
      
        
    
          <footer>
          <article>
      <div class="js-form-item form-item form-type-item js-form-type-item form-item- js-form-item- form-no-label">
            <h4 class="label">Member for</h4> 0 seconds
            </div>
    </article>
    
          <div>
            Submitted by 
    <span><span>uxwhrmlz</span></span>
     on 
    <span><time datetime="2025-09-02T07:31:11+10:00" title="Tuesday, 2 September 2025 - 07:31">Tue, 2 Sep 2025 - 07:31</time>
    </span>
          </div>
        </footer>
      
      <div>
        
                <div><p>vhzxyxa8xnq3kfrlsbpgsblz1sme4xza</p>
    </div>
          
      </div>
    
    </article>
    
    
    

    So it is stripping out the H2 completely. I'll have more of a dig when I get time - perhaps somebody can glance at this and have an "aha" moment!

    Depending on how much we "need" this to be correct, we could just add in a conditional or just check for the title? Dependant on this module's need for the check. I can't see anything that's "breaking" this, but I'd need some more time to dig in.

  • 🇬🇧United Kingdom scott_euser

    Thanks, that debugging was very helpful!

    Not solved yet, but I can see as a result of `git bisect` that 📌 Deprecate $variables['page'] for node.html.twig Active is the issue. Namely the change there to the node.html.twig now checks if view mode is full, and if so, does not output the URL.

    So we are expecting to render the 'full' view mode and therefore the URL should not be expected after that commit.

    We can update the tests to check that the title of the found results are as expected rather than title and link. E.g. either [Chocolate Cake]( (to keep it working in 11.2) or # Chocolate Cake (i.e., without the URL for 11.3)

  • 🇬🇧United Kingdom littlepixiez

    So sorry @gxleano, I missed the assignment being to yourself! I was just testing this all locally and @scott_euser you are a genius - I have never heard of git bisect before.

    It looks like we can just update the view mode to "default", and it will then show the label reliably in all versions, /or/ we can update what we are looking for in the test. I have tested it with changing the view mode here:
    https://git.drupalcode.org/project/ai/-/merge_requests/867

    However, @gxleano you may want to fix this as it's assigned to yourself. :)

  • Pipeline finished with Failed
    25 days ago
    Total: 193s
    #594218
Production build 0.71.5 2024