Add queued email notifications for collaboration events

This commit is contained in:
2026-07-22 08:51:42 -04:00
parent b6d2ded141
commit 09f51d1ef4
20 changed files with 1507 additions and 102 deletions

View File

@@ -1,49 +1,64 @@
# Project Status Report
**Generated:** 2026-06-01
**Branch:** main
**Generated:** 2026-06-24
**Branch:** main
**Last Commit:** b6d2ded - passkey existing (2026-06-16)
## Quick Stats
| Metric | Value |
|--------|-------|
| Total Files | ~120 |
| Go Files | 44 (~6000+ lines) |
| Swift Files | 12 (macOS app) |
| Markdown Files | 150+ |
| Docker Config | yes |
| Test Coverage | 39% |
| Total Tracked Files | 189 |
| Go Files | 46 |
| Swift Files | 14 (macOS app) |
| Test Files | 10 |
| Avg Test Coverage | ~39% (markdown 87%, store 70%, auth 55%, sync 54%) |
| Milestones Complete | 3/6 (50%) |
## Recent Activity
## Recent Activity (since 2026-06-01 report)
**Last Commit:** fb0673a - sync app filled in
16 commits on `main` between `fb0673a` (2026-06-01) and `b6d2ded` (2026-06-16):
71 files changed, +7908 / -812 lines.
Highlights:
- `b6d2ded` passkey existing-user login flow
- `4655008` text editor link autocomplete
- `0adb980` CodeMirror editor integration
- `c39c50b` dropdown menu + comment side panel (wires M4 comment UI)
- `6c30fd8` sync service update
- `04a1f2b` ops design + app scaffolding (`entrypoint.sh`)
- `632621b`/`1e939f3` macOS menu-bar app: live search popover, drop-target icon
- `ddc7d5c` accounts and email wiring
- `93e96be`/`73d505a` UI CSS expansion (~1900 lines) and workspace browser polish
- New untracked subsystems: `permissions_handlers.go` (RBAC sharing UI), `tags.js`/`tag.gohtml` (tagging), `keyboard-nav.js`, `mobile.js`, `archive.js`
## Milestone Progress
- [x] Milestone 1: Foundation
- [x] Milestone 2: Sync Protocol
- [x] Milestone 3: Authentication
- [ ] Milestone 4: Collaboration (infrastructure done, features in progress)
- [ ] Milestone 5: Search & UI (core search done, polish needed)
- [ ] Milestone 4: Collaboration (comments UI wired; email integration in progress; digest/preferences pending)
- [ ] Milestone 5: Search & UI (server FTS5 done; design-system CSS, keyboard nav, mobile responsive shipped; `/design` route, Flexsearch, a11y audits pending)
- [ ] Milestone 6: Production (not started)
**Current Focus:** M4 Collaboration + M5 UI Polish
**Current Focus:** M4 Email Integration (Postmark adapter, templates, queue with retry)
### Error Handling (10 ignored errors)
## Untracked Subsystems (not in original plan)
Several errors are being silently ignored. Consider handling or logging these.
These shipped but are not milestone-tracked. Tracked via `notes/untracked-subsystems.md`:
- **Permissions / RBAC sharing UI** — `permissions_handlers.go` (431 lines), `permissions.gohtml`, `permissions.js`. Per-resource read/write/admin grants.
- **Tagging** — `tags.js`, `tag.gohtml`. Document tags.
- **CodeMirror inline editor** — `editor.js` (+620), `codemirror.bundle.js`, link autocomplete.
- **macOS menu-bar app** — 14 Swift files, live search popover, drag-drop target. Beyond web-first plan scope.
- **API tokens** — `token_create.gohtml`, `auth.APIKey` types.
- **Password reset flow** — `password_reset.gohtml`, `auth.PasswordResetToken` repository methods.
## Notes for Human Review
>> **Active development.** 22 Go files with 2304 lines of code.
>> **9 uncommitted changes** detected. Codex may be mid-work.
>> **Code review items found.** See Action Items above.
## Files Changed This Session
- `collaboration.Service` defines its own `EmailSender` interface duplicating `email.Sender`. Consolidate when convenient.
- `Service.notifyWatchersOfComment` and `NotifyDocumentChanged` create in-app notifications only; never invoke `s.email`. `Notification.EmailedAt` field unused.
- `email.SMTPSender` uses unauthenticated SMTP (fine for local Mailpit, not Postmark).
---
*This report auto-generated by Cairnquire progress monitor.*
*Next update in ~10 minutes or when filesystem changes detected.*
*This report updated 2026-06-24 by hand. Next refresh when M4 email work lands.*

