fix(core,board,ecommerce,page,gdpr,ckeditor5,kginicis,admin_basic,basic): 목록 조회·검증 계층 정비 및 감사 지적 전건 처리
목록 조회 성능 축(깊은 OFFSET·정렬·색인)과 그 검증 계층에서 계획서 전수검수와 3회에 걸친 감사가 지적한 항목을 처리했다. 세부 경위는 의 각 회차 문서에 있다. 검증 계층 — 컨트롤러가 base Request 를 직접 주입받던 확장 13곳을 전용 FormRequest 로 옮겼다. 옮기면서 기존 동작 계약은 그대로 두었다: 상한 초과 limit 을 거부하지 않고 상한까지 반환하던 공개 API, per_page 를 범위로 조정하던 관리자 목록, 미지원 period 를 year 로 해석하던 인기글 목록 모두 종전과 같은 응답을 낸다. 상한/폴백을 rules 로 승격시키면 200 이던 응답이 422 가 되어 기존 링크가 깨지므로, 규칙은 타입만 닫고 클램프·폴백은 접근자가 맡는다. period 는 접근자가 닫힌 집합만 반환해 캐시 키 공간도 함께 닫힌다. ckeditor5 이미지 업로드만 ResponseHelper 봉투를 쓰지 않는다. 응답을 파싱하는 주체가 CDN 으로 로드되는 상위 CKEditor5 43.3.1 의 SimpleUploadAdapter 라 규약을 바꿀 수 없어, 각 응답 지점에 사유를 명시한 면제를 부착하고 근거를 API 문서에 남겼다. 하네스 — 룰 5개의 대상 경로 패턴이 매처와 맞지 않아 번들 확장 컨트롤러가 검사 대상에서 통째로 빠져 있었다. 패턴을 고치자 확장 위반 17건이 드러나 전건 처리했다. severity 오타가 요약 집계 양쪽에 안 잡혀 "0 error" 로 보고되던 문제도 런너 사전 검증으로 막았다. 정렬 게이트 대조 하네스는 관계 정렬 변형만 쓰는 저장소를 탐지하지 못한 채 통과시키고 있었다. 탐지·제외·인자 파싱을 함께 고치고 단위 테스트를 신설했다.
This commit is contained in:
1 parent
5f4a733b3b
commit
b10e89bef0
276 files changed
+12519
-1438
No files matched your search
@@ -0,0 +1,66 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
/**
|
||||
* 알림 발송 이력 목록의 정렬 컬럼(수신자명·제목)에 인덱스를 추가합니다.
|
||||
*
|
||||
* 목록은 지연 조인(PaginatesWithDeferredJoin)으로 페이지네이션되는데, 그 전제는
|
||||
* "정렬은 인덱스가 있는 닫힌 집합" 이다. 인덱스가 없으면 inner 쿼리도 전체 스캔이 되어
|
||||
* 깊은 OFFSET 개선 폭이 사라진다. 화면 정렬 셀렉트가 수신자명순·제목순을 제공하므로
|
||||
* 두 컬럼에 인덱스를 둔다.
|
||||
*
|
||||
* - recipient_name: 수신자명순 정렬
|
||||
* - subject: 제목순 정렬
|
||||
*/
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
if (! Schema::hasTable('notification_logs')) {
|
||||
return;
|
||||
}
|
||||
|
||||
$existingIndexes = array_column(Schema::getIndexes('notification_logs'), 'name');
|
||||
|
||||
Schema::table('notification_logs', function (Blueprint $table) use ($existingIndexes) {
|
||||
if (! in_array('idx_notification_logs_recipient_name', $existingIndexes)) {
|
||||
$table->index('recipient_name', 'idx_notification_logs_recipient_name');
|
||||
}
|
||||
|
||||
if (! in_array('idx_notification_logs_subject', $existingIndexes)) {
|
||||
$table->index('subject', 'idx_notification_logs_subject');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
if (! Schema::hasTable('notification_logs')) {
|
||||
return;
|
||||
}
|
||||
|
||||
$existingIndexes = array_column(Schema::getIndexes('notification_logs'), 'name');
|
||||
|
||||
Schema::table('notification_logs', function (Blueprint $table) use ($existingIndexes) {
|
||||
$indexes = [
|
||||
'idx_notification_logs_recipient_name',
|
||||
'idx_notification_logs_subject',
|
||||
];
|
||||
|
||||
foreach ($indexes as $index) {
|
||||
if (in_array($index, $existingIndexes)) {
|
||||
$table->dropIndex($index);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,86 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
/**
|
||||
* 코어 목록(활동 로그·알림 발송 이력·회원)의 정렬 색인 끝에 기본키를 덧붙입니다.
|
||||
*
|
||||
* 세 목록 모두 `created_at DESC, id DESC` 로 정렬한다. 색인이 `created_at` 에서 끝나면
|
||||
* 동률 구간의 `id` 순서를 인덱스로 만들 수 없어 filesort 가 붙고, 지연 조인의 inner 가
|
||||
* 인덱스 순서 그대로 끝나지 못해 깊은 OFFSET 개선 폭이 사라진다. 활동 로그처럼 같은 초에
|
||||
* 여러 건이 쌓이는 테이블에서 동률 구간은 예외가 아니라 일상이다.
|
||||
*
|
||||
* 필요한 색인은 계측 프로파일 선언(filters / order / soft_delete)에서 도출한 것이며,
|
||||
* `ListIndexCoverageTest` 가 같은 규칙으로 전 목록을 검사한다.
|
||||
*
|
||||
* - activity_logs : (created_at) → (created_at, id) 교체
|
||||
* - notification_logs : (created_at, id) 신설 (기존 정렬 색인 없음)
|
||||
* - users : (created_at) → (created_at, id) 교체
|
||||
*
|
||||
* 교체 대상 단일 색인은 새 색인의 좌측 프리픽스라 그대로 두면 쓰기 비용만 늘어난다.
|
||||
* 새 색인을 먼저 만들고 기존 색인을 나중에 지우므로, 중간에 중단되어도 조회가 색인 없이
|
||||
* 남는 구간은 없다.
|
||||
*/
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* 대상 [테이블 => [신규 색인명, 컬럼, 교체 대상 기존 색인명(없으면 null)]]
|
||||
*
|
||||
* @var array<string, array{0: string, 1: array<int, string>, 2: string|null}>
|
||||
*/
|
||||
private const TARGETS = [
|
||||
'activity_logs' => ['idx_activity_logs_created_id', ['created_at', 'id'], 'g7_activity_logs_created_at_index'],
|
||||
'notification_logs' => ['idx_notification_logs_created_id', ['created_at', 'id'], null],
|
||||
'users' => ['idx_users_created_id', ['created_at', 'id'], 'idx_users_created_at'],
|
||||
];
|
||||
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
foreach (self::TARGETS as $table => [$newIndex, $columns, $oldIndex]) {
|
||||
if (! Schema::hasTable($table)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$existing = array_column(Schema::getIndexes($table), 'name');
|
||||
|
||||
Schema::table($table, function (Blueprint $blueprint) use ($existing, $newIndex, $columns, $oldIndex) {
|
||||
if (! in_array($newIndex, $existing, true)) {
|
||||
$blueprint->index($columns, $newIndex);
|
||||
}
|
||||
|
||||
if ($oldIndex !== null && in_array($oldIndex, $existing, true)) {
|
||||
$blueprint->dropIndex($oldIndex);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
foreach (self::TARGETS as $table => [$newIndex, $columns, $oldIndex]) {
|
||||
if (! Schema::hasTable($table)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$existing = array_column(Schema::getIndexes($table), 'name');
|
||||
|
||||
Schema::table($table, function (Blueprint $blueprint) use ($existing, $newIndex, $oldIndex) {
|
||||
if ($oldIndex !== null && ! in_array($oldIndex, $existing, true)) {
|
||||
$blueprint->index(['created_at'], $oldIndex);
|
||||
}
|
||||
|
||||
if (in_array($newIndex, $existing, true)) {
|
||||
$blueprint->dropIndex($newIndex);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
Reference in new issue
Block a user