fix: 요약을 2000자까지 쓰고, 목록과 머리말이 그 길이를 견디게 한다

600 은 「아래 저장 경로가 이미 600 이니 거기 맞추자」는 판단이었지 실제로
쓰는 글의 길이를 본 것이 아니었다. 요약은 여러 문단이다.

길어진 요약이 드러낸 두 가지를 함께 고친다.

목록: 최근 기록·탐색·검색·홈 초점은 요약을 통째로 그렸다. 2000자면 한
항목이 화면을 덮어 목록이 목록이 아니게 된다. 세 줄에서 자른다 — 전문은
문서를 열면 나온다.

머리말: `public-document-header` 만 `PlainText` 를 거치지 않고 요약을
그대로 넣고 있었다. 작성자가 나눈 문단이 전부 한 덩어리로 이어졌다.
판단 결정 요약에서 고쳤던 것과 같은 결함이고, 이 자리를 빠뜨렸다.
되돌리면 <br> 가 3개에서 0개가 되어 가드가 깨지는 것을 확인했다.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011nAjrqNHGPNngN4aUbcyvJ
This commit is contained in:
DongHyeonka
2026-08-29 22:23:13 +09:00
co-authored by Claude Opus 5
parent 8fce8ea69c
commit 4e486aac59
11 changed files with 79 additions and 24 deletions
+6 -6
View File
@@ -38,28 +38,28 @@
},
"contractSet": {
"setAlgorithm": "CA_CONTRACT_SET_V1",
"setDigest": "sha256:54e2295eb185cb608fcbe5c8557e0d4f436d8f83bd200e632f7b20e47b9b76d9",
"setDigest": "sha256:b9e1e6a07e087dc56fe81805303a6f20022956174449b65575b350a71ab40675",
"packages": [
{
"packageId": "@tech-log/management-contract",
"version": "1.0.0",
"digest": "sha256:762aa81e6906469939fddd833c204ed3ca53f0fa96371f18a5ea1edaf76a64e8",
"digest": "sha256:f97b97101791d87fcf27d78a4c016370cabd2f02bb3b30eec0b8e453803d2d5f",
"runtimeProtocolVersion": 1,
"sourceRevision": "617eb6a"
"sourceRevision": "5942a2e"
},
{
"packageId": "@tech-log/public-contract",
"version": "2.1.0",
"digest": "sha256:afe415880eb5d6289ae10abf493333c97270c323c16a7245a466d4db4466e630",
"runtimeProtocolVersion": 1,
"sourceRevision": "617eb6a"
"sourceRevision": "5942a2e"
},
{
"packageId": "@tech-log/studio-contract",
"version": "3.1.0",
"digest": "sha256:2236a17064a81ae7e0c358fbc0756c8d89a5bdd7a2dfba36efffae0a448624b1",
"digest": "sha256:7e1ee18f7e6a6cb1750dd0baec28d975fb3b535116d8dfb57c17ae16ee8d2be8",
"runtimeProtocolVersion": 1,
"sourceRevision": "617eb6a"
"sourceRevision": "5942a2e"
}
]
}
@@ -1,8 +1,8 @@
{
"packageId": "@tech-log/management-contract",
"version": "1.0.0",
"digest": "sha256:762aa81e6906469939fddd833c204ed3ca53f0fa96371f18a5ea1edaf76a64e8",
"sourceRevision": "617eb6a",
"digest": "sha256:f97b97101791d87fcf27d78a4c016370cabd2f02bb3b30eec0b8e453803d2d5f",
"sourceRevision": "5942a2e",
"operationIds": [
"createCaseDraft",
"getCaseForEdit",
@@ -6331,7 +6331,7 @@ components:
maxLength: 180
summary:
type: string
maxLength: 600
maxLength: 2000
context:
type: string
importance:
@@ -6709,7 +6709,7 @@ components:
maxLength: 180
summary:
type: string
maxLength: 600
maxLength: 2000
releasedOn:
type: string
format: date
@@ -7243,7 +7243,7 @@ components:
maxLength: 180
summary:
type: string
maxLength: 600
maxLength: 2000
visibility:
type: string
enum:
@@ -2,7 +2,7 @@
"packageId": "@tech-log/public-contract",
"version": "2.1.0",
"digest": "sha256:afe415880eb5d6289ae10abf493333c97270c323c16a7245a466d4db4466e630",
"sourceRevision": "617eb6a",
"sourceRevision": "5942a2e",
"operationIds": [
"getPublicSite",
"getPublicHome",
@@ -1,8 +1,8 @@
{
"packageId": "@tech-log/studio-contract",
"version": "3.1.0",
"digest": "sha256:2236a17064a81ae7e0c358fbc0756c8d89a5bdd7a2dfba36efffae0a448624b1",
"sourceRevision": "617eb6a",
"digest": "sha256:7e1ee18f7e6a6cb1750dd0baec28d975fb3b535116d8dfb57c17ae16ee8d2be8",
"sourceRevision": "5942a2e",
"operationIds": [
"getStudioSession",
"getStudioDashboard",
@@ -917,7 +917,7 @@ components:
oneOf:
- { type: string, const: "" }
- { type: string, minLength: 3, maxLength: 100, pattern: "^[a-z0-9]+(?:-[a-z0-9]+)*$" }
summary: { type: string, maxLength: 600 }
summary: { type: string, maxLength: 2000 }
topicId: { type: [string, "null"], format: uuid }
projectId:
type: [string, "null"]
@@ -1280,7 +1280,7 @@ components:
kind: { $ref: "#/components/schemas/RecordKind" }
slug: { type: string, minLength: 3, maxLength: 100, pattern: "^[a-z0-9]+(?:-[a-z0-9]+)*$" }
title: { type: string, minLength: 1, maxLength: 120 }
summary: { type: string, maxLength: 600 }
summary: { type: string, maxLength: 2000 }
publicPath: { type: string, minLength: 1, maxLength: 500 }
topic: { $ref: "#/components/schemas/DisplayTarget" }
project:
@@ -2,6 +2,7 @@ import { Link } from "react-router-dom";
import type { PublicRecord } from "../../../application/ports/public-content-queries.ts";
import type { components } from "../../../contracts/studio/generated.ts";
import { PlainText } from "../../shared/public-render/inline-renderer.tsx";
const kindLabels = {
CASE: "Case",
@@ -33,7 +34,8 @@ export function PublicDocumentHeader({ record }: { record: PublicRecord }) {
</Link>
</nav>
<h1>{record.title}</h1>
<p>{record.summary}</p>
{/* 요약은 여러 문단일 수 있다 — 그대로 넣으면 줄바꿈이 사라져 한 덩어리로 읽힌다. */}
<p><PlainText text={record.summary} /></p>
<dl>
<div>
<dt>유형</dt>
@@ -9,7 +9,7 @@ type CatalogEntry = components["schemas"]["CatalogEntry"];
* 요약이 들어갈 수 있는 최대 길이. 계약 `WorkingCopyInputBase.summary` 와 같은 값이어야 한다 —
* 여기가 더 크면 다 쓰고 나서 저장할 때 거절당하고, 더 작으면 쓸 수 있는 자리를 못 쓴다.
*/
const SUMMARY_MAX = 600;
const SUMMARY_MAX = 2000;
/** 이 화면이 자기 칸 아래에 보여 줄 수 있는 경로. 나머지는 게시 버튼 옆에 남는다. */
export const COMMON_FIELD_PATHS = [
@@ -2391,6 +2391,16 @@ dialog::backdrop {
.record-kind { padding-top: 3px; color: var(--faint); font-family: "IBM Plex Mono", monospace; font-size: 11px; text-transform: uppercase; }
.public-record-list strong { display: block; font-size: 18px; font-weight: 630; letter-spacing: -0.02em; }
.public-record-list p { max-width: 700px; margin: 7px 0 6px; color: var(--muted); font-size: 14px; line-height: 1.62; }
/*
목록의 요약은 세 줄에서 자른다. 요약은 여러 문단이 될 수 있는데(상한 2000자) 목록에 통째로
펼치면 한 항목이 화면을 덮어 목록이 목록이 아니게 된다. 전문은 문서를 열면 나온다.
잘리는 것은 보이는 것뿐이고, 읽어 주는 기계에는 전문이 그대로 남는다.
*/
.public-record-list p,
.search-results p,
.focus-summary p,
.latest-copy > p:not(.latest-mobile-meta) { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; line-clamp: 3; overflow: hidden; }
.record-context { color: var(--faint); font-size: 11px; }
.public-record-list time { color: var(--faint); font-family: "IBM Plex Mono", monospace; font-size: 10px; text-align: right; }
.public-empty-state { margin: 0; padding: 64px 0; border-bottom: 1px solid var(--line); color: var(--muted); text-align: center; }
@@ -1,8 +1,12 @@
// @vitest-environment jsdom
import { render } from "@testing-library/react";
import { MemoryRouter } from "react-router-dom";
import { describe, expect, it } from "vitest";
import { PublicDocumentHeader } from "../../src/features/tech-log/presentation/public/components/public-document-header.tsx";
import type { QuestionRecord } from "../../src/features/tech-log/application/ports/public-content-queries.ts";
import {
InlineRenderer,
PlainText,
@@ -53,3 +57,42 @@ describe("Markdown 을 거치지 않는 평문 칸", () => {
expect(container.querySelectorAll("br")).toHaveLength(0);
});
});
/**
* 문서 머리말의 요약. 상한이 2000자가 되면서 요약은 한 문장이 아니라 여러 문단이 되었고,
* 여기만 `PlainText` 를 거치지 않아 그 문단들이 한 덩어리로 이어져 보였다.
*/
describe("문서 머리말의 요약", () => {
const record: QuestionRecord = {
kind: "QUESTION",
slug: "session-store-boundary",
title: "세션 저장소 경계",
summary: "Mediator와 BFF는 서로 다른 저장소를 쓴다.\n둘 다 메모리에 있다.\n\n인스턴스를 늘리면 설계가 필요하다.",
path: "/questions/session-store-boundary",
topic: "인증",
topicSlug: "auth",
projectSlug: "keycloak",
projectTitle: "Keycloak",
publishedAt: "2026-08-29T00:00:00Z",
publishedLabel: "2026.08.29",
visibility: "PUBLIC",
relations: [],
questionStatus: "OPEN",
facts: [],
assumptions: [],
unknowns: [],
constraints: [],
options: [],
nextValidation: "",
};
it("작성자가 나눈 문단을 지킨다", () => {
const { container } = render(
<MemoryRouter>
<PublicDocumentHeader record={record} />
</MemoryRouter>,
);
// 줄바꿈 셋(빈 줄 포함) → <br> 셋. 그대로 넣으면 0개가 되어 한 줄로 읽힌다.
expect(container.querySelectorAll(".public-document-header > p br")).toHaveLength(3);
});
});
@@ -246,18 +246,18 @@ describe("TechLog Studio document editor", () => {
계약 WorkingCopyInputBase.summary 와 같은 값이어야 한다. 300 이던 시절 이 칸은 문장
중간에서 말없이 입력을 멈췄고, 쓰는 사람에게는 키보드가 고장 난 것처럼 보였다.
*/
expect(summary).toHaveAttribute("maxlength", "600");
expect(summary).toHaveAttribute("maxlength", "2000");
fireEvent.change(summary, { target: { value: "가".repeat(412) } });
expect(screen.getByText("412 / 600")).toBeInTheDocument();
expect(screen.getByText("412 / 2000")).toBeInTheDocument();
expect(
screen.queryByText(/600자까지 모두 썼습니다/),
screen.queryByText(/2000자까지 모두 썼습니다/),
).not.toBeInTheDocument();
fireEvent.change(summary, { target: { value: "가".repeat(600) } });
expect(screen.getByText("600 / 600")).toBeInTheDocument();
fireEvent.change(summary, { target: { value: "가".repeat(2000) } });
expect(screen.getByText("2000 / 2000")).toBeInTheDocument();
// 한계에 닿았을 때만 알린다 — 글자마다 읽어 주면 받아쓰기가 된다.
expect(screen.getByText(/600자까지 모두 썼습니다/)).toBeInTheDocument();
expect(screen.getByText(/2000자까지 모두 썼습니다/)).toBeInTheDocument();
// 글자 수는 칸의 이름에 섞이지 않아야 한다. 섞이면 이름이 타자마다 바뀐다.
expect(screen.getByLabelText("요약")).toBe(summary);