Skip to content

refactor: comments on drops live in ViteHub Comments, with the same numbers, replies, and API - #64

Open
onmax wants to merge 11 commits into
feat/console-commentsfrom
feat/drop-comments-primitive
Open

onmax wants to merge 11 commits into
feat/console-commentsfrom
feat/drop-comments-primitive

Conversation

@onmax

@onmax onmax commented Oct 26, 2026 •

Copy link
Copy Markdown
Member

Drop kept its own comment tables, numbering, and reply code for comments on drops, apart from the ViteHub Comments primitive that #63 brings in. Two comment systems meant twice the code to keep right.

With this change, Drop's comments on drops are ViteHub Comments threads, in scopes of their own. Users see no change: same numbers, carry-over between versions, replies, images, review tokens, MCP tools, and API JSON. The old comments and comment_replies tables go, with their rows. Maxi allowed dropping existing comments to keep the move simple; drops stay.

Stacked on #63. Uses the new primitive API from vite-hub/vitehub#2864.

How it works

  • Scopes:

    • a doc's version chain is drop:<link>, because every version shares the link;
    • a site with the screenshots sent from it is site:<site id>.

    The thread number is the #n that people and agents use. These scopes never show in the Comments toolbar, the Console, ViteHub MCP, or @ suggestions.

  • Metadata keeps what the row columns kept: the drop and version it was written on, kind, selector, ox/oy/ow/oh, quote, label, page, and the element point. server/utils/comments.ts turns threads back into DropComment, so the client and the review script get the same JSON.

  • Routes, MCP tools (read_drop, reply, update_drop), publish resolves, and site review now use the primitive. Drop still checks who may, as before.

  • Replies on a resolved comment are allowed, as before: comments.reply(…, { allowResolved: true }) adds the reply in one write, and the comment stays resolved.

  • Deleting a drop removes its threads in deleteDrop, which every deletion path goes through:

    • a site or a whole chain uses removeScope;
    • a screenshot deleted on its own loses only its own threads.
  • Images: comment_attachments stays, and now points at ViteHub comment ids. Migration 0003 rebuilds it without foreign keys to the old tables before it drops them. It keeps old rows, so images of old comments stay out of their docs' embedded files.

  • vite-hub moves to the stack-top build (35beeca): getByComment(), @ suggestions limited to one scope, allowResolved, and the review fixes.

Evidence

On a production Node build of this branch (DROP_HOST=vps, SQLite), against the database from #63's run:

doc comments

Validation

  • pnpm install (with postinstall) and pnpm typecheck pass.
  • Full vp test: 44 files and 304 tests pass, 3 skipped. The affected files also pass on their own (test/review/review.test.mjs, test/mcp/tools.test.mjs, test/cost/round-trips.test.mjs, test/auth/console.test.mjs: 63 tests). New tests cover:
    • deleting a doc, and deleting a screenshot versus its site;
    • guest comments, and replies on resolved comments;
    • deleting a reply;
    • the stored scope and resolver;
    • @ suggestions leaving out drop commenters.
  • drizzle-kit check passes. In-memory SQLite with foreign keys on applies 0000 to 0003 over a seeded old comment, reply, and image, and foreign_key_check is empty.
  • vp check and pnpm knip are clean.

Changes you can notice

  • At most 500 threads per list. A drop's comment list shows the 500 most recently active threads. Older ones are still reachable by number. The site review list was capped at its 500 oldest before. The primitive has no paging yet.
  • One more database round trip to load a drop's comments: 3 instead of 2, because the primitive reads threads and then their comments. round-trips.test.mjs records the new numbers.
  • Author pictures are copied when the comment is written, instead of looked up live.
  • Guests get a guest:<uuid> author id. They are still never "mine".
  • Screenshots are saved before their thread, and deleted if the thread fails, because a thread cannot join Drop's own write batch.

