Skip to content

Comments

Fix emoji support in comments and project descriptions#1840

Open
moio wants to merge 4 commits intoSUSE:masterfrom
moio:fix-emoji-error-500
Open

Fix emoji support in comments and project descriptions#1840
moio wants to merge 4 commits intoSUSE:masterfrom
moio:fix-emoji-error-500

Conversation

@moio
Copy link
Member

@moio moio commented Dec 3, 2025

Emojis (e.g., 😱) in comments or project descriptions cause HTTP 500. MySQL's utf8 charset only supports 3-byte UTF-8; emojis require 4-byte utf8mb4.

Fixes #585.

This was made with Copilot agents as part of experiments for my HackWeek project.

I tested it manually and it works in my environment, as far as I can tell:

Screenshot 2025-12-03 at 15 52 22

docker-compose exec hackweek bundle exec rspec apparently fails mid way for reasons I don’t understand. In logs I see:

hackweek-hackweek-1  | 15:13:49 system   | sending SIGTERM to all processes                                            │All examples were filtered out; ignoring {focus: true}

I hope this helps. Feedback welcome.

@danidoni
Copy link
Contributor

Hey, thanks for contributing!

docker-compose exec hackweek bundle exec rspec apparently fails mid way for reasons I don’t understand. In logs I

Is your docker compose up? Try with docker compose run hackweek bundle exec rspec instead. Remember exec only works for containers that are running...

@danidoni
Copy link
Contributor

Also, you need to run the migrations locally and upload the modified schema file

@moio
Copy link
Member Author

moio commented Dec 12, 2025

thanks @danidoni

So first of all I am trying to run rspec tests on clean master, without the changes here.

App is up, but I see my emoji projects, so resetting the database.

IIUC the right command is

docker compose run hackweek bundle exec rake db:drop db:create db:migrate

This fails with:

-- add_attachment(:projects, :avatar)
rake aborted!
StandardError: An error has occurred, all later migrations canceled: (StandardError)

/hackweek/db/migrate/20140910105916_add_avatar_columns_to_projects.rb:3:in 'AddAvatarColumnsToProjects.up'

Caused by:
NoMethodError: undefined method 'add_attachment' for an instance of AddAvatarColumnsToProjects (NoMethodError)
Did you mean?  add_column
/hackweek/vendor/bundle/ruby/3.4.0/gems/activerecord-7.2.3/lib/active_record/migration.rb:1058:in 'block in ActiveRecord::Migration#method_missing'

What am I doing wrong?

@danidoni
Copy link
Contributor

danidoni commented Dec 12, 2025 via email

@moio
Copy link
Member Author

moio commented Dec 12, 2025

Right, thanks.

Checking out from master branch, then running docker-compose run --rm hackweek bundle exec rake dev:bootstrap, then running docker-compose up --build and finally docker compose run hackweek bundle exec rspec from another console results in:

140 examples, 16 failures

Failed examples:

rspec ./spec/features/collaboration_spec.rb:41 # Collaboration User dislikes a project
rspec ./spec/features/collaboration_spec.rb:16 # Collaboration User leaves a project
rspec ./spec/features/collaboration_spec.rb:28 # Collaboration User likes a project
rspec ./spec/features/collaboration_spec.rb:4 # Collaboration User joins a project
rspec ./spec/features/collaboration_spec.rb:55 # Collaboration User likes a project multiple times
rspec ./spec/features/project_management_spec.rb:27 # Project management User edits a project
rspec ./spec/features/project_management_spec.rb:75 # Project management User restarts a project
rspec ./spec/features/project_management_spec.rb:55 # Project management User archives an idea
rspec ./spec/features/project_management_spec.rb:94 # Project management more than one project having same tags
rspec ./spec/features/project_management_spec.rb:10 # Project management User creates a new project
rspec ./spec/features/project_management_spec.rb:85 # Project management User uses markdown preview button during editing
rspec ./spec/features/project_management_spec.rb:65 # Project management User finishes a project
rspec ./spec/features/comment_spec.rb:24 # Comment create
rspec ./spec/features/comment_spec.rb:60 # Comment update
rspec ./spec/features/comment_spec.rb:13 # Comment markdown preview
rspec ./spec/features/comment_spec.rb:40 # Comment reply to a comment

Checking out this branch, re-running docker-compose run --rm hackweek bundle exec rake dev:bootstrap and then docker-compose up --build, and finally docker compose run hackweek bundle exec rspec in a different console leads me to the exact same 16 failures (the 3 added examples in this PR pass).

Is it safe to assume the problem lies elsewhere?

Is there anything else I should do for this PR to be mergeable?

Copilot AI and others added 2 commits December 12, 2025 15:31
Co-authored-by: moio <250541+moio@users.noreply.github.com>
Signed-off-by: Silvio Moioli <silvio@moioli.net>
@danidoni
Copy link
Contributor

