Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions config/database.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
'username' => env('SS_DB_USERNAME'),
'password' => env('SS_DB_PASSWORD'),
'port' => env('SS_DB_PORT', 3306),
'charset' => env('SS_DB_CHARSET', 'utf8'),
'collation' => env('SS_DB_COLLATION', 'utf8_unicode_ci'),
'charset' => env('SS_DB_CHARSET', 'utf8mb4'),
'collation' => env('SS_DB_COLLATION', 'utf8mb4_unicode_ci'),
'prefix' => env('SS_DB_PREFIX', ''),
'serverVersion' => env('DB_SERVER_VERSION', '8.0.43')
];
Expand Down Expand Up @@ -61,8 +61,8 @@
'username' => env('SS_DB_USERNAME'),
'password' => env('SS_DB_PASSWORD'),
'port' => env('SS_DB_PORT', 3306),
'charset' => env('SS_DB_CHARSET', 'utf8'),
'collation' => env('SS_DB_COLLATION', 'utf8_unicode_ci'),
'charset' => env('SS_DB_CHARSET', 'utf8mb4'),
'collation' => env('SS_DB_COLLATION', 'utf8mb4_unicode_ci'),
'prefix' => env('SS_DB_PREFIX', ''),
'serverVersion' => env('DB_SERVER_VERSION', '8.0.43')
];
Expand Down
39 changes: 39 additions & 0 deletions database/migrations/model/Version20260603184510.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<?php namespace Database\Migrations\Model;

/**
* Copyright 2026 OpenStack Foundation
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
**/

use Doctrine\Migrations\AbstractMigration;
use Doctrine\DBAL\Schema\Schema as Schema;

class Version20260603184510 extends AbstractMigration
{
/**
* @param Schema $schema
*/
public function up(Schema $schema): void
{
$sql = <<<SQL
ALTER TABLE `SelectionPlan` MODIFY SubmissionPeriodDisclaimer TEXT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL;
SQL;
$this->addSql($sql);
Comment on lines +26 to +29
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.

}

/**
* @param Schema $schema
*/
public function down(Schema $schema): void
{

}
}
38 changes: 38 additions & 0 deletions tests/oauth2/OAuth2SummitSelectionPlansApiTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,44 @@ public function testUpdateSelectionPlan()
$this->assertEquals($is_hidden, $selectionPlan->is_hidden);
}

public function testUpdateSelectionPlanWithEmojiInDisclaimer()
{
// Regression: SubmissionPeriodDisclaimer column was utf8 (3-byte), which rejected U+1F4C5 (📅)
$disclaimer = "Submit before the deadline \u{1F4C5}";

$params = [
'id' => self::$summit->getId(),
'selection_plan_id' => self::$default_selection_plan->getId(),
];

$data = [
'submission_period_disclaimer' => $disclaimer,
];

$response = $this->action(
"PUT",
"OAuth2SummitSelectionPlansApiController@updateSelectionPlan",
$params,
[],
[],
[],
$this->getHeaders(),
json_encode($data)
);

$content = $response->getContent();
$this->assertResponseStatus(201);
$selectionPlan = json_decode($content);
$this->assertNotNull($selectionPlan);
$this->assertEquals($disclaimer, $selectionPlan->submission_period_disclaimer);

// Verify the value was actually persisted and reads back identically
$repository = self::$em->getRepository(\App\Models\Foundation\Summit\SelectionPlan::class);
self::$em->clear();
$persisted = $repository->find(self::$default_selection_plan->getId());
$this->assertEquals($disclaimer, $persisted->getSubmissionPeriodDisclaimer());
}

public function testAttachPresentationType()
{
$params = [
Expand Down
Loading