Skip to content

OpenConceptLab/ocl_issues#3011 | Version Locking and Rebuild an expansion follow the merged version-locking fixes - #83

Open
snyaggarwal wants to merge 14 commits into
mainfrom
issues-3011-version-locking-docs
Open

snyaggarwal wants to merge 14 commits into
mainfrom
issues-3011-version-locking-docs

Conversation

@snyaggarwal

@snyaggarwal snyaggarwal commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

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

OCL Docs now describe version locking as merged on oclapi2 master (4388a602), not as it was before the epic's fixes. The behaviour was read from the code on master. The last two commits (Dec 2) add the decisions on OpenConceptLab/ocl_online#549 and the health rules from OpenConceptLab/oclapi2#1106 (f639acf7).

Merge each part only once its toggle is on in production

Each part has its own commits (the later ones are review-round fixes), so the parts can be merged, reverted or split separately. core/fixtures/toggles.json on master already sets the first row's three toggles on for production. Before merging, confirm on production's /toggles/ that the fixture is deployed.

Commit Toggle (production) Ticket
9195e18, ae3cd3b, e30f8df Version Locking, Rebuild an expansion, version create's expansion EXPANSION_LOCKED_REPO_VERSION_TOGGLE, RESOURCE_VERSION_REPO_RESOLUTION_TOGGLE, INTENSIONAL_REFERENCE_RESOURCE_VERSIONS_TOGGLE OpenConceptLab/ocl_online#586, OpenConceptLab/ocl_online#576, OpenConceptLab/ocl_online#578
0b6f189 Rebuild: pinned references and released versions, and the Rebuild text in 9195e18 and ae3cd3b REFERENCE_SEARCH_OPTIONS_TOGGLE (OpenConceptLab/oclapi2#1089, OpenConceptLab/oclapi2#1109): hold until it's on in production. The TBv3 notice sentence also needs OpenConceptLab/oclweb3#114 deployed OpenConceptLab/ocl_issues#3009
e87140d, cc18ff2, dcefcf8, 0310541 resolved_repo_versions none: it ships with the deploy OpenConceptLab/ocl_online#577, OpenConceptLab/oclapi2#1000
25871a3 Add References reason codes, Copy HEAD's parameters none: merge once OpenConceptLab/oclapi2#1073 and OpenConceptLab/oclweb3#115 are deployed OpenConceptLab/ocl_issues#3074, OpenConceptLab/ocl_online#768
b5a37a5, 9b8d1ea, aa09d4f, c677536, d47a1de Expansion health EXPANSION_HEALTH_TOGGLE, off in production: hold or drop these commits until it's on. d47a1de also needs OpenConceptLab/oclapi2#1106 deployed, and the TBv3 badge sentence needs OpenConceptLab/oclweb3#113 deployed (both merged) OpenConceptLab/ocl_issues#3003, OpenConceptLab/ocl_issues#3001

What changes

collectionReferenceEvaluation.md, "Version Locking"

  • Value sets named without a version are locked too (evaluated_collection_versions). system-version doesn't reach them.
  • A lock carries over from earlier runs, whatever state the version is in: a release, a retired release, an unreleased version or HEAD. Only a deactivated version is skipped. Moving the lock takes a rebuild (Jon, Oct 22). This replaces "released, active and not retired".
  • Adding references:
    • an auto-expansion now applies the lock too, since its stored results were resolved under it;
    • when the default expansion evaluates a reference, the result is saved back to the reference;
    • removing a reference re-adds the other references' stored results, without resolving them again.
  • Deprecated resource-version references resolve to a version that holds the pinned version, in this order: locked version, newest unretired release, HEAD, then the rest. If no version holds it, the stored members are kept and the reference is listed as reference.resource_version in unresolved_repo_versions (also added to the list table).
  • Unversioned filter and search references add the searched version's concept and mapping versions, not HEAD ones. The Search Filters stage says so too.
  • Creating a collection version:
    • expansion is lock, latest or none, with the default when it's omitted;
    • both lock and latest evaluate every reference again, and HEAD's expansion isn't copied;
    • lock puts HEAD's locked source versions into system-version and carries HEAD's value-set locks over.
  • Rebuild:
  • A deleted locked version: the record kept at delete time, and the fallback to the latest release.
  • "Expansions built before version locking": the auto-expansion caveat now describes the old behaviour as old.
  • New "Expansion health" subsection: states (a concept or mapping version only HEAD holds makes it head_resolved), every reason code (resource_versioned_references is information only, OQ-39), health_is_current (true, false and null), and that only the default expansion has health.

expansions.md

  • Overview: value sets are locked, and the lock survives retirement and new releases.
  • "Rebuild an expansion": a rebuild is how a lock moves off HEAD or a retired release. It also covers the expansion: lock exception, a deleted system-version entry, write-back, and comparing a similar expansion first.

collections.md, "Create new version of a collection": the expansion input.

collections.md, "Add a reference to a collection": a saved reference that adds nothing returns resolved: false, reason, repo_versions and message, with a table of the reason codes from OpenConceptLab/oclapi2#1073. collectionReferenceEvaluation.md now gives TBv3's name for expansion: lock as Copy HEAD's parameters (OpenConceptLab/oclweb3#115).

resolved_repo_versions: now described as what the default expansion recorded, with the fallback when there's none.

Not in this PR

  • The KB half of the ticket: ADR-003, manage-references.md, manage-versions-and-expansions.md and the tbv3/TODO.md VERIFY item in OpenConceptLab/ocl-kb. There's no ocl-kb checkout on the machine this was written on, so those recheck items are still open.
  • Release notes. docs/source/oclapi/releases.md hasn't had an entry since 2020, so these weren't added there. Suggested lines, for wherever release notes go now:
    • resolved_repo_versions changed meaning: a reference now shows the repository versions its collection version's default expansion recorded, not a fresh resolution. With no expansion, or nothing recorded, it resolves as before. (OpenConceptLab/ocl_online#577, not toggled.)
    • Adding a concept gets the locked version: an unversioned reference added to a collection resolves within its default expansion's locked version, not the newest release. Rebuild the expansion to move it to a newer release. (OpenConceptLab/ocl_online#586, with EXPANSION_LOCKED_REPO_VERSION_TOGGLE.)

Checks

  • This is Markdown only. The review built it once with Sphinx and recommonmark to check links; the last two commits weren't built, and change no link target or heading. Read the Docs builds the PR if it's set up for PRs.
  • In-page anchors used: #when-a-lock-carries-over, #expansion-health, #stage-3-search-filters-filters, #stage-4-cascade-cascade and #stage-5-transforms-transforms. A review build with recommonmark confirmed them. Cross-page links stay plain page.md, because recommonmark doesn't resolve page.md#anchor.

Sibling PRs from this session

🤖 Generated with Claude Code

…sion describe the lock that is reused on every add, value-set locks, resource-version and filter references, and version create's expansion choice
…as the versions the default expansion recorded, not a fresh resolution
…health: its states, reasons and how current it is
@snyaggarwal

Copy link
Copy Markdown
Contributor Author

Review round 1: verdict "changes needed"

This was a high-effort review of every behavioural claim against oclapi2 master (4388a602), plus a Sphinx build of the branch to check the anchors. The following claims are confirmed:

  • the resource-version pick order and the 422 on $expand;
  • filter references return the searched version's resources;
  • lock reuse skips only inactive versions;
  • auto-expansion adds and write-back;
  • version create with lock, latest, the default choice and none;
  • a lock-built rebuild keeps its value-set locks, and a deleted system-version entry is handled;
  • health states and health_is_current.

The toggle mapping in the description matches toggles.json.

# Severity Finding
1 important recommonmark doesn't turn page.md#anchor into a doc link, so the new cross-page links (collectionReferenceEvaluation.md#version-locking, expansions.md#rebuild-an-expansion) break in the built site. Two of them worked before as plain .md links.
2 important #filters is dead: recommonmark ignores {#filters}, so the id is stage-3-search-filters-filters.
3 important duplicate_repo_versions: it fires when a repository has more than one recorded version and at least one came from an unversioned reference, for example a pinned v1 plus an unversioned v2.
4 important Two TBv3 claims describe UI that isn't merged yet: "says whether the lock is on HEAD or on a retired release" (OpenConceptLab/oclweb3#114) and the health badge (OpenConceptLab/oclweb3#113).
5 important The lock is the newest-created recorded version that is still active (order_by('-id')), not the "most recently recorded" one.
6 important Removing an exclude reference doesn't bring back what it excluded until a rebuild.
7 important resource_versioned_references, and the reference.resource_version entry, cover any reference pinned to a concept or mapping version, with or without a source version, not only deprecated ones.
8 nit empty is checked first, so unhealthy needs members.
9 nit ?includeHealth=true on expansion concept and mapping lists is undocumented.
10 nit latest keeps HEAD's own system-version.
11 nit A value set with no release falls back to HEAD.
12 nit "A new expansion of HEAD has no lock" holds for any new expansion.
13 nit collections.md: lock and latest turn autoexpand on, and none turns it off.
14 nit A lock version inherits HEAD's deleted-lock records.
15 nit Unchanged text is now stale: "reads locks only from evaluated_source_versions", and expansions.md's unresolved_repo_versions description.
16 nit resolved_repo_versions returns nothing for a reference listed as reference.resource_version, and only versions the requester can view.
17 nit unreleased_versions: "not released", not "never released".

Fixes follow, one commit per part, so the merge table still maps.

… built site, and its lock, exclude-removal, value-set and version-create details match the code
…ty list for an unresolved pinned reference and that it shows only viewable versions
…s match the classifier, and includeHealth is described
…resolved_repo_versions' resource-version entries are described as the code records them
…ce version, rather than nothing, for an unresolved pinned reference
@snyaggarwal

Copy link
Copy Markdown
Contributor Author

Review round 2: verdict "approve with nits"

All 17 round-1 findings are fixed. They were rechecked against oclapi2 master (4388a602): the lock lookup, the value-set fallback, latest keeping HEAD's system-version, autoexpand, inherited deleted locks, exclude removal, every health reason and state, resolved_repo_versions and includeHealth. A Sphinx and recommonmark build shows every anchor and cross-page link in the three pages resolving. In a scratch clone, reverting the health commits applies cleanly and leaves no dangling #expansion-health link.

# Severity Finding Status
1 nit [Transforms](#transforms) is still dead: the built id is stage-5-transforms-transforms. This predates the PR. Fixed (e30f8df)
2 nit expansions.md: a reference.resource_version entry is recorded when the source version the reference resolved to lacks the pin, even if another version holds it. Fixed (e30f8df)
3 nit includeHealth: "with health on" names a toggle the page never mentions. It also classifies the requested page live, for any expansion. Fixed (aa09d4f)
4 nit resolved_repo_versions for an unresolved pinned reference shows no source version, but value-set versions are still added. Fixed (dcefcf8)
5 nit PR text: anchors list. Fixed. Not changed: the "A deleted locked version" paragraph comes from 9195e18. b5a37a5 only appends the health sentence to it, so holding the health commits leaves the paragraph in place.

Outside this PR, not changed: collections.md's existing collectionReferenceEvaluation.md#cascade link, and the page missing from a toctree. Both predate the PR.

Nothing open, so this ends the review loop for this PR.

@snyaggarwal
snyaggarwal marked this pull request as ready for review November 24, 2026 15:57

@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. I checked the three pages against oclapi2 master at 4388a602 and Jon's decisions on ocl_issues#2942, and almost all of it matches the code:

  • Locks and rebuilds:
    • a lock carries over, and retiring or publishing a release doesn't move it (Jon, Oct 22);
    • the resource-version pick order;
    • system-version not reaching value sets, and the 400 for two versions of one source;
    • version create's lock / latest / none, and a new version locking HEAD's repo versions through system-version (Nov 5).
  • Expansion contents: a reference removal re-adding the others' recorded results; only the default expansion getting write-back and health.
  • Health: the states, health_is_current and the expansion_health fields.
  • Links: they all resolve.

Your merge plan is right: each part goes in once its toggle is on, and the health commits are held until EXPANSION_HEALTH_TOGGLE is on and oclweb3#113 is deployed.

One sentence to check before merging: collectionReferenceEvaluation.md line 264 says "Removing an exclude reference doesn't bring back what it excluded until the expansion is rebuilt."

  • In the code, Expansion.delete_references collects the removed reference's recorded concepts and mappings, removes them, and then queues readd_references_to_expansion_on_references_removal for the remaining references.
  • If an exclude reference records the members it excluded, that re-add returns them through the include references at once, which is the opposite of the sentence.
  • No test covers this case, so please confirm it with one (add an include reference, add an exclude, remove the exclude, then check the members), and fix or drop the sentence to match.

Smaller, optional:

  • The states table's healthy row: it is described as resolving to one released version. In health.py, it means no reasons and no repository resolved to HEAD, which is a little broader.
  • The resolved_repo_versions line (about line 289): an unversioned reference's resolved_repo_versions can list more than one version, since it lists every version the expansion evaluated for that repository.

…repo_versions is described as every version the expansion evaluated for its repository
…e health check defines it: members, no reasons and nothing resolved to HEAD
@snyaggarwal

Copy link
Copy Markdown
Contributor Author

Thanks. Replying to round 1.

Removing an exclude reference: the sentence on line 264 is right, so it stays. I checked it with a throwaway integration test on oclapi2 master, run locally and not committed:

  • I added an include reference to a whole source with two concepts, then an exclude for one of them. The expansion held only the other concept, and the exclude reference recorded the excluded one.
  • I removed the exclude by ids with EXPANSION_LOCKED_REPO_VERSION_TOGGLE on and off, and by expression. The excluded concept didn't come back in any of the three runs. The include reference was still there.
  • The cause: Expansion.delete_references collects members only from the include references it removes (to_ref_list_separated). An exclude's own recorded members aren't collected, so nothing is removed, and the re-add task isn't queued. The concept comes back only on a rebuild.

The two optional points, both taken:

  • 0310541: an unversioned reference's resolved_repo_versions lists every version the expansion evaluated for its repository, normally only the one it's locked to. This is in the resolved_repo_versions part.
  • c677536: the healthy row now says it has members, no reasons apply, and no repository resolves to HEAD, as health.py decides it. This is in the health part, which is still held.

I added both commits to the merge table in the description, so each one goes in with its own part.

@snyaggarwal

Copy link
Copy Markdown
Contributor Author

@paynejd a reminder: these pages follow the decisions still pending on you in OpenConceptLab/oclapi2#1073 and OpenConceptLab/oclweb3#113 to #116 (health state names, what Rebuild does on HEAD, the Create Version expansion choices). Once you decide, I'll update the pages to match and merge.

Ticket: OpenConceptLab/ocl_issues#3011.

… reference's reason code, and TBv3 calls expansion: lock Copy HEAD's parameters

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@snyaggarwal

Copy link
Copy Markdown
Contributor Author

Updated for what merged on Nov 29, in 25871a3:

This commit should merge only once OpenConceptLab/oclapi2#1073 and OpenConceptLab/oclweb3#115 are deployed; neither is yet. The merge table in the description has a row for it.

Unchanged and still held: the Expansion health part (with OpenConceptLab/oclweb3#113), and what Rebuild does on HEAD (OQ-5, with OpenConceptLab/oclweb3#114). Jon's other Create Version choices (default and custom parameters) aren't built, so the docs still list lock, latest and none.

snyaggarwal and others added 2 commits December 2, 2026 18:31
… a concept or mapping version, and released versions can be rebuilt

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ces are information in expansion health, and one only HEAD holds makes it head_resolved

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@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.

OpenConceptLab/oclapi2#1134 changes two of the rules this page describes, so here are three suggestions. They're right once that pull request is merged, so please apply them only with it or after it.

| Code | What it counts |
|---|---|
| `inconsistent_resolution` | Repositories whose unversioned references took members from versions with no single version in common (`repositories`). |
| `duplicate_repo_versions` | Repositories recorded at more than one version, at least one of them by an unversioned reference (`repositories`), for example a reference pinning `v1` and an unversioned reference resolving to `v2`. |

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.

The rule changes with OpenConceptLab/oclapi2#1134 (health rules version 5): a version that a reference names on purpose is no longer counted here.

Suggested change
| `duplicate_repo_versions` | Repositories recorded at more than one version, at least one of them by an unversioned reference (`repositories`), for example a reference pinning `v1` and an unversioned reference resolving to `v2`. |
| `duplicate_repo_versions` | Repositories for which OCL itself chose two or more versions, because unversioned references resolved to different ones (`repositories`). Versions that references name don't count. |

| `unreleased_versions` | Members from a repository version that isn't released. |
| `interim_resource_versions` | Members that are replaced concept or mapping versions, in neither a release nor HEAD. |
| `version_mismatches` | Members held by another version than the one their reference resolved to. `head_concept` and `head_mapping` count the HEAD concepts and mappings among them. |
| `ambiguous_members` | Members that different references judge differently. |

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.

The same pull request: a mapping that changed between two releases which references name isn't counted any more.

Suggested change
| `ambiguous_members` | Members that different references judge differently. |
| `ambiguous_members` | Members that different references judge differently. An expansion keeps a mapping once, in its newest version, so a reference that names an older release doesn't disagree about a mapping that changed since. |

| `ambiguous_members` | Members that different references judge differently. |
| `unattributed_members` | Members that no reference accounts for. |

`health.members` counts the concepts and mappings by class, and `multiple_named_versions` lists repositories that references name at more than one version on purpose; that alone doesn't make an expansion unhealthy.

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.

And this list now also has a repository where references name some versions and OCL chose one.

Suggested change
`health.members` counts the concepts and mappings by class, and `multiple_named_versions` lists repositories that references name at more than one version on purpose; that alone doesn't make an expansion unhealthy.
`health.members` counts the concepts and mappings by class, and `multiple_named_versions` lists repositories recorded at more than one version because references name them on purpose, with at most one version that OCL chose beside them; that alone doesn't make an expansion unhealthy.

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