Skip to content

OpenConceptLab/ocl_online#887 | A signed-out visitor stays on a person's public repository - #132

Open
paynejd wants to merge 7 commits into
mainfrom
ocl_online-887-signed-out-visitors
Open

paynejd wants to merge 7 commits into
mainfrom
ocl_online-887-signed-out-visitors

Conversation

@paynejd

@paynejd paynejd commented Dec 4, 2026 •

Copy link
Copy Markdown
Member

For OpenConceptLab/ocl_online#887. Based on main.

A visitor who isn't signed in can open a person's public source or collection and stay on it. Until now TBv3 took every 401 for an expired session and sent the visitor to the sign-in page.

What it does now

  • Only a request that carried a token signs in again. For a visitor, a 401 is an answer like any other (APIService.sendRequest). An expired session still signs in again and comes back to the page.
  • The owner's username is at the top, with its link. For a visitor, a person's repository names its owner from what it says itself, and doesn't ask the API for the person (repos/owner.js). It does the same when the API refuses the owner's record. It's the same in a comparison of two versions, and the owner's tooltip doesn't ask either.
  • An address that needs an account shows "Login is required", and signing in comes back to it. That's the page TBv3 already has. It now also shows for:
    • a version, with its tab (About too), where the address used to change to the repository's plain one
    • a comparison of two versions, concepts or mappings
    • a comparison's Content tab, which the API only answers for signed-in people; the other tabs stay open
    • a link to Matched Candidates
    • /imports
  • Changelog in a source version's menu is off for a visitor, as the exports beside it are.
  • Two things that a visitor's 401 used to put right, the app now does itself. A page that loaded as a visitor's loads again when another tab signs in. And an answer with a person's record is dropped if somebody has signed out, or in as somebody else, since it was asked for.

How it was checked

  • 451 tests and the lint pass, with main merged in. signInAgain.test.js has a visitor who was never signed in and an expired session, and its tests for the visitor fail without the change.
  • In a signed-out browser, with this build on staging's data: a person's public collection and two sources, a concept, a mapping and a comparison of two versions were still open after a minute, with no refused request. Every tab of a comparison, a source, a collection and a concept was opened too.
  • With an expired token, at a version's address and at its About tab: the app goes to sign in and keeps that address to return to.
  • With a stand-in for the sign-in server: two tabs opened together, where the other one signs in first. The page now shows the repository. Without the change to App.jsx it stayed on "Login is required".
  • Not checked: the last step of signing in with a real password.

For review

  • Where a private address used to go to the sign-in page by itself, it now shows "Login is required" with its link to sign in.

🤖 Generated with Claude Code

https://claude.ai/code/session_01AaZ4qWierCikGzbXQj3GN3

paynejd and others added 6 commits December 4, 2026 05:36
…repository instead of being sent to sign in

A request without a token that the API answers with a 401 now gives its caller that answer. Only a request that carried a token renews the session or signs the person in again.

- A person's repository shows its owner to a visitor from what the repository says of them: the person's own record is for people who are signed in. The same for comparing versions, and for the tooltip on a person.
- A repository, a version, a comparison or the imports page that needs an account shows "Login is required", with Sign in, at the address that was opened.
- An expired session comes back to the version it was on, not to the repository's plain address.
- The owner is also there after a version that doesn't exist.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AaZ4qWierCikGzbXQj3GN3
…ds an account, and the version's address has its own test

- Content asks the API to compare, which is for people who are signed in: a visitor sees "Login is required" there, and the other views stay open. Changelog in a source version's menu is off for a visitor, as the exports are.
- A version in a comparison's address that needs an account says so, where it said that it could not be found.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AaZ4qWierCikGzbXQj3GN3
…s its tab, About too, for signing in to come back to

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AaZ4qWierCikGzbXQj3GN3
… it right does so itself

- A page that loaded as a visitor's loads again once another tab has signed in while its own silent sign-in was under way.
- The person's record is kept only while they are signed in: an answer that comes after signing out isn't.
- A repository names its owner from what it says itself when the API refuses the owner's record, an organization's too.
- A link to Matched Candidates, which are for signed-in people, shows "Login is required" to a visitor. So does the tooltip on Changelog, where it's off for them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AaZ4qWierCikGzbXQj3GN3
… another tab signs in

- It follows the token that the other tab stores, whether or not this page's own silent sign-in gets an answer.
- A visitor's link to Matched Candidates asks to sign in before a repository's saved filters change the address.
- An answer with a person's record is kept only if the same token is still in use.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AaZ4qWierCikGzbXQj3GN3
…dates scrolls in a repository's results, so its link can be reached in a low window

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AaZ4qWierCikGzbXQj3GN3
@paynejd
paynejd requested a review from snyaggarwal December 4, 2026 11:26
@paynejd

paynejd commented Dec 4, 2026

