fix(core,engine): 확장 번들 503 판정을 선언 축에서 소실 축으로 교체

빈 번들 503 을 "에셋을 선언한 활성 확장이 있는데 결과가 비었다" 로 판정해,
스타일 규칙이 아직 없는 0바이트 CSS 만 선언된 기본 구성이 통째로 503 이 됐다.
file_get_contents 는 0바이트에서 false 가 아니라 '' 를 돌려주므로 읽기 실패
분기도 타지 않는다. 선언 축 게터는 전부 file_exists 게이트라 부재를 셀 수 없어,
존재 게이트가 없는 getDeclaredAssetAbsolutePaths 를 통로로 두고 503 의 근거를
소실 축(findMissingDeclaredAssets)으로 옮긴다. 존재하되 비었으면 빈 200 이다.

곁들여: 실패 배너 항목명을 내부 구분 키에서 사용자 어휘로(engine-v1.64.7),
봇 화면이 없는 템플릿 CSS 를 링크하지 않도록 실재 게이트, 매니페스트 자산
선언 드리프트 4건 정정.
This commit is contained in:
HeuJung committed 2026-09-04 15:36:33 +09:00
1 parent 482faf00be
commit 0833bd1f6a
42 files changed
+1207 -90

No files matched your search

@@ -174,6 +174,22 @@ export function getAssetFailures(): AssetFailure[] {
return Array.from(failures.values());
}
/**
* 자산 실패 안내에 쓰는 사용자 어휘를 번역합니다 (배너 밖 호출자용).
*
* 항목명(label)은 사용자 어휘여야 한다 — 내부 구분 키·식별자를 그대로 넘기면 배너에
* "module을(를) 불러오지 못했습니다" 처럼 내부 이름이 노출된다.
*
* @param key 번역 키
* @param fallback 번역 엔진 부재 시 사용할 문구
* @param params 치환 파라미터
* @return string 번역된 문자열
* @since engine-v1.64.7
*/
export function assetText(key: string, fallback: string, params?: Record<string, string | number>): string {
return t(key, fallback, params);
}
/**
* 등록된 실패 중 재시도 가능한 것을 모두 재시도합니다.
*
+18 -2
View File
@@ -9,10 +9,26 @@
import { createLogger } from '../utils/Logger';
import { loadScriptWithRetry, loadStylesheetWithRetry } from '../template-engine/networkResilience';
import { convertToCurrentMode, staticToLegacy } from '../support/assetUrl';
import { notifyAssetFailure } from '../assets/AssetFailureNotice';
import { assetText, notifyAssetFailure } from '../assets/AssetFailureNotice';
const logger = createLogger('ModuleAssetLoader');
/**
* 병합 CSS 번들의 실패 안내 항목명 (사용자 어휘).
*
* 번들 구분 키(`module`/`plugin`)는 내부 이름이다. 그대로 배너에 넘기면
* "module을(를) 불러오지 못했습니다" 처럼 사용자가 해석할 수 없는 문구가 된다.
*
* @param key 번들 구분 키 ('module' | 'plugin')
* @return string 사용자 어휘 항목명
* @since engine-v1.64.7
*/
function bundleCssLabel(key: string): string {
return key === 'plugin'
? assetText('core.assets.plugin_styles', '플러그인 스타일')
: assetText('core.assets.module_styles', '모듈 스타일');
}
/**
* 모듈 에셋 정보 인터페이스
*/
@@ -321,7 +337,7 @@ export class ModuleAssetLoader {
// 항상 실패한다 — 버튼은 있는데 아무것도 고치지 못하는 상태가 된다.
this.surfaceCssFailure(
`bundle-${key}`,
key,
bundleCssLabel(key),
legacyUrl !== null ? convertToCurrentMode(legacyUrl) : url,
error
);
@@ -5,7 +5,8 @@
*/
import { describe, it, expect, beforeEach, afterEach, vi } from 'vitest';
import { ModuleAssetLoader, type ModuleAsset } from '../ModuleAssetLoader';
import { ModuleAssetLoader, parseBundleUrlsFromConfig, type ModuleAsset } from '../ModuleAssetLoader';
import { clearAllAssetFailures, getAssetFailures } from '../../assets/AssetFailureNotice';
describe('ModuleAssetLoader', () => {
let loader: ModuleAssetLoader;
@@ -310,6 +311,9 @@ describe('ModuleAssetLoader', () => {
});
describe('loadBundle (서버측 병합 번들)', () => {
/**
* @effects loadbundle_single_script_single_link_append
*/
it('단일 script + 단일 link 를 1개씩만 append 한다', async () => {
const scriptAppends: string[] = [];
const linkAppends: string[] = [];
@@ -350,6 +354,9 @@ describe('ModuleAssetLoader', () => {
appendSpy.mockRestore();
});
/**
* @effects loadbundle_dedup_guard_no_double_load
*/
it('같은 key 를 중복 로드하지 않는다 (중복 가드)', async () => {
let scriptCount = 0;
// 실제 DOM 에 삽입해 element id 가 등록되어야 getElementById 중복 가드가 동작
@@ -370,6 +377,9 @@ describe('ModuleAssetLoader', () => {
appendSpy.mockRestore();
});
/**
* @effects loadbundle_null_urls_noop
*/
it('jsUrl/cssUrl 모두 null 이면 no-op', async () => {
const appendSpy = vi.spyOn(document.head, 'appendChild');
await expect(loader.loadBundle('module', null, null)).resolves.toBeUndefined();
@@ -379,6 +389,9 @@ describe('ModuleAssetLoader', () => {
});
describe('concat 자가등록 (IIFE 병합 계약)', () => {
/**
* @effects concat_iife_self_registration_preserved
*/
it(';\\n 로 이어붙인 2개 IIFE 가 모두 실행되어 레지스트리에 자가등록된다', () => {
// 모의 IIFE 2개 — ecommerce IIFE 처럼 세미콜론 없이 끝나도 `\n;\n` 구분자로 ASI 경계 보호
const registry: Record<string, unknown> = {};
@@ -478,6 +491,83 @@ describe('ModuleAssetLoader', () => {
loader.loadBundle('module', null, '/api/modules/bundle.css')
).resolves.toBeUndefined();
});
/**
* 배너 항목명은 사용자 어휘여야 한다 — 내부 구분 키(module/plugin)를 그대로
* 넘기면 "module을(를) 불러오지 못했습니다" 처럼 해석 불가한 문구가 노출된다.
*
* 테스트 환경에는 G7Core.t 가 없으므로 폴백 문구가 쓰인다.
*
* @effects bundle_css_failure_banner_uses_user_vocabulary
* @since engine-v1.64.7
*/
it('번들 CSS 실패 안내 항목명이 사용자 어휘다 (모듈)', async () => {
clearAllAssetFailures();
stubAssetLoading(['error', 'error', 'error']);
await loader.loadBundle('module', null, '/api/modules/bundle.css');
const failure = getAssetFailures().find(f => f.id === 'ext-css:bundle-module');
expect(failure).toBeDefined();
expect(failure!.label).toBe('모듈 스타일');
expect(failure!.label).not.toBe('module');
});
/**
* @effects bundle_css_failure_banner_uses_user_vocabulary
* @since engine-v1.64.7
*/
it('번들 CSS 실패 안내 항목명이 사용자 어휘다 (플러그인)', async () => {
clearAllAssetFailures();
stubAssetLoading(['error', 'error', 'error']);
await loader.loadBundle('plugin', null, '/api/plugins/bundle.css');
const failure = getAssetFailures().find(f => f.id === 'ext-css:bundle-plugin');
expect(failure).toBeDefined();
expect(failure!.label).toBe('플러그인 스타일');
expect(failure!.label).not.toBe('plugin');
});
});
/**
* bundleUrls 부재(구버전 blade) 시 개별 로딩으로 폴백한다.
*
* 폴백 판정은 파싱 결과가 null 인지로 이뤄진다(TemplateApp.loadExtensionAssets).
* null 이 아닌데 폴백하거나 그 반대면 확장 에셋이 통째로 로드되지 않는데, 오류도
* 경고도 남지 않는다.
*
* @effects missing_bundle_urls_falls_back_to_individual_loading
*/
describe('bundleUrls 부재 폴백 판정', () => {
afterEach(() => {
delete (window as any).G7Config;
});
it('G7Config 자체가 없으면 null 이다 (개별 로딩 폴백)', () => {
delete (window as any).G7Config;
expect(parseBundleUrlsFromConfig()).toBeNull();
});
it('G7Config 는 있으나 bundleUrls 가 없으면 null 이다 (개별 로딩 폴백)', () => {
(window as any).G7Config = { moduleAssets: [] };
expect(parseBundleUrlsFromConfig()).toBeNull();
});
it('bundleUrls 가 있으면 폴백하지 않는다 (번들 경로)', () => {
(window as any).G7Config = {
bundleUrls: { moduleJs: '/api/modules/bundle.js', moduleCss: null, pluginJs: null, pluginCss: null },
};
const urls = parseBundleUrlsFromConfig();
expect(urls).not.toBeNull();
expect(urls!.moduleJs).toContain('/api/modules/bundle');
});
});
describe('loadCSS in-flight Promise 공유', () => {
@@ -5,6 +5,14 @@
>
> 형식: [Keep a Changelog](https://keepachangelog.com/ko/1.1.0/)
## [engine-v1.64.7] - 2026-09-04
### Fixed
#### 확장 번들 스타일 실패 안내에 내부 구분 이름이 노출되던 문제
- 병합 CSS 번들 로드에 끝내 실패했을 때 안내 배너의 항목명이 번들 구분 키(`module`/`plugin`)였다. 사용자 어휘(`core.assets.module_styles` · `core.assets.plugin_styles`, 번역 미적재 시 폴백 문구)로 바꾼다 (ModuleAssetLoader.ts, AssetFailureNotice.ts)
## [engine-v1.64.0] - 2026-09-02
### Security