Repository navigation
test(core): stop the cursor-plan test expecting a collection walk for small terms - #3703
Conversation
… small terms The taxonomy cases in loader-cursor-plan.test.ts tag 40 posts with one term and assert that every page walks the ec_post published_at index. Since the small-term change (emdash-cms#3402), the loader walks ec_post only for a term with at least LARGE_TERM_ASSIGNMENTS (200) pivot rows and seeks a smaller term on the pivot, sorting just its entries. Both changes were green on their own bases; together they fail both taxonomy cases on main. The fixture now creates LARGE_TERM_ASSIGNMENTS posts, so the taxonomy cases keep exercising the walk this test guards, including the seek on descending pages that continue from an undated entry. Small terms stay covered by loader-taxonomy-pivot-plan.test.ts.
The fixture follows LARGE_TERM_ASSIGNMENTS, but the expected page count divided it by the page size, which is exact only while the page size divides the threshold. The last page can be partial, so the count now rounds up and a retuned threshold keeps the test on what it guards.
|
There was a problem hiding this comment.
This is the right fix for the right problem. Two independent PRs collided: #3662 added a test that asserted an index walk for a taxonomy-filtered published_at sort, and #3402 made that code path conditional on a term having at least LARGE_TERM_ASSIGNMENTS assignments. With only 40 tagged posts the term is small, the loader correctly seeks the pivot, and the plan assertions fail. Raising the fixture to LARGE_TERM_ASSIGNMENTS posts restores what the test was actually meant to exercise—the cursor-pagination plan shape on an index walk—without touching the loader.
I read the diff, the full test file, the loader source around LARGE_TERM_ASSIGNMENTS and buildTaxonomyPivotQuery, and the sibling loader-taxonomy-pivot-plan.test.ts. The small-term pivot path remains covered there, so this change doesn’t leave a gap. The new POSTS / PAGE_SIZE constants and the explanatory comment make the fixture boundary explicit. No production code, API contract, authorization boundary, locale filter, or logged-out query path is changed.
The PR is test-only, so no changeset is required and the author correctly marked those checklist items n/a. The formatting matches the repo’s tab convention. I found no issues to fix.
What does this PR do?
mainhas been red since #3402 merged: the two taxonomy cases inloader-cursor-plan.test.tsfail there (Test Shard (2/4)) and on PRs pushed since.Two PRs that each passed CI on their own collided:
published_atindex onec_post.With 40 posts the category counts as small, so the loader seeks the pivot. The loader is right; the fixture is too small. This PR creates
LARGE_TERM_ASSIGNMENTSposts, so these cases test the index walk again. The loader is unchanged.Type of change
Checklist
pnpm typecheckpassespnpm lintpassespnpm testpasses (or targeted tests for my change)pnpm formathas been runmessages.pochanges except in translation PRs — a workflow extracts catalogs on merge tomain. (n/a: no admin UI change)AI-generated code disclosure
Screenshots / test output
main, the plan sorts in a temporary B-tree instead of walking the index:LARGE_TERM_ASSIGNMENTS - 5posts fails exactly these two cases again; reverting fix(core): page lists across empty sort values #3662's loader and query changes fails all four on the page count.loader-taxonomy-pivot-plan.test.ts.