feat(message_bizppurio): 알림 템플릿 편집 통합·검수 의견·관리탭 개선 및 언어팩 번역 보존 결함군 수정
비즈뿌리오 알림톡 UX 개편 후속: - 코어/게시판/이커머스 알림 템플릿 [편집] 모달에 확장 채널 편집 영역 (extension_point 2종 + hidden_template_editor 채널 메타)을 신설하고, 알림톡 템플릿·문자(SMS)·수신자 규칙을 한 창에서 통합 저장하도록 개정 (행 하단은 상태 요약 전용, 승인 여부 2단 배지) - 검수 신청에 검수자 전달 의견(comment) 동봉 — kapi request 로만 전달, 행에는 저장하지 않음 (FormRequest 신설 + API 문서 백필) - 관리 탭 모바일 카드뷰·도구줄 코어 관례 통일, 사이트맵 알림 정의 다국어 라벨 결측 수정 + 코어 정의 라벨 패리티 테스트 신설 언어팩 번역 소실·보존 결함군 (보완 실측 → 커밋 전 점검에서 연쇄 확정, 전부 실패 테스트 선행 후 수정): - [기본값 복원]이 활성 언어팩 번역(ja)을 영구 소실 → 복원 기본값에 시딩과 같은 주입기(SSoT)로 팩 로케일 병합 (notification·identity) - 코어 알림/본인인증 시더의 언어팩 주입 전면 불능 → 주입기가 연관/리스트 양형태 수용 + identity 시더의 config 복합 키 보존 - 실패한 언어팩 업데이트가 active 팩을 installed 로 방치 → 상태 복원 확장 - 병합·제거의 사용자 수정 보존 판정 사문(연관 전제 isset) → dot-path 판정 교정, 팩 주입 저장의 user_overrides 오염 차단(시딩 바인딩), 템플릿 2모델 translatableTrackableFields 선언(beta.4 설계 누락), 같은 프로세스 활성화 시 시더 번역 필터 stale(캡처 인스턴스 캐시) 교정 - 7.0.9 업그레이드 스텝 신설 — 활성 팩 seed 재동기화로 기설치본의 소실 번역 자동 복구 (멱등·운영자 수정 보존·팩별 실패 격리)
This commit is contained in:
1 parent
40f62e79aa
commit
e7fa1b5535
71 files changed
+7155
-8693
No files matched your search
@@ -98,12 +98,15 @@ class SyncDatabaseTranslationsTest extends TestCase
|
||||
public function test_case_b_skips_locale_when_user_overrides_registered(): void
|
||||
{
|
||||
// Permission 은 HasUserOverrides 미사용이므로 Role 로 검증 (Role/Menu/Notification 모두 동일 정책)
|
||||
// user_overrides 는 실제 생산 형식(운영자 수정 시 updating 이벤트가 기록하는
|
||||
// dot-path 리스트 "{column}.{locale}")으로 둔다 — 과거 픽스처는 어떤 생산자도
|
||||
// 쓰지 않는 연관 형식이라 보존 판정 결함(isset 사문)을 green 으로 가렸다.
|
||||
$role = Role::query()->create([
|
||||
'identifier' => 'test_role_b',
|
||||
'name' => ['ko' => '바', 'en' => 'Bar', 'ja' => '사용자수정'],
|
||||
'description' => ['ko' => 'D', 'en' => 'D'],
|
||||
'is_active' => true,
|
||||
'user_overrides' => ['name' => ['updated_at' => now()->toIso8601String()]],
|
||||
'user_overrides' => ['name.ja'],
|
||||
]);
|
||||
|
||||
$pack = $this->setupPackWithPermissionsSeed([
|
||||
@@ -167,12 +170,13 @@ class SyncDatabaseTranslationsTest extends TestCase
|
||||
|
||||
public function test_deactivate_preserves_locale_when_user_overrides_registered(): void
|
||||
{
|
||||
// dot-path 리스트 = 실제 생산 형식 (test_case_b 주석 참조)
|
||||
$role = Role::query()->create([
|
||||
'identifier' => 'test_role_zed',
|
||||
'name' => ['ko' => '제드', 'en' => 'Zed', 'ja' => '사용자수정ja'],
|
||||
'description' => ['ko' => '', 'en' => ''],
|
||||
'is_active' => true,
|
||||
'user_overrides' => ['name' => ['updated_at' => now()->toIso8601String()]],
|
||||
'user_overrides' => ['name.ja'],
|
||||
]);
|
||||
|
||||
$pack = $this->setupPackWithPermissionsSeed([
|
||||
|
||||
@@ -0,0 +1,111 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Unit\Notifications;
|
||||
|
||||
use Tests\TestCase;
|
||||
|
||||
/**
|
||||
* 코어 소유 알림 정의 타입 ↔ 관리자 화면 라벨 패리티 (#597 후속, 2026-08-24)
|
||||
*
|
||||
* 관리자 알림 설정 화면의 정의 목록은 제목을 DB `name` 이 아니라 프론트 다국어 키
|
||||
* `admin.settings.notification_definitions.types.{type}` 로 렌더한다. 이 네임스페이스의
|
||||
* 코어 소유분은 admin 템플릿(sirsoft-admin_basic)의 `lang/partial/{ko,en}/admin.json` 이
|
||||
* 공급한다(모듈 소유 타입은 각 모듈의 화면·lang 이 담당).
|
||||
*
|
||||
* 키가 없으면 예외도 경고도 없이 원시 키 문자열이 화면 제목으로 그대로 노출된다
|
||||
* (실사례: sitemap_regenerated / sitemap_regenerate_failed — #481 이 config 정의만 추가하고
|
||||
* 템플릿 라벨을 누락). config/core.php 에 정의를 추가하는 커밋이 라벨을 빠뜨리는 일이
|
||||
* 재발하지 않도록, 코어 정의 전수를 양 로케일 라벨과 대조한다.
|
||||
*
|
||||
* 마커는 로케일별 테스트 메서드 docblock 에 있다 (@scenario 는 docblock 당 1조합).
|
||||
*/
|
||||
class NotificationDefinitionTypeLabelParityTest extends TestCase
|
||||
{
|
||||
/** 코어 소유 타입 라벨을 공급하는 admin 템플릿 lang partial */
|
||||
private const LABEL_FILES = [
|
||||
'ko' => 'templates/_bundled/sirsoft-admin_basic/lang/partial/ko/admin.json',
|
||||
'en' => 'templates/_bundled/sirsoft-admin_basic/lang/partial/en/admin.json',
|
||||
];
|
||||
|
||||
/**
|
||||
* 코어 정의 타입 전수가 ko 라벨을 가진다
|
||||
*
|
||||
* @scenario locale=ko
|
||||
*
|
||||
* @effects core_definition_types_have_admin_template_labels
|
||||
*/
|
||||
public function test_every_core_definition_type_has_ko_label(): void
|
||||
{
|
||||
$this->assertLabelsCoverCoreTypes('ko');
|
||||
}
|
||||
|
||||
/**
|
||||
* 코어 정의 타입 전수가 en 라벨을 가진다
|
||||
*
|
||||
* @scenario locale=en
|
||||
*
|
||||
* @effects core_definition_types_have_admin_template_labels
|
||||
*/
|
||||
public function test_every_core_definition_type_has_en_label(): void
|
||||
{
|
||||
$this->assertLabelsCoverCoreTypes('en');
|
||||
}
|
||||
|
||||
/**
|
||||
* 코어 정의 전수 ↔ 해당 로케일 라벨 대조
|
||||
*
|
||||
* @param string $locale 검사할 로케일 (ko|en)
|
||||
*/
|
||||
private function assertLabelsCoverCoreTypes(string $locale): void
|
||||
{
|
||||
$types = array_keys((array) config('core.notification_definitions'));
|
||||
|
||||
// 모집단 검증 — config 구조가 바뀌어 빈 배열이 되면 초록이 무의미하다.
|
||||
$this->assertGreaterThanOrEqual(
|
||||
5,
|
||||
count($types),
|
||||
'config/core.php notification_definitions 에서 코어 정의를 읽지 못했다 — 테스트 경로/구조 확인 필요'
|
||||
);
|
||||
|
||||
$relPath = self::LABEL_FILES[$locale];
|
||||
$labels = $this->loadTypeLabels($relPath);
|
||||
|
||||
$missing = array_values(array_filter(
|
||||
$types,
|
||||
fn (string $type) => ! array_key_exists($type, $labels)
|
||||
|| ! is_string($labels[$type])
|
||||
|| trim($labels[$type]) === ''
|
||||
));
|
||||
|
||||
$this->assertSame(
|
||||
[],
|
||||
$missing,
|
||||
"admin 템플릿 {$locale} 라벨 누락 — 알림 설정 화면 제목에 원시 키가 그대로 노출된다.\n"
|
||||
."{$relPath} 의 settings.notification_definitions.types 에 다음 타입을 추가할 것:\n"
|
||||
.implode(', ', $missing)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* partial admin.json 에서 타입 라벨 맵을 읽는다
|
||||
*
|
||||
* @param string $relPath 저장소 루트 기준 경로
|
||||
* @return array<string, mixed> 타입 → 라벨
|
||||
*/
|
||||
private function loadTypeLabels(string $relPath): array
|
||||
{
|
||||
$path = base_path($relPath);
|
||||
$this->assertFileExists($path, "라벨 파일이 없다: {$relPath}");
|
||||
|
||||
$data = json_decode((string) file_get_contents($path), true);
|
||||
$this->assertIsArray($data, "라벨 파일 JSON 파싱 실패: {$relPath}");
|
||||
|
||||
$labels = $data['settings']['notification_definitions']['types'] ?? null;
|
||||
$this->assertIsArray(
|
||||
$labels,
|
||||
"settings.notification_definitions.types 경로가 없다: {$relPath} — 파일 구조가 바뀌었으면 본 테스트의 경로를 갱신할 것"
|
||||
);
|
||||
|
||||
return $labels;
|
||||
}
|
||||
}
|
||||
@@ -34,13 +34,40 @@ class LanguagePackServiceTest extends TestCase
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
/** 실번들 케이스가 삭제하는 실 설치본의 백업 경로 (테스트 종료 시 복원). */
|
||||
private ?string $protectedRealInstallDir = null;
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
$this->service = $this->app->make(LanguagePackService::class);
|
||||
|
||||
// 실번들(g7-core-ja) 케이스들은 활성 설치본 디렉토리를 만들고 cleanup 에서 삭제한다.
|
||||
// DB 는 RefreshDatabase 로 격리되지만 파일 시스템은 실 저장소를 공유하므로,
|
||||
// 개발 환경에 이미 설치된 실 설치본이 있으면 백업해 두고 tearDown 에서 복원한다
|
||||
// (미보호 시 실환경 팩이 files_missing 드리프트에 빠진다 — 2026-08-24 실측).
|
||||
$realDir = base_path('lang-packs/g7-core-ja');
|
||||
if (File::isDirectory($realDir)) {
|
||||
$backup = base_path('lang-packs/.test-backup-g7-core-ja');
|
||||
File::deleteDirectory($backup);
|
||||
File::moveDirectory($realDir, $backup);
|
||||
$this->protectedRealInstallDir = $backup;
|
||||
}
|
||||
$this->registry = $this->app->make(LanguagePackRegistry::class);
|
||||
}
|
||||
|
||||
protected function tearDown(): void
|
||||
{
|
||||
if ($this->protectedRealInstallDir !== null) {
|
||||
$realDir = base_path('lang-packs/g7-core-ja');
|
||||
File::deleteDirectory($realDir);
|
||||
File::moveDirectory($this->protectedRealInstallDir, $realDir);
|
||||
$this->protectedRealInstallDir = null;
|
||||
}
|
||||
|
||||
parent::tearDown();
|
||||
}
|
||||
|
||||
/**
|
||||
* 테스트 언어팩 1건을 DB 에 직접 생성합니다.
|
||||
*
|
||||
@@ -1085,4 +1112,73 @@ class LanguagePackServiceTest extends TestCase
|
||||
File::deleteDirectory($path);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 회귀 가드 — performUpdate 중 설치 트랜잭션이 status 를 installed 로 기록한 뒤
|
||||
* (활성화 단계 이전/도중) 실패하면, catch 의 상태 복원이 Updating 만 보던 탓에
|
||||
* active 였던 팩이 installed 로 방치됐다. 파일은 백업으로 원상 복원되므로
|
||||
* 상태도 이전 상태(active)로 복원되어야 한다 — 방치되면 해당 로케일의 백엔드
|
||||
* 번역이 통째로 폴백되는데 오류도 로그도 없다 (#597 보완 실측에서 유사 상태 실측).
|
||||
*
|
||||
* @scenario vector=update_failure_after_install_transaction, actor_permission=cli_system
|
||||
*
|
||||
* @effects failed_update_restores_previous_active_status
|
||||
*/
|
||||
public function test_failed_update_restores_previous_active_status(): void
|
||||
{
|
||||
$identifier = 'test-update-restore-ja';
|
||||
$bundledDir = base_path('lang-packs/_bundled/'.$identifier);
|
||||
File::ensureDirectoryExists($bundledDir);
|
||||
File::put($bundledDir.'/language-pack.json', json_encode(['identifier' => $identifier]));
|
||||
|
||||
try {
|
||||
$pack = LanguagePack::query()->create([
|
||||
'identifier' => $identifier,
|
||||
'vendor' => 'test',
|
||||
'scope' => LanguagePackScope::Core->value,
|
||||
'target_identifier' => null,
|
||||
'locale' => 'ja',
|
||||
'locale_name' => 'Japanese',
|
||||
'locale_native_name' => '日本語',
|
||||
'text_direction' => 'ltr',
|
||||
'version' => '1.0.0',
|
||||
'status' => LanguagePackStatus::Active->value,
|
||||
'is_protected' => false,
|
||||
'manifest' => [],
|
||||
'source_type' => 'bundled',
|
||||
]);
|
||||
|
||||
// Laravel partialMock 은 생성자를 건너뛰어 readonly 의존성이 미초기화되므로,
|
||||
// 생성자 인자를 컨테이너에서 구성해 넘기는 Mockery partial 을 사용한다.
|
||||
$ctorArgs = array_map(
|
||||
static fn (\ReflectionParameter $param) => app($param->getType()->getName()),
|
||||
(new \ReflectionClass(LanguagePackService::class))->getConstructor()->getParameters()
|
||||
);
|
||||
$service = \Mockery::mock(LanguagePackService::class, $ctorArgs)->makePartial();
|
||||
$service->shouldReceive('installFromBundled')
|
||||
->once()
|
||||
->andReturnUsing(function () use ($pack) {
|
||||
// 설치 트랜잭션이 성공적으로 installed 를 기록한 직후 실패하는 상황 재현
|
||||
$pack->newQuery()->whereKey($pack->id)
|
||||
->update(['status' => LanguagePackStatus::Installed->value]);
|
||||
|
||||
throw new \RuntimeException('activate step failed (재현)');
|
||||
});
|
||||
|
||||
try {
|
||||
$service->performUpdate($pack->fresh(), true);
|
||||
$this->fail('installFromBundled 실패가 전파되어야 한다');
|
||||
} catch (\RuntimeException $e) {
|
||||
// 예상된 실패 — 상태 복원만 검증
|
||||
}
|
||||
|
||||
$this->assertSame(
|
||||
LanguagePackStatus::Active->value,
|
||||
$pack->fresh()->status,
|
||||
'실패한 update 는 이전 상태(active)를 복원해야 한다 — installed 로 방치되면 해당 로케일 번역이 조용히 폴백된다'
|
||||
);
|
||||
} finally {
|
||||
File::deleteDirectory($bundledDir);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user