Not done yet

  • I did not run Cloudflare (D1) here. D1 enforces foreign keys, and 0003 rebuilds comment_attachments before it drops the old tables for that reason, but it has not run on D1.
  • The browser check used the API to post comments, then the viewer to show them. I did not drag a comment area in the viewer.

🤖 Generated with Claude Code

Parent update (857abee): merged #63 at de7a836. The migration journal now places the Drop comment move after auth events and ViteHub Comments. Migration tests preserve the parent upgrade cases while verifying attachment preservation with foreign keys enabled, removal of the legacy comment tables, and creation of the durable cleanup queue. All 78 focused migration, cleanup, review, MCP, round-trip, and Console tests passed, along with Nuxt typecheck, changed-file lint/formatting, and drizzle-kit check. Both review repairs from 0133a42 remain intact. Merge still depends on #63 and its ViteHub Comments release prerequisite.

…umbers, replies, images, and API

Drop's own comment tables go: each comment on a doc, app, image, folder,
or site is now a ViteHub Comments thread, its first comment the comment
and the rest its replies. A doc's versions share one list by their link
(`drop:<link>`), and a site shares one with its screenshots
(`site:<id>`), so numbers still count across versions and screenshots.
The thread's metadata keeps the version and anchor, and the API answers
the same DropComment JSON. Deleting a drop deletes its threads.

Replies still reach resolved comments: the thread reopens for the reply
and resolves again. ViteHub moves to e493b58, whose Comments finds a
reply's thread (`getByComment`) and suggests only the authors of
Drop's pages for `@`, so drop commenters stay out of the overlay.

Migration 0003 drops `comments` and `comment_replies`, so existing
comments and replies go. comment_attachments loses its foreign keys and
keeps its rows, so the images of old comments stay out of embedded files.
@onmax
onmax added this pull request to stack #65 October 26, 2026 07:51
@onmax onmax changed the title refactor: comments on drops live in ViteHub Comments, with the same numbers, replies, images, and API refactor: comments on drops live in ViteHub Comments, with the same numbers, replies, and API Oct 26, 2026
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Oct 26, 2026 •

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Updated (UTC)
✅ Deployment successful!
View logs
vitehub-drop 56216d3 Oct 26 2026, 08:38 AM

@vite-hub

vite-hub Bot commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor
Session Status Started Duration
Pending Waiting 2026-10-30T11:30:37.160Z Paused
View session Waiting 2026-10-30T09:00:18.895Z 3m 33s
View session Waiting 2026-10-30T08:48:38.820Z 6m 21s
View session Waiting 2026-10-30T08:24:26.106Z 4m 50s

Next step

Waiting for open parent PR #63 to merge; this child has nothing left to repair.

Final answers

Session

Waiting for open parent PR #63 to merge; this child has nothing left to repair.

Session

Waiting for open parent PR #63 to merge; this child has nothing left to repair.

View session

After generating Nuxt types, focused vp test passed 80 tests; changed-file vp lint, vp fmt --check, and git diff --check passed. Both historical Pullfrog cleanup findings remain fixed, and current checks are green. No repair commit needed. Parent #63 remains open; pnpm view confirms vite-hub 0.0.4 lacks Comments exports. Waiting for the prerequisite release and parent merge.

Session

Pushed f7246ec to resolve the parent lockfile conflict while preserving the Comments preview. Frozen dependency refresh, type preparation, targeted vp lint, vp fmt --check, and vp test passed (82 tests). Both historical Pullfrog findings remain fixed. Parent #63 is still draft, and pnpm view confirms the published release lacks Comments exports; waiting for that release and the parent merge.

Session

Pushed f7246ec to resolve the parent lockfile conflict while preserving the Comments preview. Frozen dependency refresh, type preparation, targeted vp lint, vp fmt --check, and vp test passed (82 tests). Both historical Pullfrog findings remain fixed. Parent #63 is still draft, and pnpm view confirms the published release lacks Comments exports; waiting for that release and the parent merge.