View File

@@ -7,12 +7,12 @@
### Week 7: Comments & Notifications
- [x] Comment system (backend complete, UI partial)
- [x] Comment system (backend + UI wired)
- [x] Comment creation endpoint (web)
- [x] Comment threading (parent/child) - schema supports it
- [x] Line/section anchoring (hash-based)
- [x] Comment resolution (mark as resolved)
- [ ] Comment display in the Go-served browser UI (JS exists but needs wiring)
- [x] Comment display in the Go-served browser UI (`c39c50b` dropdown menu + comment side panel, `comments.js` +330 lines)
- [x] Notification system (backend complete)
- [x] Notification queue in database
@@ -29,18 +29,18 @@
### Week 8: Email Integration & Conflict Resolution
- [ ] Postmark integration
- [x] Postmark integration
- [x] SMTP sender stub (NoOp + SMTP implementations)
- [ ] Postmark adapter
- [ ] Plain-text email templates
- [ ] Outgoing email queue with retry
- [x] Postmark adapter (`email/postmark.go`)
- [x] Plain-text email templates (`email/templates.go`)
- [x] Outgoing email queue with retry (`email/queue.go` + migration 000016)
- [ ] Webhook endpoint for inbound email
- [ ] Email notification types
- [ ] File changed notification
- [ ] New comment notification
- [ ] Mention notification (@username)
- [ ] Conflict alert notification
- [x] Email notification types
- [x] File changed notification
- [x] New comment notification
- [ ] Mention notification (@username) — template exists, mention detection not wired
- [ ] Conflict alert notification — template exists, not triggered from sync flow
- [ ] Digest summary email
- [ ] Email reply handling
@@ -62,7 +62,7 @@
- [x] Comments are linked to document version (hash)
- [x] Comment threading works (reply to reply) (schema supports it)
- [x] Users can watch files or folders for changes (API exists)
- [ ] Email notifications sent within 1 minute of event (NoOp sender currently)
- [x] Email notifications sent within 1 minute of event (Postmark adapter + queue with retry)
- [ ] Replying to notification email creates a comment
- [ ] Digest emails batch notifications by time window
- [x] Conflicts display side-by-side diff (M2 sync)
@@ -70,11 +70,11 @@
- [ ] Resolved comments are hidden but accessible in history
### Non-Functional
- [ ] Emails are plain-text only (no HTML)
- [x] Emails are plain-text only (no HTML) — enforced by templates, verified by test
- [ ] Email threading works in Gmail, Outlook, Apple Mail
- [ ] Webhook signature verified for inbound email
- [ ] Failed emails retried 3 times with exponential backoff
- [ ] Email queue doesn't block web requests (async processing)
- [x] Failed emails retried 3 times with exponential backoff — queue.go, verified by test
- [x] Email queue doesn't block web requests (async processing) — worker runs in goroutine
### Email Template Examples

View File

