Skip to content

OpenConceptLab/ocl_online#717 OpenConceptLab/ocl_online#718 | Reads under a source version get that version's access check - #1023

Merged
snyaggarwal merged 17 commits into
masterfrom
ocl_online-717-718-version-checks
Nov 23, 2026
Merged

snyaggarwal merged 17 commits into
masterfrom
ocl_online-717-718-version-checks

Conversation

@paynejd

@paynejd paynejd commented Nov 21, 2026 •

Copy link
Copy Markdown
Member

What changes

Reads under a source now get the access check of the source version the URL names, the one that version's own concept and mapping lists already have.

  • One check for every GET and HEAD under a source. SourceChildCommonBaseView.check_source_version_access runs from initial(), before the handler. The source's HEAD and the version the URL names must exist, or the request answers 404. Source.get_url_versions resolves them. For latest, the version is the newest released one, plus any version named latest. The requester must then be able to view them, or the request answers 401 signed out and 403 signed in. Item-level checks still follow. POST, PUT, PATCH and DELETE are unchanged.
  • It covers every read under the source. That's the lists, a concept or mapping and its revisions, version history, mappings, children, parents, summary, names, descriptions, extras, collection versions and $cascade. It applies with or without q, facetsOnly or sorting, and to HEAD requests.
  • The latest list checks from OpenConceptLab/ocl_online#715 | latest gets the same access check as a named version #1013 are folded into it. check_parent_permissions and SourceVersionListHeadMixin are gone, and OpenConceptLab/ocl_online#715 | latest gets the same access check as a named version #1013's tests pass unchanged.
  • Fuzzy search's source_version. Each version it names gets the same check (401/403), for GET and HEAD. Expressions that don't resolve to a source version are skipped, as before; that now includes a collection's version and an expression that can't be parsed. A fuzzy HEAD request now counts instead of failing.
  • A concept's Atom feed under a source version (…/<version>/concepts/<c>/atom/, latest too). Feeds are served without signing in, so the feed answers only when every version the URL reads exists and is public. Otherwise it answers 404. On /user/ routes the feed reads the signed-in user's own source, and a feed URL with no owner (/sources/<source>/…) answers 404, with or without a version. Before, it looked the concept up under any owner. Feeds don't read API tokens, so a token-only request there now answers 404.
  • A version named in the query string. The reads under a source take source, org, user and version from the query string over the URL's. When the query string names a version other than HEAD, check_query_source_version_access gives it the URL's check, for each source named (commas separate several): 404 when the owner's source of that name doesn't have that version, then 401 or 403 unless the requester can view both. A name that isn't one of the owner's sources (a search's facet, such as a prefix) is skipped, as nothing is read under it. latest is the newest released version, as the reads resolve it. With no owner named (none in the URL, or an empty org), the reads take that version from every owner's source of that name: set_viewable_query_versions keeps the reads to the ones the requester can view, leaving out the others (rather than answering 401/403, which would show they exist), and a source answers 404 when none is left. A renamed source's versions keep their old name, so they're left out too. latest with no owner resolves to no release, as before. On a collection's route, the URL's version is the collection's and is left to its own checks. Precedence is unchanged. HEAD, or no version, isn't checked again, as HEAD's content carries its own access, so plain requests make no extra queries.
  • Several sources in the URL (/orgs/O/sources/A,B/…, which the reads match each of): each must exist (404), then each is checked (401/403). Before, these reads had no check.
  • Searches of latest releases (IncludeSearchLatest on /concepts/ and /mappings/). Some sources have a public HEAD and a released version the requester can't view. Hits and facets keep each of those to the members of its latest release, picked as get_latest_released_version does, or leave the source out when that release isn't public either. Keeping to the exact release (source_version) covers the time after a new release is published, before the index marks its members as the latest. Source.get_latest_release_scopes_for finds these sources in one query. Staff, owners and members see everything as before.

Routes and methods

  • GET and HEAD under /orgs/<org>/sources/<source>/, /users/<user>/sources/<source>/ and /user/sources/<source>/: concepts/… and mappings/…, with no version, a named version or latest.
  • GET /concepts/ and /mappings/ with IncludeSearchLatest.
  • Fuzzy ?source_version= on a source's concept list (GET and HEAD).
  • The concept Atom feed under a source version.
  • GET and HEAD under a source, and /concepts/ and /mappings/, whose query string names a version other than HEAD (with or without source, org or user).

Behaviour to review

  • A source or named version that doesn't exist answers 404 for every caller. Before, it answered an empty list, or the list the query parameters named.
  • latest on a private source with no released version answers 401/403 instead of an empty list. On a public source it still answers [].
  • $cascade over a source the requester can't view answers 401/403, like the source's other reads, instead of 404. The GET assertions in CascadeRepoAccessTest change to match; $clone still answers 404.
  • A concept's Atom feed on a /user/ route answers 404 without a signed-in session user (see above).
  • A query string naming a version the requester can't view answers 401/403, searches included (they answered from HEAD before, as the search path doesn't filter by version). A version the owner's named source doesn't have answers 404. With no owner named (/concepts/?source=<s>&version=v1, or an empty org), versions the requester can't view are left out, and 404 answers only when none is left. Before, these answered from HEAD or an empty list.
  • Several sources in the URL answer 401/403 when the requester can't view any one of them (master read them unchecked). latest under such a list still reads nothing, as on master.
  • After a source is renamed, its versions keep the old name, so reads under a release's old URI (/orgs/<o>/sources/<old>/v1/…) answer 404 to everyone, members included, as there's no HEAD of that name. Before, they answered as the release's access allowed.
  • A concept feed URL with no owner answers 404 (it served whichever owner's public concept came first).

Tests

New, in core/integration_tests/tests_access_control.py. The fixture is a public source with a private released v1, where HEAD has moved one concept to a newer revision, and a private source with a released v1:

  • SourceVersionReadAccessTest: reads under v1 and latest, on every route above, answer 401 signed out, 403 to a non-member and 200 to members and staff. HEAD requests answer the same. Reads under the public HEAD stay visible, and the private source stays hidden. A missing source or version answers 404 to everyone, for GET and HEAD. Also covered: latest with no release, user-owned sources under /users/ and /user/, and concept feeds under private and public versions and under /user/.

  • SourceVersionSearchAccessTest (es): searched version histories (q, facetsOnly, sortAsc, HEAD) answer as their version does. Fuzzy source_version checks each version it names, for GET and HEAD, and skips a collection's version or an unparseable expression. A latest-release search leaves out a release the requester can't view, in hits and facets, while members and staff still see it. It keeps to the new latest release before the index catches up. A public latest release stays in.

  • Query-string versions: SourceVersionReadAccessTest names v1 or latest in the query string on the detail, revision, sub-resources and lists (GET and HEAD), and names another source or a user's source; a missing version and a renamed source answer 404; with no owner, versions the requester can't view are left out and 404 answers when none is left (test_a_version_named_without_an_owner_leaves_out_those_the_requester_cannot_view); sources separated by commas in the URL answer as each (test_sources_separated_by_commas_in_the_url_answer_as_each); latest is the newest release; a collection version's $cascade with ?source= stays visible; SourceVersionSearchAccessTest covers the global and searched lists, and a source facet under a public release that names no source of the owner's. They answer 401 signed out, 403 to a non-member and 200 to members. ?version=HEAD, an empty version or a public release stay visible.

Against master's code, the new tests fail except those that check what stays visible. The tests added after review fail on the commit before their fixes.

Run locally as CI runs them at 36f75b3 (with master merged): 3,493 tests without ES, OK (2 skipped); 666 with ES, OK. pylint -j0 core/ exits 0 with no messages. The latest-release scope query on prod (read-only EXPLAIN ANALYZE): 8.5 ms, 5 rows.

Private details: OpenConceptLab/ocl_online#717, OpenConceptLab/ocl_online#718

🤖 Generated with Claude Code

https://claude.ai/code/session_01AaZ4qX9yqYaS1WjeoK2WiT
https://claude.ai/code/session_01AaZ4qUNfkgDYc59V43e44Y

paynejd and others added 3 commits November 21, 2026 12:04
…same access check as that version's list

Every GET or HEAD under a source now checks the source and the version the URL names before the view runs, as
that version's own concept and mapping lists do: 401 signed out, 403 signed in without access. That covers the
lists, a concept or mapping and its revisions, version history, mappings, children, parents, summary, names,
extras, collection versions and $cascade, searched or not. For `latest`, the version is the newest released one,
plus any version named `latest`. Item-level checks stay, and POST, PUT, PATCH and DELETE are unchanged.

The list checks added for OpenConceptLab/ocl_online#715 (check_parent_permissions and
SourceVersionListHeadMixin) are folded into this check; their tests pass unchanged. $cascade under a source the
requester can't view now answers 401/403 like the source's other reads, rather than 404.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AaZ4qX9yqYaS1WjeoK2WiT
…'t exist answers 404

