Skip to content

Fix for patch issue - #325

Open
SharonStrats wants to merge 1 commit into
stagingfrom
fix/patch-issue
Open

Fix for patch issue#325
SharonStrats wants to merge 1 commit into
stagingfrom
fix/patch-issue

Conversation

@SharonStrats

Copy link
Copy Markdown
Contributor

There are two pieces to the changes that needed to be made to make it where the profile card could be PATCHED after a restored session.

First
The changes in solidauthlogic are needed because this is the only layer that can reliably tell when the session has actually become usable. The logs showed a real race: restore() could complete late, or handleIncomingRedirect()/checkUser() could see the session active before the rest of the app had a populated WebID context. The code in SolidAuthnLogic.ts:17 and SolidAuthnLogic.ts:105 fixes that by timing out a hung restore, then still emitting sessionRestore if the session becomes active later.

That matters because other code depends on that event. In particular, the store invalidation in solidLogic.ts only runs when login or sessionRestore fires, so without this auth-layer code the app can keep stale anonymous fetch metadata and PATCH keeps failing.

Second
The changes in SolidLogic clears the stale anonymous fetch state on session restore, so rdflib is willing to re-evaluate the document with authenticated headers. Without this the refresh nor reload work.

@SharonStrats
SharonStrats requested review from bourgeoa and a lite review from Copilot September 7, 2026 12:08
@SharonStrats SharonStrats self-assigned this Sep 7, 2026
@SharonStrats SharonStrats added the bug Something isn't working label Sep 7, 2026

Copilot AI 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.

🟡 Changes recommended

The current SolidAuthnLogic.checkUser() changes regress legacy login event emission and the new rdflib invalidation code relies on unguarded internal APIs that can throw at runtime.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

Updates Solid authentication/session handling so the app can reliably detect (and react to) a restored/activated session, avoiding stale anonymous fetch metadata that prevents authenticated PATCH operations (e.g., profile card updates).

Changes:

  • Add a Vitest case covering a “late restore after timeout” scenario to ensure sessionRestore can still be emitted when restore() settles after the timeout.
  • In SolidAuthnLogic.checkUser(), add logic to emit sessionRestore when a timed-out restore later completes.
  • In createSolidLogic, invalidate rdflib’s cached “anonymous” fetch completion state on sessionRestore so subsequent loads can record authenticated headers.
File summaries
File Description
test/solidAuthLogic.test.ts Adds coverage for late restore() completion emitting sessionRestore.
src/logic/solidLogic.ts Clears rdflib fetch completion cache on sessionRestore to allow authenticated reload/PATCH.
src/authn/SolidAuthnLogic.ts Emits sessionRestore on late restore completion and refactors restore activation detection.
Review details

Suppressed comments (1)

src/authn/SolidAuthnLogic.ts:165

  • The handleRedirectFromLogin() path no longer emits the legacy login event when the session transitions from inactive to active. authSession.ts explicitly relies on SolidAuthnLogic.checkUser() to emit login/sessionRestore, so this is a behavior regression for any listeners waiting on login.
      if (typeof sessionAny?.handleRedirectFromLogin === 'function') {
        await sessionAny.handleRedirectFromLogin()
      }
  • Files reviewed: 3/3 changed files
  • Comments generated: 2
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/authn/SolidAuthnLogic.ts
Comment thread src/logic/solidLogic.ts
Prompt: various prompts and research to determine that the authSession event was not being sent and that we had to remove previous anonymous fetches so they can be refetched with authentication

Co-authored-by: GPT-5.4 <gpt-5.4@openai.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

Status: In review

Development

Successfully merging this pull request may close these issues.

2 participants