Skip to content

OpenConceptLab/ocl_online#886 | Lists of sources and collections return public_access - #1132

Open
paynejd wants to merge 3 commits into
masterfrom
ocl_online-886-list-public-access
Open

paynejd wants to merge 3 commits into
masterfrom
ocl_online-886-list-public-access

Conversation

@paynejd

@paynejd paynejd commented Dec 4, 2026 •

Copy link
Copy Markdown
Member

Part of OpenConceptLab/ocl_online#886

The lists of sources, collections and repositories now return public_access for each one, with the same value as the repository's own address. Before, a reader of a list couldn't tell a private repository from a public one.

  • Who sees which repositories doesn't change. This only adds a field to the ones already listed.
  • The short form of the lists (?brief=true) has it too, and so do other answers that use the same form of a source or a collection.

TBv3 draws its lock from this in a separate pull request. Either one can be released first: without the field, TBv3 shows no lock.

How it was checked: a new test reads a person's and an organization's lists and the global ones, as a member and signed out. It compares each value with the repository's own address. It failed before the change. The whole suite passes: 4,289 tests without search (2 skipped) and 815 with it. Two older tests that check the exact short form now expect the field.

To check on staging: GET /users/<you>/repos/ with your token shows "public_access": "None" on a private repository and "View" on a public one.

🤖 Generated with Claude Code

https://claude.ai/code/session_01AaZ4qVmwkeg26E7AcP35TN

paynejd and others added 2 commits December 4, 2026 05:17
…rn public_access

It has the same value as the repository's own address. Who sees which repositories doesn't change.

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

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

paynejd commented Dec 4, 2026

Copy link
Copy Markdown
Member Author

Codex review, pass 1 (codex-cli 0.171.0, commit e8f631c)

2 findings: P1 2.

  • F1.1 (P1) views.py:123: Brief source and collection lists omit public_access.
  • F1.2 (P1) views.py:1641: Named versions omit public_access in version lists and nested reference resolution results.
findings.json
{
  "reviewer": "codex-cli 0.171.0",
  "perspective": "defects",
  "mode": "full",
  "commit": "e8f631c16af58324b7f02001048dfe89020ebcf0",
  "verdict": "findings",
  "prior": [],
  "findings": [
    {
      "id": "F1.1",
      "severity": "P1",
      "tag": null,
      "file": "core/sources/views.py",
      "line": 123,
      "claim": "Brief source and collection lists omit public_access.",
      "scenario": "An owner requests a source or collection list with ?brief=true. The private repository appears, but its row has no public_access even though its detail response returns \"None\". The web app cannot mark it as private from the brief response.",
      "action": "Add public_access to SourceMinimalSerializer and CollectionMinimalSerializer and extend the public and private list assertions to cover brief responses.",
      "lines_delta": null,
      "confidence": "high"
    },
    {
      "id": "F1.2",
      "severity": "P1",
      "tag": null,
      "file": "core/collections/views.py",
      "line": 1641,
      "claim": "Named versions omit public_access in version lists and nested reference resolution results.",
      "scenario": "An authorized user lists a repository's versions or resolves the URI of a private named version through /$resolveReference/. The version detail returns public_access \"None\", but the list row and the nested result omit the field because both use the version-list serializers.",
      "action": "Expose the version row's public_access in both version-list serializers. Test a named version whose access differs from HEAD.",
      "lines_delta": null,
      "confidence": "high"
    }
  ]
}

@paynejd

paynejd commented Dec 4, 2026

Copy link
Copy Markdown
Member Author

Answers to pass 1:

  • F1.1 (P1): fixed. ?brief=true lists of sources and collections return public_access, and the test asks for both forms. It failed before the fix.
  • F1.2 (P1): not part of this change. The ticket is about the lists of sources, collections and repositories. A repository's version list already has the value with verbose=true, which is how TBv3 asks for it.
  • F1.3 (P2): about behaviour this change doesn't alter, so it isn't listed above. It's recorded for the team.

…ublic_access

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

paynejd commented Dec 4, 2026

Copy link
Copy Markdown
Member Author

Codex review, pass 2 (codex-cli 0.171.0, commit 9f3f5ce)

1 finding: P1 1.

  • F2.1 (P1) tests_sources.py:111: Adding public_access to brief responses breaks two existing integration tests.