A read under a source that doesn't exist, or under a named version of it that doesn't exist, answers 404 for
every caller before anything is listed, as collections already do. `latest` on a source with no released version
keeps its empty list.

Fuzzy search's `source_version` targets get the same access check as the versions' own lists: each version it
names must be one the requester can view, otherwise 401 or 403. Expressions that don't resolve are skipped, as
before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AaZ4qX9yqYaS1WjeoK2WiT
…releases the requester can view

With IncludeSearchLatest, the global concept and mapping searches answer from each source's latest release.
Their hits and facets now leave out the sources whose latest release the requester can't view, as that
release's own lists do. Those are released versions that aren't public while their HEAD is; a private HEAD's
content is already private itself. Staff, the owner and the owning organization's members see them as before.

Source.get_latest_releases_hidden_from finds them in one query, picking each source's latest release as
get_latest_released_version does.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AaZ4qX9yqYaS1WjeoK2WiT
@paynejd
paynejd requested a review from snyaggarwal November 21, 2026 17:09
paynejd and others added 2 commits November 21, 2026 12:23
…on, and a search of latest releases, keep to versions the reader can view

A concept's Atom feed under a source version (named or `latest`) answers only when the version it reads exists
and is public, as feeds are served without signing in. Source.get_url_versions resolves the versions a URL under a
source reads, for the feed and for the reads' access check.

A search of latest releases now keeps each source that has a release the requester can't view to the members of
its exact latest release, or leaves it out when that release isn't viewable either. The index marks a new latest
release's members only some time after it's published, so the latest-release flag alone could still point at the
previous release in the meantime.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AaZ4qX9yqYaS1WjeoK2WiT
…the source versions it names, as GET does

HEAD on a source's concept list with `fuzzy` resolves and checks its `source_version` targets before counting,
the same way GET does, instead of failing before the search.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AaZ4qX9yqYaS1WjeoK2WiT
@paynejd

paynejd commented Nov 21, 2026

Copy link
Copy Markdown
Member Author

Codex review, pass 1 (codex-cli 0.169.0, commit bb9f34f): 6 findings.

  • Fixed in a782c51: a concept's Atom feed under a source version now answers only when that version is public, and a search of latest releases keeps each source that has a non-public release to its exact latest release.
  • Fixed in fb3ece8: a fuzzy search's HEAD request checks its source_version targets as GET does, instead of failing.
  • One finding is refuted (CI Pylint passes). Two are accepted as existing case-insensitive matching in the search index.

Details are on the private ticket.

paynejd and others added 2 commits November 21, 2026 12:35
…xpressions that don't name a source version

A `source_version` expression that resolves to a collection's version, or that can't be parsed, is skipped like
one that doesn't resolve, instead of scoping the search by a collection's name or failing the request.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AaZ4qX9yqYaS1WjeoK2WiT
…he signed-in user's own source

The concept Atom feed on /user/sources/... routes looked the concept up under any owner. It now reads the signed-in
user's own source and answers 404 signed out, as the API's other /user/ routes do.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AaZ4qX9yqYaS1WjeoK2WiT
@paynejd

paynejd commented Nov 21, 2026

Copy link
Copy Markdown
Member Author

Codex review, pass 2 (codex-cli 0.169.0, commit fb3ece8): pass 1's fixes are confirmed, plus 6 new findings.

  • Fixed in 4117963: fuzzy search skips source_version expressions that resolve to a collection's version or can't be parsed, instead of scoping by them or failing.
  • Fixed in 16d9d8f: a concept's feed under /user/ reads the signed-in user's own source, and answers 404 signed out.
  • Three are existing behaviour outside this PR and are noted for follow-up.

Details are on the private ticket.

…rom the response headers

CI's pylint reads `response['num_found']` on the test client's response as unsubscriptable (E1136).
`response.headers` is how the other count tests read it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AaZ4qX9yqYaS1WjeoK2WiT
@paynejd

paynejd commented Nov 21, 2026

Copy link
Copy Markdown
Member Author

Codex review, pass 3 (codex-cli 0.169.0, commit 16d9d8f): the earlier fixes are confirmed, plus 3 new findings. None is fixed here; they're noted for follow-up:

  • a short delay, after a source's access changes, before search results reflect it (existing behaviour);
  • Atom feeds under /user/ don't read API tokens;
  • a race within a single latest request.

9e7ff2d is a test-only change for CI's pylint. Details are on the private ticket.

…se cover HEAD on every route in one test

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AaZ4qXcAwHwLtCieQ2LSK5
@paynejd

paynejd commented Nov 21, 2026

Copy link
Copy Markdown
Member Author

Simplification review (fresh reviewer, commit 9e7ff2d), one line each:

  • S1, fold the separate HEAD test into the read test's loop: applied in 693a32c. HEAD is now checked on every route under the release and latest (19 routes each), not only three.
  • S2, inline check_source_version_access into initial(): kept; the named method and its docstring state the access rule the PR adds, and initial() stays one call.
  • S3, inline ConceptFeed.is_public_url_version into get_object(): kept; get_object()'s 404 condition reads as named checks, and the helper's one condition stays next to its comment.

Tests on 693a32c: SourceVersionReadAccessTest 8 OK; tests_access_control + tests_cross_repo_access 156 OK (non-search run); pylint 10.00.

…>/<version>/ answers 404, as that route names no owner

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AaZ4qXcAwHwLtCieQ2LSK5
@paynejd

paynejd commented Nov 21, 2026

Copy link
Copy Markdown
Member Author

Adversarial pass (fresh reviewer, read-only, commit 9e7ff2d): the check holds on every route it covers. One finding was in this PR's own code and is fixed in 3c2098c: a concept feed under /sources/<source>/<version>/ (no owner in the route) answered 500; it now answers 404 (tested). One more change in this PR's scope is proposed and waiting on a decision. The other findings are pre-existing and tracked separately. Details on the private ticket OpenConceptLab/ocl_online#718.

paynejd and others added 2 commits November 21, 2026 13:50
…tring gets the same read check as one in the URL

The reads under a source take `source`, `org`, `user` and `version` from
the query string over the URL's, but the check ran on the URL's alone.
`check_query_source_version_access` now runs from `initial()` after the
URL's check, for GET and HEAD, whenever the query string names a version
other than HEAD for a source: 401 or 403 unless the requester can view
that version, and its HEAD, of each source named (commas separate
several). Precedence is unchanged.

- Owner: the one the query string names (org, else user). When it names
  none (no owner in the URL, or `?org=` empty), the reads match every
  owner's source of that name, so each one that has the version is
  checked. A same-named source of another owner can then refuse a
  request; a version no source has is left to the reads (empty, as
  before).
- HEAD, or no version, isn't checked here: HEAD's content carries its
  own access and is checked where it's read, and plain requests make no
  extra queries.
- `get_parent_owner_filters` takes the params to find their owner.

Tests: `SourceVersionReadAccessTest` (detail, sub-resources, revision,
lists, HEAD requests, `?version=latest`, another source's URL, `?user=`,
no owner) and `SourceVersionSearchAccessTest` (global lists, searched
lists): 401 signed out, 403 to a non-member, 200 to members; HEAD, a
public version or an empty `?version=` stay visible. They fail on the
previous commit.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AaZ4qVxv4g3w33csUQuubF
…ust exist under the owner named, and `latest` there is the release the reads use

From the Codex check of e86a9bf:
- FC.1: a source renamed after a release keeps that release under its
  old mnemonic. The source and version the query string names are now
  looked up under the owner it names, and either missing answers 404,
  as in the URL, instead of being skipped.
- With no owner (none in the URL, or an empty `org`), no owner names
  the version: 404, instead of checking every owner's source of that
  name.
- FC.4: `latest` is the newest released version
  (`find_latest_released_version_by`), as `get_base_queryset` resolves
  it, and no longer also a version literally named `latest`.
- FC.3: on a collection's route, the URL's version is the collection's.
  A `source` in the query string there doesn't check a source version
  of that name (`$cascade` is the collection route served by a source's
  view).

Tests: a renamed source, no owner and a missing version answer 404; a
newer public release answers `?version=latest` with an older private
version literally named `latest`; a collection version's `$cascade`
with `?source=` stays visible. They fail on the previous commit.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AaZ4qVxv4g3w33csUQuubF
@paynejd

paynejd commented Nov 21, 2026

Copy link
Copy Markdown
Member Author

Codex check of commits 16d9d8f..3c2098c (codex-cli 0.169.0, commit 3c2098c)

Verdict: clean, no findings. It covered 9e7ff2d (the fuzzy HEAD test reads num_found from the response headers), 693a32c (HEAD folded into the read test on every route) and 3c2098c (the owner-less versioned feed answers 404). Full output is on the private ticket.

…the owner doesn't have is skipped, as a search reads it as a facet

