Skip to content

Point collaboration provider at self-hosted docs-collab-server - #409

Open
jhodapp wants to merge 5 commits into
mainfrom
feat/docs-collab-server
Open

Point collaboration provider at self-hosted docs-collab-server#409
jhodapp wants to merge 5 commits into
mainfrom
feat/docs-collab-server

Conversation

@jhodapp

@jhodapp jhodapp commented Jun 3, 2026

Copy link
Copy Markdown
Member

Description

Repoints the collaborative coaching-notes provider from TipTap Cloud to the self-hosted docs-collab-server. This is a config-only change: TiptapCollabProvider now connects via baseUrl (the new NEXT_PUBLIC_DOCS_COLLAB_URL) instead of appId. Editor behavior, awareness/presence, the Y.Doc, and the JWT/token flow are unchanged.

Coordinated with the backend PR refactor-group/refactor-platform-rs#342 (the new server). tiptapAppId is left in place so reverting to TipTap Cloud stays a one-line change.

GitHub Issue: link if applicable

Changes

  • editor-cache-context.tsx: provider construction uses baseUrl: siteConfig.env.docsCollabUrl instead of appId, and the connect guard keys on docsCollabUrl.
  • site.config.ts: surface docsCollabUrl from NEXT_PUBLIC_DOCS_COLLAB_URL.

Screenshots / Videos Showing UI Changes (if applicable)

No visual change; the editor is identical. The useful verification artifact is a short screen recording of two browser windows on the same coaching session syncing text and presence/cursors in real time against a running docs-collab-server.