I don't know what to tell you... I started from a fresh start, on master, and I don't have any error... Did you try removing all containers from that project and rebuild again from scratch?

@moio
Copy link
Member Author

moio commented Jan 7, 2026

Just did:

docker stop $(docker ps -aq) && docker rm $(docker ps -aq) && docker rmi $(docker images -q) && docker system prune -a

git checkout master
git pull

vim config/application.rb # to add config.hosts << "lenovo.local:3000"

docker-compose run --rm hackweek bundle exec rake dev:bootstrap
docker-compose up --build # UI is browseable from http://lenovo.local:3000/ at this point
docker compose run hackweek bundle exec rspec # from another console

I get:

Finished in 1 minute 13.4 seconds (files took 3.97 seconds to load)
140 examples, 16 failures

Failed examples:

rspec ./spec/features/project_management_spec.rb:55 # Project management User archives an idea
rspec ./spec/features/project_management_spec.rb:94 # Project management more than one project having same tags
rspec ./spec/features/project_management_spec.rb:75 # Project management User restarts a project
rspec ./spec/features/project_management_spec.rb:10 # Project management User creates a new project
rspec ./spec/features/project_management_spec.rb:27 # Project management User edits a project
rspec ./spec/features/project_management_spec.rb:65 # Project management User finishes a project
rspec ./spec/features/project_management_spec.rb:85 # Project management User uses markdown preview button during editing
rspec ./spec/features/comment_spec.rb:13 # Comment markdown preview
rspec ./spec/features/comment_spec.rb:24 # Comment create
rspec ./spec/features/comment_spec.rb:40 # Comment reply to a comment
rspec ./spec/features/comment_spec.rb:60 # Comment update
rspec ./spec/features/collaboration_spec.rb:16 # Collaboration User leaves a project
rspec ./spec/features/collaboration_spec.rb:55 # Collaboration User likes a project multiple times
rspec ./spec/features/collaboration_spec.rb:41 # Collaboration User dislikes a project
rspec ./spec/features/collaboration_spec.rb:4 # Collaboration User joins a project
rspec ./spec/features/collaboration_spec.rb:28 # Collaboration User likes a project

Randomized with seed 29387

Happy to investigate further, but I'd like some direction to do so.

@danidoni
Copy link
Contributor

danidoni commented Jan 15, 2026

Happy to investigate further, but I'd like some direction to do so.

Whenever you have an error in a spec under "spec/features", rspec leaves a screenshot capturing the error that shows up in the browser inside tmp/capybara (relative to the project root).

You will find both an html dump and a png screenshot of the error.

Can you go there and see what those errors are?

@moio
Copy link
Member Author

moio commented Jan 15, 2026

Thanks, that put me on the right track!

It was HostAuthorization:

Collaboration_User_joins_a_project

As a workaround I set config.hosts = nil in config/application.rb and that worked.

Not sure if that is the recommended approach / if we should document anything different in the README for newbies like me.

@moio
Copy link
Member Author

moio commented Jan 15, 2026

Now rspec tests pass locally, both on main and on my branch.

CI here is still broken - I see it failing to recognize the collation string.

AFAIU that is caused by GHA using mysql from ubuntu packages, while the docker-compose setup uses containerized MariaDB from the latest opensuse - there is a version difference and that causes the problem.

FMPOV, CI should use the same setup that devs use locally - therefore I'd say GHA should use docker-compose as well.

  • Does that make sense?
  • Is that something that has to be addressed in this PR?

@danidoni
Copy link
Contributor

AFAIU that is caused by GHA using mysql from ubuntu packages, while the docker-compose setup uses containerized MariaDB from the latest opensuse - there is a version difference and that causes the problem.

What is GHA?

FMPOV, CI should use the same setup that devs use locally - therefore I'd say GHA should use docker-compose as well.

* Does that make sense?

To me, it makes sense yes

* Is that something that has to be addressed in this PR?

I would not address that in this PR, we like small focused PR's. If you feel confident enough to write another one.

@moio
Copy link
Member Author

moio commented Jan 27, 2026

What is GHA?

GitHub Actions

I would not address that in this PR, we like small focused PR's. If you feel confident enough to write another one.

Sure.

moio added a commit to moio/hackweek that referenced this pull request Jan 27, 2026
CI was using Ubuntu's native MySQL packages while local development
uses containerized MariaDB from openSUSE via docker-compose. This
version mismatch caused collation recognition failures (eg. from
PR SUSE#1840). Run CI through docker compose so both environments use
the same database engine and container setup.

Ref: SUSE#1840 (comment)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@moio
Copy link
Member Author

moio commented Jan 27, 2026

#1857

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.

No Emoji Support! How dare you....

3 participants