fix(core,installer): dev vendor 설치본의 코어 업데이트 중단 수정 — stale 패키지 매니페스트 3계층

Laravel PackageManifest 는 bootstrap/cache/packages.php 가 있으면 stale 여부를 검사하지
않고 그대로 읽어 등재된 provider 를 new 한다. 코어 업데이트는 Step 6/8 에서 vendor 를
--no-dev 로 교체하지만 그 파일은 Step 11 까지 이전 설치본의 것이 남으므로, 옵션 없는
`composer install` 로 깔린 사이트에서는 Step 10 spawn 자식이 새 vendor 에 없는 provider 를
찾다 부팅 단계에서 죽는다. 부팅 전이라 앱 로그에 흔적이 없고 부모에게는 자식의 비정상
종료로만 보여, 운영자에게는 「Class ... not found」 와 수동 재개 안내만 남는다.
(sir.kr 커뮤니티 제보, 7.0.9 → 7.0.10)

3계층으로 막는다.

 1. 부모 — spawn 직전 PackageManifestCacheHelper::clear
 2. 자식 — bootstrap/app.php 가 G7_UPDATE_IN_PROGRESS 를 보고 스스로 정리한다.
 이미 배포된 7.0.9·7.0.10 부모는 고칠 수 없으므로 그 아래에서 도는 신버전
 자식의 유일한 방어다. App\ 클래스를 참조하지 않고 실패는 무시한다.
 3. 범위 — CoreVersionChecker 의 env APP_VERSION 우선을 CoreUpdateContext 트리 안으로
 축소한다. 업데이트 전에 뜬 artisan serve·큐 워커가 옛 값을 물고 확장을
 incompatible_core 로 끄던 경로를 닫는다(관리자 템플릿이 대상이면 복구 UI
 자체에 도달할 수 없다).

업데이트 트리 판정은 App\Support\CoreUpdateContext 가 단독 소유하고
CoreServiceProvider::isCoreUpdateInProgress 는 위임으로 남는다. bootstrap/app.php 의
복제본은 부팅 전이라 불가피한 예외이며, 두 조건의 동형성을 테스트가 단언한다.

실측 중 드러난 결함 2건을 함께 고쳤다.

 - ConfigCacheHelper::withPreservedContainer 가 파사드 애플리케이션을 되돌리지 않아
 Step 11 이 `Target class [command.tinker] does not exist` 로 실패·롤백했다.
 - updateVersionInEnv 가 프로세스 환경을 갱신하지 않아 config 캐시에 이전 버전이 구워졌다
 (Laravel env 저장소가 불변이라 재부팅으로도 덮이지 않는다).

인스톨러는 재사용 vendor 의 개발용 패키지를 installed.json 으로 감지해 설치 환경 확인
카드·설치 로그로 알리되 설치를 차단하지 않고( 결정 D1), 재사용 경로에서도 컴파일 캐시를
정리한다. 실행되는 명령만이 아니라 실패 시 안내하는 수동 명령까지 --no-dev 로 맞췄다.
코어 업데이트 완료·핸드오프·단독 재개 사후 단계에서 queue:restart 신호를 보낸다(D3).

코어 7.0.10 → 7.0.11.
This commit is contained in:
HeuJung committed 2026-09-08 09:46:57 +09:00
1 parent 21177c8e17
commit ffab451b4a
42 files changed
+2660 -82

No files matched your search

@@ -165,6 +165,55 @@ class ExecuteUpgradeStepsStandaloneTest extends TestCase
$this->assertSame(0, $exitCode);
}
/**
* 캐시 정리 블록과 함께 상주 큐 워커 재시작 신호가 나간다 (7.0.11).
*
* 큐 워커는 부팅이 한 번뿐이라 코어 코드·config 를 기동 시점 상태로 물고 있다. 업데이트가
* 파일을 전부 교체해도 워커는 옛 코드로 잡을 계속 처리하며 그 사실이 오류로 드러나지 않는다.
*
* @effects core_update_step11_signals_queue_restart
*/
public function test_standalone_post_step_signals_queue_restart(): void
{
[$service, $module, $plugin, $template, $langPack] = $this->bindMocks();
$service->shouldReceive('runMigrations')->once();
$service->shouldReceive('reloadCoreConfigAndResync')->once();
$service->shouldReceive('runUpgradeSteps')->once();
$service->shouldReceive('updateVersionInEnv')->once();
$service->shouldReceive('clearAllCaches')->once();
$service->shouldReceive('signalQueueRestart')->once();
$service->shouldReceive('collectBundledExtensionUpdates')->once()->andReturn([
'modules' => [], 'plugins' => [], 'templates' => [],
]);
$langPack->shouldReceive('collectBundledLangPackUpdates')->once()->andReturn([]);
$this->assertSame(0, $this->runCommand([]));
}
/**
* 캐시 정리를 건너뛰는 경로(spawn 자식)에서는 신호도 보내지 않는다 — 부모가 보낸다.
*
* @effects core_update_step11_signals_queue_restart
*/
public function test_skip_cache_clear_also_skips_queue_restart_signal(): void
{
[$service, $module, $plugin, $template, $langPack] = $this->bindMocks();
$service->shouldReceive('runMigrations')->once();
$service->shouldReceive('reloadCoreConfigAndResync')->once();
$service->shouldReceive('runUpgradeSteps')->once();
$service->shouldReceive('updateVersionInEnv')->once();
$service->shouldNotReceive('clearAllCaches');
$service->shouldNotReceive('signalQueueRestart');
$service->shouldReceive('collectBundledExtensionUpdates')->once()->andReturn([
'modules' => [], 'plugins' => [], 'templates' => [],
]);
$langPack->shouldReceive('collectBundledLangPackUpdates')->once()->andReturn([]);
$this->assertSame(0, $this->runCommand(['--skip-cache-clear' => true]));
}
public function test_skip_bundled_updates_option_bypasses_bundled_prompt(): void
{
[$service, $module, $plugin, $template, $langPack] = $this->bindMocks();
@@ -457,6 +506,9 @@ class ExecuteUpgradeStepsStandaloneTest extends TestCase
// 종료부의 빈 격리 디렉토리 청소(7.0.10 도입)도 모든 경로에서 호출된다 — 전용 케이스가
// once() 로 단언하고, 나머지 케이스는 기본 허용.
$service->shouldReceive('sweepEmptyStagingDirectories')->andReturn(0)->byDefault();
// 캐시 정리 블록이 도는 경로에서는 상주 큐 워커 재시작 신호도 함께 나간다 (7.0.11 도입).
// 전용 케이스가 once()/never() 로 단언하고, 나머지 케이스는 기본 허용.
$service->shouldReceive('signalQueueRestart')->andReturnNull()->byDefault();
$module = Mockery::mock(ModuleManager::class);
$plugin = Mockery::mock(PluginManager::class);
$template = Mockery::mock(TemplateManager::class);