View session

Pushed f7246ec to resolve the parent lockfile conflict while preserving the Comments preview. Frozen dependency refresh, type preparation, targeted vp lint, vp fmt --check, and vp test passed (82 tests). Both historical Pullfrog findings remain fixed. Parent #63 is still draft, and pnpm view confirms the published release lacks Comments exports; waiting for that release and the parent merge.

Session

Waiting for open parent PR #63 to merge; this child has nothing left to repair.

View session

Both historical Pullfrog cleanup findings remain fixed. All 80 focused tests and scoped lint passed; current-head checks are green. No source changes were needed. Waiting for parent #63 and the required ViteHub release, which remains unavailable.

@vite-hub

vite-hub Bot commented Oct 26, 2026

Copy link
Copy Markdown
Contributor

P2: screenshot deletion can retain threads outside the 500-thread window. At 511b572, I reproduced this by creating a screenshot thread followed by 500 newer site threads, then deleting the screenshot: the drop disappeared but its thread remained. removeCommentsOf in server/utils/comments.ts filters threadsOf(list), which returns only the 500 most recently active threads. This is nonblocking under the repair policy; no push for a P2-only finding. A follow-up needs an uncapped deletion selector or primitive pagination so cleanup can reach older screenshot threads without deleting other site threads. The existing 63 focused tests pass.

@onmax
onmax marked this pull request as ready for review October 27, 2026 18:59
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ⚠️ Failed 2026-10-27T18:59:20.858666Z
We couldn’t complete this review. Comment @codex review to try again.
9cafc81 Draft marked ready
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, add credits to your account and enable them for code reviews in your settings.

@pullfrog pullfrog 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.

Important

Permanent cleanup can leave durable comment data behind, including for screenshots once a site exceeds the primitive list limit.

Reviewed changes across the full 29-file diff: the migration from Drop-owned comment tables to scoped ViteHub Comments threads, API and MCP compatibility, review-site integration, attachment ownership, database migration, deletion lifecycle, and focused test coverage.

  • Thread-backed Drop API — Maps primitive threads, opening comments, replies, authors, metadata, resolution state, and numbering back to the existing DropComment contracts.
  • Version and site scopes — Shares numbering across document versions and across a site with its screenshots while filtering each viewer's list.
  • Images and review flows — Keeps attachment drops in Drop storage while comment/reply identity moves to primitive IDs, including screenshot creation and rollback.
  • Schema and lifecycle — Rebuilds comment_attachments, removes the legacy tables, and adds comment cleanup to permanent Drop deletion.
  • Validation — The focused review, MCP, and D1 migration suites pass locally: 55 tests across three files.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using gpt-5.6-sol | 𝕏

Comment thread server/utils/drops/lifecycle.ts Resolved
Comment thread server/utils/comments.ts Resolved

@pullfrog pullfrog 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.

✅ No new issues found.

Reviewed changes since the prior Pullfrog review, focused on the permanent-deletion cleanup fix and its failure paths.

  • Added durable cleanup work — Queued each Drop's comment scope in the same database batch that permanently deletes the Drop, preserving retry state across request and process failures.
  • Removed the screenshot list cap from cleanup — Selected screenshot thread ids directly from the primitive schema in bounded batches, so deletion covers threads outside the 500-item viewer list.
  • Added retry coverage — Exercised primitive failure, queue insertion rollback, acknowledgement failure, process restart, and cleanup beyond 500 site threads.
  • Extended the schema and migration — Added the foreign-key-free comment_cleanup table and included it in the database configuration and migration snapshots.

Pullfrog  | View workflow run | Using gpt-5.6-sol | 𝕏

@pullfrog pullfrog 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.

✅ No new issues found.

