Skip to content

feat(public): anonymous front page + discovery endpoint (wiki-v2 #26) - #1

Merged
PMQ9 merged 1 commit into
wiki-v2from
feat/issue-26-public-front-page
Aug 30, 2026
Merged

PMQ9 merged 1 commit into
wiki-v2from
feat/issue-26-public-front-page

Conversation

@PMQ9

@PMQ9 PMQ9 commented Aug 30, 2026

Copy link
Copy Markdown

TL;DR

Fork-side code for wiki-v2 issue #26 (public front page + login/signup for visitors). Adds an anonymous public-content discovery endpoint and the public front-page UI, with zero new upstream edits beyond six documented client seams. The parent PR (cccvu/wiki-v2) bumps the submodule pointer to this branch and runs CI.

What changed

Server (fork-owned — apps/server/src/authz/public-discovery/, mounted via AuthzModule)

  • @Public POST /api/public/pages/list — anonymous discovery of explicitly-public pages, tenant-scoped via @AuthWorkspace. One set-based SQL query lists a page iff: a shares row exists + search_indexing = true (owner opt-in) + no restricted ancestor (recursive page_access closure — the twin of PagePermissionRepo.hasRestrictedAncestor) + sharing not disabled at workspace/space + not soft-deleted. Cursor pagination, perPage clamped ≤ 50, minimal PII-free projection, fail-closed on error.
  • Tests: 22-case service/offline-SQL-security-lock spec + a leakage-vector entry in authz/leakage/vectors.spec.ts.

Client (fork-owned — apps/client/src/features/public/ + pages/public/)

  • RootGate at / reuses the shared ["currentUser"] query: signed-in → <Navigate to="/home"> (unchanged, cached); anonymous → the public landing.
  • PublicShell (skip link + banner + main), hero, value cards, live discovery list (loading/empty/error), footer, PublicAuthButtons, and a request-access page (posts to the platform's gated registration via an isolated axios instance).
  • Vitest: RootGate branching, auth-button hrefs, content-list states, isPublicRoutePath/loginHrefWithReturn helpers.

Documented upstream client seams (see wiki-v2 UPSTREAM_MODIFICATIONS.md §6–§11)

  • App.tsx (index → RootGate, add /request-access); lib/api-client.ts (401 interceptor narrowed for public routes only — a pure narrowing, authed routes unchanged); lib/app-route.ts (helpers); components/layouts/global/top-menu.tsx + features/share/components/share-shell.tsx (signed-out Log in / Sign up); vite.config.ts (/auth dev proxy).

Why

Anonymous reads continue to flow through Docmost's existing, already-PDP-restriction-gated @Public share path — the anonymously-viewable set changes by zero. The discovery endpoint is a read-only enumeration of pages that are already public and (via search_indexing) already search-engine-indexable. See wiki-v2 issue 26 for the full rationale (Level 1 vs Level 2).

How this was tested

  • pnpm exec jest src/authz — 158 pass (incl. the new discovery + leakage specs).
  • nest build — clean (override signatures intact).
  • apps/client: tsc + vitest run (77) + vite build — all clean.
  • Live (via the parent's make dev-build): anonymous / renders with no login bounce; POST /api/public/pages/list returns 200 anonymously; a seeded search_indexing share appears, a search_indexing=false share does not, and adding a page_access restriction removes it; /home still bounces anonymous users to /login.

Boundary

No undocumented upstream edits: all new code is fork-owned; the six modified upstream client files are documented seams. wiki-v2's scripts/check-upstream-boundary.sh passes at 11 seams.

🤖 Generated with Claude Code

…scovery (#26)

Signed-out visitors now land on a polished public front page instead of a login
wall, can discover explicitly-public pages, and get a Log in / Sign up entry.
Deny-by-default is preserved: anonymous reads still flow through the existing
PDP-restriction-gated share path, and the new discovery endpoint lists only
owner-opted (search_indexing), non-restricted, sharing-enabled shares.

Server (fork-owned, zero upstream edits):
- authz/public-discovery: @public POST /public/pages/list, tenant-scoped via
  @AuthWorkspace, restriction + isSharingAllowed filtered in SQL (exact
  pagination), minimal PII-free projection; mounted via AuthzModule. Offline
  SQL-security lock spec + leakage-vector coverage.

Client (features/public + pages/public are fork-owned; 6 documented seams):
- RootGate at "/" (signed-in -> /home unchanged; anon -> public landing),
  PublicShell, hero, discovery list, footer, request-access page, shared
  Log in / Sign up buttons.
- Seams: App.tsx routes; api-client 401 interceptor narrowed for public
  routes; app-route helpers; top-menu + share-shell signed-out affordance;
  vite /auth dev proxy.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
@PMQ9
PMQ9 merged commit 8f4712d into wiki-v2 Aug 30, 2026
@PMQ9
PMQ9 deleted the feat/issue-26-public-front-page branch August 30, 2026 19:53
PMQ9 added a commit that referenced this pull request Sep 8, 2026
…ge, DTO validation, keyset hardening

All four round-justifying (non-blocking Level-3) findings from the 7-lens review, plus overlapping Level-2
robustness folded in while in the same files:

- [Testing L3 / DevOps L3] listByPage: give it opt-in {limit,before} keyset paging (consistent with the
  members/ACL reads), and add service-attachment.pg.spec.ts — resolvePage + listByPage now execute on real
  Postgres (a raw-sql column/table typo no longer ships green), and the paging keyset walks a shared-ms tie
  with no skip / no duplicate.
- [Testing L3] Add dto-validation.spec.ts — the new class-validator DTOs (ContentSearchDto, ContentSortDto,
  ContentCursorDto, ContentListDto incl. nested sort) now run through validate(), so dropping a constraint
  (@Max/@IsUUID/@IsIn/@IsNotEmpty/@IsISO8601, …) reds a test.
- [Correctness L3] Add a real-Postgres walk for the generalized TIMESTAMP keyset (only title was walked) and
  for value='' (null-title) as a mid-walk cursor bound.
- [Security F1 / Correctness #1 / Testing P2] A malformed keyset/cursor timestamp now 400s instead of
  500-ing at the ::timestamptz cast: a shared isIsoInstant() guard (rejects Date.parse-lenient-but-PG-invalid
  values like '2026') used by parseSubCollectionQuery and the content keyset builder.
- [Correctness #2] A text sort (title/name) now REQUIRES its cursor `value` (400) instead of silently
  falling back to a timestamp `updatedAt` and paginating on the wrong boundary.
- [DevOps #3] Bump service-bridge.openapi.json version 1.1.1 → 1.2.0 (additive expansion).

Non-blocking Level ≤2 polish is deferred to a follow-up issue. Verified: nest build, 19 service-bridge suites
(179 tests), 3 real-Postgres pg specs (30 tests), eslint, import-boundary — all green.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant