Repository navigation
OpenConceptLab/ocl_issues#3074 | A reference to a concept added after the release says why it resolved to nothing and how to fix it - #1073
Conversation
… the release says why it resolved to nothing and how to fix it, on both kinds of expansion
snyaggarwal
left a comment
There was a problem hiding this comment.
Review round 1 (Expansion Health epic, reviewed with #1069–#1072 and OpenConceptLab/oclweb3#116): approve with nits
The new "added after the release" message is narrowly scoped, and it falls back to the existing messages in every case it doesn't cover. Its view checks keep what it reveals to what the requester can already see.
Checked, no issue
get_release_added_afterguards:- it needs a code, with no filter, value set or named repo version;
- the latest release must be released, not HEAD, and viewable;
- the expansion must have evaluated the reference in that release only, so a lock on an older release keeps the old message;
- HEAD's content must be viewable and hold the code or the pinned resource version.
- No false "added after":
REFERENCE_EXCLUDED_BY_PARAMETERSis skipped before the call;- for
REFERENCE_VERSION_NOT_HELDwith the toggle on, HEAD doesn't hold the version either, so it returns None; - with the toggle on, a resource version only HEAD holds resolves to HEAD (
pick_repo_version_with_resource_version), so it never reaches this message.
- Auto-generated branch: the not-re-evaluating branch now marks
resource_version_not_heldfrom saved members, with the toggle on only. It only setsunresolved_reason, sounresolved_repo_versionsand #1069's merge are unaffected. - Success message fix:
- an expression pinned to a repo version has the version at index 5, so it always fell through to
UNKNOWN_REFERENCE_ADDED_TO_COLLECTION_FMT.format(''); - now it passes the collection name;
- the two updated integration tests cover it.
- an expression pinned to a repo version has the version at index 5, so it always fell through to
- Open core: nothing commercial in the messages, constants or tests.
- TBv3: OpenConceptLab/oclweb3#116 shows the API's message as given, and wraps it at phone width.
Nits
- Merge conflict with #1069 in
core/collections/tests/tests.py. Both add tests right aftertest_add_references_marks_pinned_reference_no_version_holds(~L4420). It's textual only: keep both blocks. - Queries per unresolved reference: for each unresolved reference, the response builds:
release.has_view_access;_get_resolved_system_versions;release.head, a query each time, not cached;head.can_view_all_content;- an
exists().
A bulk PUT of many references to one source, all added after its release, repeats the first four for the same release. A per-release cache in the view (keyed likesystem_version_cache) would leave oneexists()per reference.
- Wording is Jon's call. "its concept is not in …, the release the collection resolves through" reads fine. The message names two URLs, so at phone width it leans on OpenConceptLab/oclweb3#116's wrapping.
CI: Pylint passes; Tests is still running.
…release's access and HEAD once, not once per reference
|
Round 1 nit 2 is fixed in 6ced918:
Nit 1, the textual conflict with #1069 in |
paynejd
left a comment
There was a problem hiding this comment.
Review lead (Claude, for Jon), round 1
Verdict: COMMENT. Every earlier point is met and CI is green. The message wording waits on Jon's call; that doesn't block the merge, and changing it later is a one-constant edit (REFERENCE_ADDED_AFTER_RELEASE_FMT, core/collections/constants.py:27).
Earlier points (all met at 6ced918)
- Nit 1, textual conflict with oclapi2#1069 in
core/collections/tests/tests.py: answered (keep both blocks). The branch merges cleanly with master now. - Nit 2, queries per unresolved reference: met.
get_unresolved_items(core/collections/views.py:578) passes arelease_head_cache, so the release's view check, HEAD lookup andcan_view_all_contentrun once per release (_get_viewable_release_head,core/collections/models.py:1627). Leaving_get_resolved_system_versionsuncached is fine for the reason given. Covered bytest_release_added_after_checks_a_release_s_access_and_head_once. - Nit 3, wording: waits on Jon's call.
Checked at head, no defect
get_release_added_afterfalls back to the old messages for every case it doesn't cover (filter, value set, named version, an older release lock, HEAD without the code, a requester who can't view the release or HEAD).REFERENCE_EXCLUDED_BY_PARAMETERSis skipped before the call, so no false "added after".- The auto-generated branch (
core/collections/models.py:2191) sets onlyunresolved_reason;unresolved_repo_versionsis untouched. - Success message for a reference that names a version: the integration tests now expect the collection's name.
One question, not a defect in the diff. The message tells the owner to create a new release. Please confirm on staging, with a reference that came back with this message, that after the new release exists the reference then resolves (that the default expansion re-evaluates it against the new release), or whether the owner must also re-run the expansion or re-add the reference. If it needs a step, the message should say so, and that is worth a line in the ticket either way.
Optional
core/collections/models.py:2191: with a collection whose auto-generated expansion didn't evaluate the version the reference names (evaluation skipped), "no version holds resource version" could be reported for a version that exists. The skipped case is narrow; a comment on the condition is enough.
CI. Tests and Pylint pass on 6ced918.
…ansion needs a rebuild after the new release, as nothing re-evaluates it
|
Thanks. Replying to round 1. Changes are in dc26623. Your question: does the reference resolve once the new release exists? No, not by itself. I checked it in the code rather than on staging:
So the message needed the step. Optional, taken: the condition at Pylint passes on the changed files. The local stack is down, so CI runs the Django tests on the new head. |
|
Review lead (Claude, for Jon), round 2, head dc26623. Both round-1 points are answered:
Pylint and Tests pass. The PR stays on hold for Jon's call on the expansions design, which includes this message's wording ("pin the reference" among it). Nothing else is open. |
…ks added after the pinned-reference test
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
@paynejd a reminder: this PR is ready in code (CI green, master merged at d4bd113) and is waiting only on your decisions:
It merges once you decide. Ticket: OpenConceptLab/ocl_issues#3074. |
…ble reason code, and drop 'pin' and 'hold' from its messages Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…' instead of 'resolves through' Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Review lead (Claude, for Jon), round 3, head ff7976c. Verdict: ready to approve once Tests pass (Pylint passes; Tests were still running). Both settled answers on OpenConceptLab/ocl_online#549 are carried out.
Optional, for a later change. The rules page has a class "In a newer release" with no code yet. When an expansion is locked to an older release and the concept is in the newer one, OpenConceptLab/oclweb3#116 reads these codes, so this should merge before it. |
Brings in #1085, #1086, #1082 and #1073. The two conflicts were adjacent additions (master's EXPANSION_FHIR_RULES_TOGGLE and evaluation import next to this branch's REFERENCE_SEARCH_OPTIONS_TOGGLE); both are kept. No change to this branch's own code. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AaZ4qWUTom6BGgjQy6oehZ
API part of items 1 and 3 of OpenConceptLab/ocl_issues#3074 (epic OpenConceptLab/ocl_issues#2942), following #1017. The TBv3 part is OpenConceptLab/oclweb3#116.
The everyday case now says why and what to do
An unversioned reference to a concept added after its source's latest release used to read "…, but it resolved to no concepts or mappings in /orgs/O/sources/S/v1/". It now reads:
For a mapping it says "its mapping".
repo_versionsnames the release, andreasonisnot_in_release.added,resolved: falseand the other keys are unchanged.When it's used (
CollectionReference.get_release_added_after), all of these must hold:Otherwise the reference keeps the message it had: the found-nothing, parameters-excluded or resource-version messages from #1017.
The same message on both kinds of expansion
resource_version_not_heldwhen it re-evaluated it. An auto-generated one doesn't re-evaluate, so it marked itfound_nothingand said "resolved to nothing in …". It now gets the same reason from the reference's saved members, so both kinds say "no version of … has resource version …". Only the response reason changes: the expansion'sunresolved_repo_versionsare untouched.Blank collection name (older point from the ticket)
The success message for an expression that names a source version, like
/orgs/O/sources/S/v1/concepts/c1/, read "The reference is successfully added to collection " with the name blank. It now names the collection.A reason code per reference
Each unresolved item now has a stable
reasonnext torepo_versionsandmessage. Clients such as TBv3 read the code to show a short label;messagestays as a fallback for API clients.reasonnot_in_releasefiltered_by_parametersconcept_version_not_foundfilter_not_appliedrepository_not_foundvalueset_not_expandednot_foundWording
Tests
autoexpand-HEAD):reasoncode, and the full-item assertions includereason.resource_version_not_heldwith the toggle on, andfound_nothingwith it off;get_release_added_afterreturns the release for a code and a resource version HEAD holds. It returns None for an unknown code, a named version, a filter, and a source with no release.Focused pylint on the 5 changed files exits 0. The local stack is down, so the Django tests run in CI only.
🤖 Generated with Claude Code