Copy link
Copy Markdown
Member Author

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

Verdict: 3 findings, 3 of them P0 or P1.

  • F1.1 (P1) src/components/repos/VersionResourcesComparison.jsx:113: The Content tab shows an empty table when the changelog API requires sign-in.
  • F1.2 (P1) src/components/repos/CompareVersions.jsx:29: A comparison reports an inaccessible version as missing.
  • F1.3 (P1) src/services/__tests__/signInAgain.test.js:82: The expired-session test bypasses the repository code that preserves the return address.
findings.json
{
 "reviewer": "codex-cli 0.171.0",
 "perspective": "defects",
 "mode": "full",
 "commit": "44ba26d86",
 "verdict": "findings",
 "prior": [],
 "findings": [
  {
   "id": "F1.1",
   "severity": "P1",
   "tag": null,
   "file": "src/components/repos/VersionResourcesComparison.jsx",
   "line": 113,
   "claim": "The Content tab shows an empty table when the changelog API requires sign-in.",
   "scenario": "A signed-out visitor compares two public source versions and selects Content. The changelog API returns 401. The tab stops loading and shows zero rows with no explanation or sign-in link.",
   "action": "Preserve the changelog response status and render Error401 for a 401 in the Content tab. Keep the public comparison tabs available.",
   "lines_delta": null,
   "confidence": "high"
  },
  {
   "id": "F1.2",
   "severity": "P1",
   "tag": null,
   "file": "src/components/repos/CompareVersions.jsx",
   "line": 29,
   "claim": "A comparison reports an inaccessible version as missing.",
   "scenario": "[Shortened here.] A signed-out visitor opens a comparison link that names a version that needs an account. The request returns 401, which becomes null and produces “Sorry, this version could not be found.”",
   "action": "Carry the version lookup's 401 through to Error401 at the comparison URL. Keep the missing-version message for a version that cannot be found.",
   "lines_delta": null,
   "confidence": "high"
  },
  {
   "id": "F1.3",
   "severity": "P1",
   "tag": null,
   "file": "src/services/__tests__/signInAgain.test.js",
   "line": 82,
   "claim": "The expired-session test bypasses the repository code that preserves the return address.",
   "scenario": "A signed-in user with an expired token opens a bookmarked concept under an explicit repository version. If RepoHome's new guard is removed, its fallback can replace the concept URL with the repository root before sign-in records the return address. The test still passes because it calls the user API directly with a fixed browser location.",
   "action": "Exercise an authenticated 401 through the versioned repository route and assert that sign-in records the original version and concept URL.",
   "lines_delta": null,
   "confidence": "high"
  }
 ]
}

@paynejd

paynejd commented Dec 4, 2026

Copy link
Copy Markdown
Member Author

Answers to pass 1, in f6e8694:

  • F1.1: fixed. The API compares contents for signed-in people only, so the Content tab shows "Login is required" to a visitor without asking, and Changelog in a source version's menu is off for them, as the exports are. Checked in a signed-out browser.
  • F1.2: fixed. The comparison shows "Login is required" at its own address. Tested, and checked in the browser.
  • F1.3: fixed as far as the test setup allows. The decision is now isVersionMissing, with its own tests. The suite has no DOM, so the page was checked in a browser: with an expired token at a version's address, the app goes to sign in and keeps that address.

@paynejd

paynejd commented Dec 4, 2026

Copy link
Copy Markdown
Member Author

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

Verdict: 1 findings, 1 of them P0 or P1.

  • F2.1 (P1) src/components/repos/RepoHome.jsx:246: A 401 can still replace a version's About URL, so signing in returns the visitor to the wrong tab.
findings.json
{
 "reviewer": "codex-cli 0.171.0",
 "perspective": "defects",
 "mode": "verify",
 "commit": "f6e86948e",
 "verdict": "findings",
 "prior": [
  {
   "id": "F1.1",
   "status": "resolved"
  },
  {
   "id": "F1.2",
   "status": "resolved"
  },
  {
   "id": "F1.3",
   "status": "unresolved"
  }
 ],
 "findings": [
  {
   "id": "F2.1",
   "severity": "P1",
   "tag": null,
   "file": "src/components/repos/RepoHome.jsx",
   "line": 246,
   "claim": "A 401 can still replace a version's About URL, so signing in returns the visitor to the wrong tab.",
   "scenario": "Open `/users/someone/sources/Lab/v1/about/` while signed out or with an expired token. The failed fetch leaves About out of the tab list but marks the requested version as loaded. The tab fallback replaces `/v1/about/` with `/v1/concepts` while the login prompt is open or session renewal is pending. Sign-in then uses the rewritten address. The current tests check `isVersionMissing` and sign-in separately, so they miss the rewrite.",
   "action": "Run tab fallback only after a successful fetch for the current version. Add a regression test that checks the About URL through the repository page's 401 handling and session recovery.",
   "lines_delta": null,
   "confidence": "high"
  }
 ]
}

