Repository navigation
OpenConceptLab/ocl_online#456 | Load a page's concept mappings once for includeMappings concept lists - #949
Conversation
…or includeMappings concept lists
snyaggarwal
left a comment
There was a problem hiding this comment.
No blocking findings.
Verified the batched mapping lookup against the existing version-aware direct-mapping behavior, including map type, target repository, and retired filters. Collection and inverse-mapping paths remain unchanged.
Local verification:
ConceptSerializersTest: 22 tests passed- Pylint completed successfully (one non-blocking existing-style
too-many-localsdiagnostic) - Snyk passed; GitHub Pylint check was still pending at review time.
Submitted as a comment because GitHub does not permit authors to approve their own pull requests.
snyaggarwal
left a comment
There was a problem hiding this comment.
Second-pass review: endpoint matrix
I traced the change through the broader concept-list surfaces:
- Source HEAD lists: batching is active.
- Source-version lists: batching is active and retains the existing version-aware mapping lookup.
- Concept version-history lists: batching is active.
- Global
/concepts/: batching is active; matching on both mapping parent and concept/version IDs prevents cross-source association. - Collection concept lists: batching is intentionally bypassed, preserving collection/expansion-aware mapping resolution.
- Explicit expansion concept lists: also bypassed because the view context contains
collection, preserving existing behavior. - Inverse mappings: bypassed everywhere, preserving the existing path.
Additional source/version/collection/global and mapping-access tests passed (8 tests). I found no concrete defect, so the clean verdict stands.
Remaining non-blocking coverage gap: the new PR test exercises a raw serializer page from one source. An API-level parameterized regression test covering includeMappings=true for source versions, collections, explicit expansions, and a multi-source global list would make this matrix explicit and guard the intentional bypasses.
…ppings across concept list endpoints
…PI responses The per-concept mapping querysets had no ORDER BY, so two identical requests could list a concept's mappings in different orders once rows were rewritten (the first request saves their checksums). That made test_inverse_mappings_are_unchanged fail intermittently on CI. Both get_mappings implementations now order by id, as the batched path from #949 already does. The test compares plain lists, so a failure shows the differing element, and checks the mapping order. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TjM9dGow2KV1Gwr2dWQdph
…es flaky inverse-mappings test) (#954) * OpenConceptLab/ocl_online#456 | Print the full diff when the includeMappings list tests fail test_inverse_mappings_are_unchanged failed on master CI twice at 0c4bae2, with a diff truncated to its first difference (checksum key order). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TjM9dGow2KV1Gwr2dWQdph * OpenConceptLab/ocl_online#456 | Temporary: print the unequal leaves when the inverse-mappings test fails Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TjM9dGow2KV1Gwr2dWQdph * OpenConceptLab/ocl_online#456 | Temporary diagnostic: satisfy pylint Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TjM9dGow2KV1Gwr2dWQdph * OpenConceptLab/ocl_online#456 | Order a concept's mappings by id in API responses The per-concept mapping querysets had no ORDER BY, so two identical requests could list a concept's mappings in different orders once rows were rewritten (the first request saves their checksums). That made test_inverse_mappings_are_unchanged fail intermittently on CI. Both get_mappings implementations now order by id, as the batched path from #949 already does. The test compares plain lists, so a failure shows the differing element, and checks the mapping order. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TjM9dGow2KV1Gwr2dWQdph --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Refs OpenConceptLab/ocl_online#456
Problem
Concept lists with
includeMappings=trueserialized each concept's mappings separately, so lookups ran once per concept (~250 ms/row on CIEL).Change
ConceptAbstractSerializer.preload_pagefetches all direct mappings for the page in one query (honouringmapTypes,targetRepoUrls, retired) and runs the OpenConceptLab/ocl_online#454 | Load list-row lookups once per page for concepts and mappings #936load_list_fieldsonce for them.SourceChildPageSerializercallspreload_pagewhen the child serializer defines it.includeInverseMappingskeep the existing per-concept path.Measured (local DB with full CIEL, 100 rows, includeMappings=true, cache cleared)
mappingBrief=true: 2,226 ms -> 298 ms (query counter read 0, timing only)Not done
concept.get_latest_version()still runs once per concept.Tests
New
test_list_serializer_loads_page_mappings_oncecompares page output with row-by-row output and bounds query growth.🤖 Generated with Claude Code