Skip to content

fix(selection-plan): allow emoji in SubmissionPeriodDisclaimer#554

Open
romanetar wants to merge 1 commit into
mainfrom
feature/allow-emoji-in-submission-period-disclaimer
Open

fix(selection-plan): allow emoji in SubmissionPeriodDisclaimer#554
romanetar wants to merge 1 commit into
mainfrom
feature/allow-emoji-in-submission-period-disclaimer

Conversation

@romanetar
Copy link
Copy Markdown
Collaborator

@romanetar romanetar commented Jun 3, 2026

ref https://app.clickup.com/t/86b99xjvv

Summary by CodeRabbit

Release Notes

  • New Features

    • Selection plan disclaimer fields now support a wider range of characters, including emoji and extended special characters, enabling richer content expression and better international language support.
  • Tests

    • Added regression test to verify proper storage and retrieval of emoji and special characters in selection plan disclaimers through the API.

Signed-off-by: romanetar <roman_ag@hotmail.com>
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Jun 3, 2026

Review Change Stack

📝 Walkthrough

Walkthrough

Database configuration is upgraded from UTF-8 to UTF-8MB4 encoding across both model and write connections, a corresponding schema migration alters the SelectionPlan disclaimer column to match, and a regression test validates emoji characters persist correctly through the update API.

Changes

UTF8MB4 Charset and Emoji Support

Layer / File(s) Summary
Database configuration defaults
config/database.php
Both $model_db_config and $model_write__db_config update charset and collation defaults from utf8/utf8_unicode_ci to utf8mb4/utf8mb4_unicode_ci via SS_DB_CHARSET and SS_DB_COLLATION environment variables.
SelectionPlan schema migration
database/migrations/model/Version20260603184510.php
Doctrine migration alters the SelectionPlan table's SubmissionPeriodDisclaimer column to TEXT type with utf8mb4_general_ci collation and allows NULL values.
Emoji persistence regression test
tests/oauth2/OAuth2SummitSelectionPlansApiTest.php
New test testUpdateSelectionPlanWithEmojiInDisclaimer updates a selection plan disclaimer with an emoji via the API, validates the HTTP 201 response and returned value, clears the entity cache, and verifies the emoji persists in the database.

🎯 2 (Simple) | ⏱️ ~10 minutes

🐰 UTF-8 to emoji's best friend,
Four bytes per char, the collation trend,
Disclaimers now glow with 📅 delight,
The schema dances in collation light! ✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 40.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The pull request title clearly summarizes the main change: updating character encoding to support emoji in the SubmissionPeriodDisclaimer field.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/allow-emoji-in-submission-period-disclaimer

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Jun 3, 2026

📘 OpenAPI / Swagger preview

➡️ https://OpenStackweb.github.io/summit-api/openapi/pr-554/

This page is automatically updated on each push to this PR.

@romanetar romanetar requested a review from smarcet June 3, 2026 17:39
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (2)
database/migrations/model/Version20260603184510.php (2)

27-27: 💤 Low value

Collation differs from database default.

The migration specifies utf8mb4_general_ci while the database configuration (in config/database.php:12,65) defaults to utf8mb4_unicode_ci.

  • utf8mb4_general_ci: Faster, less accurate Unicode sorting
  • utf8mb4_unicode_ci: Slower, more accurate international character sorting

