Skip to content

feat(files): comment on markdown files and tag people - #10614

Open
waleedlatif1 wants to merge 14 commits into
stagingfrom
feat/file-comments
Open

waleedlatif1 wants to merge 14 commits into
stagingfrom
feat/file-comments

Conversation

@waleedlatif1

Copy link
Copy Markdown
Collaborator

Summary

  • Comment on any passage of a Markdown file: select text → Comment (toolbar button, Mod-Alt-M, or a floating Comment chip for read-only viewers)
  • Threads live in a right-hand panel that pushes the document over (Open / Resolved), highlight their passage, and follow edits; a passage that disappears shows as detached instead of vanishing
  • Threads anchor to the quoted text plus surrounding context, stored in new workspace_file_comment_thread / workspace_file_comment tables, never in the .md itself, so agent rewrites don't lose them
  • @-mention people in comments and in the document body (body mentions save as a normal [Name](sim:user/<id>) link)
  • Mentions and replies email the people involved, re-checked against current workspace access and the Files capability; ?comment=<id> links open the thread
  • Any member can comment; only the author edits or deletes; the thread's opener or an editor resolves; comments are refused on non-Markdown files
  • Other viewers refresh live through the file's realtime room (signal carries only the file id)
  • Hoists the [label](sim:<kind>/<id>) mention codec into lib/resources/mention-link.ts, shared by the editor and comments

Type of Change

  • New feature

Testing

  • anchors.test.ts: repeated passages, cross-paragraph quotes, edits before a passage, deleted passages, inline mention chips, select-all over lists/tables, empty and oversized selections (guards reverted to confirm the disambiguation and whitespace tests go red)
  • file-comments.integration.ts (real Postgres): read-only members comment, non-members refused, cross-file isolation for reply/edit/delete/resolve, author-only edit/delete, opener-or-writer resolve, concurrent replies never exceed the thread cap, email recipients (no author, no non-members, no members with Files withheld), edits notify only new mentions, non-Markdown files refused
  • check:migrations, drizzle generate sync, bun run generate (no drift), biome on changed files, and the targeted audits (api-validation:strict, boundaries, react-query, client-boundary, utils, comment-hygiene, file-names, source-conventions, explicit-any, permission-group-enforcement, test-patterns, realtime-prune, organization-egress); full type-check, check:audits, and test suites run in CI

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing (new tests pass the test-audit authoring gate)
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

@vercel

vercel Bot commented Dec 2, 2026 •

Copy link
Copy Markdown

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

1 Skipped Deployment
Project Deployment Actions Updated
docs Skipped Skipped Dec 2, 2026 8:48am UTC

Request Review

@blacksmith-sh

This comment has been minimized.

@greptile-apps

greptile-apps Bot commented Dec 2, 2026 •

Copy link
Copy Markdown
Contributor

Confidence Score: 5/5RetriggerView in Greptile

[Medium impact] The latest change appears safe to merge; no new blocking issue was found.

Summary

Adds passage comments, person mentions, email notifications, and live updates for Markdown files.

  • Markdown viewers can attach discussion threads to selected passages.
  • Markdown mentions can tag workspace members and notify them.

Reviews (14) · Last reviewed commit: "fix(files): re-read a stale thread list ..." · Reviewed by Greptile

@cubic-dev-ai cubic-dev-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.

All reported issues were addressed across 61 files

Reply with feedback, questions, or to request a fix.

Turn on auto-fix | Re-trigger cubic

Comment thread packages/db/schema.ts Resolved
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review this PR

@cubic-dev-ai

cubic-dev-ai Bot commented Dec 2, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review this PR

@waleedlatif1 I have started the AI code review. It will take a few minutes to complete.

@cubic-dev-ai cubic-dev-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.

All reported issues were addressed across 63 files

Requires human review: Auto-approval blocked because this review re-detected 4 unresolved issues already reported by Cubic.

Turn on auto-fix | Re-trigger cubic

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review this PR

@cubic-dev-ai

cubic-dev-ai Bot commented Dec 2, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review this PR

@waleedlatif1 I have started the AI code review. It will take a few minutes to complete.

@cubic-dev-ai cubic-dev-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.

All reported issues were addressed across 64 files

Reply with feedback, questions, or to request a fix.

Turn on auto-fix | Re-trigger cubic

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review this PR

@cubic-dev-ai

cubic-dev-ai Bot commented Dec 2, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review this PR

@waleedlatif1 I have started the AI code review. It will take a few minutes to complete.

@cubic-dev-ai cubic-dev-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.

All reported issues were addressed across 64 files

Reply with feedback, questions, or to request a fix.

Turn on auto-fix | Re-trigger cubic

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review this PR

@cubic-dev-ai

cubic-dev-ai Bot commented Dec 2, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review this PR

@waleedlatif1 I have started the AI code review. It will take a few minutes to complete.

Adds threaded comments anchored to passages of workspace Markdown files, and
@-mentions of workspace members in comments and in the document body.

- Threads anchor to a quote plus surrounding context, so they survive edits and
  whole-file rewrites; passages that disappear show as detached
- Any member can comment; only authors edit or delete; the opener or an editor
  resolves
- Mentions and replies email the people involved, re-checked against current
  workspace access and the Files capability
- Open viewers refresh through the file's realtime room
- New workspace_file_comment_thread and workspace_file_comment tables
- Anchor threads only once the shared document has loaded, so a comment
  link no longer shows every thread as detached
- List people in the document @ menu; track comment mentions by position
  so two members with one name are never confused
- Place the caret synchronously after picking a person
- Keep the editor off thread updates: split comment context into actions,
  state and layout, and sync highlights from a child component
- Anchor the comment @ picker to the text box; show Reply once typing
- Position the read-only Comment chip with Floating UI
- Fix input type inference in comment use cases and the integration
  fixtures; analytics read the resolved workspace
- Keep threads anchored when a word inside their passage is edited, and
  scan every repeat of a quote instead of the first 200
- Make the per-file thread cap exact under concurrent creates
- Keep the reply box when someone else replies; clear it only after the
  viewer's own reply
- Put the panel's Open/Resolved tab in the URL; a selected thread always
  shows its own tab, and a linked thread scrolls into view once loaded
- Add scroll-edge fades to the comments list
- Require a Markdown file for replies; reject whitespace-only quotes
- Check recipients' access before capping, so active members still hear
- Include mention names in document-mention excerpts
- Document the query hooks; hooks take a props object
…rops

- The highlight sync brings the selected thread's passage into view,
  including when a link opens the file on that thread, so the separate
  scroll-handler wiring is gone
- Name the person-mention notifier's props
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review this PR

@cubic-dev-ai

cubic-dev-ai Bot commented Dec 2, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review this PR

@waleedlatif1 I have started the AI code review. It will take a few minutes to complete.

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review this PR

@cubic-dev-ai

cubic-dev-ai Bot commented Dec 2, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review this PR

@waleedlatif1 I have started the AI code review. It will take a few minutes to complete.

@cubic-dev-ai cubic-dev-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.

No issues found across 66 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

You've manually re-run cubic several times on this PR. Each manual re-review checks the full PR again and counts toward your usage quota. To preserve your usage limits, we recommend letting cubic automatically review new commits.

Turn on auto-fix | Re-trigger cubic

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review this PR

@cubic-dev-ai

cubic-dev-ai Bot commented Dec 2, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review this PR

@waleedlatif1 I have started the AI code review. It will take a few minutes to complete.

@cubic-dev-ai cubic-dev-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.

No issues found across 66 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

You've manually re-run cubic several times on this PR. Each manual re-review checks the full PR again and counts toward your usage quota. To preserve your usage limits, we recommend letting cubic automatically review new commits.

Turn on auto-fix | Re-trigger cubic

This branch was previously deployed

1 inactive deployment
Preview — ed09326c Deployed Dec 2, 2026 by vercel[bot]
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