G0~G8 성과·동맹 측정 OS 작업 일괄 고정

8월 7일까지 워킹트리에만 남아 있던 미커밋 작업을 커밋한다. 여러 사본
폴더(worktree·clone)에 흩어져 있던 중간 스냅샷을 정리하기 전에 원본을
git 이력으로 고정하는 것이 목적이다.

- contracts/routes/services: measurement, outcome_trajectory, rupture_repair,
  deliberate_practice, calibration_transfer, supervision_research,
  multimodal_alliance, continuous_improvement 계열 신규 모듈과 테스트
- infra/db/init: 07~16 마이그레이션(측정 기반~calibration transfer 실행)
- apps/web: 세션 리뷰 카드·관리 화면·E2E 스펙 추가
- docs/ops: G0~G8 라이브 통합·배포·롤백 증거 문서와 evidence JSON/PNG
- scripts: smoke·ledger·릴리스 에이전트·NAS 프리뷰 운영 스크립트

engine.public 로그 .bak과 apps/web/test-results 산출물은 커밋에서 제외했다.
This commit is contained in:
Yun Chan 2026-08-08 01:30:53 +09:00
parent 93dd8f82d7
commit 16e791e044
390 changed files with 243188 additions and 499 deletions

View file

@ -56,6 +56,8 @@ interface RequestOptions {
headers?: Record<string, string>;
/** AbortSignal (취소·타임아웃) */
signal?: AbortSignal;
/** 주 화면이 이미 인증된 뒤 불러오는 보조 표면은 401로 전체 앱을 로그아웃시키지 않는다. */
notifyAuthExpired?: boolean;
}
function joinUrl(path: string): string {
@ -114,7 +116,13 @@ export async function apiFetch<T = unknown>(
path: string,
options: RequestOptions = {},
): Promise<T> {
const { method = "GET", body, headers = {}, signal } = options;
const {
method = "GET",
body,
headers = {},
signal,
notifyAuthExpired: shouldNotifyAuthExpired = true,
} = options;
const finalHeaders: Record<string, string> = {
Accept: "application/json",
@ -137,7 +145,9 @@ export async function apiFetch<T = unknown>(
if (!res.ok) {
const error = await parseError(res);
if (error.status === 401) notifyAuthExpired(path, error);
if (error.status === 401 && shouldNotifyAuthExpired) {
notifyAuthExpired(path, error);
}
throw error;
}
@ -162,6 +172,23 @@ export const api = {
apiFetch<T>(path, { ...opts, method: "DELETE" }),
};
/**
* 이미 인증된 주 화면 위에 덧붙는 독립 read model용 클라이언트다.
* 배포 버전 차이·선택 기능 장애의 401은 해당 카드만 degraded 처리하고,
* 주 화면의 권위 있는 인증 요청이 성공한 세션을 전역 로그아웃시키지 않는다.
*/
export const supplementalApi = {
get: <T = unknown>(
path: string,
opts?: Omit<RequestOptions, "method" | "body" | "notifyAuthExpired">,
) =>
apiFetch<T>(path, {
...opts,
method: "GET",
notifyAuthExpired: false,
}),
};
/* =====================================================================
백엔드 응답 타입 (apps/api 계약 미러)
===================================================================== */
@ -401,7 +428,14 @@ export async function openSessionStream(
if (done) break;
buffer += decoder.decode(value, { stream: true });
processBuffer();
if (streamError) break;
if (donePayload || streamError) {
try {
await reader.cancel();
} catch {
// 프로토콜 종료 뒤 전송 계층이 이미 닫혔다면 추가 취소 실패는 무시한다.
}
break;
}
}
buffer += decoder.decode();
processBuffer(true);