If SubmissionPeriodDisclaimer is primarily for display and not sorting/comparison, general_ci is fine. Otherwise, consider aligning with the database default.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@database/migrations/model/Version20260603184510.php` at line 27, The
migration alters the SelectionPlan column SubmissionPeriodDisclaimer to use
utf8mb4_general_ci which diverges from the app DB default utf8mb4_unicode_ci;
update the ALTER TABLE statement in Version20260603184510 (the MODIFY for
SubmissionPeriodDisclaimer) to use utf8mb4_unicode_ci to match
config/database.php, or if you intentionally want faster general collation, add
a short comment in the migration explaining why utf8mb4_general_ci is required
so reviewers know the deviation is deliberate.

35-38: 💤 Low value

Document why down() migration is empty.

The empty down() method means there's no rollback path for this schema change. While this might be intentional (rolling back from utf8mb4 to utf8 would corrupt emoji, and TEXT to VARCHAR could truncate data), it should be documented.

📝 Suggested documentation
     public function down(Schema $schema): void
     {
-
+        // Intentionally empty: rolling back from utf8mb4→utf8 would corrupt emoji characters,
+        // and TEXT→VARCHAR(255) could truncate existing data.
     }
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@database/migrations/model/Version20260603184510.php` around lines 35 - 38,
Add a brief doc comment above the down(Schema $schema): void method explaining
why the migration is intentionally irreversible: note that the up() changes
alter column types/charsets (e.g., conversion to utf8mb4 which would lose emoji
if reverted to utf8, and TEXT-to-VARCHAR changes that could truncate data) and
therefore no safe rollback is provided; reference the method name down and the
corresponding up migration in the comment for future maintainers.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@database/migrations/model/Version20260603184510.php`:
- Around line 26-29: The entity mapping for
SelectionPlan.SubmissionPeriodDisclaimer doesn't match the migration: update the
ORM mapping in app/Models/Foundation/Summit/SelectionPlan.php so the property
SubmissionPeriodDisclaimer is declared as type: 'text' and nullable: true (e.g.
change #[ORM\Column(name: 'SubmissionPeriodDisclaimer', type: 'string')] to
#[ORM\Column(name: 'SubmissionPeriodDisclaimer', type: 'text', nullable: true)]
and remove any length restriction), ensuring Doctrine metadata matches the ALTER
TABLE in Version20260603184510.php; after the change, run your schema validation
or tests to confirm no metadata/schema drift remains.

---

Nitpick comments:
In `@database/migrations/model/Version20260603184510.php`:
- Line 27: The migration alters the SelectionPlan column
SubmissionPeriodDisclaimer to use utf8mb4_general_ci which diverges from the app
DB default utf8mb4_unicode_ci; update the ALTER TABLE statement in
Version20260603184510 (the MODIFY for SubmissionPeriodDisclaimer) to use
utf8mb4_unicode_ci to match config/database.php, or if you intentionally want
faster general collation, add a short comment in the migration explaining why
utf8mb4_general_ci is required so reviewers know the deviation is deliberate.
- Around line 35-38: Add a brief doc comment above the down(Schema $schema):
void method explaining why the migration is intentionally irreversible: note
that the up() changes alter column types/charsets (e.g., conversion to utf8mb4
which would lose emoji if reverted to utf8, and TEXT-to-VARCHAR changes that
could truncate data) and therefore no safe rollback is provided; reference the
method name down and the corresponding up migration in the comment for future
maintainers.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: def307de-a207-46bb-90f4-202c09c02e68

📥 Commits

Reviewing files that changed from the base of the PR and between cfc7642 and 65b5083.

📒 Files selected for processing (3)
  • config/database.php
  • database/migrations/model/Version20260603184510.php
  • tests/oauth2/OAuth2SummitSelectionPlansApiTest.php

Comment on lines +26 to +29
$sql = <<<SQL
ALTER TABLE `SelectionPlan` MODIFY SubmissionPeriodDisclaimer TEXT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL;
SQL;
$this->addSql($sql);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Verify the ORM Column declaration for SubmissionPeriodDisclaimer

echo "=== Current entity mapping ==="
rg -n -A2 "SubmissionPeriodDisclaimer.*Column" --type=php app/Models/

echo ""
echo "=== Check if Doctrine validation catches this ==="
echo "Run: php artisan doctrine:schema:validate"

Repository: OpenStackweb/summit-api

Length of output: 191


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "=== Find SelectionPlan entity files ==="
fd -i "SelectionPlan\.php$" . || true

echo
echo "=== Search all occurrences of SubmissionPeriodDisclaimer ==="
rg -n "SubmissionPeriodDisclaimer" . || true

echo
echo "=== Show migration ALTER TABLE statement for SubmissionPeriodDisclaimer ==="
rg -n "ALTER TABLE `SelectionPlan`|SubmissionPeriodDisclaimer" database/migrations/model/Version20260603184510.php || true

Repository: OpenStackweb/summit-api

Length of output: 2490


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "=== Entity mapping: app/Models/Foundation/Summit/SelectionPlan.php around SubmissionPeriodDisclaimer ==="
nl -ba app/Models/Foundation/Summit/SelectionPlan.php | sed -n '120,180p'

echo
echo "=== Migration file: database/migrations/model/Version20260603184510.php (up/down) ==="
nl -ba database/migrations/model/Version20260603184510.php | sed -n '1,120p'

echo
echo "=== Repo collation references (utf8mb4_unicode_ci / utf8mb4_general_ci) ==="
rg -n "utf8mb4_unicode_ci|utf8mb4_general_ci" . || true

Repository: OpenStackweb/summit-api

Length of output: 233


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "=== Entity mapping around app/Models/Foundation/Summit/SelectionPlan.php (140-170) ==="
cat -n app/Models/Foundation/Summit/SelectionPlan.php | sed -n '130,175p'

echo
echo "=== Migration file around database/migrations/model/Version20260603184510.php (1-80) ==="
cat -n database/migrations/model/Version20260603184510.php | sed -n '1,120p'

echo
echo "=== Migration file: find the exact ALTER statement line(s) ==="
rg -n "ALTER TABLE `SelectionPlan`|SubmissionPeriodDisclaimer" database/migrations/model/Version20260603184510.php

echo
echo "=== Collation references in repo (utf8mb4_unicode_ci / utf8mb4_general_ci) ==="
rg -n "utf8mb4_unicode_ci|utf8mb4_general_ci" . || true

Repository: OpenStackweb/summit-api

Length of output: 4496


Fix Doctrine mapping for SubmissionPeriodDisclaimer (type + nullability)

  • Migration database/migrations/model/Version20260603184510.php sets SelectionPlan.SubmissionPeriodDisclaimer to TEXT ... NULL.
  • Entity app/Models/Foundation/Summit/SelectionPlan.php declares #[ORM\Column(name: 'SubmissionPeriodDisclaimer', type: 'string')] (Doctrine stringVARCHAR(255) by default) and does not mark it nullable—so ORM metadata won’t match the actual schema.
📝 Proposed fix for the entity mapping
-    #[ORM\Column(name: 'SubmissionPeriodDisclaimer', type: 'string')]
+    #[ORM\Column(name: 'SubmissionPeriodDisclaimer', type: 'text', nullable: true)]
     private $submission_period_disclaimer;
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@database/migrations/model/Version20260603184510.php` around lines 26 - 29,
The entity mapping for SelectionPlan.SubmissionPeriodDisclaimer doesn't match
the migration: update the ORM mapping in
app/Models/Foundation/Summit/SelectionPlan.php so the property
SubmissionPeriodDisclaimer is declared as type: 'text' and nullable: true (e.g.
change #[ORM\Column(name: 'SubmissionPeriodDisclaimer', type: 'string')] to
#[ORM\Column(name: 'SubmissionPeriodDisclaimer', type: 'text', nullable: true)]
and remove any length restriction), ensuring Doctrine metadata matches the ALTER
TABLE in Version20260603184510.php; after the change, run your schema validation
or tests to confirm no metadata/schema drift remains.

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.

1 participant