feat/auth: one-button sign-in, multi-device identity, and sync recovery (0.4.0) #34

Merged
BlackHatMagic merged 11 commits from fix/one-button-sign-in into master 2026-11-04 02:28:02 +00:00

Closes #33. Refs #35, #36, #37.

Changes (0.4.0)

  • One visible Cloudflare sign-in action; optional returning Discord/invite controls collapsed. New hosts confirm their authorized account/domain; resources remain in that host account. Reconnect never deploys; vault creation/selection remains explicit.
  • Any authenticated user, including guests, can link Discord and recover the exact same user and vault memberships on another device. No email merges, guest promotion, or per-device invitations.
  • Authenticated backend reports shared identity status; UI does not depend on local completion flags. Relinking is recovery-only.
  • Vault invitations require actual vault ownership; backend onboarding requires backend ownership, independently.
  • Recover Yjs bindings when Obsidian resets CodeMirror state; preserve offline/unbound edits. Prune ignored filesystem trees and isolate unreadable scan entries.
  • Explicit repair remains available before bootstrap or when identity refresh fails; Cloudflare still verifies the destination. Checkpoint original key before upload. Missing Worker recovery uses matching D1 metadata and original key/namespace, failing closed if populated vault storage is missing. Signed-in guests retain collapsed handoff-paste recovery.
  • API Custom Domain supports same-zone Worker calls. Login backend requests use Workers-supported manual redirects and reject redirects. Native login API has narrowly scoped Browser Integrity Check configuration documented.

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.

Closes #33. Refs #35, #36, #37. ## Changes (0.4.0) - One visible Cloudflare sign-in action; optional returning Discord/invite controls collapsed. New hosts confirm their authorized account/domain; resources remain in that host account. Reconnect never deploys; vault creation/selection remains explicit. - Any authenticated user, including guests, can link Discord and recover the exact same user and vault memberships on another device. No email merges, guest promotion, or per-device invitations. - Authenticated backend reports shared identity status; UI does not depend on local completion flags. Relinking is recovery-only. - Vault invitations require actual vault ownership; backend onboarding requires backend ownership, independently. - Recover Yjs bindings when Obsidian resets CodeMirror state; preserve offline/unbound edits. Prune ignored filesystem trees and isolate unreadable scan entries. - Explicit repair remains available before bootstrap or when identity refresh fails; Cloudflare still verifies the destination. Checkpoint original key before upload. Missing Worker recovery uses matching D1 metadata and original key/namespace, failing closed if populated vault storage is missing. Signed-in guests retain collapsed handoff-paste recovery. - API Custom Domain supports same-zone Worker calls. Login backend requests use Workers-supported manual redirects and reject redirects. Native login API has narrowly scoped Browser Integrity Check configuration documented. ## 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.
Unify project-owned OAuth authorization, account discovery, and first-time hosting. Keep host resources in the authorizing Cloudflare account; expose Discord linking without per-owner app registration. Preserve existing sessions and keys, keep reconnect separate from explicit updates, and require vault selection before syncing.

Refs #33
Code-Reviewer left a comment

Pi code review

1 new actionable finding

  • [P2] Discovery prerequisites block the backend update needed to establish them — packages/plugin/src/provisioning/host.ts:23

Merged 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
Area Files Changes
Other code (11) packages/plugin/src/main.ts, packages/plugin/src/login.ts, packages/plugin/src/provisioning/host.ts, packages/plugin/src/provisioning/cloudflare.ts (+7 more) Routes Cloudflare sign-in and explicit updates through shared login and hosting-destination resolution; removes automatic vault creation. Adds cancellation checks around shared-login claim polling. Adds destination resolution for reconnect, connected-backend updates, and first-time hosting. Adds account-scoped domain listing and an explicit-update guard; removes local OAuth exchange helpers.
Tests (4) 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.ts Adds coverage for reconnect, hosting selection, and inaccessible update targets. Adds coverage preventing implicit updates of undiscovered Workers. Adds rendered settings coverage for primary sign-in and owner Discord linking. Adds hosting-scope, browser-unlock, replay, and no-host-deployment coverage.
Documentation (4) README.md, docs/DEPLOY.md, docs/TESTING.md, docs/UPDATING.md Documents project-owned sign-in, Discord linking, and explicit vault selection. Documents operator-owned Cloudflare and Discord registrations and transient authorization handling. Updates manual validation scenarios for hosting consent, reconnect, linking, cancellation, and recovery. Directs explicit backend upgrades through Advanced → Update backend.

Review effort: 4/5.

Static observations (not validation results)
Observation Detail
⚠️ Diff size 19 files, +803/-686. Large diff; review coverage may be incomplete.
Binary changes No binary changes reported by this diff.
Credential patterns No matches after excluding known examples/placeholders. Added-line heuristics only; not a security audit.

Reviewed 980c2e4e9405fdf0b55c72107e5fe1910acacca6 with proxy/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.