From the Codex check of dd0eb7d, FC.2: a `source` in the query string
that isn't one of the owner's sources (a search's facet, such as a
prefix) answered 404. Nothing is read under a source that doesn't
exist, so it's skipped. A source that exists without the named version
still answers 404.

Test: `SourceVersionSearchAccessTest.test_a_source_facet_under_a_public_release_stays_a_search`
(fails on the previous commit).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AaZ4qVxv4g3w33csUQuubF
@paynejd

paynejd commented Nov 21, 2026

Copy link
Copy Markdown
Member Author

Codex check of commit e86a9bf (codex-cli 0.169.0, commit e86a9bf)

Verdict: 4 findings (2 P1, 2 P2).

  • FC.1 (P1): a version the query string names was skipped when the named owner's source didn't have it under its current name. Fixed in dd0eb7d: that answers 404, as in the URL; with no owner named, 404.
  • FC.2 (P1): the check also refuses reads that ignore a query-string version (a source's concept list GET, searches). Intended: a request naming a version the requester can't view answers 401/403 as the same version in the URL does, whichever read serves it. Listed under "Behaviour to review".
  • FC.3 (P2): a collection version's $cascade with ?source= was checked against a source version of the collection's label. Fixed in dd0eb7d: the URL's own version on a collection's route is the collection's.
  • FC.4 (P2): latest in the query string was resolved more widely than the reads resolve it. Fixed in dd0eb7d: the newest released version, as get_base_queryset resolves it.

Full output is on the private ticket.

@paynejd

paynejd commented Nov 21, 2026

Copy link
Copy Markdown
Member Author

Codex check of commits e86a9bf..dd0eb7d (codex-cli 0.169.0, commit dd0eb7d)

Verdict: 3 findings (P2).

  • FC.1: a collection version's $cascade with ?source= and another version answers 404. Not a regression: master's code answers 404 for it too, from the cascade's own read.
  • FC.2: a source facet that isn't one of the owner's sources (such as a prefix) answered 404 under a release's URL. Fixed in ae48cfa: such a name is skipped, as nothing is read under it.
  • FC.3: a source renamed after a release, which then reuses that release's label, has both releases matched by label in the concept and mapping reads. Accepted: rare, and it affects the URL path as well; tying membership to the version row belongs in get_base_queryset, for the maintainer.

Full output is on the private ticket.

@paynejd

paynejd commented Nov 21, 2026

Copy link
Copy Markdown
Member Author

Codex check of commits dd0eb7d..ae48cfa (codex-cli 0.169.0, commit ae48cfa)

Verdict: 3 findings. None comes from the commit. ae48cfa only gives a source facet under a source's URL back master's behaviour, which dd0eb7d had turned into a 404. Each finding also happens with no facet at all, on master's code:

  • FC.1 (P1): a fuzzy search isn't scoped to the URL's repository unless it names source_version targets. Pre-existing: the fuzzy path doesn't apply the URL's filters. Already with the maintainer (pass 3, out of scope).
  • FC.2 (P2): source filters in search fold case. Pre-existing, the known F1.4/F1.5 item.
  • FC.3 (P1): a search under /user/sources/<s>/latest/ resolves latest from the URL's owner, which the /user/ route doesn't name. Pre-existing: a search there finds no release, facet or not. Functional, for a separate ticket.

The review loop ends here: no P0 or P1 is open from this PR's commits. Full output is on the private ticket.

@snyaggarwal snyaggarwal left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed at ae48cfa, after your Codex passes and the adversarial pass (latest check). The version check holds on the routes I traced: every GET and HEAD under a source checks the version the URL names, and the query-string, fuzzy source_version and latest-release checks work as described. I haven't run the tests.

Before merge (inline):

  • A prod EXPLAIN ANALYZE and row count for get_latest_release_scopes_for, which now runs on every latest-release search. A suggestion keeps it to one query per request.
  • New: comma-separated sources in the URL now answer 404. The Behaviour to review list doesn't mention it.
  • A query-string version with no owner answering 404: this is already in your Behaviour to review list. I agree it needs a call, and suggest an alternative inline.

Nits (inline): extra queries on each read under a source, inactive rows in the new scope query, and the owner-less feed without a version (pre-existing).

Comment thread core/common/views.py Outdated
return results
from core.sources.models import Source
criterion = None
for mnemonic, org, username, latest_version in Source.get_latest_release_scopes_for(self.request.user):

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Before merge: prod EXPLAIN and row count. get_latest_release_scopes_for runs on every non-staff search with IncludeSearchLatest. It runs twice when facets are included, because hits and facets each go through __apply_common_search_filters. It scans every released, non-public source version, and the OR in same_repo may keep Postgres off the indexes. Each row also adds a group of about four clauses to the ES must_not, so the query grows with the number of such sources across OCL. Could you run EXPLAIN ANALYZE and a row count on prod before this merges?

The suggestion keeps it to one query per request. It needs _latest_release_scopes = None beside BaseAPIView's other class attributes, so pylint doesn't flag W0201. If the prod count is large, caching the signed-out answer for a short TTL would also help, since it's the same for every anonymous request.

Suggested change
for mnemonic, org, username, latest_version in Source.get_latest_release_scopes_for(self.request.user):
if self._latest_release_scopes is None: # hits and facets each build a search
self._latest_release_scopes = Source.get_latest_release_scopes_for(self.request.user)
for mnemonic, org, username, latest_version in self._latest_release_scopes:

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in 2eb9738: your suggestion, with _latest_release_scopes = None on BaseAPIView, and test_latest_release_search_reads_its_scopes_once (a search with facets reads the scopes once).

Prod EXPLAIN (ANALYZE, BUFFERS), read-only (plan and SQL on the private ticket): 8.5 ms execution, 3.8 ms planning; 5 rows returned, signed out and signed in alike (3,915 rows in sources, 240 of them non-public releases). The outer scan is a seq scan of sources, which is small. The public-HEAD EXISTS and both latest-release subqueries use the mnemonic index (sources_mnemoni_56cf9b_idx), and the OR in same_repo becomes a BitmapOr of the organization_id and user_id indexes. So the must_not gets 5 groups today; I've left out the signed-out cache for now.

Comment thread core/common/views.py Outdated
Comment on lines +1284 to +1289
repo_versions = Source.get_url_versions(
self.kwargs['source'], self.kwargs.get('version'), self.get_parent_owner_filters())
if repo_versions is None:
raise Http404()
for repo_version in repo_versions:
self.check_view_access(request, repo_version)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

New: comma-separated sources in the URL now answer 404. On master, /orgs/O/sources/A,B/concepts/ (and mappings/, with or without a version) lists both sources. The reads match the source through get_exact_or_criteria, which splits on commas. Here get_url_versions gets A,B as one mnemonic, finds no HEAD and answers 404. The query-string check below splits on commas and checks each source, and #1022 keeps comma lists working on the versions lists, so the paths disagree.

test_a_missing_source_or_version_is_not_found asserts the 404 for S,, so this may be intended, but the Behaviour to review list doesn't mention it. If comma lists should keep working, checking each name keeps the check whole:

Suggested change
repo_versions = Source.get_url_versions(
self.kwargs['source'], self.kwargs.get('version'), self.get_parent_owner_filters())
if repo_versions is None:
raise Http404()
for repo_version in repo_versions:
self.check_view_access(request, repo_version)
for mnemonic in compact(self.kwargs['source'].split(',')):
repo_versions = Source.get_url_versions(
mnemonic, self.kwargs.get('version'), self.get_parent_owner_filters())
if repo_versions is None:
raise Http404()
for repo_version in repo_versions:
self.check_view_access(request, repo_version)

The with_comma cases in that test would then answer 401/403/200 like the plain URL. If comma lists shouldn't keep working, a line in Behaviour to review would cover it.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Kept them working, in 2eb9738. check_source_version_access now resolves each source the URL names (404 unless each exists), then checks each (401/403), so A,B answers like the plain URL with every source checked. On master these lists had no check, as parent_resource came back None.

test_sources_separated_by_commas_in_the_url_answer_as_each covers concept and mapping lists, an item, latest and a trailing comma; test_a_missing_source_or_version_is_not_found keeps 404 for A,NoSuchSource and ,. One thing is as on master: latest under a comma list reads nothing (find_latest_released_version_by gets A,B as one mnemonic), so an item there answers 404 once the check passes.

Comment thread core/common/views.py
if (version, params.get(url_repo), owner_filters) == (
self.kwargs.get('version'), self.kwargs.get(url_repo), self.get_parent_owner_filters()):
return # the URL's own version, checked already
if not owner_filters:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed this needs a call (it's in your Behaviour to review list). When no owner is named, /concepts/?source=S&version=v1 now answers 404 to everyone, staff included, even when every owner's S v1 is public. Master's DB read returned those members across owners.

An option that keeps it working: when no owner is named, look up each source named S that has that version and check each one (401/403, or leave out the ones the requester can't view). Answer 404 only when none exists.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Built your alternative in 2eb9738. With no owner named, set_hidden_query_versions finds every owner's S with that version and keeps the ones the requester can view. The reads leave out the others' members (leave_out_hidden_query_versions, on the get_base_queryset(self.params) reads) rather than answering 401/403, so a private one's existence doesn't show. A named source answers 404 when none is left, the same answer as when none exists. Public versions read across owners as on master, staff included.

latest with no owner still reads nothing, as on master (the reads' find_latest_released_version_by filters on a NULL owner). Lists with source in the query string go to the search, which reads no version from the query string, so there the check only decides 404 or not. Tests: test_a_version_named_without_an_owner_leaves_out_those_the_requester_cannot_view, and owner-less lines in test_searches_naming_a_version_in_the_query_string_answer_as_in_the_url.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Follow-up, from the adversarial pass: in 36f75b3 the reads keep to the versions the requester can view (set_viewable_query_versions, keep_to_viewable_query_versions) instead of leaving out the ones found hidden. A renamed source's releases keep their old name, which the lookup by name missed; they're now left out. The answers above are otherwise unchanged.

Comment thread core/sources/models.py
return 'source'

@classmethod
def get_url_versions(cls, mnemonic, version, owner_filters):

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit (queries). Every GET and HEAD under a source now adds 2 to 4 queries: the HEAD and named-version lookups here, then is_publicly_viewable fetching HEAD again for each version in check_view_access, then HasPrivateAccess's membership exists(). Most of these views then fetch the same version again in set_parent_resource. Passing the HEAD already in hand to the version's check, and keeping the resolved versions on the view for set_parent_resource, would remove most of them.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Partly, in 2eb9738: set_parent_resource (concepts and mappings) now takes the version the check already read (get_url_source_version), one query less on each read under a source. I've left passing the HEAD to the version's check: is_publicly_viewable reads self.head each time, and caching it there would change a property that serializers and every permission check read, beyond this PR. The membership exists() runs only when the version isn't public.

Comment thread core/sources/models.py Outdated
Comment on lines +265 to +267
public_head = cls.objects.filter(same_repo, version=HEAD, public_access__in=cls.PUBLIC_ACCESS_VALUES)
releases = cls.objects.filter(released=True).exclude(version=HEAD).exclude(
public_access__in=cls.PUBLIC_ACCESS_VALUES).filter(Exists(public_head)).annotate(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit. latest_release keeps to active releases, but releases and public_head don't. A deleted private release still marks its source as scoped. If no active release is left, latest_version is None and the whole source drops out of signed-out latest-release searches.

Suggested change
public_head = cls.objects.filter(same_repo, version=HEAD, public_access__in=cls.PUBLIC_ACCESS_VALUES)
releases = cls.objects.filter(released=True).exclude(version=HEAD).exclude(
public_access__in=cls.PUBLIC_ACCESS_VALUES).filter(Exists(public_head)).annotate(
public_head = cls.objects.filter(
same_repo, is_active=True, version=HEAD, public_access__in=cls.PUBLIC_ACCESS_VALUES)
releases = cls.objects.filter(is_active=True, released=True).exclude(version=HEAD).exclude(
public_access__in=cls.PUBLIC_ACCESS_VALUES).filter(Exists(public_head)).annotate(

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Applied in 2eb9738, with test_inactive_versions_leave_latest_release_searches_as_they_are (an inactive private release, and an inactive HEAD).

Comment thread core/concepts/feeds.py Outdated
Comment on lines +34 to +45
"""Whether the source version a versioned URL names exists and is public (for `latest`, each it reads)."""
if 'version' not in kwargs:
return True
from core.sources.models import Source
if 'org' in kwargs:
owner_filters = {'organization__mnemonic': kwargs['org']}
elif 'user' in kwargs:
owner_filters = {'user__username': kwargs['user']}
else: # /sources/<source>/<version>/: no owner names the version
return False
versions = Source.get_url_versions(kwargs['source'], kwargs['version'], owner_filters)
return bool(versions) and all(version.is_publicly_viewable for version in versions)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit, pre-existing. The owner-less route without a version, /sources/<source>/concepts/<c>/atom/, still serves whichever owner's concept get_base_queryset(kwargs).first() returns. Only the versioned owner-less route gets the new 404. The concept is public, so nothing leaks, but the feed can belong to another owner's source of the same name. Checking the owner first covers both routes:

Suggested change
"""Whether the source version a versioned URL names exists and is public (for `latest`, each it reads)."""
if 'version' not in kwargs:
return True
from core.sources.models import Source
if 'org' in kwargs:
owner_filters = {'organization__mnemonic': kwargs['org']}
elif 'user' in kwargs:
owner_filters = {'user__username': kwargs['user']}
else: # /sources/<source>/<version>/: no owner names the version
return False
versions = Source.get_url_versions(kwargs['source'], kwargs['version'], owner_filters)
return bool(versions) and all(version.is_publicly_viewable for version in versions)
"""
Whether the URL names the source's owner and, when it names a version, that version exists and is public
(for `latest`, each it reads).
"""
from core.sources.models import Source
if 'org' in kwargs:
owner_filters = {'organization__mnemonic': kwargs['org']}
elif 'user' in kwargs:
owner_filters = {'user__username': kwargs['user']}
else: # /sources/<source>/: no owner names the source
return False
if 'version' not in kwargs:
return True
versions = Source.get_url_versions(kwargs['source'], kwargs['version'], owner_filters)
return bool(versions) and all(version.is_publicly_viewable for version in versions)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Applied in 2eb9738. /sources/<source>/concepts/<c>/atom/ now answers 404, with or without a version (test_concept_feeds_answer_only_under_public_versions).

paynejd and others added 3 commits November 22, 2026 21:59
… are each checked, and a version named with no owner leaves out the sources the requester can't view

- A URL naming several sources (`/orgs/O/sources/A,B/...`), as the reads match each, answers 404 unless each
  exists, then 401 or 403 unless the requester can view each, instead of 404 for every list.
- A query-string version with no owner (`?org=&source=S&version=v1`) is read from each owner's `S` that has it:
  the reads leave out the ones the requester can't view, and answer 404 when none is left.
- A latest-release search reads its scopes once per request (hits and facets shared one), from active rows only.
- A concept feed answers only under a URL naming the source's owner.
- The reads under a source reuse the source versions the access check read.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AaZ4qUNfkgDYc59V43e44Y
… already-read source versions

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AaZ4qUNfkgDYc59V43e44Y
@paynejd

paynejd commented Nov 23, 2026

Copy link
Copy Markdown
Member Author

Codex review, pass 1 of the fix round (codex-cli 0.169.0, commit 2eb9738)

Verdict: 4 P1, 1 P2, all on behaviour master already has; none from this round's commits. No code change, so the loop stops here.

  • F1.1 P1 core/common/views.py:1366: Ownerless version filtering applies to SQL reads only. Elasticsearch lists ignore the versions the access check resolved.
  • F1.2 P1 core/common/views.py:522: Search treats a comma-separated URL source segment as one mnemonic.
  • F1.3 P1 core/concepts/views.py:192: Versioned concept hierarchy and mapping reads fall back to HEAD behavior on newly accepted comma-separated source URLs.
  • F1.4 P1 core/concepts/views.py:423: HEAD on newly reachable public item URLs requires edit permission.
  • F1.5 P2 core/sources/models.py:267: Deactivating a private release can expose its stale latest-release entries in search.

Responses

  • F1.1: As on master: the search reads no version from the query string, so it lists HEAD's latest concepts under the search's own access filter, never the private release's. The check now only decides 404.
  • F1.2: As on master: the search's URL filters take A,B as one term. Not touched here; the plain lists, which the reads match per source, are what this commit restores.
  • F1.3: As on master: find_source_version reads the URL's A,B as one mnemonic. Each source and version is checked first, so it shows nothing the requester can't view; the version fallback is a functional gap for a follow-up.
  • F1.4: As on master for every concept and mapping detail: HEAD takes the edit permission (get_permissions lists only GET). Not about comma lists.
  • F1.5: Accepted, P2. Production has no inactive private releases (0 of 240, Nov 23), and the maintainer asked for the active-only scope.
findings.json
{
  "reviewer": "codex-cli 0.169.0",
  "perspective": "defects",
  "mode": "full",
  "commit": "2eb9738e",
  "verdict": "findings",
  "prior": [],
  "findings": [
    {
      "id": "F1.1",
      "severity": "P1",
      "tag": null,
      "file": "core/common/views.py",
      "line": 1366,
      "claim": "Ownerless version filtering applies to SQL reads only. Elasticsearch lists ignore the versions the access check resolved.",
      "scenario": "Two owners have a source named S with a public HEAD. One owner's v1 is public and the other's is private. The public v1 lets an anonymous request for `/concepts/?source=S&version=v1` pass the access check. Search can then return HEAD concepts from both owners, including concepts outside the public v1.",
      "action": "Use the authorized owner, source and version combinations to constrain search hits, counts and facets. Assert the returned owners and release members in the integration test.",
      "lines_delta": null,
      "confidence": "high"
    },
    {
      "id": "F1.2",
      "severity": "P1",
      "tag": null,
      "file": "core/common/views.py",
      "line": 522,
      "claim": "Search treats a comma-separated URL source segment as one mnemonic.",
      "scenario": "A and B both have a readable v1 with matching concepts. The plain `/orgs/O/sources/A,B/v1/concepts/` list returns members of both. Adding `q` sends Elasticsearch a single source term with the value `A,B`, so the matching concepts disappear from the results and facets.",
      "action": "Build the search filter from the checked source versions and test searched results for a URL naming two sources.",
      "lines_delta": null,
      "confidence": "high"
    },
    {
      "id": "F1.3",
      "severity": "P1",
      "tag": null,
      "file": "core/concepts/views.py",
      "line": 192,
      "claim": "Versioned concept hierarchy and mapping reads fall back to HEAD behavior on newly accepted comma-separated source URLs.",
      "scenario": "A and B have readable v1 releases. A contains concept C, and a mapping from C was added to A's HEAD after v1. On `/orgs/O/sources/A,B/v1/concepts/C/mappings/`, the concept lookup finds C, but the release lookup tries the literal mnemonic `A,B`. The fallback returns the mapping added after v1.",
      "action": "Resolve the checked release for the selected concept's source and use it for related reads. Test a release whose mappings or hierarchy differ from HEAD.",
      "lines_delta": null,
      "confidence": "high"
    },
    {
      "id": "F1.4",
      "severity": "P1",
      "tag": null,
      "file": "core/concepts/views.py",
      "line": 423,
      "claim": "HEAD on newly reachable public item URLs requires edit permission.",
      "scenario": "A public v1 contains the requested concept. A comma-separated source URL that includes its source now returns 200 to a signed-in nonmember on GET. HEAD on the same URL returns 403 because the concept detail view selects `CanEditParentDictionary`. Mapping detail has the same permission branch.",
      "action": "Use view permission for both GET and HEAD on concept and mapping detail. Extend the public comma-separated item tests to cover both methods.",
      "lines_delta": null,
      "confidence": "high"
    },
    {
      "id": "F1.5",
      "severity": "P2",
      "tag": null,
      "file": "core/sources/models.py",
      "line": 267,
      "claim": "Deactivating a private release can expose its stale latest-release entries in search.",
      "scenario": "A public HEAD has one private release whose members are indexed with the latest-release flag. An admin marks that release inactive, as in the new test. The source disappears from the SQL exclusion scopes immediately, so an anonymous latest-release search can return those members while the index still carries the flag.",
      "action": "Keep stale memberships excluded until indexing clears their flags, or constrain results to the current active release. Test hits and facets with an index that still marks the inactive release as latest.",
      "lines_delta": null,
      "confidence": "high"
    }
  ]
}

@paynejd

paynejd commented Nov 23, 2026

Copy link
Copy Markdown
Member Author

Codex check of commits 2eb9738..0b217d7 (codex-cli 0.169.0)

Verdict: clean. The commit after pass 1 (from the simplification review: one loop splits viewable and hidden versions; next() in get_url_source_version) breaks nothing.

Simplification review (Claude subagent) of 2eb9738: S1 and S3 applied in 0b217d7. S2 kept: the test pins the one scope query per request asked for in review. S4 kept: GET and HEAD take different paths, so the comma test checks both.

findings.json
{
  "reviewer": "codex-cli 0.169.0",
  "perspective": "defects",
  "mode": "final",
  "commit": "0b217d78",
  "verdict": "clean",
  "prior": [],
  "findings": []
}

paynejd added a commit that referenced this pull request Nov 23, 2026
…ing source to the version-access tests; clearer owner-filter comment

A missing source or version is the version-access check's case (#1023 answers 404
and tests it), so this test no longer asserts an answer for one and passes whichever PR merges first.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AaZ4qWTbiSiJ56vAgWwb9D
…o the versions the requester can view, and each source named is checked once

A renamed source's versions keep their old name, so finding the versions to leave out by name missed them. The reads
now keep to the members of the versions found viewable instead.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AaZ4qUNfkgDYc59V43e44Y
@paynejd

paynejd commented Nov 23, 2026

Copy link
Copy Markdown
Member Author

Adversarial pass on this round's commits (cd3d0e6..0b217d7; Claude subagent, fresh context, 14 probes). Details are on the private ticket.

  • One gap on the owner-less query-string path: a renamed source's releases keep their old name, so the lookup by name missed them. Fixed in 36f75b3: the reads now keep to the members of the versions the requester can view, rather than leaving out the ones found hidden, with a test.
  • Repeated names in a comma list are now checked once each.
  • After a rename, reads under a release's old URI answer 404, members included (this PR's behaviour since before this round). Added to Behaviour to review.
  • Three more items are on master too; they're with the follow-up tickets.
  • Held: comma lists (,, %2C) in lists and items, GET and HEAD; owner-less overrides on detail, versions, mappings, summary, $cascade and collection versions; latest with no owner; feeds; the per-request attributes, which are set on each view instance.

@paynejd

paynejd commented Nov 23, 2026

Copy link
Copy Markdown
Member Author

Codex check of commits 0b217d7..36f75b3 (codex-cli 0.169.0)

Verdict: 1 P2, accepted.

  • FC.1 P2 core/common/views.py:1361: with no owner named, members also lose reads of a renamed source's old releases, as the allow-list finds versions by name.

Response: FC.1: intended, the safe direction. It matches how this PR answers a renamed source's releases elsewhere: by the new name, with the owner named, they answer 404 as well (in Behaviour to review).

findings.json
{
  "reviewer": "codex-cli 0.169.0",
  "perspective": "defects",
  "mode": "final",
  "commit": "36f75b32",
  "verdict": "findings",
  "prior": [],
  "findings": [
    {
      "id": "FC.1",
      "severity": "P2",
      "tag": null,
      "file": "core/common/views.py",
      "line": 1361,
      "claim": "Ownerless reads now drop renamed source versions even when the requester has access.",
      "scenario": "Extend the new rename test by making the same `?user=` request as `self.member`. The org's HEAD has the new mnemonic, its private v1 retains the old mnemonic, and another owner has a public v1 under the new mnemonic. The member could previously read the concept or mapping from the org's v1. The new allowlist contains only the other owner's v1, so both reads now return 404.",
      "action": "Resolve eligible versions through the same source memberships and HEAD mnemonics the read uses. Check access to the actual HEAD and linked version, and add a member assertion alongside the existing outsider assertions.",
      "lines_delta": null,
      "confidence": "high"
    }
  ]
}

@paynejd
paynejd requested a review from snyaggarwal November 23, 2026 04:16

@snyaggarwal snyaggarwal left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving at 36f75b3. Each item from the ae48cfa review is answered as your replies describe:

  • Prod EXPLAIN: 8.5 ms and 5 scope rows, now read once per request. No cache is needed at that size.
  • Sources separated by commas in the URL read again, and each is checked. Searches and versioned sub-reads under a comma list still behave as on master (your F1.2 and F1.3), but the check runs first, so they show nothing it didn't pass.
  • No owner named: the reads keep to the versions the requester can view. That uses the URL check's rule (has_view_access reads HEAD's access through is_publicly_viewable). Every concept and mapping read goes through keep_to_viewable_query_versions, both membership views included. The 404 when none is left doesn't show whether a hidden one exists.
  • set_parent_resource reuses the version the check read. Leaving HEAD's re-read as it is is fine.
  • Active rows only in the scope query. F1.5 follows from that suggestion of mine. Deleting a version through the API removes the row, and prod has no inactive private releases, so I agree with accepting it.
  • The owner-less feed answers 404.

Behaviour to review is fine as listed, including the new rename item: a renamed source's releases already lose their HEAD on master, as versions and head look them up by name.

CI is green at 36f75b3. It merges cleanly with master, which now has #1007, and with #1024 (396efe3) on top. Neither PR's CI has run with the other's current head or with #1007, so whichever merges second should take master and pass CI first. I haven't run the tests locally.

@snyaggarwal
snyaggarwal merged commit 3b93e7d into master Nov 23, 2026
3 checks passed
@snyaggarwal
snyaggarwal deleted the ocl_online-717-718-version-checks branch November 23, 2026 04:54
snyaggarwal pushed a commit that referenced this pull request Nov 23, 2026
…'s repository version; a reference's cascade walks only source versions its creator can view (#1024)

* OpenConceptLab/ocl_online#736 | Fuzzy concept search keeps to the repository version in the URL, as plain search does

A fuzzy search that names no source_version targets now applies the URL's owner, source and version filters. The
block that builds them moves unchanged out of __get_search_results into __apply_scope_filters, which both searches
call.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AaZ4qUzz3wjAx46pzoRCsC

* OpenConceptLab/ocl_online#736 | A reference's cascade walks a source version it names only if the reference's creator can view it

A version the creator can't view is walked as if it didn't exist, so the reference adds only the concept, as for a
label that doesn't resolve; omit_if_exists_in already works this way.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AaZ4qUzz3wjAx46pzoRCsC

* OpenConceptLab/ocl_online#736 | A reference's cascade checks the system or value set version it walks too; a search scope naming no version matches nothing

The cascade check now covers every repo version a cascade walks, not only one named by label. A search scoped to a
version that doesn't resolve (latest with no release) now returns no results, rather than an Elasticsearch error.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AaZ4qUzz3wjAx46pzoRCsC

* OpenConceptLab/ocl_online#736 | Search scope reads the owner from the requester on /user/ routes

A collection's owner URL and the release `latest` resolves to now use the requester on the /user/ shortcut, as the
owner filter already did, so searches there keep to the requester's own repositories.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AaZ4qUzz3wjAx46pzoRCsC

* OpenConceptLab/ocl_online#736 | Search on the /user/ collection shortcut keeps to the collection's members; search stats with no hits answer an empty list

- A search under /user/collections/<c>/ no longer adds the requester as the
  concepts' owner: a collection's members come from any owner's source, as on
  the /users/<u>/collections/<c>/ route.
- Search stats (searchStatsOnly) with no hits return [] instead of failing on
  a null max score.
- The signed-out reference test now names the cascade version too.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AaZ4qXcjfVFHsP2kYdP9tH

* OpenConceptLab/ocl_online#736 | A reference's cascade checks the source version it walks as the walk finds it, among the versions that hold the concept

The label check looked the version up under the source's current name, while
the walk looks it up among the source versions that hold the concept. When
those differ (after a source is renamed, its releases keep the old name), the
check found nothing and let the walk through. It now resolves the label the
way the walk does and checks every version it finds.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AaZ4qXcjfVFHsP2kYdP9tH

* OpenConceptLab/ocl_online#736 | A reference's cascade resolves the source version it walks once and hands the checked version to the walk

The check and the walk each resolved the cascade's version label. The check
now resolves it once, as the walk did (among the source versions that hold
the concept, exactly one), checks it, and passes that version to the walk, or
None, which adds only the concept as an unknown label does. One lookup per
concept instead of the walk's two, and nothing changes between the check and
the walk.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AaZ4qXcjfVFHsP2kYdP9tH

* OpenConceptLab/ocl_online#736 | Fuzzy-search scope test leaves a missing source to the version-access tests; clearer owner-filter comment

A missing source or version is the version-access check's case (#1023 answers 404
and tests it), so this test no longer asserts an answer for one and passes whichever PR merges first.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AaZ4qWTbiSiJ56vAgWwb9D

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
paynejd added a commit that referenced this pull request Nov 23, 2026
…1007) into ocl_online-718-query-collection-version

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AaZ4qW8QKbfuEJubgQgsHR
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