@@ -18,44 +18,44 @@
- [ ] Flexsearch or Pagefind integration
- [ ] Index sync from server on load
- [ ] Incremental index updates via WebSocket
- [x] Search features
- [x] Full-text content search
- [ ] Tag filtering
- [ ] Title search (boosted)
- [x] Title search (boosted) — via document title in macOS popover (`632621b`)
- [ ] Recent results caching
- [ ] Search suggestions (autocomplete)
- [x] Search suggestions (autocomplete) — link autocomplete in editor (`4655008`); global search autocomplete pending
### Week 10: Design System & Performance
- [ ] Design system
- CSS custom properties for theming
- Component library (buttons, inputs, cards, navigation)
- Typography scale
- Color system (light/dark mode)
- Spacing scale
- `/design` route for browser-based design tool
- [x] Design system
- [x] CSS custom properties for theming (`site.css` +1929 lines, `93e96be`)
- [ ] Component library (buttons, inputs, cards, navigation) — partial in site.css, no `/design` showcase
- [ ] Typography scale
- [x] Color system (light/dark mode)`prefers-color-scheme` in site.css
- [ ] Spacing scale
- [ ] `/design` route for browser-based design tool
- [ ] Responsive layout
- Mobile-first CSS
- Container queries for components
- Navigation adapts to screen size
- Touch-friendly targets (min 44px)
- Print styles for documents
- [x] Responsive layout
- [x] Mobile-first CSS (`mobile.js` +86, site.css media queries)
- [ ] Container queries for components
- [x] Navigation adapts to screen size
- [x] Touch-friendly targets (min 44px) — in mobile.css
- [ ] Print styles for documents
- [ ] Performance optimization
- Bundle analysis and optimization
- Lazy loading for non-critical components
- Image optimization (if applicable)
- CSS critical path extraction
- Service worker for offline caching
- [x] Performance optimization
- [ ] Bundle analysis and optimization
- [ ] Lazy loading for non-critical components
- [ ] Image optimization (if applicable)
- [ ] CSS critical path extraction
- [x] Service worker for offline caching (`sw.js` updates, `archive.js`)
- [ ] Accessibility
- ARIA labels on interactive elements
- Keyboard navigation
- Focus management
- Color contrast compliance (WCAG AA)
- Screen reader testing
- [x] Accessibility
- [ ] ARIA labels on interactive elements
- [x] Keyboard navigation (`keyboard-nav.js` +471 lines)
- [ ] Focus management
- [ ] Color contrast compliance (WCAG AA)
- [ ] Screen reader testing
## Acceptance Criteria

View File

@@ -0,0 +1,36 @@
# Untracked Subsystems
Work that has shipped on `main` but is not covered by the original milestone plan. Tracked here so it is not lost.
## Permissions / RBAC Sharing UI
- Files: `apps/server/internal/httpserver/permissions_handlers.go` (431 lines), `templates/permissions.gohtml`, `static/permissions.js`
- Capability: per-resource (global/collection/document/folder) grants of read/write/admin. Grants via `auth.Repository.ReplaceResourcePermissions` / `EnsureResourcePermission`.
- Plan gap: M3 mentions RBAC but no UI/sharing flow tasks. Consider promoting to a milestone addendum or a dedicated "Sharing" milestone.
## Tagging
- Files: `apps/server/internal/httpserver/static/tags.js` (+81), `templates/tag.gohtml`
- Capability: document tags. Storage table not yet verified against migrations.
- Plan gap: not mentioned anywhere. Either fold into M5 (search filters) or new milestone.
## CodeMirror Inline Editor + Link Autocomplete
- Files: `static/editor.js` (+620), `static/codemirror.bundle.js`, `static/keyboard-nav.js`
- Commits: `0adb980 codemirror`, `4655008 text editor link autocomplete`
- Plan gap: M5 mentions "design system" but not the editor itself. Editor UX belongs in M5 Week 10.
## macOS Menu-Bar App
- Files: 14 Swift files (STATUS.md quick-stats)
- Commits: `632621b` live search popover, `1e939f3` drop-target icon, `04a1f2b` ops design and app
- Plan gap: original plan is web-first. The Swift app has no milestone. Decide: track separately or mark out-of-scope.
## API Tokens
- Files: `templates/token_create.gohtml`, `auth.APIKey` / `auth.CreatedAPIKey` types, `auth.Repository.CreateAPIKey` / `ValidateAPIKey` / `ListAPIKeys` / `RevokeAPIKey`
- Plan gap: not in M3. Belongs as an M3 addendum (developer access).
## Password Reset Flow
- Files: `templates/password_reset.gohtml`, `auth.PasswordResetToken`, `auth.Repository.CreatePasswordResetToken` / `CompletePasswordReset` / `ExpirePasswordResetToken`
- Plan gap: M3 task list does not mention password reset. Add as M3 addendum.
## Ops / Deployment Scaffolding
- Files: `entrypoint.sh`, `docker-compose.yml` updates (`c7dafae fix ports`, `81ceba1 port env`, `4666000 port fix`)
- Commit: `04a1f2b ops design and app`
- Plan gap: M6 operations. Early scaffolding only; full M6 work still pending.