fix(core): 레이아웃 버전 변경량 계산의 메모리 초과와 편집기 확장 편집·재로드·충돌 안내·버전 기록 결함 수정

- 버전 이력 변경량(+N/-N 줄) 계산이 변경 영역 (줄 수)² 크기의 LCS 표를 만들어
 큰 공통 레이아웃의 첫 편집기 저장이 PHP 기본 메모리 한도(128M) 서버에서
 500 으로 끝났다. 두 행 DP 로 길이만 구하도록 바꿔 메모리가 줄 수에 비례하고
 표시 숫자는 종전과 같다(참조 구현 동치·메모리 상한 회귀 테스트)
- 확장 편집 모드 저장이 overlay 확장의 injections 를 비우던 결함: 서버가 주입
 노드 출처 메타에 injection 순번을 싣고, 편집기는 그 순번(없으면 원본 노드 id)
 으로 되돌리며, 되돌릴 수 없는 노드가 있으면 저장하지 않고 안내한다
- 서빙 캐시 키를 서버 현재 확장 캐시 버전으로만 조립해 저장·복원 두 번째부터
 재로드·「최신 불러오기」가 옛 내용을 받던 결함 수정(요청 v 는 HTTP 캐시 우회용)
- 409 충돌 안내가 errors 아래의 버전을 읽지 못해 「최신 버전: -1」 로 표시되던
 결함을 세 저장 경로 공용 판독으로 수정
- 버전 저장 시 저장자를 기록하고, 복원 시에도 잠금 번호를 올린다
- 회귀 테스트(PHPUnit·Vitest), 트러블슈팅 사례 32~34, 규정·API 문서, ja 언어팩,
 편집기 번들 재빌드, 이력 문서 동반
This commit is contained in:
HeuJung committed 2026-09-09 12:19:12 +09:00
1 parent 72f46a6468
commit 0b6f329249
34 files changed
+1080 -97

No files matched your search

@@ -5,6 +5,7 @@ namespace Tests\Unit\Repositories;
use App\Models\LayoutExtension;
use App\Models\Template;
use App\Models\TemplateLayoutExtensionVersion;
use App\Models\User;
use App\Repositories\LayoutExtensionVersionRepository;
use Illuminate\Database\Eloquent\ModelNotFoundException;
use Illuminate\Foundation\Testing\RefreshDatabase;
@@ -212,4 +213,37 @@ class LayoutExtensionVersionRepositoryTest extends TestCase
$this->assertSame([], $this->repository->getCurrentVersionsByExtensionIds([]));
$this->assertSame([], $this->repository->getCurrentVersionsByExtensionIds([$this->extension->id]));
}
/**
* saveVersion 은 인증 사용자를 created_by 로 기록한다(레이아웃 본체와 동형).
*/
public function test_save_version_records_authenticated_user_as_creator(): void
{
$user = User::factory()->create();
$this->actingAs($user);
$version = $this->repository->saveVersion($this->extension->id, ['extension_point' => 'header', 'components' => []]);
$this->assertSame($user->id, $version->created_by);
}
/**
* restoreVersion 은 확장 lock_version 을 올린다(레이아웃 본체와 동형).
*/
public function test_restore_version_increments_extension_lock_version(): void
{
$oldContent = ['extension_point' => 'header', 'components' => [['type' => 'basic', 'name' => 'Span']]];
$this->extension->forceFill(['lock_version' => 2, 'content' => ['extension_point' => 'footer']])->save();
$target = TemplateLayoutExtensionVersion::factory()->create([
'extension_id' => $this->extension->id,
'version' => 1,
'content' => $oldContent,
]);
$this->repository->restoreVersion($this->extension->id, $target->id);
$this->extension->refresh();
$this->assertSame(3, (int) $this->extension->lock_version);
$this->assertEquals($oldContent, $this->extension->content);
}
}