Skip to content

Write the author display name alongside the service ID - #1

Merged
dtkav merged 1 commit into
No-Instructions:mainfrom
petergaultney:comments/author-name-in-markup
Aug 17, 2026
Merged

Write the author display name alongside the service ID#1
dtkav merged 1 commit into
No-Instructions:mainfrom
petergaultney:comments/author-name-in-markup

Conversation

@petergaultney

Copy link
Copy Markdown
Contributor

🍋:

Comment marks record the author as author="<service-id>", so a mark's display name lives only in the identity provider's user directory. Read a vault without that provider - Relay uninstalled, an export, a plain git checkout, or someone else's clone - and every comment shows a raw user ID with no way to recover who wrote it. The ID is the right thing to key identity on, but it is not durable as a record on its own.

This writes the display name alongside it: {{authorId="<id>" author="<name>">>...<<}}.

That pair is not a new format. getReviewerIdentityForMark in src/main.ts already reads it, with a comment noting that early Relay Comments builds wrote an ID in authorId and a display name in author, and preferring the ID when both are present. Metadata parsing is generic key="value", so the attribute needed no parser change. Only the writer had narrowed to ID-only; this restores the pair, and nothing downstream needed touching.

Marks stay single-attribute where the second value would add nothing: no name available, or a name equal to the ID (the literal-display-name case, where the ID is the name).

Details

  • formatAuthoredComment takes an optional authorName. Both values go through one safeAttributeValue guard, so an unsafe value is dropped rather than escaped - same conservative handling the ID already had. An unsafe ID with a safe name now degrades to author="<name>" instead of an unattributed comment; previously the ID was the only channel, so there was nothing to fall back to.
  • formatCommentMarkup passes identity.name, suppressed when identity.source === "fallback" so the placeholder "Unknown author" is never written into a file.
  • Unit tests cover the pair, both single-attribute paths, and each unsafe-value case.

Not addressed here: date has the same gap in the other direction. formatMarkDate reads and formats metadata.date and the sidebar renders it, but the writer never emits one, so it only appears on hand-written or early-build marks. Happy to add it in a separate change if you want timestamps to be durable too.

Comment marks carried only author="<relay-user-id>", so the display name
existed nowhere in the file and was unrecoverable without Relay's user
directory. Marks now carry authorId="<id>" author="<name>", the pair the
reader already resolves for early-build marks.
@petergaultney
petergaultney marked this pull request as ready for review August 17, 2026 16:30
@dtkav
dtkav merged commit 2994aea into No-Instructions:main Aug 17, 2026
1 check passed
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.

2 participants