Repository navigation
OpenConceptLab/ocl_online#788 | Expansion health and recorded version lists show a reader only the value sets they can view - #1077
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
…or a filter it never applies
…once per reference
…arch can confuse
…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
… 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
…alueSet name a create needs
…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
…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
… lists show a reader only the value sets they can view
|
Independent review (a fresh reviewer was given only the diff and the ticket): changes needed. I checked each claim against the code. Results: Confirmed, fixing here
Not taken here
|
… counts as unresolved, staff see health as stored, nested version lists drop the request again
|
Review fixes are in 339f6ae:
The other repository-URL health fields and the source version lists are left for a follow-up ticket, as noted in the review comment. |
… 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
… ocl_online-788-health-visibility # Conflicts: # core/collections/health.py # core/collections/models.py
… to a reader who can view every version the build recorded for it
…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
… ocl_online-788-health-visibility
…EAD holds, and the entry test reads the entry's own stored value set
|
Review lead (Claude, for Jon), round 1, head b964fd3. Verdict: changes needed: one should-fix, and CI to go green. The approach matches #1076's rule: a value set is shown only to a reader who can view every version recorded for it, and a hidden one answers as not found (its entries count as CI: at 7dd13eb, Tests had 10 failures, all in the new Should-fix
Nits For the follow-up you already planned (other health fields and source version lists), two more of the same kind:
Codex (codex-cli 0.169.0, xhigh, on e961bc8..7dd13eb) raised six points: should-fix 1, nits 2 and 3, the two follow-up items, and the fixture, which you fixed in b964fd3. I checked each in the code. |
…et's versions only to a reader who can view them, and a hidden entry counts once, in its usual place
|
Round 1 is addressed in c8e2e29. Thanks to the review lead and Codex, who found all three:
The two follow-up items (the hidden private HEAD and the b964fd3's fixture fix (for the 10 failures at 7dd13eb) is included. CI runs at c8e2e29. |
|
Review lead (Claude, for Jon), round 2, head c8e2e29. Verdict: ready to approve once CI is green. All three round-1 points are fixed. One optional nit is below. It still merges after #1076, as the PR body says. Round 1
Nit (optional) Codex (codex-cli 0.169.0, xhigh, on b964fd3..c8e2e29) raised three points: nit 4; a CI at c8e2e29: Pylint passes; Tests still running (the b964fd3 run was cancelled). |
…th-visibility # Conflicts: # core/collections/health.py # core/collections/models.py # core/collections/serializers.py # core/collections/tests/tests_health.py
…d version whose repository no longer resolves
|
Master (with #1076's squash 1f9fc34) is merged in as f544075. Where the only conflict was #1076's squashed code against this branch's copy of it, the branch's side is kept. #1075's changes from master are kept too. Against master, the diff is now only #788's six files. The 3 errors at c8e2e29 ( |
Fixes OpenConceptLab/ocl_online#788.
Stacked on #1076. This merges after #1076, and gets retargeted to
masteronce #1076 merges.Why
A public expansion's health and its recorded version lists can show that a private value set it references has no expansion. A reader who can't view that value set learns something about it. OCL treats a value set the reader can't view as not found. #1076 does this for the unresolved entry's reason (
get_unresolved_repo_versions_for), but health and the version lists still showed it.What changed
value_set_without_expansionreason now carriesvalue_sets. Each entry hasurl,namespace,version_urls(the versions it resolved to, or every version the build recorded for an unresolved entry; empty if it can't be found now),reference_ids(the references it counts) andentries(how many unresolved entries it stands for). It covers all three ways that reason counts: an include that resolved only to unexpanded value sets, an exclude against them, and a recordedvalueset_not_expandedentry.RULES_VERSIONgoes to 2 because the stored shape changed.get_health_for(health, access)drops the value sets the reader can't view (for an unresolved entry, unless they can view every version the build recorded for it, asget_unresolved_repo_versions_fornow decides) and recounts the references that are left. Any unresolved entry a hidden value set left counts asunresolved_referencesinstead, as a value set that wasn't found would. This matchesunresolved_repo_versions, which still lists that entry without its reason. Staff get health as stored. If no reason remains, it works the state out again:unhealthybecomeshead_resolvedorhealthy, using the storedhead_resolved_repositories. One helper does this everywhere health is served: the expansion detail, the expansions list (plain and verbose), the versions list'sexpansion_health(plain and verbose) and the version detail'sexpansion_health. The versions list now annotates the default expansion's wholehealth(expansion_health_data) rather than just its state, so it can be filtered.explicit_collection_versionsandevaluated_collection_versionson the expansion detail list only the value set versions the reader can view.resolved-repo-updatesis filtered. A value set's version pair is listed only to a reader who can view both versions.unresolved_referencesin the place health normally puts that reason.ValueSetViewAccessfollowshas_view_access: staff, public with a public HEAD, or the reader's own or their orgs'. It's shared through the serializer context and caches by version. A list serializer (ValueSetAccessListSerializer) reads the whole page at once: one query for the value set versions health names, one for their HEADs, and one for the reader's orgs. The verbose expansions list also prefetches the two collection version relations for the page.get_unresolved_repo_versions_forand health now shareExpansion.get_valueset_entry_version, which looks up the version the build recorded for an entry.The new
filter_not_appliedreason from #1076 is about a reference's own filter, not a value set's state, so it isn't filtered.Older stored health
Health stored under rules version 1 doesn't say which value sets it counted, so its
value_set_without_expansionreason is hidden from every reader except staff until it's recomputed. That keeps it from leaking.backfill_expansion_health --all --applyrecomputes rows from older rules versions (~Q(health__rules_version=RULES_VERSION)). The nightly recheck takes only rows that aren't current, so the backfill has to be run after deploy.Tests
Added to
core/collections/tests/tests_health.py:value_sets(include, exclude and recorded-entry paths), including a value set named by two references, which is stored once with both reference ids.ExpansionHealthVisibilityTestchecks member, outsider and anonymous readers on:explicit_collection_versionsandevaluated_collection_versionsin the expansion detail and the verbose listvalue_setsThe local stack is down, so none of this was run locally. It relies on CI (Pylint and Tests). Focused pylint on the changed files passes.
Not in this PR (follow-up)
head_resolved_repositories,duplicate_repo_versions,inconsistent_resolutionandmultiple_named_versions.head_resolvedfallback uses the storedhead_resolved_repositories, so a hidden private HEAD can still turnhealthyintohead_resolved.previous_version_url, which can name a private earlier version. Every version list in OCL does this.explicit_source_versions,evaluated_source_versions, and source pairs inresolved-repo-updates) aren't filtered.🤖 Generated with Claude Code