fix(core): 코어 업데이트 spawn 자식의 config 캐시 오판 3건 수정 + 컨테이너 보존 래퍼 전수
7.0.9 클린 설치본에서 7.0.10 으로 올리자 업그레이드 스텝 단계가 "부모 메모리 stale" 로 중단됐다. 스텝 자식은 부모가 비우지 않은 이전 버전 config 캐시로 부팅해 env APP_VERSION 오버라이드와 신버전 config/app.php 의 update 목록을 모두 보지 못한다. 이전 릴리즈에서는 자식 진입부의 config:cache 가 전역 Container 를 일회용 앱으로 바꿔 놓는 부수효과로 가드가 우연히 침묵했고, 그 부수효과를 걷어낸 withPreservedContainer 가 잠복 결함을 드러냈다. - stale 가드는 CoreVersionChecker::getCoreVersion(env 우선) 으로 판독 - 부모는 spawn 직전 config 캐시를 비우고, 자식은 캐시 파일이 있으면 디스크 config 를 직접 읽는다 (7.0.10 이 추가한 public/build/ext 쓰기 권한 정상화 누락 차단) - route:cache 도 같은 부수효과를 남기므로 RouteCacheHelper·optimizeSystem 을 보존 래퍼로 감쌌다 (단독 스텝 재실행·시스템 최적화 뒤 정적 재게시 예약 소실) - 과거 업그레이드 사고 14부류를 7.0.10 변경과 대조 — 재발 조건은 위 3건뿐 - audit 룰 fresh-app-artisan-call-outside-cache-helper + 픽스처, 회귀 테스트 6건(수정 전 red)
This commit is contained in:
1 parent
b79e082ca3
commit
67cae00dd8
15 files changed
+477
-10
No files matched your search
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Unit\Services;
|
||||
|
||||
use App\Services\CoreUpdateService;
|
||||
use PHPUnit\Framework\Attributes\Test;
|
||||
use Tests\TestCase;
|
||||
|
||||
/**
|
||||
* spawn 자식은 부모가 비우지 않은 이전 버전 config 캐시로 부팅할 수 있다. 그 상태에서
|
||||
* `config('app.update.*')` 는 캐시에 박힌 옛 목록이라, 신버전이 추가한 쓰기 권한 디렉토리
|
||||
* (7.0.10 의 `public/build/ext`) 가 자식의 권한 정상화에서 빠진다 (2026-09-06 서버 실측).
|
||||
* `freshDiskUpdateConfig()` 는 디스크의 `config/app.php` 를 직접 읽어 그 목록을 돌려준다.
|
||||
*/
|
||||
class CoreUpdateServiceFreshDiskConfigTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* @effects execute_upgrade_steps_child_reads_update_config_from_disk_when_config_is_cached
|
||||
*/
|
||||
#[Test]
|
||||
public function 메모리_config_가_stale_해도_디스크의_update_목록을_돌려준다(): void
|
||||
{
|
||||
config(['app.update.restore_ownership_group_writable' => ['stale-only']]);
|
||||
|
||||
$fresh = app(CoreUpdateService::class)->freshDiskUpdateConfig('restore_ownership_group_writable');
|
||||
|
||||
$this->assertNotSame(['stale-only'], $fresh);
|
||||
$this->assertContains('public/build/ext', $fresh, '디스크 config/app.php 의 목록을 읽어야 한다');
|
||||
$this->assertContains('bootstrap/cache', $fresh);
|
||||
}
|
||||
|
||||
/**
|
||||
* @effects execute_upgrade_steps_child_reads_update_config_from_disk_when_config_is_cached
|
||||
*/
|
||||
#[Test]
|
||||
public function 없는_키는_기본값을_돌려준다(): void
|
||||
{
|
||||
$this->assertSame(['x'], app(CoreUpdateService::class)->freshDiskUpdateConfig('no_such_key_'.uniqid(), ['x']));
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user