Repository navigation
OpenConceptLab/ocl_online#773 | resolved-repo-updates lists only versions a rebuild would move - #1072
Conversation
…versions a rebuild would move
snyaggarwal
left a comment
There was a problem hiding this comment.
Review: request changes
This is better than master, and it never hides a version in the common cases. The endpoint still lists some versions a rebuild keeps, which is the ticket's symptom.
1. Should-fix: a reference whose system names a version is still listed.
- Failure:
CollectionReference(system=v1.uri, code='c1')with an emptyversionisis_versionless_expression, so the rebuild records v1 inevaluated_source_versionsand keeps it. #1065'stest_rebuild_resolves_a_reference_whose_system_names_a_retired_version_by_its_urlasserts exactly that. A canonicalurl|v1system behaves the same way. - This PR treats evaluated source versions as moving unless
system-versionnames them, so it reports v1 → v2. - Fix: also keep the evaluated versions that
names_repo_versionversionless references resolve to. Skip that where asystem-versionentry for that repository overrides them.
2. Should-fix (here or a follow-up): resource-versioned references with resource-version repo resolution on.
- Failure: the rebuild re-picks the newest release that holds the concept version (
find_repo_version_with_resource_version), not the repository's latest.test_rebuild_keeps_resource_version_held_by_older_releasekeeps v1, but this endpoint lists v1 → v2. - With that toggle off, the listing is right.
- Fix: when the toggle is on, compute the pick with
get_repo_versions_holding_resource_versionsandpick_repo_version_with_resource_version, and keep the version when the pick equals it.
3. Should-fix: self.parameters can be None.
- The field is
null=True, andself.parameters.get(...)raisesAttributeError. This GET never readparametersbefore, so such a row now returns a 500. - Fix: use
get(self.parameters, ExpansionParameters.INCLUDE_SYSTEM).
Nits
- The re-resolved-repo query:
- It includes references whose
systemis itself versioned, which a rebuild keeps. .distinct('system')ignoresnamespace.- Better: iterate distinct (system, namespace) pairs and filter on
not names_repo_version.
- It includes references whose
- With
EXPANSION_LOCKED_REPO_VERSIONoff, a value set named/…/collections/C/v1(no trailing slash) or…/|v1is classified as evaluated, but still resolves to v1 on a rebuild. It is listed unless the expansion is lock-built. Impact is low. - The
get_repo_version_ids_a_rebuild_keepsdocstring is garbled ("those references name (unless through … re-resolved)"). - OpenConceptLab/oclweb3#114: the response shape is unchanged, so nothing breaks. Its
system_versionandlockpinned branches become dead once this ships, which is worth a note on that PR.
Checked, no issue:
- The relations are cleared before re-evaluation.
- Lock-built value-set locks are kept, including with the toggle off, because
use_any_lockusesbool(built_with). system-versionresolution matches the rebuild's resolution and namespace. A bare URL still moves.- HEAD named by a reference or by
url|HEADis kept. - The modified existing tests and the new tests should pass as written.
- There's no N+1 query.
…rsioned systems, resource-version picks, no parameters
|
Fixed in 798e13e.
Other changes in the same commit:
|
…lved-repo-updates
…licit version a rebuild records
|
I merged master (41aa19c) to pick up #1066 (783f6b1). That change records a reference whose |
…lved-repo-updates
snyaggarwal
left a comment
There was a problem hiding this comment.
Review round 2 (Expansion Health epic, reviewed with #1069–#1071, #1073 and OpenConceptLab/oclweb3#114): approve with nits
Round 1's three should-fix items are fixed (798e13e, 6408d63 after merging #1066):
- A versioned
system: since #1066, a rebuild records it as explicit, and it's kept by the explicit rule. - Resource-version picks: with the resolution toggle on, the pick uses
get_repo_versions_holding_resource_versionsandpick_repo_version_with_resource_version, with the rebuild's evaluated versions as locks. parameters = None: now read withget(...).
Checked, no issue
- Resource-versioned references: they aren't
is_versionless_expression, soadd_referencesrecords them as explicit. Adding the pick tokept['explicit_source_versions']is the right relation.- They can't compute against
system-version(can_compute_against_other_system_versionexcludesresource_version), so the pick never conflicts with asystem-versionpin.
- They can't compute against
system-versionpins: only versionless references compute against them, so keeping those pins only inevaluated_source_versionsmatches what a rebuild records.- Lock-built value-set locks:
- a rebuild keeps them only when
built_with == lock(kept_valueset_locks); - for anything else,
evaluated_collection_versionsis cleared beforevalueset_locksis read, so those move. This matches.
- a rebuild keeps them only when
- Response shape: unchanged, so nothing breaks outright. But OpenConceptLab/oclweb3#114's client-side
pinned: 'reference'rule now hides real updates. That's posted as a should-fix on #114, and it means this PR should deploy before #114 (see below).
Nits
- Cost on a GET.
references.exclude(no_resource_version)loads every resource-versioned reference as a full model instance, even with the resolution toggle off. With the toggle off, nothing uses them beyondresolve(), which is cached by system anyway.- Collections built from concept versions can have tens of thousands of these, and TBv3 calls this endpoint for each expansion row it opens.
- Fix: skip that queryset when
is_resource_version_repo_resolution_on()is false, and use.only(...)with the fields the pick needs when it's on.
- Lock-built locks are kept even when no reference uses them any more. A deleted value-set reference's lock is hidden. That's the opposite of explicit source versions, which are listed once no reference names them. Neither case is an update a rebuild would offer, so the impact is low. It's only a consistency point.
Deploy order: deploy this before OpenConceptLab/oclweb3#114, and only together with #114's fix. After this PR, a version listed only in explicit_* is one a rebuild moves:
- a resource-versioned reference with the resolution toggle off;
- with the toggle on, a recorded pick that differs from today's pick;
- a version no reference names any more.
#114 still labels those "pinned by a reference" and hides their Rebuild.
CI: Pylint passes; Tests is still running.
…s are loaded only for the release pick, and then with only the fields it reads
|
Round 2 nit 1 is fixed in 951d189. What changed in
Why not skip them entirely when the toggle is off: with the toggle off, a concept version reference whose Nit 2 (lock-built locks with no reference left) is unchanged. |
paynejd
left a comment
There was a problem hiding this comment.
Review lead (Claude, for Jon), round 1
Verdict: COMMENT (head 951d189). Nothing blocks the merge; the points below are nits, plus a deploy-order note.
Reviewed against OpenConceptLab/ocl_online#773. The four listed cases are covered and tested: an explicitly named version, a system-version lock, a lock-built value-set lock, and HEAD named by a reference or by system-version.
Earlier points
- Round 1 should-fix 1, a versioned
system: met. After merging master at 41aa19c (#1066) a rebuild records it as explicit, and the explicit rule keeps it. I checked the merge withgit show --remerge-diff 41aa19c3: it is empty, so master's side was taken as is, and 6408d63 then removed the branch that #1066 made dead. - Round 1 should-fix 2, resource-version picks with the resolution toggle on: met, using
get_repo_versions_holding_resource_versionsandpick_repo_version_with_resource_version. - Round 1 should-fix 3,
parametersofNone: met (get(self.parameters, ...),test_resolved_repo_updates_with_no_parameters). - Round 1 nits (distinct (system, version, namespace, valueset) tuples, value sets named in any URL form, docstring): met.
- Round 2 nit 1, loading every resource-versioned reference in full on a GET: met in 951d189. They are read as distinct tuples, and loaded with
.only(...)only when the toggle is on. - Round 2 nit 2, lock-built value-set locks kept when no reference uses them: accepted, low impact.
- Deploy order with OpenConceptLab/oclweb3#114: met on that side. #114 at 5db310d dropped its client-side "named by a reference" rule and lists what this endpoint returns, so this deploys before #114 or with it.
New (all nits)
- A value set named once by version and once by its bare URL, in the same collection, hides the bare reference's update. The explicit one adds its version id to both relations (models.py ~L2609), and the bare reference's evaluated record of the same version is then treated as kept. The source case is handled (a version recorded as both is still listed); the value-set case isn't.
- The destination in the response for a concept-version reference comes from
resolve_reference_expression(repo_url), the repository's latest. A rebuild moves it to the release that contains the concept version, which can be older. The entry is right to be listed, but the target URL can differ from what the rebuild picks. The pick is already computed, so reporting it would match. - A version left behind by a deleted reference is listed, and the test at ~L4086 expects it. A rebuild drops that repository instead of moving it, which reads against the ticket's "only versions a rebuild would move". The behaviour is the same as master and Sunny chose it on purpose, so I'd leave it unless Jon prefers otherwise.
CI: Pylint and Tests pass.
|
Thanks. Replying to round 1. I've left the three nits as they are for now, since none blocks the merge:
Happy to pick up 1 or 2 if Jon prefers them in this PR. |
|
Ready to approve. Review lead (Claude, for Jon), round 2, head 951d189. Every earlier point is met, and Pylint and Tests pass. I agree none of the three round-1 nits blocks:
The head still merges cleanly with master (bc3bd00). Deploy order is unchanged: this before OpenConceptLab/oclweb3#114, or with it. |
Fixes OpenConceptLab/ocl_online#773.
What changed
…/expansions/<id>/resolved-repo-updates/(Expansion.get_resolved_repo_version_diff_with_latest_updates) now leaves out recorded repo versions that a rebuild keeps. The response shape is unchanged ({recorded_url: resolves_to_now_url}), so current clients keep working. The newget_repo_version_ids_a_rebuild_keepsfollows whatadd_referencesdoes on a rebuild (force_reevaluate+is_adding_all):explicit_source_versions: kept, because a reference names the version (this includes a reference that names HEAD). The exception is a repository that a reference reaches through a concept or mapping version with no repo version (resource_versionset,versionempty). A rebuild resolves that one again, so it's still listed.explicit_collection_versions: kept, because a value set named with its version stays.evaluated_source_versions: moves, except for versions the expansion'ssystem-versionparameter resolves to (url|version,url|HEAD, or a version URL). A bare repository URL insystem-versionresolves again, so it still moves.evaluated_collection_versions: moves, except for an expansion built withlock(built_with, from OpenConceptLab/ocl_issues#3009 | Expansions show built_with #1060). Its active value-set locks are thekept_valueset_locksa rebuild keeps.A version recorded in both an explicit and an evaluated relation is still listed, since the evaluated reference moves it.
Why
The endpoint reported every recorded version whose repository now resolves elsewhere. It never looked at what pins the version, so TBv3 offered "updates available" and a rebuild then changed nothing. OpenConceptLab/oclweb3#114 filters some of these cases in the web app. This fixes it for every client, and for expansions with no
built_with.Reading of the ticket's "HEAD-pointed unreleased version" case
I read it as HEAD named explicitly: by a reference (
…/HEAD/…) or bysystem-version(url|HEAD). A rebuild keeps both, and both are tested. A HEAD recorded only by a versionless reference is still listed once a release exists, because a rebuild does move it to that release.Tests
ExpansionTest:system-versionurl|v1is left out while a bare URL still moves;lock-built value-set lock is left out (alatest-built one is listed);system-version|HEADis left out (listed once the parameter is gone).test_get_resolved_repo_version_diff_with_latest_updates, andCollectionVersionExpansionResolvedRepoUpdatesViewTest.test_get_200_with_updates) recorded the version as explicit. They now record it as evaluated, the case a rebuild moves.test_get_resolved_repo_version_diff_skips_duplicate_url(explicit and evaluated together) is unchanged and still expects the entry.Focused pylint on the changed files passes (exit 0). The local Docker stack is down, so the tests haven't run locally. This relies on CI's Tests job.
🤖 Generated with Claude Code