findings.json
{
  "reviewer": "codex-cli 0.171.0",
  "perspective": "defects",
  "mode": "verify",
  "commit": "9f3f5ce32c21daa68d96863eccccd5f3267fe77f",
  "verdict": "findings",
  "prior": [
    {
      "id": "F1.1",
      "status": "regressed"
    },
    {
      "id": "F1.2",
      "status": "unresolved"
    }
  ],
  "findings": [
    {
      "id": "F2.1",
      "severity": "P1",
      "tag": null,
      "file": "core/integration_tests/tests_sources.py",
      "line": 111,
      "claim": "Adding public_access to brief responses breaks two existing integration tests.",
      "scenario": "Both test_get_200 cases request an organization's brief list with one public repository. The response now includes public_access: View, so the exact dictionary assertions here and in core/integration_tests/tests_collections.py:135 fail. The mismatch was verified statically because Docker socket access was denied.",
      "action": "Add public_access to both expected response dictionaries.",
      "lines_delta": null,
      "confidence": "high"
    }
  ]
}

@paynejd

paynejd commented Dec 4, 2026

Copy link
Copy Markdown
Member Author

Answer to pass 2:

  • F2.1 (P1): fixed in 9af39e5. The two older tests that check the exact short form now expect public_access.
  • F1.2: as answered after pass 1.

@paynejd

paynejd commented Dec 4, 2026

Copy link
Copy Markdown
Member Author

Codex review, pass 3 (codex-cli 0.171.0, commit 9af39e5)

Clean: no findings.

findings.json
{
  "reviewer": "codex-cli 0.171.0",
  "perspective": "defects",
  "mode": "verify",
  "commit": "9af39e50d75b57e263c19e9597e5158570027bb7",
  "verdict": "clean",
  "prior": [
    {
      "id": "F1.1",
      "status": "resolved"
    },
    {
      "id": "F1.2",
      "status": "unresolved"
    },
    {
      "id": "F2.1",
      "status": "resolved"
    }
  ],
  "findings": []
}

@paynejd

paynejd commented Dec 4, 2026

Copy link
Copy Markdown
Member Author

Simplification review (claude subagent, commit 9af39e5)

Clean: no findings.

findings.json
{
  "reviewer": "claude subagent (sonnet)",
  "perspective": "simplify",
  "mode": "full",
  "commit": "9af39e50d75b57e263c19e9597e5158570027bb7",
  "verdict": "clean",
  "prior": [],
  "findings": []
}

@paynejd

paynejd commented Dec 4, 2026

Copy link
Copy Markdown
Member Author

The review loop is done: pass 3 and the simplification review are clean, and no commit came after them. F1.2 stays outside this ticket, as answered after pass 1: lists of versions have the value with verbose=true.

@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.

Approve. The PR adds public_access to the list and short (brief=true) forms of sources and collections. Each row shows the same value as the repository's own address, and nothing changes about who gets which rows.

Merge order: any time, so no ordering with the TBv3 lock PR. It's based on today's master (3c2e9c1) and merges cleanly with it, #1119, #1120, #1128 and #1100. It conflicts with #1078 in core/collections/serializers.py and core/sources/serializers.py, in the same Meta.fields lines #1119 touches. Whichever merges second has to resolve it, and the fix is small. Lint and Tests pass on 9af39e5.

What I checked:

  • No new leaks in the lists. The lists and /repos/ pass these serializers only repositories the requester can already open, and those repositories' own addresses already return public_access. Rows come from the database, so the value is current even before the index catches up.
  • Other users of the changed serializers.
    • get_brief_serializer: the event feed checks can_view before it serializes an event's object or referenced object.
    • $resolveReference: it reports a repository the requester can't view as unresolved before it uses SourceListSerializer or CollectionListSerializer.
  • Consistency with #1119. The field is the HEAD's own value, next to #1119's versions count for the requester's view. Neither depends on the other.
  • Tests. RepoListsPublicAccessTest covers a person's and an organization's lists and the global lists: full and brief forms, as owner or member and signed out, compared with each repository's own address.

Non-blocking, from before this PR: AbstractMappingSerializer embeds from_source and to_source with SourceListSerializer (?includeSources, ?includeFromSource, ?includeToSource), and doesn't check access. If a mapping someone can view points at a source they can't, that source's summary was already in the answer, and it now also carries "public_access": "None". This is outside #886, and I agree with your answer to F1.2 that version lists are too. It may be worth its own ticket.

This branch has not been deployed

No deployments
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