Comment on a document
A participant wants to start a new conversation on a document from their phone and see it published under their name.

As a participant, I want to write a new comment on a document and publish it under my name, so that I can start a conversation about what I just read.

Situation

I am reading a document and have something to say about it. I have an identity on this phone, and it is the one currently selected in Me.

What I do

    Scroll to "Discussion" at the end of the document and tap "Add a comment".

    Check the line that says who I am commenting as.

    Type my comment.

    Tap "Post".

    Read my comment in the thread that opens.

What I should see

    A sheet titled "New comment" rises over the document, with "Cancel" on the left and "Post" on the right. See the Compose sheet.

    A grey line reads "Commenting as Name", using my profile name, or my key's name, or a shortened ID when I have neither.

    The writing area fills the sheet and shows the hint "Write a comment…".

    "Post" is dimmed until I have typed something other than spaces.

    While the comment is being published the button reads "Posting…" and cannot be tapped again.

    When it is published the sheet closes and the new Thread opens, with my comment as the first comment and "No replies yet." under it.

    The phone gives a short success tap.

    The reply field is ready at the bottom of the thread for a follow-up.

    Going back to the document, the count and the thread list include my comment.

    The comment is published to the site whose document I am reading, signed on this phone with my identity.

    "Cancel", or dragging the sheet down, closes it and keeps what I typed for next time.

When something goes wrong

    If publishing fails, the sheet stays open, my text is kept, and a red line says why: "The server refused the comment (409): …", "The document could not be loaded to comment on.", "Couldn't reach the server." or "This identity’s key is not on this device." I fix the cause, or simply tap "Post" again.

Not included

    A comment is one plain paragraph: no formatting, pictures, attachments or quoting a passage of the document (Current limits).

    My comment does not appear until the server has accepted it.

    Comments cannot be edited or deleted in the app.

    The unsent text is one draft for the whole app, so it also shows when I open the sheet on another document (Compose sheet).

    There is no "Add a comment" in All comments.

Trace

Story US-DISC-03, status Shipped. These links are kept in step with the traceability matrix and with the "User stories" section of every page listed here.

Design

Page

Part it plays

Compose comment sheet

The sheet where the comment is written

Document and site home

Where "Add a comment" lives

Thread

Where posting lands

DiscussSection

The "Add a comment" pill

DiscussBubble

The posted comment as the thread root

input, textarea, select and label

The borderless textarea

header, footer and nav

The sheet bar with Cancel, title and Post

button

Cancel and Post

Composers

Why a first comment gets a sheet and a reply gets a pinned field

The three composers compared

The compose sheet compared with the other composers

Refresh, haptics and progress

The success haptic and the "Posting…" label

Buttons and actions

Cancel leading, the confirming action trailing

Every bar button

The Cancel and Post bar buttons

Forms and inputs

Error line above the field, draft kept

Stacks, pushes and sheets

The compose sheet as a modal

Reading another site in place

The comment goes to the site being read

Names, not identifiers

"Commenting as Name"

Honest state: loading, failure and empty

Failure says why and keeps the text

Representative strings

Exact button and error wording

Implementation

Page

Part it plays

Discuss: posting a comment

postComment: checks, signing, PublishBlobs, the returned thread link

Discuss: screens and components

DiscussComposeScreen

Discuss: root contract wiring

discussComposeDraft, discussAccountName, discussPosted and discussAfterPost

Discuss: loading and posting

forget drops the document listing after a post; the thread fallback for a fresh comment

Discuss: threading logic

paragraphContent and threadHref

Crypto: changes, refs, comments and profiles

The signed Comment blob and its record id

Crypto: primitives and key derivation

Ed25519 principal and signing

Crypto: parity vectors against the original client

Comment bytes match the original client

Identity: key storage

signerFor: the key that signs, read from the Keychain

Publishing signed blobs

POST /api/PublishBlobs with DAG-CBOR

Seed site read API

Resource for the document version

Root declarations: Read and Discuss

The discussPosted mutation and what it refreshes

Navigation and routes

The compose route as a sheet; back then go to the new thread

The data module (app.ts)

How the mutation source receives the secret store

Grants and capabilities

Network and secret-store grants the post needs

Contract UI tests

The write test against dev.hyper.media with a throwaway key

Bun unit tests

Post refusals and version handling

Current limits and known gaps

Single plain paragraph, no optimistic insert

Code

File

What

discuss.contract L242-280

DiscussComposeScreen

discuss.contract L119-120

the "Add a comment" pill

app.contract L107-120

pkg:discuss declarations (drafts, discussAccountName, discussPosted)

app.contract L335-359

discussEditCompose, discussPost, discussAfterPost, discussCancelCompose

app.contract L34-38

pkg:discuss routes

src/discuss/load.ts L158-229

postComment

src/discuss/logic.ts L240-243

paragraphContent

src/discuss/sources.ts

discussPost source

src/crypto/comment.ts L486-500

createComment

src/identity/index.ts L107-114

signerFor

src/crypto/unicode.ts

Checks that text annotations do not overlap illegally

Tests

File

What it checks

discuss.test.contract

discuss: post a comment and replies on dev.hyper.media with a throwaway key

src/discuss/__tests__/load.test.ts

a corrupt signing key returns a safe mutation refusal rather than throwing its secret

src/crypto/__tests__/crypto.test.ts

comment N: exact body, signature, CID and timestamp record ID

Delivery

Delivered by #1470.

Do you like what you are reading? Subscribe to receive updates.

Unsubscribe anytime