<!-- forgejo-pi-review:2965c2f7cfe2bf7f5d2bf0779413d3265299c5405ff31fc1a1b3b7d14bd91bd7 --> ## Pi code review **1 new actionable finding** - **[P2] Discovery prerequisites block the backend update needed to establish them** — `packages/plugin/src/provisioning/host.ts:23` Merged 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. <details> <summary>Change walkthrough</summary> | Area | Files | Changes | | --- | --- | --- | | Other code (11) | `packages/plugin/src/main.ts`, `packages/plugin/src/login.ts`, `packages/plugin/src/provisioning/host.ts`, `packages/plugin/src/provisioning/cloudflare.ts` (+7 more) | Routes Cloudflare sign-in and explicit updates through shared login and hosting-destination resolution; removes automatic vault creation. Adds cancellation checks around shared-login claim polling. Adds destination resolution for reconnect, connected-backend updates, and first-time hosting. Adds account-scoped domain listing and an explicit-update guard; removes local OAuth exchange helpers. | | Tests (4) | `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.ts` | Adds coverage for reconnect, hosting selection, and inaccessible update targets. Adds coverage preventing implicit updates of undiscovered Workers. Adds rendered settings coverage for primary sign-in and owner Discord linking. Adds hosting-scope, browser-unlock, replay, and no-host-deployment coverage. | | Documentation (4) | `README.md`, `docs/DEPLOY.md`, `docs/TESTING.md`, `docs/UPDATING.md` | Documents project-owned sign-in, Discord linking, and explicit vault selection. Documents operator-owned Cloudflare and Discord registrations and transient authorization handling. Updates manual validation scenarios for hosting consent, reconnect, linking, cancellation, and recovery. Directs explicit backend upgrades through Advanced → Update backend. | Review effort: **4/5**. </details> <details> <summary>Static observations (not validation results)</summary> | Observation | Detail | | --- | --- | | ⚠️ Diff size | 19 files, +803/-686. Large diff; review coverage may be incomplete. | | Binary changes | No binary changes reported by this diff. | | Credential patterns | No matches after excluding known examples/placeholders. Added-line heuristics only; not a security audit. | </details> --- Reviewed `980c2e4e9405fdf0b55c72107e5fe1910acacca6` with `proxy/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) {
Collaborator

[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.

**[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.
Author
Owner

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.

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.
Verify the connected Worker through Cloudflare settings before applying updates, instead of requiring the discovery metadata that the update installs. Configure the activated project login service and route it ahead of the vault wildcard.
Code-Reviewer left a comment

Pi code review

1 new actionable finding

  • [P2] Backend outages hide the control needed to deploy a repair — packages/plugin/src/ui/settings-tab.ts:607
Earlier findings: 1 rechecked
  • Resolved: Discovery prerequisites block the backend update needed to establish them (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
Area Files Changes
Other code (12) packages/plugin/src/main.ts, packages/plugin/src/login.ts, packages/plugin/src/provisioning/host.ts, packages/plugin/src/provisioning/cloudflare.ts (+8 more) Routes Cloudflare authorization through shared browser sign-in, separates reconnect from explicit updates, and removes automatic vault creation. Adds cancellation checks to shared-login polling. Resolves reconnect, explicit update, and new-host destinations. Adds hosting-domain and update-target checks and blocks implicit updates of existing Workers.
Tests (4) 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.ts Adds coverage for update-target verification and existing-Worker protection. Adds hosting-destination selection tests. Adds rendered settings tests for sign-in and Discord linking. Adds Cloudflare authorization, browser-unlock, and replay tests.
Documentation (4) README.md, docs/DEPLOY.md, docs/TESTING.md, docs/UPDATING.md Documents the new sign-in, hosting, and Discord-linking flows. Documents project-owned OAuth registrations and transient authorization handling. Updates manual validation steps for the new flows. Moves documented backend updates to Advanced settings.

Review effort: 4/5.

Static observations (not validation results)
Observation Detail
⚠️ Diff size 20 files, +872/-690. Large diff; review coverage may be incomplete.
Binary changes No binary changes reported by this diff.
Credential patterns No matches after excluding known examples/placeholders. Added-line heuristics only; not a security audit.

Reviewed 8f7e5b2ff19a19ce91b3250a2d2d8566185c0a3f with proxy/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.

<!-- forgejo-pi-review:79484bb9d1e1998e7b1617e64c759ca5c4026ac3ae324c0ba2b6e6214ed92d1e --> ## Pi code review **1 new actionable finding** - **[P2] Backend outages hide the control needed to deploy a repair** — `packages/plugin/src/ui/settings-tab.ts:607` <details> <summary>Earlier findings: 1 rechecked</summary> - **Resolved:** Discovery prerequisites block the backend update needed to establish them (`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. </details> 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. <details> <summary>Change walkthrough</summary> | Area | Files | Changes | | --- | --- | --- | | Other code (12) | `packages/plugin/src/main.ts`, `packages/plugin/src/login.ts`, `packages/plugin/src/provisioning/host.ts`, `packages/plugin/src/provisioning/cloudflare.ts` (+8 more) | Routes Cloudflare authorization through shared browser sign-in, separates reconnect from explicit updates, and removes automatic vault creation. Adds cancellation checks to shared-login polling. Resolves reconnect, explicit update, and new-host destinations. Adds hosting-domain and update-target checks and blocks implicit updates of existing Workers. | | Tests (4) | `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.ts` | Adds coverage for update-target verification and existing-Worker protection. Adds hosting-destination selection tests. Adds rendered settings tests for sign-in and Discord linking. Adds Cloudflare authorization, browser-unlock, and replay tests. | | Documentation (4) | `README.md`, `docs/DEPLOY.md`, `docs/TESTING.md`, `docs/UPDATING.md` | Documents the new sign-in, hosting, and Discord-linking flows. Documents project-owned OAuth registrations and transient authorization handling. Updates manual validation steps for the new flows. Moves documented backend updates to Advanced settings. | Review effort: **4/5**. </details> <details> <summary>Static observations (not validation results)</summary> | Observation | Detail | | --- | --- | | ⚠️ Diff size | 20 files, +872/-690. Large diff; review coverage may be incomplete. | | Binary changes | No binary changes reported by this diff. | | Credential patterns | No matches after excluding known examples/placeholders. Added-line heuristics only; not a security audit. | </details> --- Reviewed `8f7e5b2ff19a19ce91b3250a2d2d8566185c0a3f` with `proxy/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;
Collaborator

[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.

**[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.
Author
Owner

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.

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.
Check installed CodeMirror compartment and live ySync plugin rather than connected DOM alone. Reconcile unbound editor edits before reattaching or receiving remote updates, retry outside editor transactions, and stop recovery with the engine. Cover state-reset recovery, two-way propagation, offline queueing, and initial editor divergence with real CodeMirror regression tests.

Refs #35
Code-Reviewer left a comment

Pi code review

0 new actionable findings

No new actionable findings. Previously reported issues, if any, are tracked below.

Earlier findings: 1 rechecked
  • Still open (not reposted): Backend outages hide the control needed to deploy a repair (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
Area Files Changes
Other code (12) packages/plugin/src/main.ts, packages/plugin/src/login.ts, packages/plugin/src/provisioning/host.ts, packages/plugin/src/provisioning/cloudflare.ts (+8 more) Routes Cloudflare authentication through shared browser sign-in and separates reconnect, creation, and explicit updates. Adds cancellation checks to shared sign-in polling. Resolves hosting destinations and verifies connected backend update targets. Adds account and domain discovery and prevents implicit updates of existing Workers.
Tests (5) 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) Adds rendered settings tests for primary sign-in and Discord linking. Adds hosting destination and fail-closed behavior tests. Adds tests for update target verification and undiscovered Workers. Adds editor rebinding and offline edit recovery tests.
Documentation (4) README.md, docs/DEPLOY.md, docs/TESTING.md, docs/UPDATING.md Documents shared sign-in, Discord linking, and explicit vault selection. Documents project-owned OAuth registrations and transient authorization handling. Updates manual validation steps for the shared sign-in flow. Directs backend updates to Advanced settings.

Review effort: 4/5.

Static observations (not validation results)
Observation Detail
⚠️ Diff size 22 files, +1098/-694. Large diff; review coverage may be incomplete.
Binary changes No binary changes reported by this diff.
Credential patterns No matches after excluding known examples/placeholders. Added-line heuristics only; not a security audit.

Reviewed 56fdcb7159f775a964c1cc213cf42a318e4f5b5b with proxy/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.

<!-- forgejo-pi-review:138001ab1c8acb0de35815a91a89fd8064c3e432dd0cb6e91f9688c24d47ecf7 --> ## Pi code review **0 new actionable findings** No new actionable findings. Previously reported issues, if any, are tracked below. <details> <summary>Earlier findings: 1 rechecked</summary> - **Still open (not reposted):** Backend outages hide the control needed to deploy a repair (`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. </details> 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. <details> <summary>Change walkthrough</summary> | Area | Files | Changes | | --- | --- | --- | | Other code (12) | `packages/plugin/src/main.ts`, `packages/plugin/src/login.ts`, `packages/plugin/src/provisioning/host.ts`, `packages/plugin/src/provisioning/cloudflare.ts` (+8 more) | Routes Cloudflare authentication through shared browser sign-in and separates reconnect, creation, and explicit updates. Adds cancellation checks to shared sign-in polling. Resolves hosting destinations and verifies connected backend update targets. Adds account and domain discovery and prevents implicit updates of existing Workers. | | Tests (5) | `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) | Adds rendered settings tests for primary sign-in and Discord linking. Adds hosting destination and fail-closed behavior tests. Adds tests for update target verification and undiscovered Workers. Adds editor rebinding and offline edit recovery tests. | | Documentation (4) | `README.md`, `docs/DEPLOY.md`, `docs/TESTING.md`, `docs/UPDATING.md` | Documents shared sign-in, Discord linking, and explicit vault selection. Documents project-owned OAuth registrations and transient authorization handling. Updates manual validation steps for the shared sign-in flow. Directs backend updates to Advanced settings. | Review effort: **4/5**. </details> <details> <summary>Static observations (not validation results)</summary> | Observation | Detail | | --- | --- | | ⚠️ Diff size | 22 files, +1098/-694. Large diff; review coverage may be incomplete. | | Binary changes | No binary changes reported by this diff. | | Credential patterns | No matches after excluding known examples/placeholders. Added-line heuristics only; not a security audit. | </details> --- Reviewed `56fdcb7159f775a964c1cc213cf42a318e4f5b5b` with `proxy/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.
Author
Owner

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.

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.
Hide onboarding for backend non-owners and vault invitations for selected-vault non-owners. Reject manager and membership-role bypasses server-side by checking actual vault ownership; retain guest-owned vault sharing. Add rendered UI role matrix and real SQLite-backed invite endpoint tests.

Refs #36
Code-Reviewer left a comment

Pi code review

0 new actionable findings

No new actionable findings. Previously reported issues, if any, are tracked below.

Earlier findings: 1 rechecked
  • Still open (not reposted): Backend outages hide the control needed to deploy a repair (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
Area Files Changes
Other code (14) PLAN.html, packages/plugin/src/login.ts, packages/plugin/src/main.ts, packages/plugin/src/provisioning/cloudflare.ts (+10 more) Updates the authentication, hosting, platform, and invitation design. Adds cancellation checks to shared sign-in polling. Routes Cloudflare sign-in through shared login and separates reconnect from deployment. Adds hosting-domain discovery and safeguards against implicit Worker updates.
Documentation (4) README.md, docs/DEPLOY.md, docs/TESTING.md, docs/UPDATING.md Documents Cloudflare sign-in, Discord linking, and explicit vault selection. Documents project-owned OAuth registrations and transient authorization handling. Updates manual authentication and hosting validation scenarios. Moves the documented backend update action under Advanced.
Tests (6) packages/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) Tests update target verification and protection against implicit updates. Tests destination selection and fail-closed behavior. Tests editor binding recovery and synchronization. Tests rendered sign-in controls and invitation visibility.

Review effort: 4/5.

Static observations (not validation results)
Observation Detail
⚠️ Diff size 24 files, +1285/-749. Large diff; review coverage may be incomplete.
Binary changes No binary changes reported by this diff.
Credential patterns No matches after excluding known examples/placeholders. Added-line heuristics only; not a security audit.

Reviewed ae94aafffdd61c457833c955db294abf72b24b81 with proxy/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.

<!-- forgejo-pi-review:b2a670be4163c29d916bcac31f1e12ca26772e052b8ed407c8c797a96c085213 --> ## Pi code review **0 new actionable findings** No new actionable findings. Previously reported issues, if any, are tracked below. <details> <summary>Earlier findings: 1 rechecked</summary> - **Still open (not reposted):** Backend outages hide the control needed to deploy a repair (`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. </details> 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. <details> <summary>Change walkthrough</summary> | Area | Files | Changes | | --- | --- | --- | | Other code (14) | `PLAN.html`, `packages/plugin/src/login.ts`, `packages/plugin/src/main.ts`, `packages/plugin/src/provisioning/cloudflare.ts` (+10 more) | Updates the authentication, hosting, platform, and invitation design. Adds cancellation checks to shared sign-in polling. Routes Cloudflare sign-in through shared login and separates reconnect from deployment. Adds hosting-domain discovery and safeguards against implicit Worker updates. | | Documentation (4) | `README.md`, `docs/DEPLOY.md`, `docs/TESTING.md`, `docs/UPDATING.md` | Documents Cloudflare sign-in, Discord linking, and explicit vault selection. Documents project-owned OAuth registrations and transient authorization handling. Updates manual authentication and hosting validation scenarios. Moves the documented backend update action under Advanced. | | Tests (6) | `packages/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) | Tests update target verification and protection against implicit updates. Tests destination selection and fail-closed behavior. Tests editor binding recovery and synchronization. Tests rendered sign-in controls and invitation visibility. | Review effort: **4/5**. </details> <details> <summary>Static observations (not validation results)</summary> | Observation | Detail | | --- | --- | | ⚠️ Diff size | 24 files, +1285/-749. Large diff; review coverage may be incomplete. | | Binary changes | No binary changes reported by this diff. | | Credential patterns | No matches after excluding known examples/placeholders. Added-line heuristics only; not a security audit. | </details> --- Reviewed `ae94aafffdd61c457833c955db294abf72b24b81` with `proxy/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.
Author
Owner

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.

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.
Refresh server permissions when opening settings so a newly created guest-owned vault does not lose its sharing controls to stale cached roles. Label independent actions Share this vault and Invite to this backend. Test stale-role refresh for guest vault owners.

Refs #36
Code-Reviewer left a comment

Pi code review

0 new actionable findings

No new actionable findings. Previously reported issues, if any, are tracked below.

Earlier findings: 1 rechecked
  • Still open (not reposted): Backend outages hide the control needed to deploy a repair (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
Area Files Changes
Other code (12) packages/plugin/src/main.ts, packages/plugin/src/login.ts, packages/plugin/src/provisioning/host.ts, packages/plugin/src/provisioning/cloudflare.ts (+8 more) Routes Cloudflare sign-in and explicit backend updates through shared browser authorization. Adds cancellation checks to shared-login polling. Resolves reconnects, connected-backend updates, and new hosting destinations. Adds domain selection and update-target verification while preventing implicit updates.
Documentation (4) README.md, docs/DEPLOY.md, docs/TESTING.md, docs/UPDATING.md Documents Cloudflare sign-in, Discord linking, and explicit vault selection. Documents operator registration and shared-login activation requirements. Updates the manual validation checklist for the new flows. Points backend upgrades to the Advanced update action.

Review effort: 4/5.

Static observations (not validation results)
Observation Detail
⚠️ Diff size 24 files, +1319/-749. Large diff; review coverage may be incomplete.
Binary changes No binary changes reported by this diff.
Credential patterns No matches after excluding known examples/placeholders. Added-line heuristics only; not a security audit.

Reviewed b8ba52e3655c1dc4cba1441afdfbb73c3ff42bf6 with proxy/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.

<!-- forgejo-pi-review:95a7b86c2819d897b4489302bb0efdc4fc41a5b4cf15965adec10917d982ff80 --> ## Pi code review **0 new actionable findings** No new actionable findings. Previously reported issues, if any, are tracked below. <details> <summary>Earlier findings: 1 rechecked</summary> - **Still open (not reposted):** Backend outages hide the control needed to deploy a repair (`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. </details> 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. <details> <summary>Change walkthrough</summary> | Area | Files | Changes | | --- | --- | --- | | Other code (12) | `packages/plugin/src/main.ts`, `packages/plugin/src/login.ts`, `packages/plugin/src/provisioning/host.ts`, `packages/plugin/src/provisioning/cloudflare.ts` (+8 more) | Routes Cloudflare sign-in and explicit backend updates through shared browser authorization. Adds cancellation checks to shared-login polling. Resolves reconnects, connected-backend updates, and new hosting destinations. Adds domain selection and update-target verification while preventing implicit updates. | | Documentation (4) | `README.md`, `docs/DEPLOY.md`, `docs/TESTING.md`, `docs/UPDATING.md` | Documents Cloudflare sign-in, Discord linking, and explicit vault selection. Documents operator registration and shared-login activation requirements. Updates the manual validation checklist for the new flows. Points backend upgrades to the Advanced update action. | Review effort: **4/5**. </details> <details> <summary>Static observations (not validation results)</summary> | Observation | Detail | | --- | --- | | ⚠️ Diff size | 24 files, +1319/-749. Large diff; review coverage may be incomplete. | | Binary changes | No binary changes reported by this diff. | | Credential patterns | No matches after excluding known examples/placeholders. Added-line heuristics only; not a security audit. | </details> --- Reviewed `b8ba52e3655c1dc4cba1441afdfbb73c3ff42bf6` with `proxy/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.
Remove owner-only identity-link gates without changing account kind or invitation privileges. Recover the exact guest user, owned vaults, and shared memberships on multiple devices; reject collisions and credential replay. Expose Discord linking for guests and update owner-only error text.
Author
Owner

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 d7c0a7b preview 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.

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 d7c0a7b preview 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.
Handle backend link/handoff redirects manually and reject non-success statuses without forwarding credentials. Skip ignored directories before adapter listing, isolate unreadable children and files so one broken symlink cannot abort the vault manifest. Add Workers redirect compatibility and scan isolation regression tests.
Author
Owner

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 1e8dbb6 to all four vaults with settings/notes unchanged. No vault backend deployment required for these fixes. Browser completion still needs retest; latest head review pending.

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 1e8dbb6 to all four vaults with settings/notes unchanged. No vault backend deployment required for these fixes. Browser completion still needs retest; latest head review pending.
Code-Reviewer left a comment

Pi code review

2 new actionable findings

  • [P2] Interrupted first-time setup cannot be resumed in the plugin — packages/plugin/src/provisioning/cloudflare.ts:382
  • [P2] Signed-in guests cannot paste a backend handoff link — packages/plugin/src/ui/settings-tab.ts:99
Earlier findings: 1 rechecked
  • Still open (not reposted): Backend outages hide the control needed to deploy a repair (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
Area Files Changes
Other code (14) packages/plugin/src/main.ts, packages/plugin/src/login.ts, packages/plugin/src/provisioning/host.ts, packages/plugin/src/provisioning/cloudflare.ts (+10 more) Routes Cloudflare authorization through shared login and separates reconnect from explicit deployment. Adds cancellation to shared sign-in polling. Selects reconnect, first-time hosting, or an explicit update destination. Adds domain discovery and prevents implicit updates of existing Workers.
Documentation (4) README.md, docs/DEPLOY.md, docs/TESTING.md, docs/UPDATING.md Updates setup and cross-device sign-in instructions. Documents project-owned OAuth registrations and login-service activation. Updates manual validation scenarios for sign-in and hosting. Moves documented backend updates to Advanced settings.

Review effort: 4/5.

Static observations (not validation results)
Observation Detail
⚠️ Diff size 26 files, +1521/-768. Large diff; review coverage may be incomplete.
Binary changes No binary changes reported by this diff.
Credential patterns No matches after excluding known examples/placeholders. Added-line heuristics only; not a security audit.

Reviewed 1e8dbb61198dbebebcab1082b50721d6acd815ca with proxy/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.

<!-- forgejo-pi-review:83a6719968ca5b7b09e90257665fca21828fdf64f0b1ff4933765093a4e3e5c7 --> ## Pi code review **2 new actionable findings** - **[P2] Interrupted first-time setup cannot be resumed in the plugin** — `packages/plugin/src/provisioning/cloudflare.ts:382` - **[P2] Signed-in guests cannot paste a backend handoff link** — `packages/plugin/src/ui/settings-tab.ts:99` <details> <summary>Earlier findings: 1 rechecked</summary> - **Still open (not reposted):** Backend outages hide the control needed to deploy a repair (`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. </details> 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. <details> <summary>Change walkthrough</summary> | Area | Files | Changes | | --- | --- | --- | | Other code (14) | `packages/plugin/src/main.ts`, `packages/plugin/src/login.ts`, `packages/plugin/src/provisioning/host.ts`, `packages/plugin/src/provisioning/cloudflare.ts` (+10 more) | Routes Cloudflare authorization through shared login and separates reconnect from explicit deployment. Adds cancellation to shared sign-in polling. Selects reconnect, first-time hosting, or an explicit update destination. Adds domain discovery and prevents implicit updates of existing Workers. | | Documentation (4) | `README.md`, `docs/DEPLOY.md`, `docs/TESTING.md`, `docs/UPDATING.md` | Updates setup and cross-device sign-in instructions. Documents project-owned OAuth registrations and login-service activation. Updates manual validation scenarios for sign-in and hosting. Moves documented backend updates to Advanced settings. | Review effort: **4/5**. </details> <details> <summary>Static observations (not validation results)</summary> | Observation | Detail | | --- | --- | | ⚠️ Diff size | 26 files, +1521/-768. Large diff; review coverage may be incomplete. | | Binary changes | No binary changes reported by this diff. | | Credential patterns | No matches after excluding known examples/placeholders. Added-line heuristics only; not a security audit. | </details> --- Reviewed `1e8dbb61198dbebebcab1082b50721d6acd815ca` with `proxy/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) {
Collaborator

[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.

**[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 {
Collaborator

[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.

**[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.
Confirmed Worker-to-Worker backend requests failed with HTTP 525 while external requests returned 200. Attach API Custom Domain alongside publishing wildcard route, reject cross-Worker hostname conflicts before mutation, and surface structured backend link errors with HTTP status. Document manual deployment requirement. Refs #37.
Author
Owner

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.

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.
Code-Reviewer left a comment

Pi code review

1 new actionable finding

  • [P2] A deleted Worker cannot be restored using the saved recovery key — packages/plugin/src/provisioning/host.ts:26
Earlier findings: 3 rechecked
  • Still open (not reposted): Signed-in guests cannot paste a backend handoff link (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.
  • Still open (not reposted): Interrupted first-time setup cannot be resumed in the plugin (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.
  • Still open (not reposted): Backend outages hide the control needed to deploy a repair (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
Area Files Changes
Other code (14) packages/plugin/src/main.ts, packages/plugin/src/login.ts, packages/plugin/src/provisioning/host.ts, packages/plugin/src/provisioning/cloudflare.ts (+10 more) Routes Cloudflare authorization through shared browser sign-in and separates reconnect from explicit deployment. Adds cancellation checks to shared sign-in polling. Resolves existing backends, update targets, and first-time hosting destinations. Adds domain discovery, update-target validation, provisioning guards, and API Custom Domain setup.
Documentation (4) README.md, docs/DEPLOY.md, docs/TESTING.md, docs/UPDATING.md Updates setup and sign-in guidance for Cloudflare and Discord. Documents shared-login registration and API Custom Domain setup. Updates the manual authentication and provisioning checklist. Updates backend deployment instructions.

Review effort: 4/5.

Static observations (not validation results)
Observation Detail
⚠️ Diff size 26 files, +1600/-775. Large diff; review coverage may be incomplete.
Binary changes No binary changes reported by this diff.
Credential patterns No matches after excluding known examples/placeholders. Added-line heuristics only; not a security audit.

Reviewed 6fa234b00864f03e5d541b25e7779a8b8842e196 with proxy/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.

<!-- forgejo-pi-review:4cfc46e21ace28ac737e3f548bccdc770b3ef9cc9b5ba6849578c6455825e9c6 --> ## Pi code review **1 new actionable finding** - **[P2] A deleted Worker cannot be restored using the saved recovery key** — `packages/plugin/src/provisioning/host.ts:26` <details> <summary>Earlier findings: 3 rechecked</summary> - **Still open (not reposted):** Signed-in guests cannot paste a backend handoff link (`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. - **Still open (not reposted):** Interrupted first-time setup cannot be resumed in the plugin (`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. - **Still open (not reposted):** Backend outages hide the control needed to deploy a repair (`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. </details> 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. <details> <summary>Change walkthrough</summary> | Area | Files | Changes | | --- | --- | --- | | Other code (14) | `packages/plugin/src/main.ts`, `packages/plugin/src/login.ts`, `packages/plugin/src/provisioning/host.ts`, `packages/plugin/src/provisioning/cloudflare.ts` (+10 more) | Routes Cloudflare authorization through shared browser sign-in and separates reconnect from explicit deployment. Adds cancellation checks to shared sign-in polling. Resolves existing backends, update targets, and first-time hosting destinations. Adds domain discovery, update-target validation, provisioning guards, and API Custom Domain setup. | | Documentation (4) | `README.md`, `docs/DEPLOY.md`, `docs/TESTING.md`, `docs/UPDATING.md` | Updates setup and sign-in guidance for Cloudflare and Discord. Documents shared-login registration and API Custom Domain setup. Updates the manual authentication and provisioning checklist. Updates backend deployment instructions. | Review effort: **4/5**. </details> <details> <summary>Static observations (not validation results)</summary> | Observation | Detail | | --- | --- | | ⚠️ Diff size | 26 files, +1600/-775. Large diff; review coverage may be incomplete. | | Binary changes | No binary changes reported by this diff. | | Credential patterns | No matches after excluding known examples/placeholders. Added-line heuristics only; not a security audit. | </details> --- Reviewed `6fa234b00864f03e5d541b25e7779a8b8842e196` with `proxy/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 {
Collaborator

[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.

**[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.
Author
Owner

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.

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.
Reproduced silverquill HTTP 403 / Cloudflare 1010 on config and start; narrow configuration rule disables BIC only on login.behold.quest/v1/. Verified config, start, and pending claim return 200 from same native network/client without changing identities or sessions.
Code-Reviewer left a comment

Pi code review

0 new actionable findings

No new actionable findings. Previously reported issues, if any, are tracked below.

Earlier findings: 4 rechecked
  • Still open (not reposted): A deleted Worker cannot be restored using the saved recovery key (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.
  • Still open (not reposted): Signed-in guests cannot paste a backend handoff link (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.
  • Still open (not reposted): Interrupted first-time setup cannot be resumed in the plugin (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.
  • Still open (not reposted): Backend outages hide the control needed to deploy a repair (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
Area Files Changes
Other code (15) packages/plugin/src/main.ts, packages/plugin/src/login.ts, packages/plugin/src/provisioning/host.ts, packages/plugin/src/provisioning/cloudflare.ts (+11 more) Replaces local Cloudflare OAuth with cancellable shared browser sign-in and separates reconnect from deployment. Adds cancellation checks to shared sign-in polling. Resolves existing backends, validates update targets, and selects first-time hosting destinations. Adds existing-Worker safeguards, domain discovery, and API Custom Domain provisioning.
Documentation (4) README.md, docs/DEPLOY.md, docs/TESTING.md, docs/UPDATING.md Documents one-button authentication, Discord linking, and explicit vault selection. Documents project-owned OAuth registrations and shared-login deployment requirements. Updates manual validation steps for the authentication flows. Moves the documented backend deployment action to Advanced settings.

Review effort: 4/5.

Static observations (not validation results)
Observation Detail
⚠️ Diff size 26 files, +1602/-775. Large diff; review coverage may be incomplete.
Binary changes No binary changes reported by this diff.
Credential patterns No matches after excluding known examples/placeholders. Added-line heuristics only; not a security audit.

Reviewed 377826ff4554bdbd47639885657570c16f4d50bf with proxy/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.

<!-- forgejo-pi-review:f79f903850746281f31642e381f0eab631c00034994ab687bbd4d07095708b92 --> ## Pi code review **0 new actionable findings** No new actionable findings. Previously reported issues, if any, are tracked below. <details> <summary>Earlier findings: 4 rechecked</summary> - **Still open (not reposted):** A deleted Worker cannot be restored using the saved recovery key (`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. - **Still open (not reposted):** Signed-in guests cannot paste a backend handoff link (`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. - **Still open (not reposted):** Interrupted first-time setup cannot be resumed in the plugin (`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. - **Still open (not reposted):** Backend outages hide the control needed to deploy a repair (`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. </details> 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. <details> <summary>Change walkthrough</summary> | Area | Files | Changes | | --- | --- | --- | | Other code (15) | `packages/plugin/src/main.ts`, `packages/plugin/src/login.ts`, `packages/plugin/src/provisioning/host.ts`, `packages/plugin/src/provisioning/cloudflare.ts` (+11 more) | Replaces local Cloudflare OAuth with cancellable shared browser sign-in and separates reconnect from deployment. Adds cancellation checks to shared sign-in polling. Resolves existing backends, validates update targets, and selects first-time hosting destinations. Adds existing-Worker safeguards, domain discovery, and API Custom Domain provisioning. | | Documentation (4) | `README.md`, `docs/DEPLOY.md`, `docs/TESTING.md`, `docs/UPDATING.md` | Documents one-button authentication, Discord linking, and explicit vault selection. Documents project-owned OAuth registrations and shared-login deployment requirements. Updates manual validation steps for the authentication flows. Moves the documented backend deployment action to Advanced settings. | Review effort: **4/5**. </details> <details> <summary>Static observations (not validation results)</summary> | Observation | Detail | | --- | --- | | ⚠️ Diff size | 26 files, +1602/-775. Large diff; review coverage may be incomplete. | | Binary changes | No binary changes reported by this diff. | | Credential patterns | No matches after excluding known examples/placeholders. Added-line heuristics only; not a security audit. | </details> --- Reviewed `377826ff4554bdbd47639885657570c16f4d50bf` with `proxy/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.
Expose shared identity presence through authenticated /v1/me, scoped to current user without subjects or login-service requests. Replace local Discord flag with refreshed backend state; hide relinking in recovery and distinguish unknown old-backend state. Guard stale refresh responses across session/backend switches. Covers lost browser returns, foreign/local identities, guest permissions, and unknown status. Refs #37.
Author
Owner

85e127e fixes 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.

85e127e fixes 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.
Author
Owner

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.

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.
Address reviews 435, 463, and 465: expose collapsed repair before session/identity refresh, authorize missing Worker using matching D1 metadata, checkpoint original recovery key before upload, preserve original namespace or fail closed for populated vaults, and offer handoff paste to guests. Normal sign-in never repairs implicitly. Prepare 0.4.0 release; 64 tests and typecheck/build pass.
BlackHatMagic changed title from fix/auth: one-button Cloudflare sign-in and Discord linking to feat/auth: one-button sign-in, multi-device identity, and sync recovery (0.4.0) 2026-11-04 02:20:07 +00:00
Author
Owner

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 head f7f8847 before merge/release.

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 head f7f8847 before merge/release.
Code-Reviewer left a comment

Pi code review

0 new actionable findings

No new actionable findings. Previously reported issues, if any, are tracked below.

Earlier findings: 4 rechecked
  • Resolved: A deleted Worker cannot be restored using the saved recovery key (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.
  • Resolved: Signed-in guests cannot paste a backend handoff link (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.
  • Resolved: Interrupted first-time setup cannot be resumed in the plugin (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.
  • Resolved: Backend outages hide the control needed to deploy a repair (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
Area Files Changes
Other code (13) 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) Routes Cloudflare sign-in through the shared browser flow, checkpoints recovery keys, and separates sign-in from explicit updates. Resolves reconnects, verified update targets, and first-time hosting destinations. Adds domain discovery, missing-Worker recovery checks, provisioning checkpoints, and API Custom Domain configuration. Simplifies account controls and exposes collapsed recovery, provider, and update actions.
Documentation (4) docs/DEPLOY.md, docs/TESTING.md, docs/UPDATING.md, README.md Documents shared OAuth registrations, login-service deployment, and API Custom Domain routing. Updates manual validation guidance for sign-in, hosting, and identity linking. Documents explicit backend updates and recovery prerequisites. Updates user-facing setup and multi-device sign-in instructions.

Review effort: 4/5.

Static observations (not validation results)
Observation Detail
⚠️ Diff size 30 files, +1993/-797. Large diff; review coverage may be incomplete.
Binary changes No binary changes reported by this diff.
Credential patterns No matches after excluding known examples/placeholders. Added-line heuristics only; not a security audit.

Reviewed f7f88474dad84b7b37f914d77dd8e57e95067d82 with proxy/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.

<!-- forgejo-pi-review:02583603da3a78b38cf511bb98ac71b552ca626d9b8593c99b5cfb6148263961 --> ## Pi code review **0 new actionable findings** No new actionable findings. Previously reported issues, if any, are tracked below. <details> <summary>Earlier findings: 4 rechecked</summary> - **Resolved:** A deleted Worker cannot be restored using the saved recovery key (`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. - **Resolved:** Signed-in guests cannot paste a backend handoff link (`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. - **Resolved:** Interrupted first-time setup cannot be resumed in the plugin (`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. - **Resolved:** Backend outages hide the control needed to deploy a repair (`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. </details> 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. <details> <summary>Change walkthrough</summary> | Area | Files | Changes | | --- | --- | --- | | Other code (13) | `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) | Routes Cloudflare sign-in through the shared browser flow, checkpoints recovery keys, and separates sign-in from explicit updates. Resolves reconnects, verified update targets, and first-time hosting destinations. Adds domain discovery, missing-Worker recovery checks, provisioning checkpoints, and API Custom Domain configuration. Simplifies account controls and exposes collapsed recovery, provider, and update actions. | | Documentation (4) | `docs/DEPLOY.md`, `docs/TESTING.md`, `docs/UPDATING.md`, `README.md` | Documents shared OAuth registrations, login-service deployment, and API Custom Domain routing. Updates manual validation guidance for sign-in, hosting, and identity linking. Documents explicit backend updates and recovery prerequisites. Updates user-facing setup and multi-device sign-in instructions. | Review effort: **4/5**. </details> <details> <summary>Static observations (not validation results)</summary> | Observation | Detail | | --- | --- | | ⚠️ Diff size | 30 files, +1993/-797. Large diff; review coverage may be incomplete. | | Binary changes | No binary changes reported by this diff. | | Credential patterns | No matches after excluding known examples/placeholders. Added-line heuristics only; not a security audit. | </details> --- Reviewed `f7f88474dad84b7b37f914d77dd8e57e95067d82` with `proxy/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.
Author
Owner

Release gate passed: current-head review 467 on f7f88474da reports 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.

Release gate passed: current-head review 467 on f7f88474dad84b7b37f914d77dd8e57e95067d82 reports 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.
Author
Owner

Merged as 277168eed7 after 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.

Merged as 277168eed7219473d4db7083e09c7b89cb1592e3 after 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.
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
BlackHatMagic/Behold.quest!34
No description provided.