Skip to content

Add community submission and public profile pages#70

Merged
BASIC-BIT merged 3 commits into
mainfrom
issue-23-submissions-public-pages
May 19, 2026
Merged

Add community submission and public profile pages#70
BASIC-BIT merged 3 commits into
mainfrom
issue-23-submissions-public-pages

Conversation

@BASIC-BIT
Copy link
Copy Markdown
Owner

@BASIC-BIT BASIC-BIT commented May 18, 2026

Summary

  • Add authenticated community profile submission backend path for unclaimed person/community profiles.
  • Add public profile reads plus /p/{slug} and /c/{slug} pages with safe public projection.
  • Add presentation fields, docs, and backend tests for submission sanitization/projection privacy.

Verification

  • pnpm verify

Notes

  • Submission mutation requires Convex auth and does not allow anonymous writes.
  • The /submit UI stays locked behind NEXT_PUBLIC_VRDEX_SUBMISSIONS_AUTH_READY=true until web auth is wired, so anonymous visitors do not see a form that can only fail.
  • Public profile query omits source-attribution identifiers and internal creation provenance.
  • Screenshot-based visual verification was not completed in this local pass.

Closes #23
Closes #22
Closes #19
Closes #21

@BASIC-BIT BASIC-BIT marked this pull request as ready for review May 18, 2026 11:38
Copilot AI review requested due to automatic review settings May 18, 2026 11:38
@greptile-apps
Copy link
Copy Markdown

greptile-apps Bot commented May 18, 2026

Greptile Summary

This PR wires up the first community submission and public profile path end-to-end: an auth-gated Convex mutation that sanitizes and stores unclaimed profiles, a public query with proper publicationState and type-route guards, and Next.js pages at /p/<slug> and /c/<slug> that render the projected public data.

  • Backend (convex/profiles.ts, _profilePublic.ts, _profileSubmissions.ts): submitCommunityProfile requires Convex auth, runs full sanitization with cross-type field rejection, generates the slug server-side, and stores narrow source attribution. toPublicProfile correctly strips creationSource, sourceAttribution, and sortName from API responses; the new test suite covers projection privacy and the oversized-subtype regression.
  • Frontend (p/[slug], c/[slug], submit): Route pages use fetchPublicProfileBySlug with type guards, delegate to notFound() on mismatches, and render through ProfilePublicPage. The submission form stays locked behind NEXT_PUBLIC_VRDEX_SUBMISSIONS_AUTH_READY until web auth is wired; submissionErrorMessage uses an allow-list with a safe generic fallback for unexpected errors.
  • Schema (schema.ts): Adds about, avatarImageUrl, bannerImageUrl, and sourceAttribution as optional fields; all new additions are correctly scoped and backward-compatible.

Confidence Score: 5/5

Safe to merge; the auth gate, public projection, and sanitization all behave correctly for the current submission path.

The submission mutation correctly requires a Convex identity before writing, the public projection does not leak internal attribution fields, and the cross-type field rejection is guarded by a pure presence check verified with a regression test. The two findings are non-blocking quality observations.

The /p/[slug] and /c/[slug] page files are clean but lack generateMetadata; the ProfileBackendNotice error string in profile-public-page.tsx is worth a quick look before the routes go live to real users.

Important Files Changed

Filename Overview
convex/profiles.ts Adds getPublicBySlug query and submitCommunityProfile mutation; auth-gated submission is correct, public projection correctly uses toPublicProfile, and publicationState is guarded via canReadProfile.
convex/_profileSubmissions.ts New sanitization helpers; cross-type field rejection now uses a pure presence check (fixing the previous oversized-subtype regression), deduplication and length bounds look correct.
convex/_profilePublic.ts Public projection correctly omits sourceAttribution, creationSource, sortName, and other internal fields; test coverage confirms the privacy boundary.
apps/web/src/app/_components/profile-public-page.tsx Public profile UI is well-structured; safeImageBackground correctly restricts to https: URLs; the "error" backend-notice message is development-oriented and would be confusing in production.
apps/web/src/app/submit/profile-submission-form.tsx Submission form correctly gates behind NEXT_PUBLIC_VRDEX_SUBMISSIONS_AUTH_READY; submissionErrorMessage uses a safe allow-list with a generic fallback, addressing the prior raw-error concern.
apps/web/src/app/p/[slug]/page.tsx Person profile route correctly calls fetchPublicProfileBySlug with type guard, delegates to notFound() on null; missing generateMetadata means all profile pages share a generic title.
apps/web/src/app/c/[slug]/page.tsx Community profile route mirrors /p/[slug] correctly; same missing generateMetadata observation applies.
convex/schema.ts Adds about, avatarImageUrl, bannerImageUrl, and sourceAttribution to shared profile fields; all new fields are optional and correctly scoped to community-submission provenance tracking.
tests/backend/profile-foundation.test.ts New test suites cover sort-name normalization, per-type sanitization, cross-type field rejection (including the oversized-subtype regression), and public-projection privacy; coverage looks adequate for the new functionality.
apps/web/src/convex/server.ts Adds fetchPublicProfileBySlug helper that guards on missing URL and catches fetch errors; consistent with the existing fetchBackendStatus pattern.
Prompt To Fix All With AI
Fix the following 2 code review issues. Work through them one at a time, proposing concise fixes.

---