@paynejd

paynejd commented Dec 4, 2026

Copy link
Copy Markdown
Member Author

Answers to pass 2, in 9266ee9:

  • F2.1: fixed. The page now records the loaded repository's route only when there is a repository, so the tab isn't replaced before. Checked in a browser, before and after: signed out and with an expired token, /v2/about/ used to become /v2/concepts, and now stays and is what signing in comes back to.
  • F1.3: the same check covers it. A DOM for the test suite isn't part of this change.

@paynejd

paynejd commented Dec 4, 2026

Copy link
Copy Markdown
Member Author

Codex review, pass 3 (codex-cli 0.171.0, commit 9266ee9)

Verdict: 1 findings, 1 of them P0 or P1.

  • F3.1 (P1): About existing code that this change does not touch. It is handled separately.
findings.json
{
 "reviewer": "codex-cli 0.171.0",
 "perspective": "defects",
 "mode": "verify",
 "commit": "9266ee94c",
 "verdict": "findings",
 "prior": [
  {
   "id": "F1.1",
   "status": "resolved"
  },
  {
   "id": "F1.2",
   "status": "unresolved"
  },
  {
   "id": "F1.3",
   "status": "unresolved"
  },
  {
   "id": "F2.1",
   "status": "resolved"
  }
 ],
 "findings": [
  {
   "id": "F3.1",
   "severity": "P1",
   "tag": null,
   "file": null,
   "line": null,
   "claim": "About existing code that this change does not touch. It is handled separately.",
   "scenario": null,
   "action": null,
   "lines_delta": null,
   "confidence": "high"
  }
 ]
}

@paynejd

paynejd commented Dec 4, 2026

Copy link
Copy Markdown
Member Author

Answers to pass 3:

  • F3.1: about existing code, not this change. It's handled separately.

Simplification review (a fresh Claude subagent, commit 9266ee9): two small items, neither applied.

  • One assertion fewer in versionMissing.test.js: kept, as it shows that the plain address is left alone whatever the answer is, for one line.
  • Put back the old comment in usePins.js: kept as changed, because the old one says that a 401 sends a visitor to sign in, which this change makes untrue.

@paynejd

paynejd commented Dec 4, 2026

Copy link
Copy Markdown
Member Author

Adversarial pass (a fresh Claude subagent, commit 9266ee9), on signing in and what a visitor sees. No P0 or P1, one P2 and five P3. Fixed in f81bbec:

  • P2, two tabs opened together: when the other tab signed in first, this one stayed on "Login is required". It now loads again. Checked in a browser, before and after.
  • P3, an answer after signing out could write the person's record back. It's dropped now, with a test.
  • P3, Changelog's tooltip gave a visitor the wrong reason. It says "Login is required".
  • P3, a visitor's link to Matched Candidates said that there were no matches. It shows "Login is required".
  • P3, an owner whose record the API refuses had a chip without a name. It's the name that the repository gives, with a test.

Recorded, not changed here: one P3 about what a History tab says when it can't be read, which is the same for people who are signed in.

What held: a token that's refused every time doesn't loop, the return address can't lead off the site, and an expired token always signs in again.

@paynejd

paynejd commented Dec 4, 2026

Copy link
Copy Markdown
Member Author

Codex check of commits 9266ee9..f81bbec (codex-cli 0.171.0)

Verdict: 3 findings, 2 of them P0 or P1.

  • FC.1 (P1) src/components/app/App.jsx:157: Cross-tab sign-in refresh still depends on the visitor tab obtaining its own tokens.
  • FC.2 (P1) src/components/search/Search.jsx:334: Saved repository filters can bypass the Matched Candidates sign-in gate.
  • FC.3 (P2) src/common/utils.js:304: A late profile response can still overwrite the cache after an account switch.
findings.json
{
 "reviewer": "codex-cli 0.171.0",
 "perspective": "defects",
 "mode": "final",
 "commit": "f81bbec8f",
 "verdict": "findings",
 "prior": [],
 "findings": [
  {
   "id": "FC.1",
   "severity": "P1",
   "tag": null,
   "file": "src/components/app/App.jsx",
   "line": 157,
   "claim": "Cross-tab sign-in refresh still depends on the visitor tab obtaining its own tokens.",
   "scenario": "A visitor opens /imports and signs in in another tab while the first tab's silent sign-in is pending. If the silent iframe times out, the first tab returns before checking the shared token and stays on “Login is required”. Its next visibility check also exits because the token is already present.",
   "action": "Check for a token written by another tab before returning on a null silent sign-in result, and refresh the current page when that token exists.",
   "lines_delta": null,
   "confidence": "high"
  },
  {
   "id": "FC.2",
   "severity": "P1",
   "tag": null,
   "file": "src/components/search/Search.jsx",
   "line": 334,
   "claim": "Saved repository filters can bypass the Matched Candidates sign-in gate.",
   "scenario": "A visitor opens a Matched Candidates link without a filters parameter in a public source whose Concepts tab has a saved default filter. The default-filter rewrite drops $match before the gate runs. The page sends a keyword search and shows ordinary results instead of “Login is required”.",
   "action": "Gate unsigned Matched Candidates links using the URL before applying repository defaults or issuing a search.",
   "lines_delta": null,
   "confidence": "high"
  },
  {
   "id": "FC.3",
   "severity": "P2",
   "tag": null,
   "file": "src/common/utils.js",
   "line": 304,
   "claim": "A late profile response can still overwrite the cache after an account switch.",
   "scenario": "A tab still has a profile request for account A in flight when the shared session signs out and signs in as B. If A's response then arrives, isLoggedIn() sees B's token and accepts A's record. The UI can use A's identity and permission flags while requests carry B's token.",
   "action": "Capture the token used for the profile request and cache the response only if that token is still current. Extend the test to cover a replacement token.",
   "lines_delta": null,
   "confidence": "high"
  }
 ]
}

@paynejd

paynejd commented Dec 4, 2026

Copy link
Copy Markdown
Member Author

Answers to the first check (the commit after the adversarial pass), all fixed in ded087c:

  • FC.1: fixed. The page follows the token that another tab stores, whether or not its own silent sign-in gets an answer. Checked in a browser with two tabs, with a sign-in server that answers and one that never does.
  • FC.2: fixed. A visitor is asked to sign in before a repository's saved filters are applied.
  • FC.3: fixed. The answer is kept only if the token it was asked with is still in use, with a test.

@paynejd

paynejd commented Dec 4, 2026

Copy link
Copy Markdown
Member Author

Codex check of commits 9266ee9..ded087c (codex-cli 0.171.0)

Verdict: 2 findings, 1 of them P0 or P1.

  • FC.1 (P1) src/components/search/Search.jsx:813: The repository view can clip the required login message and sign-in link.
  • FC.2 (P2) src/components/app/App.jsx:127: The cross-tab sign-in can leave the visitor page mounted indefinitely.
findings.json
{
 "reviewer": "codex-cli 0.171.0",
 "perspective": "defects",
 "mode": "final",
 "commit": "ded087c36",
 "verdict": "findings",
 "prior": [
  {
   "id": "FC.1",
   "status": "resolved"
  },
  {
   "id": "FC.2",
   "status": "resolved"
  },
  {
   "id": "FC.3",
   "status": "resolved"
  }
 ],
 "findings": [
  {
   "id": "FC.1",
   "severity": "P1",
   "tag": null,
   "file": "src/components/search/Search.jsx",
   "line": 813,
   "claim": "The repository view can clip the required login message and sign-in link.",
   "scenario": "A signed-out visitor opens a public source’s Matched Candidates link in a 1024 × 540 viewport. The full-page error starts below the repository header and tabs, and its 341px illustration pushes the login message and link past the bottom of the non-scrollable content area.",
   "action": "Render a compact login prompt with a sign-in link inside the repository results panel, sized to fit or scroll within that panel.",
   "lines_delta": null,
   "confidence": "high"
  },
  {
   "id": "FC.2",
   "severity": "P2",
   "tag": null,
   "file": "src/components/app/App.jsx",
   "line": 127,
   "claim": "The cross-tab sign-in can leave the visitor page mounted indefinitely.",
   "scenario": "Another tab signs in and stores a valid token. The visitor tab receives the storage event, but its new GET /user/ request stalls while other API requests remain available. The request has no timeout, so neither callback runs and the page stays in its visitor state.",
   "action": "Bound the profile request and remount on timeout if the token is still current.",
   "lines_delta": null,
   "confidence": "high"
  }
 ]
}

@paynejd

paynejd commented Dec 4, 2026

Copy link
Copy Markdown
Member Author

Answers to the second check:

  • FC.1: fixed in 604b207. The message is in the results' scrolling box, and its link can be reached at 1440×900, 1024×540 and 390×844 (on a phone with the summary closed, as for the results themselves). That commit is only this layout. It was checked in a browser, not by another Codex pass.
  • FC.2: accepted as it is. It needs a request that never ends, and then the page stays as it was until it's reloaded. The app's own silent sign-in waits for the same request in the same way.

Only the imports of RepoHome.jsx conflicted.

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

paynejd commented Dec 4, 2026

Copy link
Copy Markdown
Member Author

main is merged in (a39434f): only the two import lines of RepoHome.jsx conflicted, and nothing else of this change is different. The 451 tests and the lint pass, and I opened the comparisons signed out again on the merged code.

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.

1 participant