Skip to content

OpenConceptLab/ocl_online#885 | Making a repository private or public again says that it worked - #130

Open
paynejd wants to merge 3 commits into
mainfrom
ocl_online-885-visibility-202
Open

paynejd wants to merge 3 commits into
mainfrom
ocl_online-885-visibility-202

Conversation

@paynejd

@paynejd paynejd commented Dec 4, 2026 •

Copy link
Copy Markdown
Member

Closes OpenConceptLab/ocl_online#885

When an owner made a source private, or public again, the form showed a red "202: [object Object]" and stayed open, although the change was saved. The API answers 202 when it saved the change and is still indexing the source's concepts and mappings for it. The form took only 200 and 201 as success.

Now 202 is a success too, so the form does what it does after any other update: it says that the repository was updated, goes to it, and asks for the notices again. The answer has the same repository data as a 200.

Every save asks for the notices again now, not only one that changed the visibility from what the form was filled with. A form opened before someone changed it elsewhere can change it back without looking like a change.

Other forms: none needs it. This is the only form that changes a repository's visibility, and that change is the only save that the API answers with 202. (For a collection it answers 200.)

Checked

  • A test for 200, 201, 202 and a refusal. The one for 202 fails with the old rule. All 413 tests and the linter pass.
  • In a browser, on a mocked API, before and after: private and public again with 202, private with 200, and a refusal (403), whose own words show as before.

To check on staging: make a source with a concept in it private, then public again. Each time the form says "updated" and goes to the source.

🤖 Generated with Claude Code

https://claude.ai/code/session_01AaZ4qVmwkeg26E7AcP35TN

paynejd and others added 2 commits December 4, 2026 05:01
…e API answers with 202 is a success, not a red error

The API saves the change and answers 202 while it still indexes the repository's content for it.

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

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 47cbf6c)

1 finding: P2 1.

  • F1.1 (P2) RepoCreate.jsx:290: A successful 202 can skip the account notice refresh when the edit form has a stale copy of the source.
findings.json
{
  "reviewer": "codex-cli 0.171.0",
  "perspective": "defects",
  "mode": "full",
  "commit": "47cbf6ced0f91e4aa83ccee27949b9f46e4905b4",
  "verdict": "findings",
  "prior": [],
  "findings": [
    {
      "id": "F1.1",
      "severity": "P2",
      "tag": null,
      "file": "src/components/repos/RepoCreate.jsx",
      "line": 290,
      "claim": "A successful 202 can skip the account notice refresh when the edit form has a stale copy of the source.",
      "scenario": "Open a populated public source in two tabs. Make it private in the first tab. In the stale tab, edit the description and save. The form resubmits Public, so the API switches the source back to public and returns 202. The response matches the stale tab's original visibility, so the form reports success and navigates without re-requesting account notices.",
      "action": "Refresh notices on every successful 202 and cover the case where the returned visibility matches the form's original value.",
      "lines_delta": null,
      "confidence": "high"
    }
  ]
}

@paynejd

paynejd commented Dec 4, 2026

Copy link
Copy Markdown
Member Author

Answer to pass 1, in the second commit:

  • F1.1 (P2): fixed, by asking for the notices after every save. That's simpler than comparing, and it covers a collection saved from a stale form too, which the API answers with 200.

@paynejd

paynejd commented Dec 4, 2026

Copy link
Copy Markdown
Member Author

Simplification review (claude subagent, commit 6b1e2fc)

2 possible cuts.

  • S1 (dup-test) repoSave.test.js:19: The refusal test asserts five near-identical inputs (detail body, field-error body, string, undefined). Two cases cover the same branch (no numeric status, so false): the API error body and the string/undefined case.
  • S2 (shrink) repoSave.js:2: The comment says the same thing as the 202 test name and the line's own status list. The exported one-line helper has a single caller; it exists only so node --test can reach it, which the ticket's test criterion requires, so keep the function and trim the comment to one short line or fold the 202 reason into the test only.
findings.json
{
  "reviewer": "claude subagent",
  "perspective": "simplify",
  "mode": "full",
  "commit": "6b1e2fc0fd31c57f0ceb40d707761bacbd235c24",
  "verdict": "findings",
  "prior": [],
  "findings": [
    {
      "id": "S1",
      "severity": null,
      "tag": "dup-test",
      "file": "src/components/repos/__tests__/repoSave.test.js",
      "line": 19,
      "claim": "The refusal test asserts five near-identical inputs (detail body, field-error body, string, undefined). Two cases cover the same branch (no numeric status, so false): the API error body and the string/undefined case.",
      "scenario": null,
      "action": "Keep one API-body case and one non-object case (e.g. 'Network Error'); drop the field-error body and the undefined case.",
      "lines_delta": -2,
      "confidence": "low"
    },
    {
      "id": "S2",
      "severity": null,
      "tag": "shrink",
      "file": "src/components/repos/repoSave.js",
      "line": 2,
      "claim": "The comment says the same thing as the 202 test name and the line's own status list. The exported one-line helper has a single caller; it exists only so node --test can reach it, which the ticket's test criterion requires, so keep the function and trim the comment to one short line or fold the 202 reason into the test only.",
      "scenario": null,
      "action": "Shorten the comment, or drop it and let the test name carry the reason.",
      "lines_delta": -1,
      "confidence": "low"
    }
  ]
}

Answers:

  • S1: applied. Two of the refusals are gone.
  • S2: declined. The reason for 202 belongs where the statuses are listed.

@paynejd

paynejd commented Dec 4, 2026

Copy link
Copy Markdown
Member Author

Codex check of commits 47cbf6c..4f1b925 (codex-cli 0.171.0)

Clean: no findings.

findings.json
{
  "reviewer": "codex-cli 0.171.0",
  "perspective": "defects",
  "mode": "final",
  "commit": "4f1b925a1bf349a68103c8df06b552173f299a18",
  "verdict": "clean",
  "prior": [
    {
      "id": "F1.1",
      "status": "resolved"
    }
  ],
  "findings": []
}

@paynejd
paynejd marked this pull request as ready for review December 4, 2026 10:11
@paynejd
paynejd requested a review from snyaggarwal December 4, 2026 10:11

@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. A save that the API answers with 202 is now treated as a success, like 200 and 201. The form says the repository was updated and goes to it, instead of showing "202: [object Object]".

Merge order: any time. It doesn't depend on an API change. CI (lint and test) passes on 4f1b925, and it merges cleanly.

What I checked against oclapi2:

  • The 202 answer. ConceptContainerBaseView.update (core/common/mixins.py) answers 202 only when the save started the reindex of a visibility change (_public_access_task, set in core/sources/signals.py). Its body is the same detail serializer as the 200, so response.data.url is there for the redirect.
  • Refusals. APIService gives back the error body or message with no status, so isRepoSaved is false for refusals, and the refusal-notice and error branches work as before.
  • Other forms. RepoCreate.jsx is the only oclweb3 form that writes public_access. The versions tab already treats 202 from summary/ separately. So I agree no other form needs the change.
  • Asking for the notices on every save (your answer to F1.1). It's one extra GET per save, it covers a stale form, and it's simpler than comparing values.

@snyaggarwal

Copy link
Copy Markdown
Contributor

Correction to my review: the 202 comes from ConceptDictionaryUpdateMixin.update in core/common/mixins.py, not ConceptContainerBaseView. The rest stands.

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