Reviewed changes since the prior Pullfrog review, focused on the parent merge and migration upgrade paths.

  • Resequenced the migration journal — Placed auth events before ViteHub Comments and Drop's destructive legacy-comment migration, with strictly increasing timestamps.
  • Preserved preview upgrade paths — Covered databases whose auth and Comments migrations were recorded at current or historical timestamps, while retaining primitive comments and legacy attachment rows.
  • Expanded migration invariants — Verified auth indexes, cleanup-table creation, legacy-table removal, foreign-key integrity, and migration idempotence across fresh and existing databases.

Pullfrog  | View workflow run | Using gpt-5.6-sol | 𝕏

@vite-hub

vite-hub Bot commented Oct 28, 2026

Copy link
Copy Markdown
Contributor

New pull request evidence is queued.

@vite-hub

vite-hub Bot commented Oct 28, 2026

Copy link
Copy Markdown
Contributor

New pull request evidence is queued.

@vite-hub

vite-hub Bot commented Oct 28, 2026

Copy link
Copy Markdown
Contributor

New pull request evidence is queued.

@vite-hub

vite-hub Bot commented Oct 28, 2026

Copy link
Copy Markdown
Contributor

New pull request evidence is queued.

@vite-hub

vite-hub Bot commented Oct 28, 2026

Copy link
Copy Markdown
Contributor

New pull request evidence is queued.

@vite-hub

vite-hub Bot commented Oct 28, 2026

Copy link
Copy Markdown
Contributor

New pull request evidence is queued.

@vite-hub

vite-hub Bot commented Oct 28, 2026

Copy link
Copy Markdown
Contributor

New pull request evidence is queued.

@vite-hub

vite-hub Bot commented Oct 28, 2026

Copy link
Copy Markdown
Contributor

New pull request evidence is queued.

@vite-hub

vite-hub Bot commented Oct 28, 2026

Copy link
Copy Markdown
Contributor

New pull request evidence is queued.

@vite-hub

vite-hub Bot commented Oct 28, 2026

Copy link
Copy Markdown
Contributor

New pull request evidence is queued.

@vite-hub

vite-hub Bot commented Oct 28, 2026

Copy link
Copy Markdown
Contributor

New pull request evidence is queued.

@vite-hub

vite-hub Bot commented Oct 28, 2026

Copy link
Copy Markdown
Contributor
Session Status Started Duration
View session Starting Not started —

Queued

Waiting for a worker slot.

@vite-hub

vite-hub Bot commented Oct 28, 2026

Copy link
Copy Markdown
Contributor
Session Status Started Duration
Pending Waiting 2026-10-28T16:56:16.910Z Paused

Next step

CI reconciliation completed; the same-head repair budget is exhausted.

Final answers

Session

CI reconciliation completed; the same-head repair budget is exhausted.

@vite-hub

vite-hub Bot commented Oct 28, 2026

Copy link
Copy Markdown
Contributor
Session Status Started Duration
Pending Waiting 2026-10-28T17:10:24.636Z Paused

Next step

CI reconciliation completed; the same-head repair budget is exhausted.

Final answers

Session

CI reconciliation completed; the same-head repair budget is exhausted.

@vite-hub

vite-hub Bot commented Oct 28, 2026

Copy link
Copy Markdown
Contributor

New pull request evidence is queued.

@vite-hub

vite-hub Bot commented Oct 28, 2026

Copy link
Copy Markdown
Contributor

New pull request evidence is queued.

@vite-hub

vite-hub Bot commented Oct 28, 2026

Copy link
Copy Markdown
Contributor
Session Status Started Duration
Pending Waiting 2026-10-28T17:21:11.620Z Paused

Next step

CI reconciliation completed; the same-head repair budget is exhausted.

Final answers

Session

CI reconciliation completed; the same-head repair budget is exhausted.

@vite-hub

vite-hub Bot commented Oct 28, 2026

Copy link
Copy Markdown
Contributor

New pull request evidence is queued.

@vite-hub

vite-hub Bot commented Oct 28, 2026

