Skip to content

OBJ-85 — @mention parsing + user resolution - #31

Merged
objectgyan merged 1 commit into
mainfrom
objectgyan/obj-85-m55-mention-parsing-user-resolution
May 17, 2026
Merged

objectgyan merged 1 commit into
mainfrom
objectgyan/obj-85-m55-mention-parsing-user-resolution

Conversation

@objectgyan

Copy link
Copy Markdown
Owner

Summary

  • Adds MentionExtractor that parses @([A-Za-z0-9_.-]+) tokens from comment/reply bodies
  • Resolves each token via ICurrentUserAccessor.ResolveByMentionTokenAsync; unknown token → 400 unknown_user before any DB write
  • Persists resolved mentions in comment_mentions (new EF migration AddCommentMentions)
  • Defines INotificationSink + NotificationEvent in Core; registers NoOpNotificationSink (OBJ-86 will replace with real dispatcher)
  • Wires mention logic into POST comment + POST reply handlers
  • Dev tokens: alice → …002, bob → …003

Test plan

  • 152 unit tests pass (MentionExtractor: 9 tests, NotificationSink: 3 tests, existing Auth/Controls/etc.)
  • 81 integration tests pass (includes 4 new MentionApiTests)
  • scripts/validate-obj-85.ps1 exits 0 — DB confirms 2 rows for @alice+@bob, 400 for @Nonexistent
  • Build: 0 warnings, 0 errors (TreatWarningsAsErrors=true)

- MentionExtractor parses @([A-Za-z0-9_.-]+) tokens from comment/reply bodies
- DevCurrentUserAccessor.ResolveByMentionTokenAsync resolves alice, bob, dev
- CommentMention entity + AddCommentMentions EF migration (comment_mentions table)
- POST comment/reply: unknown @token → 400 unknown_user before any DB write
- INotificationSink + NotificationEvent in Core; NoOpNotificationSink registered (OBJ-86 replaces)
- mention.created event fired per resolved mention via sink
- 4 integration tests (MentionApiTests) + 9 + 3 unit tests (MentionExtractor, Sink)
- validate-obj-85.ps1: asserts alice + bob rows in DB + 400 on @Nonexistent
@linear-code

linear-code Bot commented May 17, 2026 •

Copy link
Copy Markdown
OBJ-85 M5.5 — @mention parsing + user resolution

Milestone: M5 · Wave: 2

Summary

Parse @username tokens out of comment bodies and resolve to known users via ICurrentUserAccessor's lookup. Unknown mentions return a validation error.

Acceptance

  • Mention extractor returns canonical user IDs
  • Unknown mention → 400 with { code: "unknown_user" }
  • Known mention recorded in comment_mentions table

Validation

  • DB check: after a comment with @alice & @bob, SELECT user_id FROM comment_mentions WHERE comment_id=… shows both
  • Live API check: curl POST comment with @nonexistent → 400; with valid users → 201
  • Script: scripts/validate-obj-NNN.ps1

Branch / PR

Branch from main; target main. No trailers/footer.

Review in Linear

@objectgyan
objectgyan merged commit 2286ca2 into main May 17, 2026
2 of 3 checks passed
objectgyan added a commit that referenced this pull request May 17, 2026
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