Skip to content

fix(web): a private create with no encryption key stops asking for an unlock - #692

Merged
PastaPastaPasta merged 1 commit into
masterfrom
fix/new-private-no-key-unlock
Nov 24, 2026
Merged

PastaPastaPasta merged 1 commit into
masterfrom
fix/new-private-no-key-unlock

Conversation

@PastaPastaPasta

Copy link
Copy Markdown
Owner

On a reloaded (locked) tab with no encryption key stored in the browser, choosing Private on /new shows two messages that contradict each other: an "Unlock to create a private repo" passphrase box, and "cannot create a private repository: your identity has no encryption key in this browser. Add it in Settings". Unlocking can never help here, because encryptionOps reads the stored key ids without an unlock and returned null. A user who follows the first prompt unlocks and is still blocked.

Found in tonight's mainnet-readiness web QA on forge.dashhq.org (MAINTAINER signed in with an identity file, without ticking "Read and write members-only and private content").

Fix: needsUnlock is false when no key is stored (noKey), so only the Settings pointer shows and Create stays disabled with "Add your encryption key…". A locked tab that does hold a key still asks for the unlock, which e2e/session-persistence.spec.ts covers.

Test: app/new/page.test.tsx has a new case (locked tab, no key, Private). It fails before the change and passes after; the whole file passes (9/9) and tsc --noEmit is clean.

🤖 Generated with Claude Code

… unlock

On a reloaded (locked) tab, picking Private on /new with no encryption key
stored in this browser showed both "Unlock to create a private repo" and
"cannot create a private repository: your identity has no encryption key in
this browser". Unlocking can't help when no key is stored, so only the
Settings pointer is shown now.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@coderabbitai

coderabbitai Bot commented Nov 24, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 55 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 937cf5f5-7e05-4281-9a35-15086d325e86
Commits

Reviewing files that changed from the base of the PR and between a0b5ec9 and 961acf1.

Files selected for processing: 2

  • forge-web/app/new/page.test.tsx
  • forge-web/app/new/page.tsx
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@PastaPastaPasta PastaPastaPasta left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: approve

Reviewed 961acf1.

  • Fix is right. noKey is true only when Private is chosen and encryptionOps returned null, which means a successful read found no stored key. storedEncryptionKeyIds (vault.ts:1614) can be read while the tab is locked, and a resumed signing-only session still counts its own vault blob. So null on a locked tab really means there's no key, and unlocking can't help. With the fix the passphrase box goes away, private-no-key stays, and Create is blocked by the "Add your encryption key…" reason.
  • Locked tab with a stored key still asks for the unlock. In that case ops.data is non-null, so noKey is false and needsUnlock is unchanged. The same goes for a read that is still loading or that failed: keyMissing needs settled && error === null, so the unlock prompt still shows. The browser test e2e/session-persistence.spec.ts:159-165 (Private, then new-private-unlock) covers the stored-key case.
  • No regressions on public creates or wallet/phrase sessions. noKey is gated on isPrivate. A public create with members-only content already dropped out through withMembers = … && !keyMissing, so the new !noKey changes nothing there. Wallet and phrase sessions have unlockScope !== 'signing', so needsUnlock was already false.
  • The test fails without the fix. Under the old code, unlockScope='signing' with held=null makes needsUnlock true, which renders new-private-unlock, and the Create title becomes "Unlock this tab…". So both toBeNull() and the /Add your encryption key/ match would fail. Reasoned from the code, not run: no local vitest on this box, and the web job is still pending.
  • Nit, not blocking: a matching unit test for "locked, key stored, Private: unlock shown" would keep this rule in the unit suite and not rely only on browser coverage.

🤖 Posted autonomously by Claude (claude-opus-5-5) on behalf of pasta.

@PastaPastaPasta
PastaPastaPasta merged commit 9a1a871 into master Nov 24, 2026
20 checks passed
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