Repository navigation
OpenConceptLab/ocl_online#454 | Page HEAD concept and mapping lists by ids first - #937
Merged
Merged
Conversation
…y ids first A source's HEAD concept or mapping list sliced its page out of the joined query (select_related from/to concepts, or created_by/updated_by), so a deep page ran those joins for every row its OFFSET skipped. CustomPaginator(page_by_ids=True) now filters the list by the sliced ids instead, and joins only the page's rows. ConceptListView and MappingListView turn it on for a source's HEAD list; repo-version lists already select their ids first and search results are paged by Elasticsearch. Pages return the same rows in the same order. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Member
Author
Codex review, pass 1 (codex-cli 0.162.1, commit 94e5ef0)Verdict: clean. No findings. findings.json{
"reviewer": "codex-cli 0.162.1",
"perspective": "defects",
"mode": "full",
"commit": "94e5ef03",
"verdict": "clean",
"prior": [],
"findings": []
} |
… trim paging tests From the simplification review of #937: should_page_by_ids reads parent_resource.is_head through pydash get; the paging tests drop a redundant set_checksums and a version-list test this change can't affect. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Member
Author
Simplification review (fresh Claude subagent, commit 94e5ef0)Verdict: 4 cuts proposed, all applied in 71095aa.
After the cuts, the paging tests fail on master and pass here; simplify.json{
"reviewer": "claude subagent",
"perspective": "simplify",
"mode": "full",
"commit": "94e5ef03",
"verdict": "findings",
"prior": [],
"findings": [
{
"id": "S1",
"severity": null,
"tag": "shrink",
"file": "core/concepts/views.py",
"line": 177,
"claim": "should_page_by_ids fetches parent_resource into a local and null-checks it; pydash get walks the dotted path (as core/common/mixins.py:187 does).",
"scenario": null,
"action": "return 'source' in self.kwargs and bool(get(self, 'parent_resource.is_head'))",
"lines_delta": -1,
"confidence": "high"
},
{
"id": "S2",
"severity": null,
"tag": "shrink",
"file": "core/mappings/views.py",
"line": 71,
"claim": "Same override as ConceptListView; shorten the same way.",
"scenario": null,
"action": "return 'source' in self.kwargs and bool(get(self, 'parent_resource.is_head'))",
"lines_delta": -1,
"confidence": "high"
},
{
"id": "S3",
"severity": null,
"tag": "delete",
"file": "core/integration_tests/tests_list_pages.py",
"line": 34,
"claim": "row.set_checksums() in setUp is redundant: the uncaptured limit=total request computes and stores every row's checksums before the page requests.",
"scenario": null,
"action": "nothing replaces it",
"lines_delta": -1,
"confidence": "medium"
},
{
"id": "S4",
"severity": null,
"tag": "delete",
"file": "core/integration_tests/tests_list_pages.py",
"line": 64,
"claim": "test_version_list_unchanged can't fail because of this PR: repo-version lists are is_sliced, so CustomPaginator never reads page_by_ids.",
"scenario": null,
"action": "nothing replaces it",
"lines_delta": -10,
"confidence": "low"
}
]
} |
Member
Author
Codex review, check of cuts (codex-cli 0.162.1, commit 71095aa)Verdict: clean. The simplification commit broke nothing. findings.json{
"reviewer": "codex-cli 0.162.1",
"perspective": "defects",
"mode": "cuts",
"commit": "71095aa8",
"verdict": "clean",
"prior": [],
"findings": []
} |
snyaggarwal
approved these changes
Oct 14, 2026
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.
Relates to OpenConceptLab/ocl_online#454 (partial). This is independent of #936; either can merge first.
Summary
On a source's HEAD concept or mapping list, the page query runs its joins for every row a deep page's OFFSET skips, and then throws those rows away. The joins are the
select_relatedfrom/to concepts for mappings, andcreated_by/updated_byfor concepts.This change selects the page's ids first and joins only those rows:
CustomPaginator(page_by_ids=True)filters by the sliced ids instead of slicing the joined query.ListWithHeadersMixin.should_page_by_ids()isFalseby default.ConceptListViewandMappingListViewreturnTruefor a source's HEAD list. Repo-version lists already select their ids first (is_sliced), and search results are paged by Elasticsearch, so neither changes.updated_at(rare) may swap places within a page; their order was already arbitrary.Effect
I timed the page query alone on production data, warm cache:
Both return identical rows. Details are on the ticket.
Next step (not in this PR)
On a cold cache, most of a deep page's cost is the OFFSET walk itself: the ids subquery reads every skipped row from the table to get its id. A covering index would let that walk read the index alone: the list index's columns
(parent_id, updated_at DESC)withINCLUDE (id), under the same predicate. That index needs this change, because master's page query reads whole rows. It's a migration on the concepts and mappings tables, so it's proposed on the ticket first.Tests
core/integration_tests/tests_list_pages.py(new) checks two things, for concepts and mappings:pylint -j0 core/is clean.Review
should_page_by_ids, a redundant test setup step, and a test this change can't affect.🤖 Generated with Claude Code