Skip to content

OpenConceptLab/ocl_issues#3009 | Expansions show built_with - #1060

Merged
snyaggarwal merged 2 commits into
masterfrom
issues-3009-expansion-built-with
Nov 25, 2026
Merged

snyaggarwal merged 2 commits into
masterfrom
issues-3009-expansion-built-with

Conversation

@snyaggarwal

@snyaggarwal snyaggarwal commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

Ticket: OpenConceptLab/ocl_issues#3009 · Epic: OpenConceptLab/ocl_issues#2942

Why

OpenConceptLab/ocl_issues#3009's TBv3 panel (OpenConceptLab/oclweb3#114) suggests a rebuild to move an expansion off a lock on HEAD or on a retired release. A rebuild doesn't move every lock, though. An expansion that version create built with expansion: lock keeps its value-set locks on a rebuild (Expansion.add_references, kept_valueset_locks), and its source versions are kept through system-version. The other cases can be told apart from what the API already returns: explicit versions, system-version, and each recorded version's released and retired. This one can't: built_with isn't serialized. Without it, the panel would offer Create similar → compare → Rebuild for a value set the rebuild then keeps.

What changes

  • ExpansionSerializer and ExpansionDetailSerializer return built_with, read-only: lock, latest, or null when version create recorded no choice. null covers:

    • an expansion made on its own;
    • a version created with the lock toggle off or without autoexpand;
    • versions created before the field existed, which aren't backfilled.

    Only lock changes what a rebuild keeps. The collection-wide /collections/:collection/expansions/ list returns the field too. It's an existing model field, so there's no migration and no new query.

Tests

  • CollectionVersionExpansionViewTest.test_get_shows_how_version_create_built_the_expansion: versions created with lock and with latest show that choice on the expansion detail and in the version's expansions list. An expansion made on its own shows null, and a built_with sent on expansion create is ignored. A client-set lock would change what a rebuild keeps.
  • Focused run in a one-off openconceptlab/oclapi2:production container: CollectionVersionExpansionViewTest and CollectionVersionExpansionsViewTest, 10 tests, OK.
  • pylint on the two changed files: exit 0.

Sibling PRs from this session

🤖 Generated with Claude Code

@snyaggarwal

Copy link
Copy Markdown
Contributor Author

Review round 1: verdict "approve with nits"

This was a high-effort review of the diff against core/collections/models.py and views.py. The findings:

  • built_with is an existing nullable field (lock / latest), so there's no migration and no N+1.
  • The only write path through these serializers is CollectionVersionExpansionsView.create. There, read_only_fields keeps a client from setting a value that would change rebuilds (kept_valueset_locks, use_any_lock, swap_head).
  • No other serializer needs the field: FHIR uses its own shape.
  • The test is sound. EXPANSION_LOCKED_REPO_VERSION_TOGGLE is on in the fixtures OCLAPITestCase loads, and version create in TEST_MODE seeds exactly one expansion.
  • Swagger shows a read-only nullable enum.
# Severity Finding Status
1 nit PR text: null also covers versions created with the lock toggle off or without autoexpand, and versions created before the field existed. Fixed in the description
2 nit No regression test for the read-only guarantee. Fixed: a built_with sent on expansion create is ignored. Focused tests: 10 OK, pylint exit 0

Nothing open. This ends the review loop for this PR.

@snyaggarwal
snyaggarwal marked this pull request as ready for review November 24, 2026 16:14

@paynejd paynejd left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Review lead (Claude, for Jon), round 1

Thanks, Sunny. built_with is now on both expansion serializers and read-only, so a client can tell which locks a rebuild keeps but can't set them. The test covers:

  • the detail view;
  • the version's expansions/ list;
  • an expansion made on its own (null);
  • a client trying to set the field.

The branch is current with master, and CI is green. Approved.

Deploy this before oclweb3#114. Without the field, that panel offers a rebuild to move a lock-built expansion's value-set locks, which a rebuild keeps.

@snyaggarwal
snyaggarwal merged commit 9ddb6b8 into master Nov 25, 2026
3 checks passed
@snyaggarwal
snyaggarwal deleted the issues-3009-expansion-built-with branch November 25, 2026 01:36
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.

2 participants