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,65 @@
|
||||
<?php
|
||||
|
||||
namespace App\Search\DTO;
|
||||
|
||||
/**
|
||||
* FULLTEXT 인덱스 정의 (Value Object)
|
||||
*
|
||||
* `INFORMATION_SCHEMA` + `SHOW CREATE TABLE` 에서 읽어 온 실제 인덱스 구성입니다.
|
||||
* 재생성 시 이 값을 그대로 다시 써서 검색 동작이 달라지지 않게 합니다.
|
||||
*/
|
||||
readonly class FulltextIndexDefinition
|
||||
{
|
||||
/**
|
||||
* @param string $table 테이블명 (프리픽스 포함 — 스키마에서 읽은 실제 이름)
|
||||
* @param string $name 인덱스명
|
||||
* @param array<int, string> $columns 색인 컬럼 목록
|
||||
* @param string|null $parser 파서명 (예: ngram). 지정되지 않은 인덱스는 null
|
||||
*/
|
||||
public function __construct(
|
||||
public string $table,
|
||||
public string $name,
|
||||
public array $columns,
|
||||
public ?string $parser = null,
|
||||
) {}
|
||||
|
||||
/**
|
||||
* 백틱을 두른 테이블명을 반환합니다.
|
||||
*
|
||||
* @return string 예: `g7_pages`
|
||||
*/
|
||||
public function quotedTable(): string
|
||||
{
|
||||
return '`'.$this->table.'`';
|
||||
}
|
||||
|
||||
/**
|
||||
* 백틱을 두른 컬럼 목록을 반환합니다.
|
||||
*
|
||||
* @return string 예: `title`, `content`
|
||||
*/
|
||||
public function quotedColumns(): string
|
||||
{
|
||||
return '`'.implode('`, `', $this->columns).'`';
|
||||
}
|
||||
|
||||
/**
|
||||
* `ALTER TABLE ... ADD FULLTEXT` 에 붙일 파서 절을 반환합니다.
|
||||
*
|
||||
* @return string 파서가 없으면 빈 문자열
|
||||
*/
|
||||
public function parserClause(): string
|
||||
{
|
||||
return $this->parser === null ? '' : ' WITH PARSER '.$this->parser;
|
||||
}
|
||||
|
||||
/**
|
||||
* 사람이 읽는 식별자를 반환합니다.
|
||||
*
|
||||
* @return string 예: g7_pages.ft_pages_title
|
||||
*/
|
||||
public function label(): string
|
||||
{
|
||||
return $this->table.'.'.$this->name;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
<?php
|
||||
|
||||
namespace App\Search\DTO;
|
||||
|
||||
use App\Enums\SearchIndexStatus;
|
||||
|
||||
/**
|
||||
* 검색 인덱스 건강도 판정 결과 (Value Object · 엔진 중립)
|
||||
*
|
||||
* 어떤 엔진이든 공통으로 답할 수 있는 것만 필드로 둡니다 — 무엇을(`identifier`),
|
||||
* 어떤 상태로(`status`), 무엇을 근거로(`measurement`) 판정했는가.
|
||||
*
|
||||
* 엔진마다 다른 세부(FULLTEXT 의 테이블·컬럼·파서, 외부 엔진의 샤드·문서 수 등)는
|
||||
* `details` 에 담습니다. 코어가 그 내용을 해석하지 않으므로 새 엔진이 추가되어도
|
||||
* 코어를 고칠 일이 없습니다.
|
||||
*
|
||||
* `context` 는 엔진 구현이 재생성에 필요한 자기 정보를 실어 두는 자리입니다
|
||||
* (코어는 그대로 되돌려 줄 뿐 들여다보지 않습니다).
|
||||
*/
|
||||
readonly class SearchIndexHealth
|
||||
{
|
||||
/**
|
||||
* @param string $driver 판정을 만든 Scout 드라이버명
|
||||
* @param string $identifier 인덱스 식별자 (엔진 내에서 유일)
|
||||
* @param SearchIndexStatus $status 판정 등급
|
||||
* @param string $measurement 판정 근거 수치·사유 (사람이 읽는 한 줄)
|
||||
* @param array<string, mixed> $details 엔진별 부가 정보 (표시 전용)
|
||||
* @param array<string, mixed> $context 재생성에 필요한 엔진 내부 정보
|
||||
*/
|
||||
public function __construct(
|
||||
public string $driver,
|
||||
public string $identifier,
|
||||
public SearchIndexStatus $status,
|
||||
public string $measurement = '',
|
||||
public array $details = [],
|
||||
public array $context = [],
|
||||
) {}
|
||||
|
||||
/**
|
||||
* 재생성 대상인지 여부.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function needsRebuild(): bool
|
||||
{
|
||||
return $this->status === SearchIndexStatus::Stale;
|
||||
}
|
||||
|
||||
/**
|
||||
* 기계 판독용 배열로 반환합니다.
|
||||
*
|
||||
* `context` 는 엔진 내부 정보라 응답에 싣지 않습니다.
|
||||
*
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function toArray(): array
|
||||
{
|
||||
return [
|
||||
'driver' => $this->driver,
|
||||
'identifier' => $this->identifier,
|
||||
'status' => $this->status->value,
|
||||
'status_label' => $this->status->label(),
|
||||
'measurement' => $this->measurement,
|
||||
'details' => $this->details,
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,119 @@
|
||||
<?php
|
||||
|
||||
namespace App\Search\DTO;
|
||||
|
||||
/**
|
||||
* 검색 인덱스 재생성 실행 보고 (Value Object · 엔진 중립)
|
||||
*
|
||||
* 커맨드는 콘솔 출력으로, 컨트롤러는 API 응답으로 같은 값을 씁니다.
|
||||
*
|
||||
* `remaining` 은 재생성 **후 다시 점검한** 잔존 목록입니다 — "재생성했다" 와
|
||||
* "복구됐다" 는 다른 사실이라 따로 담습니다.
|
||||
*/
|
||||
readonly class SearchIndexRepairReport
|
||||
{
|
||||
/**
|
||||
* @param string $driver 대상 Scout 드라이버명
|
||||
* @param int $inspected 점검한 인덱스 수
|
||||
* @param array<int, string> $repaired 재생성 성공 인덱스 식별자
|
||||
* @param array<string, string> $failed 재생성 실패 [식별자 => 사유]
|
||||
* @param array<int, string> $remaining 재생성 후에도 색인 누락으로 남은 식별자
|
||||
* @param bool $available 이 엔진에서 점검을 수행할 수 있었는지
|
||||
* @param string|null $reason 수행 불가 사유 (available=false 일 때)
|
||||
*/
|
||||
public function __construct(
|
||||
public string $driver,
|
||||
public int $inspected = 0,
|
||||
public array $repaired = [],
|
||||
public array $failed = [],
|
||||
public array $remaining = [],
|
||||
public bool $available = true,
|
||||
public ?string $reason = null,
|
||||
) {}
|
||||
|
||||
/**
|
||||
* 점검을 수행할 수 없었던 경우의 보고를 만듭니다.
|
||||
*
|
||||
* @param string $driver 드라이버명
|
||||
* @param string|null $reason 사유
|
||||
* @return self
|
||||
*/
|
||||
public static function unavailable(string $driver, ?string $reason): self
|
||||
{
|
||||
return new self(driver: $driver, available: false, reason: $reason);
|
||||
}
|
||||
|
||||
/**
|
||||
* 재생성 대상이 없었을 때의 보고를 만듭니다.
|
||||
*
|
||||
* @param string $driver 드라이버명
|
||||
* @param int $inspected 점검한 인덱스 수
|
||||
* @return self
|
||||
*/
|
||||
public static function nothingToDo(string $driver, int $inspected): self
|
||||
{
|
||||
return new self(driver: $driver, inspected: $inspected);
|
||||
}
|
||||
|
||||
/**
|
||||
* 재생성을 실제로 수행했는지 여부.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function didRebuild(): bool
|
||||
{
|
||||
return $this->repaired !== [] || $this->failed !== [];
|
||||
}
|
||||
|
||||
/**
|
||||
* 전부 복구되었는지 여부 (실패·잔존 모두 없음).
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isClean(): bool
|
||||
{
|
||||
return $this->failed === [] && $this->remaining === [];
|
||||
}
|
||||
|
||||
/**
|
||||
* 한 줄 요약을 반환합니다.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function summary(): string
|
||||
{
|
||||
if (! $this->available) {
|
||||
return $this->reason ?? __('search.index.unavailable', ['driver' => $this->driver]);
|
||||
}
|
||||
|
||||
if (! $this->didRebuild()) {
|
||||
return __('search.index.report.nothing_to_do', ['count' => $this->inspected]);
|
||||
}
|
||||
|
||||
return __('search.index.report.rebuilt', [
|
||||
'inspected' => $this->inspected,
|
||||
'repaired' => count($this->repaired),
|
||||
'failed' => count($this->failed),
|
||||
'remaining' => count($this->remaining),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 기계 판독용 배열로 반환합니다.
|
||||
*
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function toArray(): array
|
||||
{
|
||||
return [
|
||||
'driver' => $this->driver,
|
||||
'available' => $this->available,
|
||||
'reason' => $this->reason,
|
||||
'inspected' => $this->inspected,
|
||||
'repaired' => $this->repaired,
|
||||
'failed' => $this->failed,
|
||||
'remaining' => $this->remaining,
|
||||
'summary' => $this->summary(),
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user