feat: 기록의 맥락을 읽기 난간의 앞뒤 한 칸으로 모은다
제목 아래 맥락 블록(ContextNavigator)과 난간의 Related 가 같은 것을 두 번 말하고 있었다. 난간 하나만 남기고, 거기에 주제가 정한 사고 순서의 바로 앞·뒤 한 칸을 둔다. 기록 화면은 그 순서를 알아야 하므로 자기 주제의 기록 목록을 함께 받는다. 주제의 사고 순서는 종류마다 한 편이 아니라 전부를 세우고, 관계가 가리키는 프로젝트 결정을 기준 다음 칸에 끼운다. 답이 나온 질문은 흐름에는 남되 「아직 답하지 못한 질문」으로 다시 서지 않는다. 문서 머리말의 빵부스러기는 프로젝트/주제만 남기고 종류는 링크가 아닌 한 줄로 내린다. 홈의 「종류별로 읽기」는 주 내비가 이미 데려가므로 내린다. `tests/component/inline-line-breaks.test.tsx` 는 머리말의 `<p>` 를 전부 세고 있어서 종류 한 줄이 늘자 깨졌다. 요약만 세도록 좁혔다 — 문단 나누기를 망가뜨리면 여전히 실패한다. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Cfj8mZ9QmT3MEKonzM5xPj
This commit is contained in:
co-authored by
Claude Opus 5
parent
8c57ed7d57
commit
99c05c567d
@@ -98,9 +98,18 @@ describe("문서 머리말의 요약", () => {
|
||||
/>
|
||||
</MemoryRouter>,
|
||||
);
|
||||
const paragraphs = container.querySelectorAll(".public-document-header p");
|
||||
/*
|
||||
머리말에는 요약 말고도 종류를 적은 한 줄(`.section-kicker`)이 있다. 이 가드가 보는 것은
|
||||
요약이 문단으로 나뉘는가이므로 그 줄은 빼고 센다 — 예전처럼 머리말의 `<p>` 를 전부 세면
|
||||
머리말에 줄이 하나 늘 때마다 요약과 상관없이 깨진다.
|
||||
*/
|
||||
const paragraphs = container.querySelectorAll(
|
||||
".public-document-header p:not(.section-kicker)",
|
||||
);
|
||||
expect(paragraphs).toHaveLength(2);
|
||||
expect(container.querySelectorAll(".public-document-header p br")).toHaveLength(1);
|
||||
expect(
|
||||
container.querySelectorAll(".public-document-header p:not(.section-kicker) br"),
|
||||
).toHaveLength(1);
|
||||
expect(paragraphs[0]).toHaveTextContent("둘 다 메모리에 있다.");
|
||||
expect(paragraphs[1]).toHaveTextContent("인스턴스를 늘리면 설계가 필요하다.");
|
||||
});
|
||||
|
||||
@@ -116,16 +116,39 @@ const dependencies = {
|
||||
resolvePublishedLabel: ResolvePublishedLabel;
|
||||
};
|
||||
|
||||
describe("기록마다 맥락이 제목 바로 아래에 있다", () => {
|
||||
for (const [kind, model] of Object.entries(MODELS)) {
|
||||
it(`${kind} 기록이 프로젝트·주제·이웃 기록을 함께 보여 준다`, () => {
|
||||
describe("Record는 위치와 앞뒤 탐색만 보여 준다", () => {
|
||||
const navigation = {
|
||||
previous: {
|
||||
label: "열린 질문",
|
||||
title: "앞에서 확인할 질문",
|
||||
path: "/questions/previous",
|
||||
},
|
||||
next: {
|
||||
label: "적용 기준",
|
||||
title: "다음에 읽을 기준",
|
||||
path: "/references/next",
|
||||
},
|
||||
} as const;
|
||||
|
||||
for (const kind of ["CASE", "CONCEPT", "SETUP", "REFERENCE", "QUESTION"] as const) {
|
||||
it(`${kind} 기록이 Project / Topic / Previous / Current / Next만 rail에 보여 준다`, () => {
|
||||
render(
|
||||
<MemoryRouter>
|
||||
<PublicRecordRenderer {...dependencies} model={model} />
|
||||
<PublicRecordRenderer
|
||||
{...dependencies}
|
||||
model={MODELS[kind]}
|
||||
navigation={navigation}
|
||||
/>
|
||||
</MemoryRouter>,
|
||||
);
|
||||
|
||||
const context = screen.getByRole("navigation", { name: "이 기록의 맥락" });
|
||||
// 예전처럼 제목 아래에 별도 Context Path를 다시 그리지 않는다.
|
||||
expect(screen.queryByRole("navigation", { name: "이 기록의 맥락" })).toBeNull();
|
||||
|
||||
const breadcrumb = screen.getByRole("navigation", { name: "문서 경로" });
|
||||
expect(breadcrumb).toHaveTextContent("가상화/CPU 가상화");
|
||||
|
||||
const context = screen.getByRole("navigation", { name: "읽기 맥락" });
|
||||
expect(within(context).getByRole("link", { name: "가상화" })).toHaveAttribute(
|
||||
"href",
|
||||
"/projects/gasanghwa",
|
||||
@@ -134,28 +157,22 @@ describe("기록마다 맥락이 제목 바로 아래에 있다", () => {
|
||||
"href",
|
||||
"/topics/cpu",
|
||||
);
|
||||
// 이웃 기록은 제목만이 아니라 "왜 그것을 읽어야 하는지"를 함께 보여야 사슬로 읽힌다.
|
||||
expect(within(context).getByRole("link", { name: "이어지는 기준" })).toBeInTheDocument();
|
||||
expect(
|
||||
within(context).getByText("이 기록의 결론이 그대로 이 기준이 되었다."),
|
||||
).toBeInTheDocument();
|
||||
// 지금 보는 기록도 목록에 있어야 "내가 그중 어디인가"가 보인다.
|
||||
expect(within(context).getByText("지금 읽는 기록")).toBeInTheDocument();
|
||||
expect(within(context).getByRole("link", { name: /앞에서 확인할 질문/ })).toHaveAttribute(
|
||||
"href",
|
||||
"/questions/previous",
|
||||
);
|
||||
expect(within(context).getByText(/Current/)).toBeInTheDocument();
|
||||
expect(within(context).getByRole("link", { name: /다음에 읽을 기준/ })).toHaveAttribute(
|
||||
"href",
|
||||
"/references/next",
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
it("올라갈 곳도 옆으로 갈 곳도 없으면 빈 상자를 남기지 않는다", () => {
|
||||
it("Project Decision도 본문 위에 별도 Context Path를 만들지 않는다", () => {
|
||||
render(
|
||||
<MemoryRouter>
|
||||
<PublicRecordRenderer
|
||||
{...dependencies}
|
||||
model={{
|
||||
...MODELS.CONCEPT,
|
||||
topic: { id: "t", label: "", publicPath: null },
|
||||
project: null,
|
||||
relations: [],
|
||||
}}
|
||||
/>
|
||||
<PublicRecordRenderer {...dependencies} model={MODELS.PROJECT_DECISION} />
|
||||
</MemoryRouter>,
|
||||
);
|
||||
|
||||
|
||||
@@ -125,7 +125,7 @@ afterEach(() => {
|
||||
});
|
||||
|
||||
describe("TechLog home discovery", () => {
|
||||
it("renders the exact identity, now block, latest ordering, and explore choices", async () => {
|
||||
it("renders the exact identity and the NOW → PROJECTS → RECENT hierarchy", async () => {
|
||||
await renderDiscoveryRoute("TECH_LOG_HOME", "/");
|
||||
|
||||
expect(screen.getByRole("heading", { level: 1, name: "TechLog" })).toBeVisible();
|
||||
@@ -152,7 +152,7 @@ describe("TechLog home discovery", () => {
|
||||
홈의 입구는 프로젝트다. 맥락을 자세히 그리는 일은 프로젝트·주제 화면이 맡고, 홈은 어디로
|
||||
들어갈지 정하게 한다.
|
||||
*/
|
||||
const projects = screen.getByRole("region", { name: "조사가 사는 곳" });
|
||||
const projects = screen.getByRole("region", { name: "프로젝트" });
|
||||
expect(within(projects).getAllByRole("listitem").length).toBeGreaterThan(0);
|
||||
|
||||
/*
|
||||
@@ -181,17 +181,9 @@ describe("TechLog home discovery", () => {
|
||||
Array.from(latest.querySelectorAll(".latest-time > span"), (span) => span.textContent),
|
||||
)].every((label) => /^[가-힣 ]+$/u.test(label ?? "")),
|
||||
).toBe(true);
|
||||
/*
|
||||
종류별 입구. 예전에는 이 자리가 낱말 뜻풀이였고 이름이 `Case`·`OpenQuestion` 같은
|
||||
저장소의 말이었다. 이름이 하는 일을 말하도록 바뀌었으므로 설명도 함께 바뀐다.
|
||||
프로젝트는 종류가 아니라 그릇이므로 이 목록에서 뺐다 — 주 내비가 이미 데려간다.
|
||||
*/
|
||||
expect(
|
||||
screen.getByRole("link", { name: /무엇을 해보고 무엇을 확인했는지.*검증 기록/ }),
|
||||
).toHaveAttribute("href", "/explore/cases");
|
||||
expect(
|
||||
screen.getByRole("link", { name: /아직 답하지 못한 것과 다음 검증.*열린 질문/ }),
|
||||
).toHaveAttribute("href", "/explore/questions");
|
||||
// Home은 계층별 Context Path를 그리지 않는다. 현재 작업과 Project 입구만 남긴다.
|
||||
expect(screen.queryByText(/한 프로젝트의 맥락을 따라 읽습니다/)).toBeNull();
|
||||
expect(screen.queryByText("종류별로 읽기")).toBeNull();
|
||||
});
|
||||
|
||||
it("preserves the source home empty and error states", async () => {
|
||||
|
||||
@@ -219,7 +219,12 @@ describe("TechLog canonical Public documents", () => {
|
||||
const [firstEvidence] = within(main).getAllByText(evidence, { exact: false });
|
||||
expect(firstEvidence).toBeVisible();
|
||||
const breadcrumb = within(main).getByRole("navigation", { name: "문서 경로" });
|
||||
expect(breadcrumb).toHaveTextContent(`${kind}/${topic}/${project}`);
|
||||
expect(breadcrumb).toHaveTextContent(`${project}/${topic}`);
|
||||
expect(breadcrumb).not.toHaveTextContent(kind);
|
||||
const typeLabel = main.querySelector(
|
||||
".case-header > .section-kicker, .public-document-header > .section-kicker",
|
||||
);
|
||||
expect(typeLabel).toHaveTextContent(kind);
|
||||
/*
|
||||
글자만 보고 있었더니 주제 링크가 어디로 가는지는 아무도 묻지 않았다. 그 링크는
|
||||
`/topics/:slug` 를 가리켰고, 그 화면은 세 개의 주제를 하드코딩해 두고 있어 실제 주제는
|
||||
@@ -349,7 +354,7 @@ describe("TechLog topics and Public not-found routing", () => {
|
||||
await renderDocumentRoute("TECH_LOG_TOPIC", `/topics/${slug}`);
|
||||
|
||||
expect(screen.getByRole("heading", { level: 1, name: title })).toBeVisible();
|
||||
expect(screen.getByRole("heading", { name: "정리해 둔 것" })).toBeVisible();
|
||||
expect(screen.getByRole("heading", { name: "정리된 개념과 기준" })).toBeVisible();
|
||||
});
|
||||
|
||||
/*
|
||||
@@ -361,24 +366,27 @@ describe("TechLog topics and Public not-found routing", () => {
|
||||
아직 답하지 못한 질문은 흐름에 넣지 않는다. 마지막 칸에 두면 이 주제가 질문으로 끝난 것처럼
|
||||
읽히고, 그것은 사고의 결과가 아니라 다음 할 일이다.
|
||||
*/
|
||||
it("orders the reasoning path by kind and does not repeat it below", async () => {
|
||||
it("separates Record reasoning flow from Knowledge and Open", async () => {
|
||||
const { container } = await renderDocumentRoute("TECH_LOG_TOPIC", "/topics/jpa");
|
||||
|
||||
const steps = [...container.querySelectorAll(".context-flow__copy")].map((copy) => ({
|
||||
label: copy.querySelector(".context-flow__meta")?.textContent,
|
||||
href: copy.querySelector("a")?.getAttribute("href"),
|
||||
}));
|
||||
expect(steps.map((entry) => entry.label)).toEqual(["검증 기록", "적용 기준"]);
|
||||
expect(steps.map((entry) => entry.label)).toEqual([
|
||||
"검증 기록",
|
||||
"열린 질문",
|
||||
"적용 기준",
|
||||
"결정",
|
||||
]);
|
||||
|
||||
// 흐름에 오른 편은 아래 목록에서 빠진다 — 같은 편이 두 번 나오면 순서를 정해 준 뜻이 없다.
|
||||
const rest = [...container.querySelectorAll(".public-record-list > li > a")].map((link) =>
|
||||
// Knowledge는 navigation의 나머지가 아니라 Topic에서 정리한 Concept / Reference 콘텐츠다.
|
||||
const knowledge = [...container.querySelectorAll(".public-record-list > li > a")].map((link) =>
|
||||
link.getAttribute("href"),
|
||||
);
|
||||
for (const entry of steps) {
|
||||
expect(rest).not.toContain(entry.href);
|
||||
}
|
||||
expect(rest).toContain("/questions/collection-fetch-join-with-pagination");
|
||||
expect(screen.getByRole("heading", { name: "아직 답하지 못한 것" })).toBeVisible();
|
||||
expect(knowledge).toContain("/references/jpa-list-fetch-strategy");
|
||||
// 해결된 질문은 Reasoning Path에는 남아도 OPEN으로 다시 나타나지 않는다.
|
||||
expect(screen.queryByRole("heading", { name: "아직 답하지 못한 질문" })).toBeNull();
|
||||
});
|
||||
|
||||
/*
|
||||
@@ -395,27 +403,23 @@ describe("TechLog topics and Public not-found routing", () => {
|
||||
).not.toBeInTheDocument();
|
||||
});
|
||||
|
||||
/*
|
||||
흐름이 서지 않는 주제에서도 기록은 남아야 한다. 흐름을 그릴지 말지를 화면 안에서만 판단했을
|
||||
때, 기록이 하나뿐인 주제는 흐름도 없고 목록도 "흐름에 올랐다" 며 그 하나를 빼서 화면에
|
||||
아무것도 남지 않았다.
|
||||
*/
|
||||
it("keeps the only record of a single-record topic visible", async () => {
|
||||
it("keeps a sparse Topic useful when a Record leads directly to a Decision", async () => {
|
||||
const { container } = await renderDocumentRoute("TECH_LOG_TOPIC", "/topics/redis");
|
||||
|
||||
expect(container.querySelectorAll(".context-flow").length).toBe(0);
|
||||
expect(
|
||||
Array.from(
|
||||
container.querySelectorAll(".public-record-list > li > a"),
|
||||
container.querySelectorAll(".context-flow__copy > a"),
|
||||
(link) => link.getAttribute("href"),
|
||||
),
|
||||
).toContain("/cases/redis-adapter-ttl-boundary");
|
||||
).toEqual([
|
||||
"/cases/redis-adapter-ttl-boundary",
|
||||
"/projects/backend-skeleton/decisions#storage-port-unification",
|
||||
]);
|
||||
});
|
||||
|
||||
it("keeps JPA topic records in canonical reasoning order", async () => {
|
||||
const { container } = await renderDocumentRoute("TECH_LOG_TOPIC", "/topics/jpa");
|
||||
|
||||
// 픽스처의 JPA 주제는 종류마다 한 편씩이다. 원리가 없으므로 흐름은 확인 → 기준 둘이다.
|
||||
expect(
|
||||
Array.from(
|
||||
container.querySelectorAll(".context-flow__copy > a"),
|
||||
@@ -423,7 +427,9 @@ describe("TechLog topics and Public not-found routing", () => {
|
||||
),
|
||||
).toEqual([
|
||||
"/cases/collection-fetch-join-pagination",
|
||||
"/questions/collection-fetch-join-with-pagination",
|
||||
"/references/jpa-list-fetch-strategy",
|
||||
"/projects/backend-skeleton/decisions#feed-pagination-boundary",
|
||||
]);
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user