Repository navigation
OpenConceptLab/ocl_online#771 | A value set or filter a reference can't apply makes it resolve to nothing, not the whole system - #1076
Conversation
…'t apply makes it resolve to nothing instead of the whole system; filter op is applied and checked on save
…idening # Conflicts: # core/collections/tests/tests.py
|
Review lead (Claude, for Jon), round 1, head 15254e2. Verdict: changes needed, and please wait to merge until Jon answers two calls. Four small should-fixes and three nits below. The value-set side otherwise does what OpenConceptLab/ocl_online#771 asks: a value set the reference can't apply now makes it resolve to nothing, reported with its own reason, never the whole system. With Jon (please wait to merge until he answers; nothing else depends on this PR)
Decided by the launch lead
Should-fix
Nits Checked, no issue: a value set the creator can't view answers exactly as one that isn't found; one unusable value set among several makes the whole reference resolve to nothing; the reason isn't overwritten by Codex (codex-cli 0.169.0, xhigh) raised eight points. Should-fixes 1-4 and nits 5-7 come from them, each checked in the code. The FHIR and importer point is the lead's decision above. Its point about an older exclusion's saved matches on an auto-generated expansion is how auto-expansions work today (they reuse saved results), not this PR. CI: Pylint passes; Tests still running. |
…or a filter it never applies
…once per reference
…arch can confuse
|
Review (independent reviewer, main claims checked against the code): changes needed. They were small: three are fixed, and one decision is left open. There was no earlier review on this PR to credit. What the reviewer checked and found to hold
Fixed
Stopped: needs a product decision Left, with reasons Focused pylint passes on the changed files. I'm waiting on CI. |
…th no default expansion couldn't be applied, not that it wasn't found
…e a filter op or property they can't apply, naming both
|
Following Sunny's calls on the two FHIR points:
Both decisions are recorded under "Decisions to confirm" as Sunny's calls that change what FHIR clients see, so Jon can weigh in. Focused pylint passes. |
… ES-tagged class, and the value set test adds a new concept
…t a filter OCL can't apply again; the reference resolves to nothing
…ansion once, as one without expansion
…hy a value set couldn't be applied too
…y finds nothing; a search URL's paging and sorting parameters are set aside
…sion as repeated parameters, so it reads back as in
… it's taken as a search modifier
…n't be applied says why, instead of falling back to its saved members
…ue set can't be applied says why instead of an empty success
|
Reply to the review lead's round 1. Thanks to the lead, and to Codex, whose points the lead checked. My earlier review comment said there was no prior review; I missed this one, sorry. Sunny chose the lead's rule for FHIR. Each fix below is its own commit. FHIR (the lead's rule)
Should-fix
Nits Left for Jon, as you set out (now under "Decisions to confirm" in the PR body): exclusions that can't be applied, and the two existing production references whose filter property isn't a search field. The new message wording also waits on him. Also from CI try 1: b9c4dcb moved the Focused pylint passes on every changed file. I'm waiting on CI at eb67462. Not merging. |
…alueSet name a create needs
|
Review lead (Claude, for Jon), round 2, head e418490. Verdict: nearly there. One should-fix and four nits left, and the merge still waits on Jon's two calls. All seven round-1 points are fixed, each in its own commit, and I checked each in the code. Still with Jon (please wait to merge until he answers)
Decided by the launch lead: FHIR ValueSet create and update accept a filter OCL can't apply, and the reference resolves to nothing (92894b6 does this). A value set the reference's creator can't view keeps answering as not found (OpenConceptLab/ocl_online#771). Round 1, all fixed
Should-fix Nits Codex (codex-cli 0.169.0, xhigh, on 15254e2..e418490) raised six points: 8-12 above, each checked in the code. Its point that a pasted It merges cleanly with master. CI is still running on e418490. |
…s shown only to a reader who can view it; to others it answers as not found
…ession, and an in with no values is refused on save
…value set to references by namespace as well as URL
…d-transform reference with the same expression that couldn't be applied
|
Reply to the review lead's round 2. Thanks to the lead, and to Codex, whose points the lead checked. Should-fix Nits PR body: I corrected the wording about the 53 Also: CI try 2 (e418490) gave the FHIR fail-closed test the ValueSet |
|
Review lead (Claude, for Jon), round 3, head 8bbc984. Verdict: one small should-fix left, from the escaping change. Ready to approve once it's in and CI is green. The merge still waits on Jon's two calls (Q54, the rule; Q55, the two existing references). Round 2
Should-fix
Nits Not this PR's (the same on master): a public expansion's health count and its recorded version lists can still show that a referenced private value set has no expansion; and the parser drops blank query values, so Codex (codex-cli 0.169.0, xhigh, on e418490..8bbc984) raised six points: should-fix 1, nits 2-4 and the two that predate this PR, each checked in the code. CI at 8bbc984: Pylint passes; Tests still running. |
…d value set in the namespace its reference resolves in
… parsing, so earlier expressions with spaces are still duplicates
…set couldn't be applied is judged on the version the build recorded
… reference matches as an unresolved reference
…on, answers for a cascade-and-transform include with the same expression
|
Reply to the review lead's round 3. Thanks to the lead, and to Codex, whose points the lead checked. Should-fix
Nits Not this PR's: the two points you listed as the same on master are left as they are. The PR body is updated to match. Also, CI try 3 of the last round (61763a4) made the health test record its entry in the namespace the reference resolves in; on CI that's the owner's URL, not |
|
Review lead (Claude, for Jon), round 4, head 60faaf0. Verdict: one small should-fix and one one-line nit left. Ready to approve once they're in and CI is green. The merge still waits on Jon's two calls (Q54, the rule; Q55, the two existing references). Round 3: all four fixed
Should-fix
Nit Codex (codex-cli 0.169.0, xhigh, on 8bbc984..60faaf0) raised three points: the two above, checked in the code, and a batch response edge case (a saved exclusion and a failed include with one expression report only the failure) that I'd leave. CI at 60faaf0: Pylint passes; Tests still running. |
… reason and unresolved entry naming what it couldn't apply, counted apart in health
…s shown only if the reader can view every version of it the build recorded
…the expression reads back whole
|
Jon's Q54 condition and the review lead's round 4 are both in. Thanks to the lead, and to Codex, whose points the lead checked. Jon's answers are on OpenConceptLab/ocl_online#771. Q54 condition
Round 4
I left Codex's batch edge case as you suggested: a saved exclusion plus a failed include with the same expression report only the failure. PR body: Q54 is now listed as accepted with the condition built, and Q55 as resolved, since the owner email doesn't block the merge. Focused pylint passes on every changed file. I'm waiting on CI at 573030f. Not merging. |
|
Codex check of commits 60faaf0..573030f (review lead, Claude for Jon; codex-cli 0.169.0, xhigh), head 573030f. Verdict: one small should-fix left. Ready to approve once it's in and CI is green. Jon has answered both calls on OpenConceptLab/ocl_online#771 (Q54 accepted with his condition; Q55 not a merge blocker), so the merge is yours once that's done. Jon's condition (a filter OCL can't apply never reads as matched-nothing): met by 112d9ef in each place it shows. The reference gets Round 4: both fixed. The reason is shown only if the reader can view every recorded version of the value set (88a2cfb). Should-fix
Nit Codex's other three points I'd leave:
CI at 573030f: Pylint and Tests still running. |
…he saved results of a reference whose filter or value set can't be applied
…by include as well as expression, so an exclusion keeps an include's
|
Reply to the review lead's Codex check. Thanks to the lead, and to Codex.
Codex's other three points are left as you suggested. Focused pylint passes on the changed files. I'm waiting on CI at e961bc8. Not merging. |
Fixes OpenConceptLab/ocl_online#771.
What changed
Value sets (
get_resource_queryset_from_system_and_valueset)expansion_uripoints at nothing.unresolved_repo_versions, in the existing shape:{'url', 'namespace', 'type': 'reference.valueset'}. An unexpanded one also carriesreason: valueset_not_expanded.unresolved_reasonis set to a new reason code. This happens on auto-generated expansions (autoexpand-HEAD) too, and for pinned references, which used to fall back to their saved members.valueset_not_found: the value set isn't found, or the creator can't view it. These two answer the same, so a private value set's existence isn't revealed.valueset_not_expanded: the value set has no default expansion.resolved: false, the value sets it names, and a plain message.last_resolved_at = None.filter_not_applied, and areference.filterunresolved entry that names each property and op it couldn't apply. It isn't counted as a reference that matched nothing.value_set_without_expansion, and not underunresolved_referencesas well. An entry that no reference matches any more (its namespace changed) still counts as an unresolved reference.unresolved_repo_versions, and$expand, show an entry'sreasononly to a reader who can view that value set, judged on every version of it the build recorded. To anyone else it answers as not found, as a value set the creator can't view already does.$expandstill answers 422 for an unresolved entry. For an unexpanded value set, to a caller who can view it, it now saysThe included value set '…' has no default expansion, so it could not be applied and the value set cannot be expanded(processing/vs-invalid, message idOCL_VS_EXP_IMPORT_NOT_EXPANDED), instead of "Unable to find included value set".explicit/evaluated_collection_versions) are unchanged.Filters (
_apply_filters)opis applied:=stays a match;inmatches any of its comma-separated values, forqas well;inis written to an expression as repeated parameters (prop=A&prop=B), so it reads back asin. Only%,&,=,#,+and?are escaped, so a value reads back whole. Spaces stay as before, so an expression saved earlier still matches as a duplicate.inwith no values can't be applied, and the references PUT refuses it.opisn't inALLOWED_FILTER_OPS, or it is aninwith no values. If any entry can't be applied, the reference resolves to nothing, whatever the other entries match.page,limit,offset,sortAsc,sortDesc,facetsOnly,brief,raw,includeRetired,includeMappings,includeInverseMappingsandincludeExtras. These are set aside first, so older references and pasted search URLs keep working.exact_match,excludeWildcard,verboseand the rest) are classified as before. Theiropis checked first.PUT …/references/) returns a 400 before anything is queued or saved when a filter names a property oropit can't apply. The body is keyed by expression:{"/orgs/O/sources/S/concepts/?conceptclass=X": {"filter": ["Filter property 'conceptclass' is not supported."]}}… {"filter": ["Filter op 'is-a' is not supported for property 'concept_class'. Use one of: =, in."]}Why
"Only these codes" quietly became "every code in the system" when a filter property had a typo, or when a value set was private or unexpanded. FHIR
$expandthen served the result.Decisions to confirm
Jon's answers (OpenConceptLab/ocl_online#771)
filter_not_applied, and its own unresolved entry{'url': expression, 'namespace', 'type': 'reference.filter', 'reason': 'filter_not_applied', 'filter': [{property, op}, …]}naming what it couldn't apply. Health counts it underfilter_not_applied, apart fromunresolved_references.$expandanswers 422OCL_VS_EXP_FILTER_NOT_APPLIED, naming the property and op.Sunny's calls (these change what FHIR clients see, so Jon may weigh in)
last_resolved_at = None). The native references PUT is the only place that answers 400.$expandkeeps answering 422 when the expansion has an unresolved entry, including exclude references and value-set-only includes. The old answer was silently incomplete. An unexpanded value set is worded as one that couldn't be applied.get_unresolved_items). Naming it "not viewable" would tell an$expandcaller that a private value set exists. Sunny and Jon to confirm.Left from review round 2 (nit 9): the set-aside of paging and display parameters also applies to a structured filter or FHIR include with, say, a
pageentry, which then takes every candidate, as on master. It can't be limited to stored references cleanly.build_expressionwrites structured filters into the expression too, so a reference made from a URL can't be told from a structured one. And a new reference has an id before the expansion evaluates it.Access: whose access is checked for building is unchanged (OpenConceptLab/ocl_online#724 is separate).
Note: this PR and #1075 both change
ExpansionDetailSerializer, so whichever merges second needs a small merge.Tests
Expansion.add_referencesrecords the entry and the reason, including for a pinned reference.get_unresolved_repo_versions_forshows the reason to a member and hides it from others.filter_not_appliedand its entry, and health counts it apart fromunresolved_references. The FHIR create path records it too, and$expandnames it.infor a field and forq, and the round trip through the expression, including escaped values.inis refused.get_filter_clause_property(including the op check on modifiers) andget_filter_errors.page,limitorsortAscisn't refused.inadds the matching concepts (ES-tagged class).autoexpand-HEAD.test_create_with_is_a_filter_and_systemkeeps its original expectation: the ValueSet is accepted.test_create_with_a_filter_it_cant_apply_resolves_to_nothing: such a reference resolves to nothing and is left unresolved.test_an_expansion_that_cannot_be_served_is_a_422covers the new wording, and the not-found answer for a caller who can't view the value set.test_get_concepts_applies_es_filter_with_case_switch_extras_and_search_url_parameters(formerly…_unknown_property) now expects a mixed filter with an unknown property to find nothing, per the lead's rule.test_resolve_valueset_versions_with_unresolved_resolves_explicit_and_evaluatednow gives its value sets expansions.🤖 Generated with Claude Code