feat/auth: one-button sign-in, multi-device identity, and sync recovery (0.4.0) #34
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/one-button-sign-in"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes #33. Refs #35, #36, #37.
Changes (0.4.0)
Security/preservation
PKCE, browser-only unlock, one-use encrypted pending authorization; no host tokens persisted. Explicit updates preserve existing secrets and sessions. Opening settings contacts only authenticated backend /me, not the shared login hub. No automatic vault selection or note upload on auth. Existing notes/settings/keys preserved.
Verification
64 tests, typecheck, production build and whitespace checks pass at
f7f8847. Regression coverage includes role matrix, same guest across multiple devices, identity collision/replay, CodeMirror resets/bidirectional propagation, ignored/broken filesystem trees, missing Worker recovery, routing-failure retries, and backend-confirmed link status after lost browser return. Review findings 435/463/465 addressed and awaiting latest-head review.Deployment / limitations
Project apps and login service activated. Production vault and login fixes deployed; actual Anastasia guest now has a confirmed shared identity link and /me returns linked=true for the original user ID. Preview installed in four vaults preserving data.json and notes. External and same-zone checks performed; they are not full device/browser certification.
Untargeted multi-window obsidian:// return and Reopen browser reusing the one-use start URL remain known limitations; use the completion code in the original final browser tab under Obsidian did not open? while the original waiting modal remains active. Android new flow still needs validation; iOS untested. Release notes will distinguish these gaps. No merge until current-head review is checked.
Pi code review
1 new actionable finding
packages/plugin/src/provisioning/host.ts:23Merged the three candidate reviews of the pinned head-versus-base auth, settings, provisioning, and documentation changes, deduplicating their shared upgrade-path finding and verifying its callers and guards against repository code. Verification was read-only; no tests, builds, or live browser, device, or Cloudflare checks were run.
Change walkthrough
packages/plugin/src/main.ts,packages/plugin/src/login.ts,packages/plugin/src/provisioning/host.ts,packages/plugin/src/provisioning/cloudflare.ts(+7 more)packages/plugin/src/provisioning/host.test.ts,packages/plugin/src/provisioning/cloudflare.test.ts,packages/plugin/src/ui/settings-tab.test.ts,packages/worker/src/login-service.test.tsREADME.md,docs/DEPLOY.md,docs/TESTING.md,docs/UPDATING.mdReview effort: 4/5.
Static observations (not validation results)
Reviewed
980c2e4e9405fdf0b55c72107e5fe1910acacca6withproxy/glm-5.3-flash + proxy/deepseek-v4.1-flash + proxy/gpt-6.1-sol → proxy/gpt-6.1-sol. Automated advisory review; no project commands or tests were executed.@ -0,0 +20,4 @@backendToUpdate?: string,): Promise<HostingDestination | null> {const existing = await discoverCloudflareBackends(accessToken);if (backendToUpdate) {[P2] Discovery prerequisites block the backend update needed to establish them
Compliance/regression: explicit backend updates now require successful owner-ticket discovery before applying migrations or registering backend metadata. An owner upgrading a deployment without migration 0004 or its backend_url registration cannot perform the documented one-time update, even from the original device with a valid owner session. The base implementation allowed explicit setup/update to provision the selected account and domain without first requiring discovery.
Trigger: With the shared login service activated, an authenticated owner installs this plugin version while their existing backend lacks the discovery schema or backend_url registration, then selects Advanced → Update backend on the original device.
Impact: The owner cannot upgrade the backend or enable Cloudflare reconnect through the plugin and must perform an out-of-band deployment or database repair.
Evidence: packages/plugin/src/provisioning/host.ts:23 calls discoverCloudflareBackends before handling backendToUpdate, and lines 25–29 reject updates unless discovery returns the connected backend with a cloudflareAccountId. discoverCloudflareBackends delegates to cloudflareOwnerAccounts in packages/shared/src/account.ts, which skips databases without app_settings.backend_url and requires successful owner_login_tickets queries before returning a candidate; missing discovery tables can instead make discovery throw. packages/plugin/src/main.ts calls cloudflareDestination before provision, so neither applySchema nor the backend_url INSERT in provisionBackend can establish those prerequisites. Ordinary sign-in cannot bypass this gate because provisionBackend rejects existing Workers unless updateExisting is set. docs/UPDATING.md explicitly says existing owners must establish migration 0004 and backend_url by updating once from the original device; the base completeCloudflareOAuth setup branch called provision after account selection without discovery.
Verified review 423: the upgrade prerequisite cycle is genuine. Fixed explicit Update backend to inspect authorized accounts and match the connected Worker PUBLIC_DOMAIN through read-only Worker settings, without calling discovery or requiring its migrations. Ordinary sign-in still discovers first and never implicitly updates. Added old-Worker/domain-mismatch and denied-account upgrade tests. Typecheck and all 38 tests pass.
Operator supplied Cloudflare client ID and confirmed public/domain verification. Deployed the separate login service to https://login.behold.quest, version 8f742b19-dece-46a1-952f-ce312e09e3be, using dedicated D1 4520acd0-a1ee-46f6-9beb-051fe73fbe33 and new login-only signing/encryption keys. Explicit hostname route prevents vault wildcard interception. Config/JWKS and Cloudflare start/redirect smoke checks pass, with correct client/callback/hosting scopes/PKCE; vault health unchanged. Discord stays disabled until operator adds LOGIN_PROVIDERS secret via dashboard. No vault backend redeployment or secret rotation. Full browser/Obsidian callback remains untested; PR is not merged.
Pi code review
1 new actionable finding
packages/plugin/src/ui/settings-tab.ts:607Earlier findings: 1 rechecked
packages/plugin/src/provisioning/host.ts:23, first reported in review #423) — packages/plugin/src/provisioning/host.ts now handles backendToUpdate before calling discoverCloudflareBackends. It verifies the connected origin through cloudflareUpdateDomain using the Worker's PUBLIC_DOMAIN binding, and main.ts passes updateExisting to provision, allowing the update to install discovery prerequisites without first discovering an owner ticket.Aggregated the candidate reviews of the Cloudflare and Discord sign-in, provisioning, and settings changes against the pinned base. Verification was read-only; no tests, builds, or live browser, Obsidian, or Cloudflare checks were run.
Change walkthrough
packages/plugin/src/main.ts,packages/plugin/src/login.ts,packages/plugin/src/provisioning/host.ts,packages/plugin/src/provisioning/cloudflare.ts(+8 more)packages/plugin/src/provisioning/cloudflare.test.ts,packages/plugin/src/provisioning/host.test.ts,packages/plugin/src/ui/settings-tab.test.ts,packages/worker/src/login-service.test.tsREADME.md,docs/DEPLOY.md,docs/TESTING.md,docs/UPDATING.mdReview effort: 4/5.
Static observations (not validation results)
Reviewed
8f7e5b2ff19a19ce91b3250a2d2d8566185c0a3fwithproxy/glm-5.3-flash + proxy/deepseek-v4.1-flash + proxy/gpt-6.1-sol → proxy/gpt-6.1-terra. Automated advisory review; no project commands or tests were executed.@ -765,0 +604,4 @@private advancedSection(parent: HTMLElement): void {const details = parent.createEl("details");details.createEl("summary", { text: "Advanced" });parent = details;[P2] Backend outages hide the control needed to deploy a repair
The explicit backend update control is shown only when the current user has been successfully loaded as an owner. After a failed startup identity request, an owner with a saved session cannot use the plugin to deploy a fix to an unhealthy backend.
Trigger: An owner starts Obsidian with a saved session while the backend returns a non-401 error or times out, such as after a broken Worker deployment, and opens Advanced settings.
Impact: The owner cannot access the documented in-plugin update path to repair the Worker and must instead deploy out of band or wait for the backend to recover and reload Obsidian.
Evidence: In packages/plugin/src/main.ts, onload leaves the saved session intact on a non-401 refreshMe failure, but currentUser remains null because refreshMe assigns it only after api.me succeeds. packages/plugin/src/ui/settings-tab.ts renders Advanced for that saved session but gates Update backend on currentUser?.kind === "owner"; the previous unconditional Cloudflare setup/update control and Account refresh button were removed.
Fixed live-sync regression reported in #35. A connected EditorView can lose appendConfig yCollab after Obsidian replaces EditorState. The stale bound flag skipped both reattachment and disk fallback, leaving online sockets with divergent editor/Y.Text. Now verifies the actual compartment, ySync plugin, and Y.Text binding; recovers unbound editor edits before attaching or receiving peer updates; retries through deferred editor-change checks and a stopped-engine-safe 500 ms check. Added real-CodeMirror regression coverage for reset + bidirectional propagation, initial divergence, offline recovery, and stop cleanup. All 41 tests, typecheck, production build, diff checks pass. Installing preview into the two existing test vaults without settings or note changes. Latest head still requires bot review; no merge or backend deployment.
Pi code review
0 new actionable findings
No new actionable findings. Previously reported issues, if any, are tracked below.
Earlier findings: 1 rechecked
packages/plugin/src/ui/settings-tab.ts:607, first reported in review #435) — In packages/plugin/src/main.ts, onload retains a saved session after a non-401 refreshMe failure, while currentUser remains null because refreshMe assigns it only after api.me() succeeds. In packages/plugin/src/ui/settings-tab.ts, Advanced is rendered for that session, but Update backend remains gated on currentUser?.kind === "owner". An owner starting against a broken or unreachable Worker therefore cannot access the documented in-plugin repair deployment; the prior unconditional Cloudflare setup control and Account refresh button are gone.Aggregated the candidate reviews of the authentication, provisioning, settings, and editor-binding changes against the pinned base and head. The prior repair-path finding remains actionable; no checks or live OAuth or device validation were run with the available read-only tools.
Change walkthrough
packages/plugin/src/main.ts,packages/plugin/src/login.ts,packages/plugin/src/provisioning/host.ts,packages/plugin/src/provisioning/cloudflare.ts(+8 more)packages/plugin/src/ui/settings-tab.test.ts,packages/plugin/src/provisioning/host.test.ts,packages/plugin/src/provisioning/cloudflare.test.ts,packages/plugin/src/sync/engine.test.ts(+1 more)README.md,docs/DEPLOY.md,docs/TESTING.md,docs/UPDATING.mdReview effort: 4/5.
Static observations (not validation results)
Reviewed
56fdcb7159f775a964c1cc213cf42a318e4f5b5bwithproxy/glm-5.3-flash + proxy/deepseek-v4.1-flash + proxy/gpt-6.1-sol → proxy/gpt-6.1-terra. Automated advisory review; no project commands or tests were executed.Addressed #36: only backend owners see guest onboarding; only selected-vault owners see vault invite controls. API already denied backend guest onboarding, but vault invite API allowed managers; now checks vaults.owner_user_id on a non-deleted vault, without backend-owner or membership-owner bypasses. Guest-owned vaults remain shareable by their actual owner. Added rendered role matrix and SQLite-backed endpoint tests covering manager/contributor/viewer/outsider/backend-owner denial and owner success. All 49 tests, typecheck, production build, diff checks pass. Backend change not deployed yet; existing memberships/invites unchanged.
Pi code review
0 new actionable findings
No new actionable findings. Previously reported issues, if any, are tracked below.
Earlier findings: 1 rechecked
packages/plugin/src/ui/settings-tab.ts:607, first reported in review #435) — In packages/plugin/src/main.ts, onload retains the saved session after a non-401 refreshMe failure, while refreshMe assigns currentUser only after api.me() succeeds. packages/plugin/src/ui/settings-tab.ts still renders Update backend only when currentUser?.kind is owner, so an owner starting against a broken Worker cannot access the documented in-plugin repair deployment.Aggregated the candidate reviews of the pinned base-to-head changes, covering authentication, provisioning, settings, invitation permissions, and editor synchronization. Verification was limited to repository inspection; no tests, builds, or live Cloudflare or Obsidian checks were run.
Change walkthrough
PLAN.html,packages/plugin/src/login.ts,packages/plugin/src/main.ts,packages/plugin/src/provisioning/cloudflare.ts(+10 more)README.md,docs/DEPLOY.md,docs/TESTING.md,docs/UPDATING.mdpackages/plugin/src/provisioning/cloudflare.test.ts,packages/plugin/src/provisioning/host.test.ts,packages/plugin/src/sync/engine.test.ts,packages/plugin/src/ui/settings-tab.test.ts(+2 more)Review effort: 4/5.
Static observations (not validation results)
Reviewed
ae94aafffdd61c457833c955db294abf72b24b81withproxy/glm-5.3-flash + proxy/deepseek-v4.1-flash + proxy/gpt-6.1-sol → proxy/gpt-6.1-terra. Automated advisory review; no project commands or tests were executed.Follow-up #36 clarification: vault and backend ownership are independent. Verified live Anastasia account is guest and owns vault ce378cce-609d-4f06-845c-524eaed14ff8. Neither the vault invite API nor the UI ownership predicate requires backend ownership. Settings had rendered cached role lists without refresh; now refreshes /me and rerenders permissions, with explicit Share this vault versus Invite to this backend labels. Added stale contributor-to-owner refresh test for guest account; all 50 tests/typecheck/build pass. No proof yet that stale cache was the specific runtime symptom; installing preview for verification. No existing membership/invite mutations or backend redeployment.
Pi code review
0 new actionable findings
No new actionable findings. Previously reported issues, if any, are tracked below.
Earlier findings: 1 rechecked
packages/plugin/src/ui/settings-tab.ts:607, first reported in review #435) — The Update backend control remains gated by currentUser?.kind === "owner" in packages/plugin/src/ui/settings-tab.ts:639. In main.ts, a non-401 startup identity failure retains the saved session but leaves currentUser unset; the settings refresh only logs a subsequent failure. An owner starting against an unhealthy backend therefore cannot reach the in-plugin repair deployment.Merged the candidate reviews of the authentication, provisioning, settings, invitation, and sync changes against the supplied base. This was a read-only review; no tests, builds, or live Cloudflare or Obsidian checks were run.
Change walkthrough
packages/plugin/src/main.ts,packages/plugin/src/login.ts,packages/plugin/src/provisioning/host.ts,packages/plugin/src/provisioning/cloudflare.ts(+8 more)README.md,docs/DEPLOY.md,docs/TESTING.md,docs/UPDATING.mdReview effort: 4/5.
Static observations (not validation results)
Reviewed
b8ba52e3655c1dc4cba1441afdfbb73c3ff42bf6withproxy/glm-5.3-flash + proxy/deepseek-v4.1-flash + proxy/gpt-6.1-sol → proxy/gpt-6.1-terra. Automated advisory review; no project commands or tests were executed.Core multi-device correction #37: allow any authenticated user to initiate/complete shared identity linking to that same user; removed owner-only UI/plugin/API gates. Discord linking does not change role or grant invitation privileges. Added real signed-assertion/SQLite tests recovering one guest on Laptop and Phone with same user ID, owned and shared vault roles, no new user/invite, replay rejection, identity collision rejection, plus authenticated route target injection rejection and guest UI linking. All 53 tests/typecheck/build pass.
Explicitly deployed correction for live guest testing: vault Worker b367e9c1-310d-4c71-bc8a-5e64d30633ca and login Worker f991a202-123a-4195-967f-1e5ec4a05ffa. Vault owner-only invite API tightening is now live too. Existing secret bindings preserved by Wrangler (no secret upload/rotation), both health/config smoke checks pass, actual Anastasia guest session can now obtain a linking ticket (200). Installed
d7c0a7bpreview to all four silverquill vaults, settings and notes unchanged. Browser Discord completion still needs user validation; bot review of newest head pending; PR not merged.Fixed runtime failures from guest multi-device test: Workers rejects redirect:error, so backend link/handoff requests now use redirect:manual with existing !ok status rejection (including all 3xx), never forwarding credentials. Added test simulating Workers rejection plus malicious backend redirect/no-directory-registration test. Sync scan was descending ignored .opencode and aborting on a dangling symlink (confirmed on silverquill). Now prunes ignored trees before listing and isolates unreadable folders/files so unrelated notes continue. Added engine scan-isolation test; all 55 tests, typecheck, build pass. Deployed login service 436dad5c-2bd8-4709-86ac-93051cf52e3e preserving secrets; installed
1e8dbb6to all four vaults with settings/notes unchanged. No vault backend deployment required for these fixes. Browser completion still needs retest; latest head review pending.Pi code review
2 new actionable findings
packages/plugin/src/provisioning/cloudflare.ts:382packages/plugin/src/ui/settings-tab.ts:99Earlier findings: 1 rechecked
packages/plugin/src/ui/settings-tab.ts:607, first reported in review #435) — The current Advanced section still renders Update backend only when currentUser.kind is owner. On startup, main.ts retains a saved session but leaves currentUser null after a non-401 /me failure, and the settings refresh only logs a subsequent failure. An owner restarting against an unhealthy backend therefore cannot access the documented in-plugin repair deployment.Aggregated the candidate reviews of the pinned head against the supplied base, focusing on sign-in, provisioning, settings, and the prior finding. Verification was limited to read-only repository inspection; no tests, builds, or live browser or Cloudflare checks were run.
Change walkthrough
packages/plugin/src/main.ts,packages/plugin/src/login.ts,packages/plugin/src/provisioning/host.ts,packages/plugin/src/provisioning/cloudflare.ts(+10 more)README.md,docs/DEPLOY.md,docs/TESTING.md,docs/UPDATING.mdReview effort: 4/5.
Static observations (not validation results)
Reviewed
1e8dbb61198dbebebcab1082b50721d6acd815cawithproxy/glm-5.3-flash + proxy/deepseek-v4.1-flash + proxy/gpt-6.1-sol → proxy/gpt-6.1-terra. Automated advisory review; no project commands or tests were executed.@ -332,6 +379,11 @@ export async function provisionBackend(options: ProvisionOptions): Promise<Provi// Validate the domain/account pair before creating or changing any resources.const zone = await ensureZone(token, accountId, domain);const existed = await workerExists(token, accountId, workerName);if (existed && !options.updateExisting) {[P2] Interrupted first-time setup cannot be resumed in the plugin
A failure after Worker upload but before DNS or route creation leaves a partially provisioned backend that ordinary sign-in will not repair. The former explicit setup action could rerun provisioning; the new update action is unavailable before a session exists.
Trigger: First-time provisioning uploads the Worker, then the D1 metadata write, wildcard DNS operation, or Worker route operation fails, for example because of a transient Cloudflare error.
Impact: The host cannot finish setup through the plugin and must repair or clean up Cloudflare resources outside it before proceeding.
Evidence: In packages/plugin/src/provisioning/cloudflare.ts, Worker upload precedes the backend_url write and DNS/route creation. On retry, host.ts selects reconnect if discovery finds that URL, but main.ts attempts accountLogin against the still-unrouted backend; if discovery finds no URL, the new Worker-exists guard rejects provisioning. settings-tab.ts returns before Advanced when there is no session, so the suggested explicit update is not available.
@ -187,2 +98,2 @@try {await this.plugin.refreshMe(false);this.signInLinkSetting(returning);} else {[P2] Signed-in guests cannot paste a backend handoff link
The settings rewrite removes the link-paste control from the signed-in guest view, including the recovery path for a backend-local browser handoff that does not open Obsidian automatically.
Trigger: A signed-in guest completes a backend-local sign-in or handoff in the browser, but the Obsidian deep link does not open and the guest needs to paste the resulting link.
Impact: The guest cannot complete that recovery from the current session and must sign out or find another way to open the deep link.
Evidence: settings-tab.ts calls signInLinkSetting in the signed-out branch and in Advanced only when currentUser.kind is owner. The prior Account section rendered the link field unconditionally; main.ts openSignInLink handles the handoff state and unlock.
6fa234b: diagnosed actual production same-zone Worker routing failure. Temporary diagnostic Worker on behold.quest received HTTP 525 from api.behold.quest while outside-zone/external requests returned 200. api.behold.quest had no Custom Domain, only wildcard route. Attached API Custom Domain to existing behold-quest Worker: identical same-zone diagnostic now returns 200. Diagnostic Worker/domain/route removed. No user identities/sessions changed; no backend code redeployed or secrets rotated. Provisioning now creates API Custom Domain alongside wildcard route and rejects foreign-Worker domain ownership before mutations; manual deployment docs updated. Link failures include HTTP status + bounded structured backend message, excluding HTML gateway bodies. 56 tests/typecheck/build pass. Login diagnostic deployed as 2dd8954f-a4b2-4386-a3f1-a99d7ad02259; previews installed to four vaults preserving settings/notes. Real Discord browser completion remains for user validation.Pi code review
1 new actionable finding
packages/plugin/src/provisioning/host.ts:26Earlier findings: 3 rechecked
packages/plugin/src/ui/settings-tab.ts:99, first reported in review #463) — settings-tab.ts renders signInLinkSetting in the signed-out branch and in Advanced only for an owner. A signed-in guest therefore cannot paste a backend-local browser handoff when the deep link fails; the remaining Join with token control does not supply the handoff's unlock value.packages/plugin/src/provisioning/cloudflare.ts:382, first reported in review #463) — cloudflare.ts still uploads the Worker before writing backend_url and creating the Custom Domain, DNS and route. If a later step fails, discovery either attempts to connect to the incomplete backend or a creation retry hits the existing-Worker guard; settings-tab.ts returns before Advanced when there is no session, leaving first-time setup without an in-plugin repair path.packages/plugin/src/ui/settings-tab.ts:607, first reported in review #435) — settings-tab.ts still renders Update backend only when currentUser.kind is owner. main.ts initializes currentUser to null and retains the saved session after a non-401 startup /me failure, while the settings refresh logs a subsequent failure; an owner restarting against an unhealthy backend cannot access the documented update control.Merged the candidate reviews of authentication, provisioning, settings, sync, and backend changes against the pinned head and base. Verification was limited to static repository reads; no tests, builds, live Cloudflare requests, or device flows were run.
Change walkthrough
packages/plugin/src/main.ts,packages/plugin/src/login.ts,packages/plugin/src/provisioning/host.ts,packages/plugin/src/provisioning/cloudflare.ts(+10 more)README.md,docs/DEPLOY.md,docs/TESTING.md,docs/UPDATING.mdReview effort: 4/5.
Static observations (not validation results)
Reviewed
6fa234b00864f03e5d541b25e7779a8b8842e196withproxy/glm-5.3-flash + proxy/deepseek-v4.1-flash + proxy/gpt-6.1-sol → proxy/gpt-6.1-terra. Automated advisory review; no project commands or tests were executed.@ -0,0 +23,4 @@if (backendToUpdate) {const accounts = await listCloudflareAccounts(accessToken);for (const account of accounts) {try {[P2] A deleted Worker cannot be restored using the saved recovery key
The new update resolver requires the connected Worker to exist before provisioning can run. Consequently, the provisioning code's recovery path for a missing Worker and surviving database cannot be reached through the plugin, even on the original device with its saved backend key.
Trigger: An existing host's Worker is deleted while its D1 database and the original device's backend URL and recovery key survive.
Impact: The host cannot restore the backend through Obsidian and must recover it out of band; the backend and its vaults remain unavailable until then.
Evidence: In host.ts, the update branch calls cloudflareUpdateDomain for each account and rejects the update if none succeeds. That function reads the missing Worker's settings, so it cannot validate the target. Ordinary sign-in instead discovers the surviving database's backend URL and attempts to connect to the unavailable Worker. Although cloudflare.ts permits recreation when the saved session secret is supplied, neither path reaches that provisioning branch; the previous explicit setup action could rerun provisioning.
Follow-up production 403 diagnosed from silverquill with Python native HTTP client: /v1/config and /v1/start returned Cloudflare error 1010 browser_signature_banned before Worker execution, while local curl returned 200. Created configuration ruleset 52addc2e201c46ba868924f866bc056d, rule 031787c15fa14e63886cbd1063a7db0d: set_config bic:false ONLY for login.behold.quest /v1/ prefix. No all-WAF skip, no browser-page exception, no other hostnames. Identical silverquill native requests now GET config 200, POST start 200, POST claim 200 pending. No flow completion or user identity/session changes. Documented operator requirement; no plugin or Worker redeployment required. Full Discord browser flow remains unverified.
Pi code review
0 new actionable findings
No new actionable findings. Previously reported issues, if any, are tracked below.
Earlier findings: 4 rechecked
packages/plugin/src/provisioning/host.ts:26, first reported in review #465) — host.ts still requires cloudflareUpdateDomain() to read the existing Worker's settings before returning an update destination, so a deleted Worker cannot be matched. Ordinary sign-in instead discovers the surviving D1 backend and attempts to connect to the unavailable Worker. The provisioning branch that accepts the saved recovery key therefore remains unreachable through these paths, leaving restoration dependent on out-of-band intervention.packages/plugin/src/ui/settings-tab.ts:99, first reported in review #463) — settings-tab.ts renders signInLinkSetting() in the signed-out account branch and in the owner-only Advanced block, but not for a signed-in guest. The backend-local handoff fallback requires the complete state and unlock link; the remaining token-only Join control cannot provide the unlock, so a guest whose deep link fails must sign out or find another way to deliver it.packages/plugin/src/provisioning/cloudflare.ts:382, first reported in review #463) — cloudflare.ts uploads the Worker before writing backend metadata and creating the API Custom Domain, DNS, and route. After a failure in those later steps, sign-in either tries to connect to the incomplete backend or reaches the existing-Worker creation guard. settings-tab.ts returns before Advanced when there is no session, so a first-time host cannot invoke the explicit update path to finish setup in the plugin.packages/plugin/src/ui/settings-tab.ts:607, first reported in review #435) — settings-tab.ts still places Update backend inside the currentUser?.kind === "owner" guard. main.ts initializes currentUser to null and retains a saved session after a non-401 startup identity failure; a subsequent settings refresh failure is logged without exposing the action. An owner restarting against an unhealthy Worker therefore cannot access the documented in-plugin repair deployment.Aggregated the candidate reviews of the authentication, provisioning, settings, sharing, and sync changes against the supplied base; all four previously reported issues remain actionable, with no additional findings supported by the candidates. This was a read-only review; tests, builds, and live Cloudflare, browser, and device flows were not run.
Change walkthrough
packages/plugin/src/main.ts,packages/plugin/src/login.ts,packages/plugin/src/provisioning/host.ts,packages/plugin/src/provisioning/cloudflare.ts(+11 more)README.md,docs/DEPLOY.md,docs/TESTING.md,docs/UPDATING.mdReview effort: 4/5.
Static observations (not validation results)
Reviewed
377826ff4554bdbd47639885657570c16f4d50bfwithproxy/glm-5.3-flash + proxy/deepseek-v4.1-flash + proxy/gpt-6.1-sol → proxy/gpt-6.1-terra. Automated advisory review; no project commands or tests were executed.85e127efixes persistent Link Discord after successful browser linking/lost return: authenticated backend /v1/me now exposes boolean sharedSignInLinked derived from current user discovery identity, without provider subjects or contacting login hub. UI ignores obsolete device flag, refreshes on settings, shows Shared sign-in linked with relinking collapsed under Account-link recovery; unknown old-backend status never claims unlinked. Shared link is deliberately provider-neutral because stored identity is hashed; no unsupported claim of exact Discord identity. Tests cover backend guest/owner isolation, local vs shared providers, unauthenticated denial, lost browser return and stale/unknown device flags. 59 tests/typecheck/build pass. Vault backend deployed 23b22391-2078-43f4-8290-5e3147be4e30 preserving bindings/secrets and API Custom Domain. Installed four vault previews preserving settings/notes; actual Anastasia session /me returns 200 sharedSignInLinked:true, same guest ID. Unfinished/unapplied browser-recovery migration removed; return targeting remains separate outstanding work.Verification clarification: initial Python native-UA /me check received 403 from API hostname BIC (existing rule exception is login hostname only) and interrupted installation after vault three. Completed fourth installation separately, verified all four SHA256 f25ccc0e0f7f3074cbb6231a033a3412276235a33d63daabe2b625b148d3ebcb. Authenticated Anastasia /me with Mozilla UA returned 200, sharedSignInLinked:true and original guest ID. No API security configuration changed in this scoped UI fix. Running Obsidian render still requires reload/user validation.
fix/auth: one-button Cloudflare sign-in and Discord linkingto feat/auth: one-button sign-in, multi-device identity, and sync recovery (0.4.0)Verified old review findings against current code and fixed in
f7f8847(not treating stale clean counts as approval). Reviews 435/463/465: collapsed explicit repair now available without session/currentUser for saved target, while known guests retain no hosting controls; Cloudflare authorization still verifies actual target. Missing Worker resolver matches surviving D1 backend metadata, requires original key and namespace for populated vaults (fail closed if absent). Recovery material checkpointed before first upload; metadata before upload; retry routing failure preserves existing secrets/no implicit repair on reconnect. Signed-in guests can paste full handoff under Advanced. Added meaningful regression tests for all paths. Prepared 0.4.0 versions; 64 tests, typecheck/build/diff checks pass. Please recheck latest headf7f8847before merge/release.Pi code review
0 new actionable findings
No new actionable findings. Previously reported issues, if any, are tracked below.
Earlier findings: 4 rechecked
packages/plugin/src/provisioning/host.ts:26, first reported in review #465) — cloudflareUpdateDomain now handles a Worker-settings 404 by matching the saved backend against surviving D1 backend_url metadata. The explicit update path can then pass the scoped saved session secret to provisionBackend, which checks for the original Durable Object namespace and refuses to replace missing vault storage.packages/plugin/src/ui/settings-tab.ts:99, first reported in review #463) — Signed-in users reach advancedSection, and its call to signInLinkSetting is outside the guest/reader hosting-controls guard. Guests can therefore paste a complete backend handoff link for openSignInLink to process.packages/plugin/src/provisioning/cloudflare.ts:382, first reported in review #463) — Provisioning now checkpoints the backend URL and recovery key before resource creation, and signed-out settings render Advanced when a backend URL or domain is saved. For the reported post-upload DNS or route failure, the explicit update path can match the Worker by PUBLIC_DOMAIN and retry provisioning with existing secrets preserved.packages/plugin/src/ui/settings-tab.ts:607, first reported in review #435) — advancedSection now shows Update backend unless currentUser is explicitly a guest or reader, rather than requiring a loaded owner. It is consequently available when a saved-session owner's /v1/me request fails and currentUser remains null; the update resolver separately verifies the target against Cloudflare resources.Aggregated the candidate reviews of the pinned head against the supplied base, including rechecks of all four previous findings. This was a source-only review; tests, live Cloudflare API behavior, and browser/device flows could not be run.
Change walkthrough
packages/plugin/src/main.ts,packages/plugin/src/provisioning/host.ts,packages/plugin/src/provisioning/cloudflare.ts,packages/plugin/src/ui/settings-tab.ts(+9 more)docs/DEPLOY.md,docs/TESTING.md,docs/UPDATING.md,README.mdReview effort: 4/5.
Static observations (not validation results)
Reviewed
f7f88474dad84b7b37f914d77dd8e57e95067d82withproxy/glm-5.3-flash + proxy/deepseek-v4.1-flash + proxy/gpt-6.1-sol → proxy/gpt-6.1-terra. Automated advisory review; no project commands or tests were executed.Release gate passed: current-head review 467 on
f7f88474dareports zero new actionable findings and resolves all four earlier findings. Local 64 tests/typecheck/build/diff/ZIP checks passed; no Forgejo Actions workflows/status checks configured. Proceeding with authorized squash merge and Forgejo 0.4.0 release. Notes explicitly retain multi-window browser return/Reopen limitations and unverified device coverage.Merged as
277168eed7after current-head review 467 (zero new findings, all four previous findings resolved). Re-ran 64 tests, typecheck, build/package/ZIP verification on merged master. Published Forgejo release 0.4.0 with ZIP, SHA256 file, main.js, manifest.json, styles.css; downloaded release ZIP and confirmed exact hash. Release: https://git.bhm.gg/BlackHatMagic/Behold.quest/releases/tag/0.4.0 . Known browser-return/device validation limitations are explicit in notes. Test vaults remain on earlier installed preview; no implicit plugin activation/auth/vault selection or backend deployment performed during release.