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.
Ruby agplai-assistantdockerdsgvogdprhotwireissue-trackerjira-alternativeknowledge-basellmmcp-servermeeting-notesopen-sourceproject-managementredmine-alternativeruby-on-railsself-hostedticketingtime-tracking
test: review round 3 of #81, pin is_private as text on MCP and html charsets
Guido Boyke96f9e9cc9623
diff --git a/app/services/posts/comment.rb b/app/services/posts/comment.rbindex 62dbff7..8d8524c 100644--- a/app/services/posts/comment.rb+++ b/app/services/posts/comment.rb@@ -100,7 +100,8 @@ module Posts# JSON and forms give UTF-8 on both surfaces. Only a multipart part (REST)# can name a charset of its own: html, stored as sent, keeps it, and# ActionText reads it as it always did (a Latin-1 comment keeps its- # letters); plain transcodes it. A binary part names no charset, so plain+ # letters; a byte without a character in its charset fails the save, as+ # before); plain transcodes it. A binary part names no charset, so plain# reads its bytes as UTF-8.def readable(body)return body.dup.force_encoding(Encoding::UTF_8) if body.encoding == Encoding::UTF_8diff --git a/spec/services/lalabase/tools/post_comment_failure_spec.rb b/spec/services/lalabase/tools/post_comment_failure_spec.rbindex 9eaf931..6a1c3e4 100644--- a/spec/services/lalabase/tools/post_comment_failure_spec.rb+++ b/spec/services/lalabase/tools/post_comment_failure_spec.rb@@ -59,6 +59,15 @@ RSpec.describe Lalabase::Tools::PostComment, :ci_guard doendend+ # The rule holds the reading of is_private (a JSON true or the string+ # "true", as the tool always took it); the tool must hand the value on.+ it 'takes is_private given as the string "true" as private' do+ result = execute(is_private: 'true')+ saved = Post.find(JSON.parse(result.content).fetch('id'))+ expect(saved).to be_private+ expect(saved.visible_to_user_id).to eq(user.id)+ end+it 'answers an unexpected failure with a fixed text, never the exception text' dofailing_save(:internal_error, ['PG::ConnectionBad: could not connect to server at 192.168.0.1'])result = executediff --git a/spec/services/posts/comment_spec.rb b/spec/services/posts/comment_spec.rbindex 966cfcc..2a1f3aa 100644--- a/spec/services/posts/comment_spec.rb+++ b/spec/services/posts/comment_spec.rb@@ -98,6 +98,14 @@ RSpec.describe Posts::Comment, :ci_guard doexpect(described_class.parse(body: "a#{0xFF.chr}b".b)).not_to be_refusedend+ # Kept, not transcoded: the two differ only where a byte has no character+ # in its charset (0x81 in Windows-1252). Transcoding would refuse it here;+ # ActionText fails the save instead, as it did before R3a.+ it 'keeps an html body in a named encoding even where it would not transcode' do+ cp1252 = "a#{0x81.chr}b".force_encoding(Encoding::CP1252)+ expect(described_class.parse(body: cp1252)).not_to be_refused+ end+# html takes a no-break space as text, as it always did; the model then# decides on the stored plain text.it 'leaves an html body of a no-break space to the model' do