Skip to content

OpenConceptLab/ocl_online#456 | Load a page's concept mappings once for includeMappings concept lists - #949

Merged
snyaggarwal merged 3 commits into
masterfrom
ocl_online#456
Oct 21, 2026
Merged

snyaggarwal merged 3 commits into
masterfrom
ocl_online#456

Conversation

@snyaggarwal

Copy link
Copy Markdown
Contributor

Refs OpenConceptLab/ocl_online#456

Problem

Concept lists with includeMappings=true serialized each concept's mappings separately, so lookups ran once per concept (~250 ms/row on CIEL).

Change

Measured (local DB with full CIEL, 100 rows, includeMappings=true, cache cleared)

  • Detail: 1,610 queries / 2,252 ms -> 125 queries / 645 ms
  • mappingBrief=true: 2,226 ms -> 298 ms (query counter read 0, timing only)
  • Response identical to the old one except the order of mappings within a concept, which was unspecified before and is now by id.

Not done

  • Production timing of a 100-row CIEL page and the saved-page comparison (AC 2, 3 and 4).
  • concept.get_latest_version() still runs once per concept.

Tests

New test_list_serializer_loads_page_mappings_once compares page output with row-by-row output and bounds query growth.

🤖 Generated with Claude Code

@snyaggarwal snyaggarwal left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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-locals diagnostic)
  • 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 snyaggarwal self-assigned this Oct 21, 2026

@snyaggarwal snyaggarwal left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@snyaggarwal
snyaggarwal merged commit 6996294 into master Oct 21, 2026
1 of 2 checks passed
@snyaggarwal
snyaggarwal deleted the ocl_online#456 branch October 21, 2026 08:23
paynejd added a commit that referenced this pull request Oct 22, 2026
…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
paynejd added a commit that referenced this pull request Oct 22, 2026
…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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant