feat(core,admin_basic): 번들 비-ko 언어팩 자동 프로비저닝 + 미설치·드리프트 발견성

신규 설치/복구 시 비-ko/en 번들 언어팩(ja 등)이 자동으로 채워지지 않아
런타임에 오류 없이 조용히 ko 로 폴백하고, 운영자가 이를 알아채기 어려웠다.
두 결손을 함께 해소한다.

프로비저닝(SSoT):
- language-pack:provision 멱등 커맨드 신설. supported_locales ∖ {ko,en} 의
 미설치 번들 팩을 설치하고, 설치본 파일이 사라진 드리프트 팩(슬롯 점유로
 getUninstalledBundledPacks 가 못 잡는)도 복구 경로로 겸한다. 재실행 시 0건 수렴.

발견성:
- CLI language-pack:list 를 Service::list 경유로 전환해 미설치(uninstalled)와
 드리프트(active·파일 없음)를 함께 표면화.
- files_missing / bundled_source_available 파생 플래그를 Resource 에 노출.
- 관리자 언어팩 목록에 "파일 없음" 배지 + 원클릭 재설치(기존 install-bundled 모달
 재사용). 재설치 경로만 auto_activate 로 바인딩해 복구 후 active 를 유지한다.

회귀 방지:
- 정적 룰 lang-pack-supported-locale-has-bundle(선언 로케일 ↔ 번들 소스 부재) 신설,
 lang-pack-installed-version-drift 를 프로비저닝된 환경 한정으로 확장.
- 백엔드/레이아웃/E2E/시나리오 테스트 + 룰 fixture 추가.

부수 수정:
- 프로비저닝 작업 중 표면화된 ecommerce 언어팩 시더 테스트 격리결함 수정
 (modules 등록 행을 매 테스트가 직접 보장 — 프로세스당 1회 시딩 전제 붕괴 대응).
This commit is contained in:
HeuJung committed 2026-07-27 14:58:48 +09:00
1 parent 6b791679a6
commit 3d8890b118
23 files changed
+1574 -30

No files matched your search

+20 -5
View File
@@ -3,9 +3,12 @@
namespace App\Http\Resources;
use App\Enums\LanguagePackOrigin;
use App\Extension\Helpers\ChangelogParser;
use App\Helpers\TimezoneHelper;
use Carbon\Carbon;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\App;
use Illuminate\Support\Facades\DB;
/**
* 언어팩 단건 API 리소스.
@@ -46,6 +49,8 @@ class LanguagePackResource extends BaseApiResource
'github_changelog_url' => $this->resolveManifestField('github_changelog_url'),
'bundled_identifier' => $this->getValue('bundled_identifier'),
'install_blocked_reason' => $this->getValue('install_blocked_reason'),
'files_missing' => (bool) $this->getValue('files_missing', false),
'bundled_source_available' => (bool) $this->getValue('bundled_source_available', false),
'target_name' => $this->resolveTargetName(),
'installed_at' => $this->formatTimestamp('installed_at'),
'activated_at' => $this->formatTimestamp('activated_at'),
@@ -82,7 +87,7 @@ class LanguagePackResource extends BaseApiResource
return null;
}
$locale = \Illuminate\Support\Facades\App::getLocale();
$locale = App::getLocale();
$fallback = (string) config('app.fallback_locale', 'ko');
foreach ([$locale, $fallback, 'ko', 'en'] as $candidate) {
@@ -153,7 +158,7 @@ class LanguagePackResource extends BaseApiResource
$directoryPath = str_replace(base_path().DIRECTORY_SEPARATOR, '', $directory);
$changelogPath = $directory.DIRECTORY_SEPARATOR.'CHANGELOG.md';
if (is_file($changelogPath)) {
$changelogEntries = \App\Extension\Helpers\ChangelogParser::parse($changelogPath);
$changelogEntries = ChangelogParser::parse($changelogPath);
}
} catch (\Throwable $e) {
$directoryPath = null;
@@ -185,6 +190,10 @@ class LanguagePackResource extends BaseApiResource
* 미설치 번들 가상 행(`status === uninstalled`)은 활성/비활성/제거 액션이
* 무의미하므로 `can_install` 만 노출합니다. 모듈/플러그인 행 액션과 동일 패턴.
*
* 드리프트 행(설치본 파일 부재 + 번들 소스 실재)은 설치 행이지만 "재설치로 복구" 가
* 유효한 액션이므로 `can_install` 을 함께 노출합니다. 이 플래그가 없으면 화면이
* 복구 버튼을 켤 근거가 없어, 드리프트가 보이기만 하고 고칠 수 없는 상태로 남습니다.
*
* @return array<string, string>
*/
protected function abilityMap(): array
@@ -195,11 +204,17 @@ class LanguagePackResource extends BaseApiResource
];
}
return [
$map = [
'can_activate' => 'core.language_packs.manage',
'can_deactivate' => 'core.language_packs.manage',
'can_uninstall' => 'core.language_packs.manage',
];
if ($this->getValue('files_missing') && $this->getValue('bundled_source_available')) {
$map['can_install'] = 'core.language_packs.install';
}
return $map;
}
/**
@@ -248,7 +263,7 @@ class LanguagePackResource extends BaseApiResource
return null;
}
$row = \Illuminate\Support\Facades\DB::table($table)
$row = DB::table($table)
->where('identifier', $target)
->first(['name']);
if (! $row || ! $row->name) {
@@ -260,7 +275,7 @@ class LanguagePackResource extends BaseApiResource
return is_string($row->name) ? $row->name : null;
}
$locale = \Illuminate\Support\Facades\App::getLocale();
$locale = App::getLocale();
return $decoded[$locale] ?? $decoded[config('app.fallback_locale', 'ko')] ?? (reset($decoded) ?: null);
}