Repository navigation
OpenConceptLab/ocl_online#736 | Unresolved-reference details list only repository versions the requester can view - #1028
Conversation
…y repository versions the requester can view The add-references response names the repository versions a reference resolved to nothing in. It now names only versions the requester can view. Otherwise it names what the reference itself gives (its system and value sets), with the same wording as for a repository that doesn't exist. Members, owners and staff see the versions as before, and the same check is the one resolved_repo_versions already uses. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AaZ4qTUrHhWdhdS68p12fx
…s that the requester can't view counts as missing in unresolved-reference details A reference can name a version in its system URL. When the requester can't view that version, the details no longer look up the versions the expansion recorded for its repository; they name what the reference gives, as for a version that doesn't exist. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AaZ4qTUrHhWdhdS68p12fx
Codex review, pass 1 (codex-cli 0.169.0, commit e696a0b)Verdict: findings (2 × P1, 1 × P2). Two are in code this PR doesn't change; the third is fixed. The full findings are on the private tracker.
Next: pass 2 on da85344. |
…e version a reference's system resolves to, however it is named The previous check covered a version named in a form the reference recognizes as versioned. A system URL without its trailing slash names a version the same way for the resolver, so the check now applies to whichever version the system resolves to. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AaZ4qTUrHhWdhdS68p12fx
Codex review, pass 2 (codex-cli 0.169.0, commit da85344)Verdict: findings (2 × P2). One is fixed; the other is in code this PR doesn't change. The full findings are on the private tracker.
Next: pass 3 on a032cc7. |
…ly a version the reference's system names A versionless reference again names the release its expansion recorded, whatever newer release the requester can't view exists. The early check applies only when the system names a version, with or without the URL's trailing slash, as the resolver reads it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AaZ4qTUrHhWdhdS68p12fx
Codex review, pass 3 (codex-cli 0.169.0, commit a032cc7)Verdict: one finding (P2), fixed. Codex marks every earlier finding resolved; it now treats F1.1, F1.2 and F2.2 as outside this PR.
That's the third and last full pass; no P0 or P1 is open in this PR's code. Next: a simplification review, a Codex check of a032cc7..HEAD, and an adversarial pass. |
…-version check into one line, drop a repeated assertion Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AaZ4qTUrHhWdhdS68p12fx
Simplification review (Claude subagent, commit 8592e37)Verdict: four small cuts proposed; two applied in 4c89dce.
Tests ( simplify.json{"reviewer":"claude subagent","perspective":"simplify","mode":"full","commit":"8592e373","verdict":"findings","prior":[],"findings":[{"id":"S1","severity":null,"tag":"shrink","file":"core/collections/models.py","line":1502,"claim":"The `names_version` local is used once, and the two-step `named_version` / `system_versions` conditionals can be one guard.","action":"named_version = self._get_expression_system_version(system_version_cache) if (self.names_repo_version or self.is_explicit_valueset(self.system or '')) else None, then keep the existing `system_versions = [] if named_version and not named_version.has_view_access(user) else ...`. Saves the separate `names_version` line. The access check itself stays.","scenario":null,"lines_delta":-1,"confidence":"low"},{"id":"S2","severity":null,"tag":"shrink","file":"core/collections/views.py","line":597,"claim":"The unviewable named version is reset to None with a separate 2-line `if`.","action":"Fold the check into the lookup: named_version = reference.resolve_expression_system_version if reference.names_repo_version else None; named_version = named_version if named_version and named_version.has_view_access(user) else None. This leaves the access check in place and drops one line.","scenario":null,"lines_delta":-1,"confidence":"low"},{"id":"S3","severity":null,"tag":"dup-test","file":"core/collections/tests/tests.py","line":4143,"claim":"In test_evaluated_repo_version_urls_name_only_versions_the_user_can_view, the `user=None` assertion (`[source.uri]`) repeats the non-member assertion on the line above it. Both reach the same `has_view_access` branch, and the view tests cover the requester path. Keep the member and non-member assertions, which pin the access change.","action":"Delete the `None` assertion line. The `None` argument is still exercised by the pre-existing missing-repository test.","scenario":null,"lines_delta":-1,"confidence":"low"},{"id":"S4","severity":null,"tag":"dup-test","file":"core/integration_tests/tests_collections.py","line":1180,"claim":"The member and staff view tests each build the same fixture and assert the same release URI, so they can be one parametrised test. Both are acceptance criteria and must still run. This only merges the boilerplate.","action":"Use a single test that loops over (member, staff) with `self.subTest`, or give `_private_source_with_empty_release` a `grant` parameter. Both cases stay covered.","scenario":null,"lines_delta":-6,"confidence":"low"}]}
|
…ersion in the system URL as the resolver does The resolver drops a system URL's query string before it looks for a version in the path, so the check does too, and it takes a version after '|' as the resolver does. A query string can no longer hide a version the system names, or make a versionless system look as if it names one. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AaZ4qTUrHhWdhdS68p12fx
Codex check of commits a032cc7..4c89dce (codex-cli 0.169.0)Verdict: one finding (P2), fixed. Full findings are on the private tracker.
Tests (551 non-ES + 174 ES) and |
…ersion in a relative system URL by its position The path check took an owner named like a repository type (an org called "sources") for a repository, and read a versionless system as naming a version. It now reads a relative URL's path by position (/orgs|users/<owner>/<repo type>/<repo>/<version>/), with its query string dropped as the resolver does, and a canonical URL's version only after '|'. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AaZ4qTUrHhWdhdS68p12fx
Codex check of commits 4c89dce..3bdb5d0 (codex-cli 0.169.0)Verdict: one finding (P2), fixed.
Adversarial pass (fresh Claude subagent, commit 3bdb5d0)Verdict: no finding in the response code this PR changes; one P3 note.
Tests (551 non-ES + 174 ES) and |
… version segment without parsing the rest of the path A system URL with an empty segment, such as a doubled slash, made the helper that names the repository type fail, so the response errored after the reference was saved. The check now takes the fifth path segment directly, and an empty one names no version. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AaZ4qTUrHhWdhdS68p12fx
Codex check of commits 3bdb5d0..d44a221 (codex-cli 0.169.0)Verdict: one finding (P2), a regression from d44a221, fixed.
Tests (551 non-ES + 174 ES) and findings.json{
"reviewer": "codex-cli 0.169.0",
"perspective": "defects",
"mode": "final",
"commit": "d44a2213",
"verdict": "findings",
"prior": [
{
"id": "FC.1",
"status": "resolved"
}
],
"findings": [
{
"id": "FC.1",
"severity": "P2",
"tag": null,
"file": "core/collections/models.py",
"line": 1506,
"claim": "An empty repository-type segment now causes the add-references response to return HTTP 500 after saving the reference.",
"scenario": "Add a concept reference with system `/orgs/acme//catalog/` to a collection with an expansion. The resolver treats the system as missing and saves an unresolved reference. While building the response, `to_parent_kwargs_from_uri` indexes the empty repository-type segment and raises `IndexError`. Before this commit, the response listed the supplied system URL in `repo_versions`.",
"action": "Read the version segment from the normalized parent path without indexing the repository-type segment, and add a regression test for the unresolved response.",
"lines_delta": null,
"confidence": "high"
}
]
} |
Codex check of commits d44a221..2c275dd (codex-cli 0.169.0)Verdict: clean. The earlier FC.1 is resolved, and nothing new. Review loop summary for 2c275dd: three full Codex passes, a simplification review (2 of 4 cuts applied), Codex checks of every later commit (the last one clean), and an adversarial access pass (clean in this PR's code). No P0 or P1 is open in this PR's code. Two findings (F1.2, F2.2) concern how references evaluate, outside this PR, and are recorded separately; F1.1 is #1024's. |
snyaggarwal
left a comment
There was a problem hiding this comment.
Approving at 2c275dd. A repository version the requester can't view now answers like one that doesn't exist, in both places the add-references response names versions:
get_evaluated_repo_version_urlskeeps only versions withhas_view_access(user). When the system names a version the requester can't view, it uses the system or value sets instead of the expansion's recorded version. Its one caller passes the request's user.- A pinned reference's named version counts only when the requester can view it, so the item otherwise takes the "no version of {system} holds" wording.
Reading the system as the resolver does (after |, the fifth path segment without the query string, and an empty segment naming none) covers each form your Codex checks found. Members, owners and staff are unchanged.
It merges cleanly with master now that #1009 is in. CI is green. I haven't run the tests.
Fine to leave F1.1 (#1024's), F1.2 and F2.2 out of scope, as they're in reference evaluation and on master already.
Part of OpenConceptLab/ocl_online#736. Follows #1017 (OpenConceptLab/ocl_issues#3043), which is on
masterbut not yet released.What changes
The add-references response (
PUT /…/collections/<c>/references/) names the repository versions a reference resolved to nothing in. That list now holds only versions the requester can view:CollectionReference.get_evaluated_repo_version_urlstakes the user and keeps only versions withhas_view_access(user), the same checkget_resolved_repo_versions_serializedalready applies. With none left, it falls back to what the reference itself gives (itssystemand value sets), as it does today when no version resolves.So a repository the requester can't view gets the same
repo_versionsand wording as a repository that doesn't exist. Members, owners and staff see what they see today.Tests
CollectionReferencesViewTest: a private source in another org answers exactly like a missing source, for a versionless reference and for a pinned reference naming a version; an org member and a staff user still get the release's URL.ExpansionTest:get_evaluated_repo_version_urlsnames the release to a member and falls back to the system for another user and for no user.core.collections,core.integration_tests.tests_collectionsandcore.common(551 non-ES, 139 ES) and CI'spylint -j0 core/(exit 0).🤖 Generated with Claude Code
https://claude.ai/code/session_01AaZ4qTUrHhWdhdS68p12fx