Copy link
Copy Markdown
Contributor
Session Status Started Duration
Pending Waiting 2026-10-28T17:30:46.881Z Paused

Next step

CI reconciliation completed; the same-head repair budget is exhausted.

Final answers

Session

CI reconciliation completed; the same-head repair budget is exhausted.

@vite-hub

vite-hub Bot commented Oct 28, 2026

Copy link
Copy Markdown
Contributor

New pull request evidence is queued.

@vite-hub

vite-hub Bot commented Oct 28, 2026

Copy link
Copy Markdown
Contributor
Session Status Started Duration
Pending Waiting 2026-10-28T17:40:37.052Z Paused

Next step

CI reconciliation completed; the same-head repair budget is exhausted.

Final answers

Session

CI reconciliation completed; the same-head repair budget is exhausted.

@vite-hub

vite-hub Bot commented Oct 28, 2026

Copy link
Copy Markdown
Contributor
Session Status Started Duration
Pending Waiting 2026-10-28T17:45:40.079Z Paused

Next step

CI reconciliation completed; the same-head repair budget is exhausted.

Final answers

Session

CI reconciliation completed; the same-head repair budget is exhausted.

@vite-hub

vite-hub Bot commented Oct 28, 2026

Copy link
Copy Markdown
Contributor

New pull request evidence is queued.

@vite-hub

vite-hub Bot commented Oct 28, 2026

Copy link
Copy Markdown
Contributor

New pull request evidence is queued.

@vite-hub

vite-hub Bot commented Oct 28, 2026

Copy link
Copy Markdown
Contributor

New pull request evidence is queued.

@vite-hub

vite-hub Bot commented Oct 28, 2026

Copy link
Copy Markdown
Contributor

New pull request evidence is queued.

@vite-hub

vite-hub Bot commented Oct 28, 2026

Copy link
Copy Markdown
Contributor
Session Status Started Duration
Pending Waiting 2026-10-28T18:11:42.490Z Paused

Next step

CI reconciliation completed; the same-head repair budget is exhausted.

Final answers

Session

CI reconciliation completed; the same-head repair budget is exhausted.

@vite-hub

vite-hub Bot commented Oct 28, 2026

Copy link
Copy Markdown
Contributor

New pull request evidence is queued.

@vite-hub

vite-hub Bot commented Oct 28, 2026

Copy link
Copy Markdown
Contributor
Session Status Started Duration
Pending Waiting 2026-10-28T18:26:00.871Z Paused

Next step

CI reconciliation completed; the same-head repair budget is exhausted.

Final answers

Session

CI reconciliation completed; the same-head repair budget is exhausted.

@vite-hub

vite-hub Bot commented Oct 28, 2026

Copy link
Copy Markdown
Contributor

New pull request evidence is queued.

@vite-hub

vite-hub Bot commented Oct 28, 2026

Copy link
Copy Markdown
Contributor

New pull request evidence is queued.

@vite-hub

vite-hub Bot commented Oct 28, 2026

Copy link
Copy Markdown
Contributor
Session Status Started Duration
Pending Waiting 2026-10-28T18:42:05.774Z Paused

Next step

CI reconciliation completed; the same-head repair budget is exhausted.

Final answers

Session

CI reconciliation completed; the same-head repair budget is exhausted.

@vite-hub

vite-hub Bot commented Oct 28, 2026

Copy link
Copy Markdown
Contributor

New pull request evidence is queued.

@vite-hub

vite-hub Bot commented Oct 28, 2026

Copy link
Copy Markdown
Contributor

New pull request evidence is queued.

@vite-hub

vite-hub Bot commented Oct 28, 2026

Copy link
Copy Markdown
Contributor
Session Status Started Duration
Pending Waiting 2026-10-28T18:51:46.922Z Paused

Next step

CI reconciliation completed; the same-head repair budget is exhausted.

Final answers

Session

CI reconciliation completed; the same-head repair budget is exhausted.

This branch has not been deployed

No deployments
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