Skip to content

✨ feat(page-share): add document share flow#15059

Closed
Innei wants to merge 7 commits into
canaryfrom
codex/page-share-canary
Closed

✨ feat(page-share): add document share flow#15059
Innei wants to merge 7 commits into
canaryfrom
codex/page-share-canary

Conversation

@Innei

@Innei Innei commented May 21, 2026

Copy link
Copy Markdown
Member

πŸ’» Change Type

  • ✨ feat
  • πŸ› fix
  • ♻️ refactor
  • πŸ’„ style
  • πŸ‘· build
  • ⚑️ perf
  • βœ… test
  • πŸ“ docs
  • πŸ”¨ chore

πŸ”— Related Issue

No precise matching GitHub issue found for document/page sharing.

πŸ”€ Description of Change

  • Add the document_shares database table, schema export, DBML update, and document share model.
  • Add authenticated document share settings APIs and a public shared document read API.
  • Add page sharing UI: share button, access popover, public published shell, guest error view, and read-only page viewer.
  • Add pageShare locale resources and local dev proxy support for shared page routes.

πŸ§ͺ How to Test

  • Tested locally
  • Added/updated tests
  • No tests needed

Commands run:

bunx vitest run --silent='passed-only' src/spa/router/desktopRouter.sync.test.tsx
cd packages/database && bunx vitest run --silent='passed-only' src/models/__tests__/documentShare.test.ts
git diff --check origin/canary..HEAD

Additional check:

bun run type-check

bun run type-check currently fails on pre-existing repository issues, mainly missing @lobechat/business-model-bank/model-config module declarations and unrelated implicit any errors outside this PR's touched files.

πŸ“Έ Screenshots / Videos

Before After
N/A N/A

πŸ“ Additional Information

Comment and edit access are represented in the UI as coming soon; the current server mutation accepts read-only shared links.

@vercel

vercel Bot commented May 21, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
lobehub Ready Ready Preview, Comment May 27, 2026 4:54pm

Request Review

@dosubot dosubot Bot added size:XXL This PR changes 1000+ lines, ignoring generated files. feature:page labels May 21, 2026

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

We've reviewed this pull request using the Sourcery rules engine

@codecov

codecov Bot commented May 21, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 22.22222% with 21 lines in your changes missing coverage. Please review.
βœ… Project coverage is 69.67%. Comparing base (49d191d) to head (b188ada).
⚠️ Report is 7 commits behind head on canary.

Additional details and impacted files
@@            Coverage Diff             @@
##           canary   #15059      +/-   ##
==========================================
- Coverage   70.80%   69.67%   -1.13%     
==========================================
  Files        3159     3091      -68     
  Lines      315826   300125   -15701     
  Branches    28704    25888    -2816     
==========================================
- Hits       223608   209114   -14494     
+ Misses      92049    90842    -1207     
  Partials      169      169              
Flag Coverage Ξ”
app 61.66% <23.07%> (-0.01%) ⬇️
database ?
packages/agent-runtime 80.48% <ΓΈ> (ΓΈ)
packages/builtin-tool-lobe-agent 19.87% <ΓΈ> (ΓΈ)
packages/context-engine 84.13% <ΓΈ> (ΓΈ)
packages/conversation-flow 91.28% <ΓΈ> (ΓΈ)
packages/file-loaders 87.89% <ΓΈ> (ΓΈ)
packages/memory-user-memory 74.99% <ΓΈ> (ΓΈ)
packages/model-bank 99.99% <ΓΈ> (ΓΈ)
packages/model-runtime 83.90% <ΓΈ> (ΓΈ)
packages/prompts 72.67% <ΓΈ> (ΓΈ)
packages/python-interpreter 92.90% <ΓΈ> (ΓΈ)
packages/ssrf-safe-fetch 0.00% <ΓΈ> (ΓΈ)
packages/types 35.03% <0.00%> (-0.02%) ⬇️
packages/utils 88.47% <ΓΈ> (ΓΈ)
packages/web-crawler 88.08% <ΓΈ> (ΓΈ)

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Ξ”
Store 67.71% <ΓΈ> (ΓΈ)
Services 54.64% <ΓΈ> (ΓΈ)
Server 72.23% <ΓΈ> (ΓΈ)
Libs 56.94% <12.50%> (-0.04%) ⬇️
Utils 86.06% <ΓΈ> (ΓΈ)
πŸš€ New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • πŸ“¦ JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Innei added 2 commits May 27, 2026 00:35
- Wait for shared-page probe before mounting authenticated tree to avoid PageAgentProvider stuck in Suspense.
- Render guest view inline in (main)/_layout to bypass intermediate Outlet, since outlet context does not propagate across nested layouts.
- Whitelist /page/ and /share/ in tRPC 401 handler so unauthenticated guests are not redirected to /signin.
- ShareButton β†’ ActionIcon (consistent with Header siblings), drop SWR pre-fetch.
- SharePopover rewritten with createStaticStyles + cssVar tokens; replace custom dropdown with @lobehub/ui/base-ui Select + labelRender/optionRender.
- Drop coming-soon comment/edit options, dividers, double padding, hard-coded colors, and dead branches; AccessValue simplified to private/link.
- Use copyToClipboard from @lobehub/ui and SHARED_PAGE_PROBE_KEY constant for mutate.
- Clean up unused i18n keys.
@Innei Innei marked this pull request as ready for review May 27, 2026 12:26

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Sorry @Innei, you have reached your weekly rate limit of 500000 diff characters.

Please try again later or upgrade to continue using Sourcery

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

πŸ’‘ Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7edb742fb0

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with πŸ‘.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +27 to +31
editorData: doc.editorData,
fileType: doc.fileType,
id: doc.id,
metadata: safeMetadata,
pages: (doc.pages as unknown[] | null) ?? null,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Avoid exposing editor internals on public shares

For non-owner /page/:id link shares, this public share.getSharedDocument response still includes the raw editorData (and adjacent pages) even though the guest viewer only renders document.content. When a shared page contains editor-only state such as pending diff/review nodes, comments, or other structured metadata, anyone with the link can inspect the network response and read data that is not intended to be part of the published read-only markdown; return these fields only for owners or omit them from the guest payload.

Useful? React with πŸ‘Β / πŸ‘Ž.

"updated_at" timestamp with time zone DEFAULT now() NOT NULL
);
--> statement-breakpoint
ALTER TABLE "document_shares" DROP CONSTRAINT IF EXISTS "document_shares_document_id_documents_id_fk";--> statement-breakpoint

@tjx666 tjx666 May 27, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Isn't this redundant?


This comment was translated by Claude.

Original Content

θΏ™ζ˜―δΈζ˜―ε€šδ½™ηš„

@Innei Innei May 27, 2026

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I'll regenerate it.


This comment was translated by Claude.

Original Content ζˆ‘ι‡ζ–°η”ŸζˆδΈ‹

@arvinxx

arvinxx commented May 29, 2026

Copy link
Copy Markdown
Member

@Innei needs to rebase.


This comment was translated by Claude.

Original Content @Innei 要 rebase δΈ‹δΊ†

@Innei Innei closed this May 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature:page size:XXL This PR changes 1000+ lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants