Skip to content

Self-hosted project management for devs and their clients: tickets, time tracking, docs and meetings, with an AI assistant that cites its sources. AGPL-3.0.

docs: review round 4 of #81, name the one status change and the blank lines of plain

Guido Boyke657aee3e52f7
diff --git a/CLAUDE.md b/CLAUDE.md
index 1f76ba3..53b5325 100644
--- a/CLAUDE.md
+++ b/CLAUDE.md
@@ -791,7 +791,10 @@ feature by feature):
* **Error bodies** keep `error` and the HTTP status as they always were and add `code`, the
MCP vocabulary (`invalid_input`, `read_only`, `forbidden`, `not_found`, `refused`, plus
- `unauthorized`); an unmapped actor code is `refused` with the old value as `reason`. Every
+ `unauthorized`); an unmapped actor code is `refused` with the old value as `reason`. One
+ status changed on purpose: an unexpected actor failure (`internal_error`) on
+ `time_sessions.create` (R6) and `posts.create` (R3a) answers 500 without the exception's
+ text, where it was a 422 that carried it. Every
body comes from `Api::V1::ErrorBody` through `BaseController#render_error`; guard
`spec/architecture/api_v1_error_body_guard_spec.rb`. Answers outside the controllers carry
no `code`: the Rack::Attack 429 (plain text), a 500 from the exceptions app, a 400 for a
diff --git a/app/services/posts/comment.rb b/app/services/posts/comment.rb
index 1e5cff9..496320d 100644
--- a/app/services/posts/comment.rb
+++ b/app/services/posts/comment.rb
@@ -18,8 +18,10 @@
# The body arrives as ActionText HTML (format html, the default, stored as
# sent) or as literal text (format plain): Posts::PlainTextBody escapes it and
# turns line breaks into paragraphs and <br>, so body_text comes back as the
-# client sent it. A body that is no string is taken as its text (`to_s`), as
-# both surfaces always did.
+# client sent it, up to its blank lines: line endings become LF, blank lines at
+# the edges are dropped, and a run of blank lines inside (a line of only spaces
+# and tabs counts as blank) comes back as one. A body that is no string is
+# taken as its text (`to_s`), as both surfaces always did.
module Posts
class Comment
# The body formats a client may name.
@@ -96,9 +98,9 @@ module Posts
body = readable(body)
return :body_invalid_utf8 unless body&.valid_encoding?
- # plain promises body_text == body, so a byte that cannot round-trip is
- # refused rather than cleaned. html keeps its legacy behaviour: the HTML
- # parser drops a NUL byte on its own.
+ # plain promises body_text as sent (up to its blank lines), so a byte
+ # that cannot round-trip is refused rather than cleaned. html keeps its
+ # legacy behaviour: the HTML parser drops a NUL byte on its own.
return :body_nul if plain? && body.include?("\0")
# Decided on what would be stored: a plain body of Unicode whitespace