Testing Strategy

  • npm run lint, npx tsc --noEmit, and npm run build are clean. No type changes were needed (the base-class baseUrl override type-checks).
  • Validated manually end-to-end against a local docs-collab-server (see the backend PR's docs/test-plans/docs-collab-server-local-e2e.md): real-time two-window text sync, presence, persistence across a server restart, and CRDT offline merge.

Concerns

@jhodapp jhodapp self-assigned this Jun 3, 2026
@jhodapp jhodapp changed the title feat: point collaboration provider at self-hosted docs-collab-server Point collaboration provider at self-hosted docs-collab-server Jun 3, 2026
@jhodapp jhodapp added the enhancement Improves existing functionality or feature label Jun 3, 2026
@jhodapp jhodapp moved this to 🏗 In progress in Refactor Coaching Platform Jun 3, 2026
@jhodapp jhodapp added this to the 1.0.0-beta3 milestone Jun 3, 2026
jhodapp added 3 commits June 3, 2026 09:13
Provider init now gates on siteConfig.env.docsCollabUrl instead of
tiptapAppId, but the editor-cache-context and connection-status test
mocks still only defined tiptapAppId. With docsCollabUrl undefined,
initializeProvider early-returned, no TiptapCollabProvider was created,
and the test helpers threw on the missing provider instance.
NEXT_PUBLIC_* vars are inlined at build time; the Dockerfile never declared
NEXT_PUBLIC_DOCS_COLLAB_URL as an ARG/ENV, so the CI build arg was dropped and
docsCollabUrl resolved undefined in the browser bundle, causing the collab
provider to fail to connect. Declare it across the base/builder/runner stages
alongside the other NEXT_PUBLIC_* vars.
Sync the docs-collab FE branch with main (159 commits). Adopts the
renamed recurring-series endpoint (POST /coaching_session_series),
replacing the removed POST /coaching_sessions/recurring path. Collab
provider wiring (docsCollabUrl) and Dockerfile build args preserved.
@jhodapp
jhodapp marked this pull request as ready for review July 22, 2026 03:42
@jhodapp jhodapp moved this from 🏗 In progress to Review in Refactor Coaching Platform Jul 22, 2026
@greptile-apps

greptile-apps Bot commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR redirects the TipTap collaborative editor from TipTap Cloud to a self-hosted docs-collab-server by switching TiptapCollabProvider from appId to baseUrl (sourced from the new NEXT_PUBLIC_DOCS_COLLAB_URL env var). The change is propagated consistently through site.config.ts, the Dockerfile's three build stages, both CI/CD workflows, and the two affected test mocks.

  • editor-cache-context.tsx: the provider guard and constructor option swap from tiptapAppId/appId to docsCollabUrl/baseUrl; all other provider logic (JWT, awareness, error fallback, sync timeout) is untouched.
  • site.config.ts: exposes docsCollabUrl from NEXT_PUBLIC_DOCS_COLLAB_URL; tiptapAppId is intentionally retained for one-line rollback.
  • Dockerfile + workflows: NEXT_PUBLIC_DOCS_COLLAB_URL is wired as a build-arg and baked into the image in every relevant stage, matching the existing pattern for other NEXT_PUBLIC_* vars.

Confidence Score: 5/5

  • Safe to merge once the DOCS_COLLAB_URL GitHub Actions variable is provisioned per environment and deployment is coordinated with the backend PR.
  • The change is purely config routing: two lines in the provider constructor, one new env var surfaced through site.config, and symmetric additions to the Dockerfile and workflows. The surrounding provider lifecycle, JWT flow, awareness protocol, and offline fallback are all unchanged. Tests are updated and tsc/lint/build are confirmed clean by the author.
  • No files require special attention beyond confirming the DOCS_COLLAB_URL repo variable is set in each target GitHub Actions environment before deploying.

Important Files Changed

Filename Overview
src/components/ui/coaching-sessions/editor-cache-context.tsx Switches provider guard and constructor option from tiptapAppId/appId to docsCollabUrl/baseUrl; all surrounding logic (JWT flow, awareness, error handling) is unchanged.
src/site.config.ts Adds docsCollabUrl mapped from NEXT_PUBLIC_DOCS_COLLAB_URL; tiptapAppId is retained for easy rollback as documented.
Dockerfile Correctly redeclares NEXT_PUBLIC_DOCS_COLLAB_URL as ARG and ENV in all three build stages where other NEXT_PUBLIC_* vars live.
.github/workflows/build_and_push_nonproduction_images.yml Passes NEXT_PUBLIC_DOCS_COLLAB_URL from the DOCS_COLLAB_URL GitHub Actions repo variable into the Docker build args, consistent with the existing pattern.
.github/workflows/build_and_push_production_images.yml Same DOCS_COLLAB_URL variable wiring as non-production workflow; change is symmetric.
tests/components/ui/coaching-sessions/editor-cache-context.test.tsx Mock updated from tiptapAppId to docsCollabUrl, keeping the test aligned with the new config key.
tests/components/ui/coaching-sessions/coaching-notes/connection-status.test.tsx Mock updated from tiptapAppId to docsCollabUrl, consistent with the editor-cache-context test change.

Sequence Diagram

sequenceDiagram
    participant FE as EditorCacheProvider
    participant SC as siteConfig
    participant TC as TiptapCollabProvider
    participant DCS as docs-collab-server

    FE->>SC: read docsCollabUrl
    alt docsCollabUrl is falsy
        FE-->>FE: return early, no provider
    else docsCollabUrl is set
        FE->>TC: new TiptapCollabProvider with baseUrl
        TC->>DCS: WebSocket connect
        DCS-->>TC: synced event
        TC-->>FE: enableEditing called
        FE-->>FE: setCache isReady true
    end
    Note over TC,DCS: Previously appId pointed to TipTap Cloud, now baseUrl points to self-hosted server
Loading

Reviews (2): Last reviewed commit: "fix(ci): pass NEXT_PUBLIC_DOCS_COLLAB_UR..." | Re-trigger Greptile

NEXT_PUBLIC_* vars are inlined into the client bundle at build time, so the
docs-collab URL has to reach the image as a build-arg. 6ebe091 declared the
ARG/ENV across the Dockerfile stages but neither image-publishing workflow
passed a value, leaving an empty URL baked into the bundle. initializeProvider
early-returns on a falsy docsCollabUrl, so notes would open local-only with no
error surfaced.

Requires a repo-scoped DOCS_COLLAB_URL variable; environment-scoped will not
resolve, since neither publishing job declares an environment key.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement Improves existing functionality or feature

Projects

Status: Review

Development

Successfully merging this pull request may close these issues.

1 participant