### Issue 1 of 2
apps/web/src/app/_components/profile-public-page.tsx:136-138
The `"error"` case in `ProfileBackendNotice` renders a development-oriented message that would confuse visitors in production. When the Convex backend is transiently unreachable in a deployed environment (timeout, cold-start delay, etc.), users would see instructions to "Start the local Convex backend" — which has no meaning outside a developer's machine.

```suggestion
          {kind === "missing-url"
            ? "Run the local backend bootstrap before loading public profile pages from this worktree."
            : "This profile could not be loaded. Please try again in a moment."}
```

### Issue 2 of 2
apps/web/src/app/p/[slug]/page.tsx:13-27
**Missing page-specific metadata**

Neither `/p/[slug]` nor `/c/[slug]` exports a `generateMetadata` function, so every public profile page inherits the generic "VRDex" title and description from the root layout. Browser tabs, search-engine snippets, and social-share previews all show the same undifferentiated title regardless of which profile is being viewed. Adding a `generateMetadata` export that calls `fetchPublicProfileBySlug` and returns `{ title: profile.displayName, description: profile.headline ?? profile.bio }` (or a 404-appropriate fallback) would give each page a meaningful, crawlable identity.

Reviews (2): Last reviewed commit: "docs: clarify submission write exception" | Re-trigger Greptile

Comment thread convex/_profileSubmissions.ts
Comment thread apps/web/src/app/_components/profile-public-page.tsx
Comment thread convex/_profilePublic.ts
Copy link
Copy Markdown

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

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: 01c8169651

ℹ️ 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 thread convex/profiles.ts
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds the first end-to-end “community submit → published public profile page” slice across Convex + Next.js, including a public-safe profile projection and docs/tests for submission sanitization and privacy boundaries.

Changes:

  • Introduces an authenticated Convex mutation for community profile submissions, plus a public query for reading published profiles by slug.
  • Extends the profiles schema with presentation fields (about/avatar/banner) and adds a public projection helper that omits source attribution.
  • Adds /submit, /p/<slug>, and /c/<slug> pages to create and render public profiles, plus supporting docs and backend unit tests.

Reviewed changes

Copilot reviewed 19 out of 20 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
tests/backend/profile-foundation.test.ts Adds unit tests for submission sanitization helpers and public projection privacy behavior.
README.md Updates repo overview and links to new submission/public profile routes and docs.
docs/planning/architecture.md Updates implementation status to include submission flow and public routes.
docs/backend/profile-slugs.md Documents slug generation usage for the new submission mutation.
docs/backend/profile-schema.md Documents new presentation fields and source attribution on profiles.
docs/backend/profile-access-and-claims.md Clarifies community submission field boundaries and auth requirement.
docs/backend/community-submissions.md New doc defining submission constraints, public routes, and projection rules.
convex/schema.ts Adds about, avatar/banner URLs, and sourceAttribution to the profiles schema.
convex/README.md Documents new backend modules and updated backend contracts.
convex/profiles.ts New public query for profile reads + authenticated community submission mutation.
convex/_profileSubmissions.ts New sanitization and normalization helpers for community submission inputs.
convex/_profilePublic.ts New helper to project profiles into a safe public shape (omitting attribution).
convex/_generated/api.d.ts Updates generated Convex API typings to include new modules/functions.
apps/web/src/convex/server.ts Adds a server-side helper to fetch public profiles by slug via Convex.
apps/web/src/app/submit/profile-submission-form.tsx New client form that calls the submission mutation and links to the created profile.
apps/web/src/app/submit/page.tsx New /submit page wrapper and layout.
apps/web/src/app/page.tsx Updates homepage CTAs and copy to reflect the new submission/public profile routes.
apps/web/src/app/p/[slug]/page.tsx New public person profile route that SSR-fetches and renders the public projection.
apps/web/src/app/c/[slug]/page.tsx New public community profile route that SSR-fetches and renders the public projection.
apps/web/src/app/_components/profile-public-page.tsx New shared public profile page component including trust-state UI and presentation fields.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread convex/_profileSubmissions.ts
Comment thread apps/web/src/app/submit/profile-submission-form.tsx
Comment thread apps/web/src/app/submit/profile-submission-form.tsx Outdated
Comment thread apps/web/src/app/_components/profile-public-page.tsx
Comment thread apps/web/src/app/_components/profile-public-page.tsx Outdated
@BASIC-BIT
Copy link
Copy Markdown
Owner Author

Review follow-up prepared locally before push:

  • Fixed hasCommunitySubmissionFields to be presence-only for cross-type rejection and added a regression test.
  • Restricted profile image backgrounds to https: only.
  • Removed creationSource from the public profile projection and extended the privacy assertion.
  • Gated /submit behind an explicit auth-ready flag so the form is not exposed before Convex auth is wired.
  • Normalized list-field validation wording to <Field> items.
  • Updated success-link text to show the full profile path.
  • Added role="img" to the avatar background container.
  • Added a safe allow-list for submission error messages so unexpected backend details are not shown verbatim.

Local verification: pnpm verify passed.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 19 out of 20 changed files in this pull request and generated 3 comments.

Comment thread apps/web/src/app/p/[slug]/page.tsx
Comment thread apps/web/src/app/c/[slug]/page.tsx
Comment thread docs/backend/profile-schema.md Outdated
@BASIC-BIT
Copy link
Copy Markdown
Owner Author

@greptile

@BASIC-BIT BASIC-BIT merged commit 2deff53 into main May 19, 2026
6 checks passed
@BASIC-BIT BASIC-BIT deleted the issue-23-submissions-public-pages branch May 19, 2026 08:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants