Repository navigation
test(content): pin where the agent's product grid goes when the most-linked section isn't the last - #1653
Merged
Conversation
…linked section isn't the last Follow-up from ansvisor#1607 (item 2). The grid goes at the end of the H2 section that links the path's products most. In the tests that section was always the one before the FAQ, so the tests still passed if the grid always went before the last H2, or after the first section that links any product. A page now links one product before the most-linked section and one after it, with a section and the FAQ last; and two sections that link them as often take the first. Each of these breaks the new test: the grid before the last H2 always, after the first section that links any, and the later of two on a tie. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This was referenced Oct 28, 2026
gkhngyk
approved these changes
Oct 28, 2026
gkhngyk
left a comment
Contributor
There was a problem hiding this comment.
Looks good.
What I checked:
- Own change. 5f9ebba on main (3f6a4d4), one test file. It merges cleanly on main and with #1654, #1662, #1663 and #1664.
- The test pins the placement. On this head,
shopping-blocks.test.jspasses (12 tests). WithinsertProductGridbroken on purpose, the new test fails each time:- the grid always before the last H2;
- the grid after the first section that links a product;
- the later of two sections on a tie (
>=for>); - the grid after the last section that links a product (this one also fails the older test).
- The tie case's regex tells the two sections apart by their last link (
p2in "Picks",p1in "More"), so a grid after "More" can't match it.
Before the API deploy: test only, nothing changes.
8 of 12 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Follow-up from #1607 (item 2): the test now pins where the Content Agent puts its product grid when the most-linked section isn't the last one.
The grid goes at the end of the H2 section that links the path's products most. In the existing tests, that section was always the one just before the FAQ. So the tests still passed if the grid always went before the last H2, or after the first section that links any product.
The new test page links one product before the most-linked section and one after it, with another section and the FAQ last. A second case has two sections that link products equally often; the first of them wins.
Each of these wrong placements fails the new test (checked by breaking the code on purpose, then putting it back):
Test only, no behaviour change.
Related issue
Follow-up from #1607's review.
Type of change
feat— New featurefix— Bug fixchore— Maintenance / dependenciesdocs— Documentation onlyrefactor— Code change that neither fixes a bug nor adds a featuretest— Adding or updating testsHow to test
cd server && npx vitest run src/lib/shopping-blocks.test.jsChecklist
feature/,fix/,chore/,docs/) — see CONTRIBUTING.mdyarn lintpasses (run fromweb/)yarn typecheckpasses (run fromweb/)yarn format:checkpasses (run fromweb/)Full checks were run in one tree with this batch's six follow-up branches merged:
The branch prefix is
test/, matching the commit type.🤖 Generated with Claude Code