fix(core,board,ecommerce,page,gdpr,ckeditor5,kginicis,admin_basic,basic): 목록 조회·검증 계층 정비 및 감사 지적 전건 처리
목록 조회 성능 축(깊은 OFFSET·정렬·색인)과 그 검증 계층에서 계획서 전수검수와 3회에 걸친 감사가 지적한 항목을 처리했다. 세부 경위는 의 각 회차 문서에 있다. 검증 계층 — 컨트롤러가 base Request 를 직접 주입받던 확장 13곳을 전용 FormRequest 로 옮겼다. 옮기면서 기존 동작 계약은 그대로 두었다: 상한 초과 limit 을 거부하지 않고 상한까지 반환하던 공개 API, per_page 를 범위로 조정하던 관리자 목록, 미지원 period 를 year 로 해석하던 인기글 목록 모두 종전과 같은 응답을 낸다. 상한/폴백을 rules 로 승격시키면 200 이던 응답이 422 가 되어 기존 링크가 깨지므로, 규칙은 타입만 닫고 클램프·폴백은 접근자가 맡는다. period 는 접근자가 닫힌 집합만 반환해 캐시 키 공간도 함께 닫힌다. ckeditor5 이미지 업로드만 ResponseHelper 봉투를 쓰지 않는다. 응답을 파싱하는 주체가 CDN 으로 로드되는 상위 CKEditor5 43.3.1 의 SimpleUploadAdapter 라 규약을 바꿀 수 없어, 각 응답 지점에 사유를 명시한 면제를 부착하고 근거를 API 문서에 남겼다. 하네스 — 룰 5개의 대상 경로 패턴이 매처와 맞지 않아 번들 확장 컨트롤러가 검사 대상에서 통째로 빠져 있었다. 패턴을 고치자 확장 위반 17건이 드러나 전건 처리했다. severity 오타가 요약 집계 양쪽에 안 잡혀 "0 error" 로 보고되던 문제도 런너 사전 검증으로 막았다. 정렬 게이트 대조 하네스는 관계 정렬 변형만 쓰는 저장소를 탐지하지 못한 채 통과시키고 있었다. 탐지·제외·인자 파싱을 함께 고치고 단위 테스트를 신설했다.
This commit is contained in:
1 parent
5f4a733b3b
commit
b10e89bef0
276 files changed
+12519
-1438
No files matched your search
@@ -1128,7 +1128,10 @@ export class TemplateApp {
|
||||
route: { ...(route.params || {}), path: route.path },
|
||||
query: queryObject,
|
||||
_global: { ...this.globalState }, // 나중에 갱신됨
|
||||
_globalSetState: (updates: Partial<GlobalState>) => this.setGlobalState(updates), // Form dataKey="_global.xxx" 지원
|
||||
// Form dataKey="_global.xxx" 지원.
|
||||
// @since engine-v1.54.5: 함수형 업데이트도 그대로 위임한다 — 소비부(DynamicRenderer 의
|
||||
// _localInit 동기화)가 렌더 시점 스냅샷 대신 쓰기 시점 prev 를 base 로 쓰기 위함.
|
||||
_globalSetState: (updates: Partial<GlobalState> | ((prev: GlobalState) => GlobalState)) => this.setGlobalState(updates),
|
||||
_dataSourceErrors: Object.keys(dataSourceErrors).length > 0 ? dataSourceErrors : undefined,
|
||||
// initLocal 옵션으로 초기화할 로컬 상태 (DynamicRenderer에서 처리)
|
||||
_localInit: Object.keys(localInit).length > 0 ? localInit : undefined,
|
||||
|
||||
@@ -29,9 +29,44 @@ import { evaluateConditionBranches } from './helpers/ConditionEvaluator';
|
||||
import { triggerModalParentUpdate } from './ParentContextProvider';
|
||||
import type { GlobalHeaderRule } from './LayoutLoader';
|
||||
import { IdentityGuardInterceptor } from '../identity/IdentityGuardInterceptor';
|
||||
import { isAbortError, isNetworkFailure } from './networkResilience';
|
||||
|
||||
const logger = createLogger('ActionDispatcher');
|
||||
|
||||
/**
|
||||
* 액션 실패 시 화면에 띄울 문구를 결정합니다.
|
||||
*
|
||||
* 우선순위는 (1) 서버가 준 메시지 → (2) 네트워크 실패 안내 → (3) 내부 식별 문구다.
|
||||
*
|
||||
* 네트워크 실패(`TypeError: Failed to fetch`)와 요청 취소(AbortError)는 **응답 자체가 없어**
|
||||
* 서버 메시지가 존재하지 않는다. 그때 내부 식별 문구(`Failed to execute action: apiCall`)를
|
||||
* 그대로 토스트에 띄우면 운영자는 무슨 일이 일어났는지 알 수 없고 다국어도 적용되지 않는다.
|
||||
*
|
||||
* @param originalError 원래 발생한 에러
|
||||
* @param handler 실패한 핸들러명
|
||||
* @param serverMessage 서버 응답이 준 메시지 (없으면 undefined)
|
||||
* @param fallbackMessage 위 둘이 없을 때 쓸 문구 (기본: 내부 식별 문구).
|
||||
* `ActionError` 가 이미 고유 메시지를 들고 있으면 그것을 넘겨 보존한다.
|
||||
* @return string 화면에 띄울 문구 ($t: 구문이면 호출부가 번역한다)
|
||||
* @since engine-v1.54.6
|
||||
*/
|
||||
export function resolveActionFailureMessage(
|
||||
originalError: unknown,
|
||||
handler: string,
|
||||
serverMessage?: string,
|
||||
fallbackMessage?: string
|
||||
): string {
|
||||
if (serverMessage) {
|
||||
return serverMessage;
|
||||
}
|
||||
|
||||
if (isNetworkFailure(originalError) || isAbortError(originalError)) {
|
||||
return '$t:core.errors.network_request_failed';
|
||||
}
|
||||
|
||||
return fallbackMessage || `Failed to execute action: ${handler}`;
|
||||
}
|
||||
|
||||
/**
|
||||
* 프리뷰 모드에서 억제되는 핸들러 목록
|
||||
*
|
||||
@@ -2607,8 +2642,23 @@ export class ActionDispatcher {
|
||||
const errorStatus = (actionError.originalError as any)?.status || apiResponse.status || 500;
|
||||
|
||||
// 에러 컨텍스트 생성 (ErrorHandlingResolver와 호환)
|
||||
// API 응답의 message를 우선 사용하고, 없으면 ActionError 메시지 사용
|
||||
const errorMessage = responseData.message || actionError.message;
|
||||
// API 응답의 message를 우선 사용하고, 응답이 아예 없었던 네트워크 실패에는
|
||||
// 내부 식별 문구 대신 다국어 안내를 쓴다 (engine-v1.54.6)
|
||||
let errorMessage = resolveActionFailureMessage(
|
||||
actionError.originalError ?? error,
|
||||
action.handler,
|
||||
responseData.message,
|
||||
actionError.message
|
||||
);
|
||||
|
||||
// 상태에 실려 텍스트로 그대로 렌더되는 경로(`{{error.message}}` → `_global.*Error`)가 있으므로
|
||||
// 여기서 번역해 둔다. 키 문자열이 화면에 노출되면 안 된다.
|
||||
if (this.translationEngine && this.translationContext && errorMessage.startsWith('$t:')) {
|
||||
errorMessage = this.translationEngine.resolveTranslations(
|
||||
errorMessage,
|
||||
this.translationContext
|
||||
);
|
||||
}
|
||||
const errorContextData: ErrorContext = {
|
||||
status: errorStatus,
|
||||
message: errorMessage,
|
||||
|
||||
@@ -5,6 +5,27 @@
|
||||
>
|
||||
> 형식: [Keep a Changelog](https://keepachangelog.com/ko/1.1.0/)
|
||||
|
||||
## [engine-v1.54.6] - 2026-08-01
|
||||
|
||||
### Fixed
|
||||
|
||||
#### 통신이 끊겼을 때 내부 식별 문구가 사용자에게 노출되던 문제
|
||||
|
||||
- `template-engine/ActionDispatcher.ts` — 액션 실패 문구 결정을 `resolveActionFailureMessage()` 로 분리하고, **응답 자체가 없었던 실패**(`TypeError: Failed to fetch` / `AbortError`)에는 다국어 안내(`$t:core.errors.network_request_failed`)를 쓴다. 종전에는 서버 메시지가 없으므로 내부 식별 문구인 `Failed to execute action: apiCall` 이 그대로 토스트에 떴다 — 운영자가 무슨 일이 일어났는지 알 수 없고 다국어도 적용되지 않았다.
|
||||
- 우선순위는 (1) 서버 메시지 → (2) 네트워크 안내 → (3) 기존 문구다. `ActionError` 가 이미 들고 있던 고유 메시지(예: 미등록 핸들러 안내)는 그대로 보존한다.
|
||||
- `{{error.message}}` 가 상태에 실려 텍스트로 렌더되는 경로가 있어 `$t:` 키를 디스패처에서 미리 번역한다(키 문자열 노출 방지).
|
||||
- 코어 다국어 키 `core.errors.network_request_failed` 추가 (ko/en + ja 번들).
|
||||
|
||||
## [engine-v1.54.5] - 2026-07-31
|
||||
|
||||
### Fixed
|
||||
|
||||
#### 데이터소스 `initLocal` 동기화가 라우트 진입 시드를 되돌리던 문제
|
||||
|
||||
- `template-engine/DynamicRenderer.tsx` — `_localInit` 을 전역 `_local`(저장소 B)에 동기화할 때, 병합 base 를 렌더 시점 스냅샷(`dataContext._global._local`)이 아니라 **쓰기 시점의 canonical 상태**(함수형 업데이트의 `prev._local`)로 바꿨다. `setGlobalState` 는 `{ _local: X }` 를 얕게 펼쳐 저장소를 통째로 교체하는데, 이 effect 는 렌더 커밋 뒤에 실행되므로 그 사이에 `init_actions` 가 URL query 로 시드한 값이 스냅샷 기반 교체에 통째로 되돌아갔다.
|
||||
- 증상: 목록 화면에서 필터를 적용하고 상세로 들어갔다가 브라우저 뒤로가기로 복귀하면 URL·목록·총건수는 필터가 걸린 상태인데 **필터 컨트롤만 기본값**으로 표시됐다. 그 상태에서 다른 조건을 바꿔 검색하면 기존 필터가 조용히 사라진다. `initLocal` 데이터소스의 응답 시점과 시드 시점의 경합이라 같은 화면에서도 재현이 들쭉날쭉했다.
|
||||
- `TemplateApp.ts` — `dataContext._globalSetState` 가 함수형 업데이트를 그대로 위임하도록 시그니처를 넓혔다(`setGlobalState` 는 이미 함수형을 지원).
|
||||
- `_merge: "replace"` 계약(기존 base 무시)과 `_local` 이외 전역 키 보존은 종전과 동일하다.
|
||||
## [engine-v1.54.4] - 2026-07-31
|
||||
|
||||
### Fixed
|
||||
|
||||
@@ -1371,16 +1371,26 @@ const DynamicRenderer: React.FC<DynamicRendererProps> = memo(
|
||||
// 전역 상태도 함께 업데이트 (컴포넌트 로컬 상태와 전역 상태 동기화)
|
||||
// G7Core.state.get()._local에서도 데이터를 조회할 수 있도록 함
|
||||
if (dataContext._globalSetState) {
|
||||
const currentGlobalLocal = (dataContext._global as any)?._local || {};
|
||||
let globalLocalUpdate: Record<string, any>;
|
||||
if (mergeStrategy === 'replace') {
|
||||
globalLocalUpdate = { ...initDataWithoutMeta, hasChanges: false };
|
||||
} else if (mergeStrategy === 'deep') {
|
||||
globalLocalUpdate = deepMergeState(currentGlobalLocal, { ...initDataWithoutMeta, hasChanges: false });
|
||||
} else {
|
||||
globalLocalUpdate = { ...currentGlobalLocal, ...initDataWithoutMeta, hasChanges: false };
|
||||
}
|
||||
dataContext._globalSetState({ _local: globalLocalUpdate });
|
||||
// @since engine-v1.54.5: 병합 base 는 렌더 시점 스냅샷(dataContext._global._local)이 아니라
|
||||
// **쓰기 시점의 canonical _local(prev._local)** 이어야 한다.
|
||||
//
|
||||
// setGlobalState 는 updates 를 얕게 펼치므로 `{ _local: X }` 는 저장소 B 를 통째로 교체한다.
|
||||
// 이 effect 는 마운트 후(렌더 커밋 뒤)에 실행되는데, 그 사이에 init_actions 가 URL query 로
|
||||
// _local 을 시드해 두었다면(목록 화면의 필터·정렬 컨트롤) 렌더 시점 스냅샷을 base 로 쓴 교체가
|
||||
// 그 시드를 통째로 되돌린다 — 뒤로가기 복귀 시 URL·목록은 필터가 걸린 상태인데 필터 컨트롤만
|
||||
// 기본값으로 표시되는 결함(#492 D-20). 함수형 업데이트로 prev 를 읽어 그 역전을 제거한다.
|
||||
dataContext._globalSetState((prev: Record<string, any>) => {
|
||||
const currentGlobalLocal = (prev as any)?._local || {};
|
||||
let globalLocalUpdate: Record<string, any>;
|
||||
if (mergeStrategy === 'replace') {
|
||||
globalLocalUpdate = { ...initDataWithoutMeta, hasChanges: false };
|
||||
} else if (mergeStrategy === 'deep') {
|
||||
globalLocalUpdate = deepMergeState(currentGlobalLocal, { ...initDataWithoutMeta, hasChanges: false });
|
||||
} else {
|
||||
globalLocalUpdate = { ...currentGlobalLocal, ...initDataWithoutMeta, hasChanges: false };
|
||||
}
|
||||
return { ...prev, _local: globalLocalUpdate };
|
||||
});
|
||||
}
|
||||
|
||||
// _localInit 데이터가 변경되면 DataBindingEngine 캐시 무효화
|
||||
|
||||
+173
@@ -0,0 +1,173 @@
|
||||
/**
|
||||
* _localInit → 전역 `_local` 동기화가 **쓰기 시점의 canonical 상태**를 base 로 병합하는지 검증
|
||||
*
|
||||
* 회귀 배경 (#492 D-20)
|
||||
*
|
||||
* 목록 화면은 URL query 로 필터/정렬을 표현하고, 라우트 진입 시 `init_actions` 가 그 query 를
|
||||
* `_local` 에 시드해 필터 컨트롤을 복원한다. 그런데 `_localInit`(데이터소스 initLocal) 동기화가
|
||||
* 렌더 시점 스냅샷(`dataContext._global._local`)을 병합 base 로 쓰고, `setGlobalState` 는
|
||||
* `{ _local: X }` 를 얕게 펼쳐 저장소를 **통째로 교체**한다. 이 effect 는 렌더 커밋 뒤에 실행되므로
|
||||
* 시드가 그 사이에 일어나면 스냅샷 기반 교체가 시드를 되돌린다 —
|
||||
* 상세 진입 후 뒤로가기로 목록에 복귀하면 URL·목록·총건수는 필터가 걸린 상태인데
|
||||
* 필터 라디오만 `전체` 로 표시되는 결함.
|
||||
*
|
||||
* 아래 테스트는 그 순서를 그대로 재현한다: 스냅샷(stale) ≠ canonical(seeded).
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import { describe, it, expect, beforeEach, vi } from 'vitest';
|
||||
import { render } from '@testing-library/react';
|
||||
import DynamicRenderer, { ComponentDefinition } from '../DynamicRenderer';
|
||||
import { ComponentRegistry } from '../ComponentRegistry';
|
||||
import { DataBindingEngine } from '../DataBindingEngine';
|
||||
import { TranslationEngine, TranslationContext } from '../TranslationEngine';
|
||||
import { ActionDispatcher } from '../ActionDispatcher';
|
||||
import { resetLocalInitTracking } from '../localInitSlot';
|
||||
|
||||
const TestDiv: React.FC<Record<string, unknown>> = (props) => {
|
||||
const { children, ...rest } = props as { children?: React.ReactNode };
|
||||
return <div {...(rest as Record<string, never>)}>{children}</div>;
|
||||
};
|
||||
|
||||
describe('_localInit 전역 동기화 — canonical base 병합', () => {
|
||||
let registry: ComponentRegistry;
|
||||
let bindingEngine: DataBindingEngine;
|
||||
let translationEngine: TranslationEngine;
|
||||
let actionDispatcher: ActionDispatcher;
|
||||
let translationContext: TranslationContext;
|
||||
|
||||
beforeEach(() => {
|
||||
resetLocalInitTracking();
|
||||
registry = ComponentRegistry.getInstance();
|
||||
(registry as any).registry = {
|
||||
Div: { component: TestDiv, metadata: { name: 'Div', type: 'basic' } },
|
||||
};
|
||||
bindingEngine = new DataBindingEngine();
|
||||
translationEngine = new TranslationEngine();
|
||||
actionDispatcher = new ActionDispatcher({ navigate: vi.fn() });
|
||||
translationContext = { templateId: 'test-template', locale: 'ko' };
|
||||
});
|
||||
|
||||
const componentDef: ComponentDefinition = {
|
||||
id: 'list_root',
|
||||
type: 'basic',
|
||||
name: 'Div',
|
||||
props: { 'data-testid': 'root' },
|
||||
children: [],
|
||||
} as unknown as ComponentDefinition;
|
||||
|
||||
/**
|
||||
* TemplateApp.setGlobalState 와 동일한 계약을 갖는 테스트 대역.
|
||||
* - 객체 업데이트: 얕은 펼침 (`{ _local: X }` 는 저장소를 통째로 교체)
|
||||
* - 함수형 업데이트: `prev` 를 인자로 받아 반환값으로 교체
|
||||
*/
|
||||
const createStore = (initial: Record<string, any>) => {
|
||||
let state = initial;
|
||||
return {
|
||||
get current() {
|
||||
return state;
|
||||
},
|
||||
setGlobalState: (
|
||||
updates: Record<string, any> | ((prev: Record<string, any>) => Record<string, any>)
|
||||
) => {
|
||||
state = typeof updates === 'function' ? updates(state) : { ...state, ...updates };
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
it('init_actions 시드가 렌더 뒤 _localInit 동기화로 되돌아가지 않아야 한다', () => {
|
||||
// canonical(저장소 B): init_actions 가 URL query 로 시드한 최신 값
|
||||
const store = createStore({
|
||||
_local: {
|
||||
filter: { issueStatus: 'issuing', targetType: 'all' },
|
||||
sortBy: 'name_asc',
|
||||
},
|
||||
});
|
||||
|
||||
// 렌더 시점 스냅샷: 시드 이전 값(레이아웃 기본값)이 담긴 stale 컨텍스트
|
||||
const staleGlobalSnapshot = {
|
||||
_local: {
|
||||
filter: { issueStatus: 'all', targetType: 'all' },
|
||||
sortBy: 'created_at_desc',
|
||||
},
|
||||
};
|
||||
|
||||
render(
|
||||
<DynamicRenderer
|
||||
componentDef={componentDef}
|
||||
dataContext={{
|
||||
_local: staleGlobalSnapshot._local,
|
||||
_global: staleGlobalSnapshot,
|
||||
_globalSetState: store.setGlobalState,
|
||||
_localInit: { rows: [{ id: 1 }] },
|
||||
}}
|
||||
translationContext={translationContext}
|
||||
registry={registry}
|
||||
bindingEngine={bindingEngine}
|
||||
translationEngine={translationEngine}
|
||||
actionDispatcher={actionDispatcher}
|
||||
/>
|
||||
);
|
||||
|
||||
// _localInit payload 는 반영되어야 한다
|
||||
expect(store.current._local.rows).toEqual([{ id: 1 }]);
|
||||
// 그리고 시드된 필터/정렬은 살아 있어야 한다 (수정 전에는 'all' / 'created_at_desc' 로 역전)
|
||||
expect(store.current._local.filter.issueStatus).toBe('issuing');
|
||||
expect(store.current._local.sortBy).toBe('name_asc');
|
||||
});
|
||||
|
||||
it('_merge:"replace" 는 기존 계약대로 base 를 무시하고 payload 로 교체한다', () => {
|
||||
const store = createStore({
|
||||
_local: { filter: { issueStatus: 'issuing' }, stale: 'keep-out' },
|
||||
});
|
||||
|
||||
render(
|
||||
<DynamicRenderer
|
||||
componentDef={componentDef}
|
||||
dataContext={{
|
||||
_local: {},
|
||||
_global: { _local: {} },
|
||||
_globalSetState: store.setGlobalState,
|
||||
_localInit: { _merge: 'replace', form: { name: 'A' } },
|
||||
}}
|
||||
translationContext={translationContext}
|
||||
registry={registry}
|
||||
bindingEngine={bindingEngine}
|
||||
translationEngine={translationEngine}
|
||||
actionDispatcher={actionDispatcher}
|
||||
/>
|
||||
);
|
||||
|
||||
expect(store.current._local.form).toEqual({ name: 'A' });
|
||||
expect(store.current._local.stale).toBeUndefined();
|
||||
expect(store.current._local.filter).toBeUndefined();
|
||||
});
|
||||
|
||||
it('_global 이외의 전역 키는 동기화로 소실되지 않아야 한다', () => {
|
||||
const store = createStore({
|
||||
_local: { filter: { issueStatus: 'issuing' } },
|
||||
cartKey: 'ck-1',
|
||||
toasts: [],
|
||||
});
|
||||
|
||||
render(
|
||||
<DynamicRenderer
|
||||
componentDef={componentDef}
|
||||
dataContext={{
|
||||
_local: {},
|
||||
_global: { _local: {} },
|
||||
_globalSetState: store.setGlobalState,
|
||||
_localInit: { rows: [] },
|
||||
}}
|
||||
translationContext={translationContext}
|
||||
registry={registry}
|
||||
bindingEngine={bindingEngine}
|
||||
translationEngine={translationEngine}
|
||||
actionDispatcher={actionDispatcher}
|
||||
/>
|
||||
);
|
||||
|
||||
expect(store.current.cartKey).toBe('ck-1');
|
||||
expect(store.current.toasts).toEqual([]);
|
||||
});
|
||||
});
|
||||
+69
@@ -0,0 +1,69 @@
|
||||
import { describe, it, expect } from 'vitest';
|
||||
import { resolveActionFailureMessage } from '../ActionDispatcher';
|
||||
|
||||
/**
|
||||
* 액션 실패 문구가 **운영자에게 의미 있는 말**인지 고정한다.
|
||||
*
|
||||
* 네트워크 실패(`TypeError: Failed to fetch`)는 응답 자체가 없으므로 서버 메시지가 없다.
|
||||
* 그때 내부 식별자(`Failed to execute action: apiCall`)를 그대로 토스트에 띄우면
|
||||
* 운영자는 무슨 일이 일어났는지 알 수 없고 다국어도 적용되지 않는다.
|
||||
*
|
||||
* 확장 업데이트 모달에서 통신이 끊겼을 때 실제로 이 문구가 노출되는 것을 브라우저 실측으로
|
||||
* 확인했다(#492 검색 인덱스 실측 세션).
|
||||
*
|
||||
* @since engine-v1.54.6
|
||||
*/
|
||||
describe('resolveActionFailureMessage', () => {
|
||||
it('네트워크 실패에는 다국어 키를 돌려준다', () => {
|
||||
const message = resolveActionFailureMessage(
|
||||
new TypeError('Failed to fetch'),
|
||||
'apiCall',
|
||||
undefined
|
||||
);
|
||||
|
||||
expect(message).toBe('$t:core.errors.network_request_failed');
|
||||
});
|
||||
|
||||
it('요청 취소도 네트워크 계열로 안내한다', () => {
|
||||
const abort = new Error('The user aborted a request.');
|
||||
abort.name = 'AbortError';
|
||||
|
||||
expect(resolveActionFailureMessage(abort, 'apiCall', undefined)).toBe(
|
||||
'$t:core.errors.network_request_failed'
|
||||
);
|
||||
});
|
||||
|
||||
it('서버가 메시지를 주면 그대로 쓴다', () => {
|
||||
expect(
|
||||
resolveActionFailureMessage(new Error('boom'), 'apiCall', '유효하지 않은 레이아웃 전략입니다.')
|
||||
).toBe('유효하지 않은 레이아웃 전략입니다.');
|
||||
});
|
||||
|
||||
it('서버 메시지도 네트워크 실패도 아니면 기존 식별 문구를 유지한다', () => {
|
||||
expect(resolveActionFailureMessage(new Error('boom'), 'setState', undefined)).toBe(
|
||||
'Failed to execute action: setState'
|
||||
);
|
||||
});
|
||||
|
||||
it('ActionError 가 이미 들고 있던 고유 메시지는 덮어쓰지 않는다', () => {
|
||||
expect(
|
||||
resolveActionFailureMessage(
|
||||
new Error('boom'),
|
||||
'ecommerce.initPreferredCurrency',
|
||||
undefined,
|
||||
'Unknown action handler: ecommerce.initPreferredCurrency'
|
||||
)
|
||||
).toBe('Unknown action handler: ecommerce.initPreferredCurrency');
|
||||
});
|
||||
|
||||
it('네트워크 실패는 고유 메시지보다 우선한다 (내부 문구가 사용자에게 보이지 않도록)', () => {
|
||||
expect(
|
||||
resolveActionFailureMessage(
|
||||
new TypeError('Failed to fetch'),
|
||||
'apiCall',
|
||||
undefined,
|
||||
'Failed to execute action: apiCall'
|
||||
)
|
||||
).toBe('$t:core.errors.network_request_failed');
|
||||
});
|
||||
});
|
||||
@@ -721,6 +721,55 @@ describe('트러블슈팅 회귀 테스트 - 데이터소스 업데이트 및
|
||||
|
||||
// DynamicRenderer 의 trackingKey 계산과 동일한 형태 — 값·타임스탬프 둘 다 달라 재적용된다
|
||||
expect(after).not.toBe(before);
|
||||
describe('[사례 8] initLocal 동기화가 init_actions 의 query 시드를 되돌림 (engine-v1.54.5)', () => {
|
||||
/**
|
||||
* 증상: 목록에서 필터 적용 → 상세 진입 → 뒤로가기 복귀 시 URL·목록은 필터 상태인데
|
||||
* 필터 컨트롤만 기본값으로 표시된다 (#492 D-20).
|
||||
* 원인: _localInit → 전역 _local 동기화가 **렌더 시점 스냅샷**을 병합 base 로 썼고,
|
||||
* setGlobalState 는 `{ _local: X }` 를 얕게 펼쳐 저장소를 통째로 교체한다.
|
||||
* effect 는 렌더 커밋 뒤에 실행되므로 그 사이의 init_actions query 시드가 되돌아갔다.
|
||||
* 해결: 함수형 업데이트로 **쓰기 시점 prev._local** 을 base 로 병합.
|
||||
*
|
||||
* 렌더 통합 검증은 DynamicRenderer.localInitGlobalSync.test.tsx 가 담당한다.
|
||||
*/
|
||||
const applySync = (
|
||||
store: Record<string, any>,
|
||||
snapshotBase: Record<string, any>,
|
||||
initData: Record<string, any>,
|
||||
useCanonicalBase: boolean
|
||||
) => {
|
||||
const base = useCanonicalBase ? store._local || {} : snapshotBase;
|
||||
// setGlobalState 의 얕은 펼침 계약 — `_local` 은 통째로 교체된다
|
||||
return { ...store, _local: { ...base, ...initData, hasChanges: false } };
|
||||
};
|
||||
|
||||
it('스냅샷 base 는 시드를 되돌린다 (수정 전 동작)', () => {
|
||||
const store = { _local: { filter: { issueStatus: 'issuing' }, sortBy: 'name_asc' } };
|
||||
const staleSnapshot = { filter: { issueStatus: 'all' }, sortBy: 'created_at_desc' };
|
||||
|
||||
const next = applySync(store, staleSnapshot, { rows: [1] }, false);
|
||||
|
||||
expect(next._local.filter.issueStatus).toBe('all');
|
||||
expect(next._local.sortBy).toBe('created_at_desc');
|
||||
});
|
||||
|
||||
it('canonical base 는 시드를 보존한다 (수정 후 동작)', () => {
|
||||
const store = { _local: { filter: { issueStatus: 'issuing' }, sortBy: 'name_asc' } };
|
||||
const staleSnapshot = { filter: { issueStatus: 'all' }, sortBy: 'created_at_desc' };
|
||||
|
||||
const next = applySync(store, staleSnapshot, { rows: [1] }, true);
|
||||
|
||||
expect(next._local.filter.issueStatus).toBe('issuing');
|
||||
expect(next._local.sortBy).toBe('name_asc');
|
||||
expect(next._local.rows).toEqual([1]);
|
||||
});
|
||||
|
||||
it('_local 이외의 전역 키는 동기화로 소실되지 않아야 함', () => {
|
||||
const store = { _local: { filter: { issueStatus: 'issuing' } }, cartKey: 'ck-1' };
|
||||
|
||||
const next = applySync(store, {}, { rows: [] }, true);
|
||||
|
||||
expect(next.cartKey).toBe('ck-1');
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -81,11 +81,16 @@ if (isset($_GET['ajax_action'])) {
|
||||
$cleanOutput = $exitCode === 0 ? '명령이 성공적으로 실행되었습니다.' : '명령 실행 중 오류가 발생했습니다.';
|
||||
}
|
||||
|
||||
// 성공/실패 여부 표시
|
||||
// 종료 코드 표시
|
||||
//
|
||||
// 비-0 종료가 곧 "명령 실패" 는 아니다. 점검 계열 커맨드(예: search:index)는
|
||||
// 점검 자체는 정상 수행하고 "이상을 발견했다" 는 뜻으로 비-0 을 돌려준다.
|
||||
// 이것을 "실행 실패" 로 적으면 운영자가 도구가 고장난 것으로 읽고
|
||||
// 정작 발견된 이상(색인 누락 등)을 놓친다.
|
||||
if ($exitCode === 0) {
|
||||
$cleanOutput = "✅ 완료\n\n" . $cleanOutput;
|
||||
} else {
|
||||
$cleanOutput = "❌ 실패 (exitCode: {$exitCode})\n\n" . $cleanOutput;
|
||||
$cleanOutput = "⚠️ 종료 코드 {$exitCode} — 아래 출력을 확인하세요\n\n" . $cleanOutput;
|
||||
}
|
||||
|
||||
echo json_encode([
|
||||
@@ -860,6 +865,14 @@ if (isset($_GET['ajax_action'])) {
|
||||
<span>사이트맵 생성</span>
|
||||
<span class="text-[10px] opacity-60">(seo:generate-sitemap)</span>
|
||||
</button>
|
||||
<button onclick="runCommand('search:index')" class="inline-flex items-center gap-1.5 px-3 py-2 bg-blue-600 hover:bg-blue-700 text-white text-xs font-medium rounded transition-colors">
|
||||
<span>검색 인덱스 점검</span>
|
||||
<span class="text-[10px] opacity-60">(search:index)</span>
|
||||
</button>
|
||||
<button onclick="runCommand('search:index --repair')" class="inline-flex items-center gap-1.5 px-3 py-2 bg-amber-600 hover:bg-amber-700 text-white text-xs font-medium rounded transition-colors" title="색인이 누락된 인덱스를 재생성합니다. 대상 인덱스가 잠기거나 재색인되므로 운영 중에는 유지보수 시간에 수행하세요.">
|
||||
<span>검색 인덱스 재생성</span>
|
||||
<span class="text-[10px] opacity-60">(search:index --repair)</span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1943,7 +1956,7 @@ if (isset($_GET['ajax_action'])) {
|
||||
: 'mt-2 p-2 bg-red-900/30 border border-red-700/50 rounded text-red-300 text-[11px]';
|
||||
finalEl.textContent = result.success
|
||||
? `🎉 ${command} 실행 완료!`
|
||||
: `❌ ${command} 실행 실패`;
|
||||
: `⚠️ ${command} — 종료 코드 ${result.code ?? 1} (출력 확인 필요)`;
|
||||
content.appendChild(finalEl);
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user