feat(revisions): allow revision comment editing after creation #174

Open
opened 2026-03-03 20:29:55 +00:00 by forbes · 0 comments
Owner

Context

From GAP_ANALYSIS.md Open Question #2: "Allow comment updates post-creation?"

Decision: Yes. Revision comments should be editable after creation.

Current Behavior

Revision comments are set at creation time via POST /api/items/{partNumber}/revisions and are immutable thereafter. The existing PATCH /api/items/{partNumber}/revisions/{revision} endpoint (HandleUpdateRevision in handlers.go) only supports updating status and labels fields — it does not accept comment.

Proposed Behavior

Extend PATCH /api/items/{partNumber}/revisions/{revision} to accept an optional comment field:

PATCH /api/items/{partNumber}/revisions/{rev}
{
  "comment": "Updated comment text"
}

Rules

  • Any user with editor role or above can edit the comment on a draft or review revision
  • Comments on released or obsolete revisions can only be edited by admin users
  • The audit log should capture the comment change (old value → new value)
  • SSE event revision.updated should fire with the changed fields

Files to Modify

  • internal/api/handlers.goHandleUpdateRevision(): add comment to the accepted fields in the update request struct and SQL UPDATE
  • internal/db/items.goUpdateRevision() or equivalent: add comment column to the UPDATE query
  • GAP_ANALYSIS.md Section 7, Question 2
  • Existing endpoint: PATCH /api/items/{pn}/revisions/{rev} handles status and labels already
## Context From GAP_ANALYSIS.md Open Question #2: "Allow comment updates post-creation?" **Decision: Yes.** Revision comments should be editable after creation. ## Current Behavior Revision comments are set at creation time via `POST /api/items/{partNumber}/revisions` and are immutable thereafter. The existing `PATCH /api/items/{partNumber}/revisions/{revision}` endpoint (`HandleUpdateRevision` in `handlers.go`) only supports updating `status` and `labels` fields — it does not accept `comment`. ## Proposed Behavior Extend `PATCH /api/items/{partNumber}/revisions/{revision}` to accept an optional `comment` field: ```json PATCH /api/items/{partNumber}/revisions/{rev} { "comment": "Updated comment text" } ``` ### Rules - Any user with `editor` role or above can edit the comment on a `draft` or `review` revision - Comments on `released` or `obsolete` revisions can only be edited by `admin` users - The audit log should capture the comment change (old value → new value) - SSE event `revision.updated` should fire with the changed fields ## Files to Modify - `internal/api/handlers.go` — `HandleUpdateRevision()`: add `comment` to the accepted fields in the update request struct and SQL UPDATE - `internal/db/items.go` — `UpdateRevision()` or equivalent: add `comment` column to the UPDATE query ## Related - GAP_ANALYSIS.md Section 7, Question 2 - Existing endpoint: `PATCH /api/items/{pn}/revisions/{rev}` handles status and labels already
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: kindred/silo#174