fix: 종류 이름을 화면마다 하나로 맞추고, 읽는 순서를 기록에서 만든다
홈 한 화면에 종류 이름이 아홉 개 떠 있었다. 최근 기록 목록은 `CASE`·`CONCEPT`·`OPEN QUESTION`·`REFERENCE` 로, 바로 아래 「종류별로 읽기」는 「검증 기록」·「동작 원리」· 「적용 기준」·「열린 질문」으로 같은 넷을 불렀다. 독자는 둘이 같은 것이라는 단서를 어디서도 받지 못했다 — 이름을 바꾸기 전보다 나빠진 유일한 자리다. 목록도 공용 표에서 가져온다. 주제 허브의 「먼저 읽을 것」은 넷 다 열린 질문이었다. 서버가 주는 대표 값은 순서가 아니라 통 두 개(대표 Case · 열린 질문)이고 앞쪽이 비어 있어서, 아직 답이 없는 질문만 모아 놓고 「먼저 읽을 것」이라 부르고 있었다. 그리고 그 넷이 바로 아래 목록에 그대로 다시 나왔다. 이제 기록에서 순서를 만든다 — 원리 → 확인한 기록 → 기준 → 아직 모르는 것 — 그리고 위에 오른 편은 아래에서 뺀다. 개념은 목록 매퍼에서 통째로 버려지고 있었다. 서버는 보내고 필터에는 「동작 원리」가 있는데 결과가 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:
co-authored by
Claude Opus 5
parent
88d841dc96
commit
dc2fda7a5d
@@ -38,28 +38,28 @@
|
||||
},
|
||||
"contractSet": {
|
||||
"setAlgorithm": "CA_CONTRACT_SET_V1",
|
||||
"setDigest": "sha256:316028ca9b408cd5e943f1971792fbdb843392ea51ae415815fbbb8701d03909",
|
||||
"setDigest": "sha256:6547e98a79ff5e09afeac849036d559481fc8abc6e232a2b5ce5c9841a071a25",
|
||||
"packages": [
|
||||
{
|
||||
"packageId": "@tech-log/management-contract",
|
||||
"version": "1.0.0",
|
||||
"digest": "sha256:61f8360cfb2e638c5d8c5557434b564e39cea517464c33cedcd1c5bf39a58aa8",
|
||||
"runtimeProtocolVersion": 1,
|
||||
"sourceRevision": "71bab4c"
|
||||
"sourceRevision": "a58ad30"
|
||||
},
|
||||
{
|
||||
"packageId": "@tech-log/public-contract",
|
||||
"version": "2.1.0",
|
||||
"digest": "sha256:977edf6707dc41a92f58f0f42908864ab8a3c1991d08f5c598319d51dac65235",
|
||||
"digest": "sha256:a964914040740a1223c33b5aeaf7724a8a0c78d91063bf3f1b7d7594c314a395",
|
||||
"runtimeProtocolVersion": 1,
|
||||
"sourceRevision": "71bab4c"
|
||||
"sourceRevision": "a58ad30"
|
||||
},
|
||||
{
|
||||
"packageId": "@tech-log/studio-contract",
|
||||
"version": "3.1.0",
|
||||
"digest": "sha256:d2bfbe0a12136f131ccb8c42f8868108ba8d0f0182b347f9b815316c343a970c",
|
||||
"runtimeProtocolVersion": 1,
|
||||
"sourceRevision": "71bab4c"
|
||||
"sourceRevision": "a58ad30"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -221,11 +221,26 @@ export function baseOf(
|
||||
* for free; it is a real extra request now, and the alternative — widening the
|
||||
* list response — would send every body to render a title.
|
||||
*/
|
||||
/**
|
||||
* 지식 목록이 싣는 종류. 계약의 `KnowledgeListItem.type` 과 같은 집합이어야 한다.
|
||||
*
|
||||
* <p>여기가 삼항이던 동안 개념은 어디에도 없어 `null` 로 버려졌다. 서버는 개념을 보내고 탐색
|
||||
* 필터에는 「동작 원리」가 있는데 결과는 0건이었다 — 독자에게는 기록이 없는 것으로 보였다.
|
||||
* 손으로 나열한 목록에 개념을 빠뜨리는 일이 이 저장소에서 반복됐고, 이 자리가 마지막이다.
|
||||
*/
|
||||
const KNOWLEDGE_LIST_KINDS: Record<string, PublicRecord["kind"]> = {
|
||||
CASE: "CASE",
|
||||
CONCEPT: "CONCEPT",
|
||||
REFERENCE: "REFERENCE",
|
||||
};
|
||||
|
||||
export function knowledgeListItemToRecord(item: Readonly<Record<string, unknown>>): PublicRecord | null {
|
||||
const type = String(item.type ?? "");
|
||||
const kind = KNOWLEDGE_LIST_KINDS[type];
|
||||
if (!kind) return null;
|
||||
const path = String(item.path ?? "");
|
||||
const slug = path.split("/").filter(Boolean).pop() ?? "";
|
||||
const base = baseOf(type === "REFERENCE" ? "REFERENCE" : "CASE", slug, {
|
||||
const base = baseOf(kind, slug, {
|
||||
title: item.title as string,
|
||||
summary: (item.primarySummary as string) ?? "",
|
||||
path,
|
||||
@@ -248,6 +263,17 @@ export function knowledgeListItemToRecord(item: Readonly<Record<string, unknown>
|
||||
sections: Object.freeze([]),
|
||||
}) as CaseRecord;
|
||||
}
|
||||
if (type === "CONCEPT") {
|
||||
return Object.freeze({
|
||||
...base,
|
||||
kind: "CONCEPT",
|
||||
basisVersion: "",
|
||||
// 목록 항목은 본문을 담지 않는다 — 본문은 상세 조회에서만 온다.
|
||||
content: "",
|
||||
bodyAssets: Object.freeze([]),
|
||||
sections: Object.freeze([]),
|
||||
}) as ConceptRecord;
|
||||
}
|
||||
if (type === "REFERENCE") {
|
||||
return Object.freeze({
|
||||
...base,
|
||||
@@ -322,6 +348,8 @@ export function questionListItemToRecord(item: Readonly<Record<string, unknown>>
|
||||
summary: (item.summary as string) ?? "",
|
||||
path,
|
||||
primaryProject: item.primaryProject as Summary,
|
||||
// 계약이 이제 질문 목록에도 주제를 준다. 없던 동안 목록의 질문 줄만 「· 프로젝트」로 시작했다.
|
||||
primaryTopic: item.primaryTopic as Summary,
|
||||
publishedAt: item.updatedAt as string,
|
||||
}),
|
||||
kind: "QUESTION",
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
"packageId": "@tech-log/management-contract",
|
||||
"version": "1.0.0",
|
||||
"digest": "sha256:61f8360cfb2e638c5d8c5557434b564e39cea517464c33cedcd1c5bf39a58aa8",
|
||||
"sourceRevision": "71bab4c",
|
||||
"sourceRevision": "a58ad30",
|
||||
"operationIds": [
|
||||
"createCaseDraft",
|
||||
"getCaseForEdit",
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
{
|
||||
"packageId": "@tech-log/public-contract",
|
||||
"version": "2.1.0",
|
||||
"digest": "sha256:977edf6707dc41a92f58f0f42908864ab8a3c1991d08f5c598319d51dac65235",
|
||||
"sourceRevision": "71bab4c",
|
||||
"digest": "sha256:a964914040740a1223c33b5aeaf7724a8a0c78d91063bf3f1b7d7594c314a395",
|
||||
"sourceRevision": "a58ad30",
|
||||
"operationIds": [
|
||||
"getPublicSite",
|
||||
"getPublicHome",
|
||||
|
||||
@@ -523,6 +523,11 @@ export interface components {
|
||||
currentUnderstanding?: string;
|
||||
nextVerification?: string;
|
||||
primaryProject?: components["schemas"]["ProjectSummary"];
|
||||
/** @description 이 질문이 속한 주제. 지식 목록(`KnowledgeListItem`)은 처음부터 이것을 싣고 있었는데
|
||||
* 질문 목록만 빠져 있어서, 같은 목록에 섞여 나오는 질문 줄만 맥락이 「· 프로젝트」로
|
||||
* 시작했다. 주제로 거르는 것은 서버가 이미 하고 있었다 — 보여 줄 값만 없었다.
|
||||
* */
|
||||
primaryTopic?: components["schemas"]["TopicSummary"];
|
||||
/** Format: date-time */
|
||||
updatedAt: string;
|
||||
};
|
||||
|
||||
@@ -1181,6 +1181,13 @@ components:
|
||||
type: string
|
||||
primaryProject:
|
||||
$ref: '#/components/schemas/ProjectSummary'
|
||||
primaryTopic:
|
||||
allOf:
|
||||
- $ref: '#/components/schemas/TopicSummary'
|
||||
description: |
|
||||
이 질문이 속한 주제. 지식 목록(`KnowledgeListItem`)은 처음부터 이것을 싣고 있었는데
|
||||
질문 목록만 빠져 있어서, 같은 목록에 섞여 나오는 질문 줄만 맥락이 「· 프로젝트」로
|
||||
시작했다. 주제로 거르는 것은 서버가 이미 하고 있었다 — 보여 줄 값만 없었다.
|
||||
updatedAt: *id003
|
||||
QuestionPage:
|
||||
type: object
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
"packageId": "@tech-log/studio-contract",
|
||||
"version": "3.1.0",
|
||||
"digest": "sha256:d2bfbe0a12136f131ccb8c42f8868108ba8d0f0182b347f9b815316c343a970c",
|
||||
"sourceRevision": "71bab4c",
|
||||
"sourceRevision": "a58ad30",
|
||||
"operationIds": [
|
||||
"getStudioSession",
|
||||
"getStudioDashboard",
|
||||
|
||||
@@ -112,6 +112,7 @@ export function HomeFocus({
|
||||
|
||||
{renderedItems.map((item) => {
|
||||
const selected = item.key === activeKey;
|
||||
const shown = item.details.filter((detail) => detail.value.trim() !== "");
|
||||
return (
|
||||
<article
|
||||
className="focus-content"
|
||||
@@ -123,19 +124,27 @@ export function HomeFocus({
|
||||
>
|
||||
<div className="focus-summary">
|
||||
<h2>{item.title}</h2>
|
||||
<p>{cardSummary(item.summary)}</p>
|
||||
{/* 프로젝트 한 줄 설명이 비어 있을 수 있다 — 그때는 빈 문단을 두지 않는다. */}
|
||||
{item.summary.trim() ? <p>{cardSummary(item.summary)}</p> : null}
|
||||
<Link className="text-link" to={item.targetPath}>
|
||||
작업 맥락 보기 <span aria-hidden="true">↗</span>
|
||||
</Link>
|
||||
</div>
|
||||
<dl className="focus-details">
|
||||
{item.details.map((detail) => (
|
||||
<div key={detail.label}>
|
||||
<dt>{detail.label}</dt>
|
||||
<dd>{detail.value}</dd>
|
||||
</div>
|
||||
))}
|
||||
</dl>
|
||||
{/*
|
||||
값이 없는 항목은 그리지 않는다. 「현재 목표」·「다음 작업」을 아직 적지 않은
|
||||
프로젝트에서 라벨과 구분선만 남아 빈 칸 두 개가 화면에 있었다 — 비어 있다는 사실을
|
||||
보여 줄 이유가 없는 자리다.
|
||||
*/}
|
||||
{shown.length > 0 ? (
|
||||
<dl className="focus-details">
|
||||
{shown.map((detail) => (
|
||||
<div key={detail.label}>
|
||||
<dt>{detail.label}</dt>
|
||||
<dd>{detail.value}</dd>
|
||||
</div>
|
||||
))}
|
||||
</dl>
|
||||
) : null}
|
||||
</article>
|
||||
);
|
||||
})}
|
||||
|
||||
@@ -49,23 +49,37 @@ function optionalString(value: unknown): string | undefined {
|
||||
* 릴리스는 Publication 파이프라인을 거치지 않아 그 투영에 행이 없다. 그래서 릴리스만 따로 읽어
|
||||
* 시간순으로 합친다.
|
||||
*/
|
||||
const latestTypeLabels: Readonly<Record<string, string>> = {
|
||||
PROJECT_ACTIVITY: "PROJECT ACTIVITY",
|
||||
QUESTION: "OPEN QUESTION",
|
||||
/**
|
||||
* 최근 기록 한 줄이 다는 이름.
|
||||
*
|
||||
* <p>이 표가 영문 대문자를 그대로 흘려보내던 동안 홈 한 화면에 종류 이름이 아홉 개 떠 있었다 —
|
||||
* 목록에는 `CASE`·`CONCEPT`·`OPEN QUESTION`·`REFERENCE`, 바로 아래 「종류별로 읽기」에는
|
||||
* 「검증 기록」·「동작 원리」·「적용 기준」·「열린 질문」. 독자는 둘이 같은 것이라는 단서를
|
||||
* 어디서도 받지 못했다. 이름을 바꾸기 전보다 나빠진 유일한 자리였다.
|
||||
*
|
||||
* <p>기록의 네 종류는 공용 표에서 가져온다. 프로젝트 활동만 여기 따로 적는다 — 기록이 아니라
|
||||
* 프로젝트에서 일어난 일이라 `RecordKind` 에 없다.
|
||||
*/
|
||||
const NOT_A_RECORD_LABELS: Readonly<Record<string, string>> = {
|
||||
PROJECT_ACTIVITY: "프로젝트 활동",
|
||||
};
|
||||
|
||||
function latestTypeLabel(entryType: string): string {
|
||||
if (entryType in DOCUMENT_KIND_LABELS) {
|
||||
return DOCUMENT_KIND_LABELS[entryType as keyof typeof DOCUMENT_KIND_LABELS];
|
||||
}
|
||||
return NOT_A_RECORD_LABELS[entryType] ?? entryType;
|
||||
}
|
||||
|
||||
async function getLatestEntries(
|
||||
publicContent: PublicContentQueries,
|
||||
): Promise<LatestEntry[]> {
|
||||
const [records, searchableEntities] = await Promise.all([
|
||||
publicContent.getLatestEntries(),
|
||||
publicContent.searchPublicContent(""),
|
||||
]);
|
||||
const records = await publicContent.getLatestEntries();
|
||||
|
||||
const recordTimeline: LatestEntry[] = records.map((entry) => ({
|
||||
id: entry.id,
|
||||
// 목록의 다른 이름들과 같은 자리에 놓이므로 표기도 같은 규칙을 쓴다 — 대문자에 공백.
|
||||
typeLabel: latestTypeLabels[entry.entryType] ?? entry.entryType,
|
||||
typeLabel: latestTypeLabel(entry.entryType),
|
||||
title: entry.title,
|
||||
summary: entry.summary,
|
||||
date: dateLabel(entry.publishedAt),
|
||||
@@ -75,39 +89,23 @@ async function getLatestEntries(
|
||||
path: entry.path,
|
||||
}));
|
||||
|
||||
const releaseTimeline = (
|
||||
await Promise.all(
|
||||
searchableEntities
|
||||
.filter((entity) => entity.contentType === "RELEASE")
|
||||
.map(async (entity) => {
|
||||
const prefix = "/releases/";
|
||||
if (!entity.path.startsWith(prefix)) return [];
|
||||
const release = await publicContent.getRelease(
|
||||
decodeURIComponent(entity.path.slice(prefix.length)),
|
||||
);
|
||||
if (!release) return [];
|
||||
return [
|
||||
{
|
||||
id: `release-${release.version}`,
|
||||
typeLabel: "RELEASE",
|
||||
title: release.title,
|
||||
summary: release.summary,
|
||||
date: release.publishedLabel,
|
||||
dateTime: release.publishedAt,
|
||||
topic: "TechLog",
|
||||
project: "TechLog",
|
||||
path: release.path,
|
||||
},
|
||||
];
|
||||
}),
|
||||
)
|
||||
).flat();
|
||||
/*
|
||||
릴리스는 넣지 않는다. 변경 기록은 이 기록의 읽을거리가 아니라 사이트 자체의 이력이라
|
||||
주 내비에서 뺐는데, 홈 목록에는 그대로 섞여 있었다 — 같은 판단이 한 자리에만 적용돼 있었다.
|
||||
`/releases` 는 그대로 살아 있고 릴리스 화면에서 읽는다.
|
||||
|
||||
return [...recordTimeline, ...releaseTimeline].sort((left, right) =>
|
||||
right.dateTime.localeCompare(left.dateTime),
|
||||
);
|
||||
그리고 앞의 몇 편만 보인다. 주제 허브가 생긴 지금 홈이 할 일은 목록을 통째로 펴 두는 것이
|
||||
아니라 「무엇을 견줬나」와 「지금 무엇을 하고 있나」를 보여 주는 것이다 — 목록이 홈의 절반을
|
||||
차지하면 그 둘이 스크롤 아래로 밀린다.
|
||||
*/
|
||||
return [...recordTimeline]
|
||||
.sort((left, right) => right.dateTime.localeCompare(left.dateTime))
|
||||
.slice(0, LATEST_ON_HOME);
|
||||
}
|
||||
|
||||
/** 홈이 펴 두는 최근 기록 수. 나머지는 「모든 기록 탐색」이 받는다. */
|
||||
const LATEST_ON_HOME = 4;
|
||||
|
||||
/** 목록의 날짜 칸은 공개 화면 어디서나 같은 형식이다. */
|
||||
function dateLabel(isoTimestamp: string): string {
|
||||
const parsed = new Date(isoTimestamp);
|
||||
|
||||
@@ -4,9 +4,46 @@ import {
|
||||
} from "../../../../../presentation/routes/route-input.tsx";
|
||||
import { PublicDocumentRelations } from "../../shared/public-render/public-document-relations.tsx";
|
||||
import { ProseText } from "../../shared/public-render/prose-text.tsx";
|
||||
import type {
|
||||
PublicRecord,
|
||||
RecordKind,
|
||||
} from "../../../application/ports/public-content-queries.ts";
|
||||
import { DOCUMENT_KIND_LABELS } from "../../shared/document-kind-labels.ts";
|
||||
import { PublicRecordList } from "../components/public-record-list.tsx";
|
||||
import { usePublicContent } from "../use-public-content.tsx";
|
||||
|
||||
/**
|
||||
* 읽는 순서.
|
||||
*
|
||||
* <p>서버가 주는 대표 기록(`featuredCases`/`featuredReference`)은 작성자가 주제마다 손으로
|
||||
* 골라 두는 값이라 대부분 비어 있다. 비어 있으면 열린 질문만 남아, 아직 답이 없는 질문 넷을
|
||||
* 모아 두고 「먼저 읽을 것」이라 부르게 된다 — 처음 온 사람에게 가장 나쁜 첫 화면이다.
|
||||
*
|
||||
* <p>그래서 기록 자체에서 순서를 만든다. 원리를 먼저 알고, 그것을 확인한 기록을 보고, 거기서
|
||||
* 나온 기준을 읽고, 아직 답하지 못한 것을 마지막에 본다.
|
||||
*
|
||||
* <p>서버의 대표 값을 쓰지 않는 이유는 그것이 순서가 아니라 통 두 개(대표 Case · 열린 질문)라
|
||||
* 서다. 통을 이어 붙이면 기준이 통째로 빠지고, 채워져 있는 쪽이 질문뿐일 때는 질문만 남는다.
|
||||
*/
|
||||
const READING_ORDER: ReadonlyArray<RecordKind> = ["CONCEPT", "CASE", "REFERENCE", "QUESTION"];
|
||||
|
||||
/** 한 종류에서 앞의 몇 편까지. 넘으면 순서가 아니라 목록이 된다. */
|
||||
const PER_KIND = 2;
|
||||
|
||||
function firstReads(records: ReadonlyArray<PublicRecord>) {
|
||||
return READING_ORDER.flatMap((kind) =>
|
||||
records
|
||||
.filter((record) => record.kind === kind)
|
||||
.slice(0, PER_KIND)
|
||||
.map((record) => ({
|
||||
label: DOCUMENT_KIND_LABELS[record.kind],
|
||||
title: record.title,
|
||||
path: record.path,
|
||||
summary: record.summary,
|
||||
})),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 주제 한 편.
|
||||
*
|
||||
@@ -31,6 +68,9 @@ export function TopicPage() {
|
||||
if (!topic) return <RegisteredNotFoundRoute />;
|
||||
|
||||
const axisLabel = topic.variantLabel.trim() || "접근";
|
||||
const readingOrder = firstReads(records);
|
||||
const readingPaths = new Set(readingOrder.map((entry) => entry.path));
|
||||
const rest = records.filter((record) => !readingPaths.has(record.path));
|
||||
return (
|
||||
<main id="main-content" className="shell public-index-page topic-hub">
|
||||
<header className="public-page-header">
|
||||
@@ -47,6 +87,14 @@ export function TopicPage() {
|
||||
<section className="topic-variants" aria-labelledby="topic-variants-title">
|
||||
<p className="section-kicker">{axisLabel}</p>
|
||||
<h2 id="topic-variants-title">{`${axisLabel}별로 무엇을 알게 됐나`}</h2>
|
||||
{/*
|
||||
오른쪽 숫자를 더해도 아래 목록의 개수와 맞지 않는다. 한 기록이 여러 축에 걸릴 수
|
||||
있고, 어느 축에도 걸리지 않은 기록은 공통이기 때문이다 — 그 규칙을 화면이 말하지
|
||||
않으면 독자는 빠진 기록이 있다고 읽는다.
|
||||
*/}
|
||||
<p className="topic-variants-note">
|
||||
{`한 기록이 여러 ${axisLabel}에 걸릴 수 있고, 어디에도 걸리지 않은 기록은 이 주제의 공통 기록입니다.`}
|
||||
</p>
|
||||
<ul>
|
||||
{topic.variants.map((variant) => (
|
||||
/*
|
||||
@@ -72,16 +120,20 @@ export function TopicPage() {
|
||||
) : null}
|
||||
|
||||
<PublicDocumentRelations
|
||||
relations={[...topic.featuredCases, ...topic.activeQuestions]}
|
||||
relations={readingOrder}
|
||||
kicker="Reading order"
|
||||
title="먼저 읽을 것"
|
||||
/>
|
||||
|
||||
{/*
|
||||
먼저 읽을 것에 오른 편은 여기서 뺀다. 예전에는 같은 네 편이 위아래로 두 번 나왔다 —
|
||||
「먼저 읽을 것」이 목록의 앞부분을 복사한 것처럼 보이면 순서를 정해 준 뜻이 없어진다.
|
||||
*/}
|
||||
<div className="public-result-heading">
|
||||
<h2>관련 기록</h2>
|
||||
<p>{`${records.length}개의 관련 기록`}</p>
|
||||
<h2>나머지 기록</h2>
|
||||
<p>{`${rest.length}개`}</p>
|
||||
</div>
|
||||
<PublicRecordList records={records} />
|
||||
<PublicRecordList records={rest} emptyMessage="먼저 읽을 것 외에 남은 기록이 없습니다." />
|
||||
|
||||
<PublicDocumentRelations
|
||||
relations={topic.relatedProjects}
|
||||
|
||||
@@ -2395,13 +2395,36 @@ dialog::backdrop {
|
||||
종류 표시. 이름이 이제 한국어 문구이므로 대문자 변환을 쓰지 않는다 — 한글에는 대소문자가
|
||||
없고, mono 글꼴은 한글을 갖지 않아 낱말 사이만 벌어진다.
|
||||
*/
|
||||
.record-kind { padding-top: 3px; color: var(--faint); font-size: 12px; letter-spacing: -0.01em; }
|
||||
/*
|
||||
다섯 종류를 색 다섯으로 칠하지 않는다. 독자가 구분해야 하는 것은 지식의 상태 셋이고, 그중
|
||||
아직 답하지 못한 것만 눈에 띄면 된다.
|
||||
|
||||
다만 색만 조금 진하게 해서는 셋이 한 덩어리로 보였다 — 이름을 한글 역할명으로 바꾼 뒤에도
|
||||
네 종류가 같은 회색 작은 글씨라 목록을 훑을 때 종류가 읽히지 않았다. 배경 없이 왼쪽 선
|
||||
하나와 글자 굵기로만 가른다; 이 사이트의 다른 강조와 같은 방식이고 색맹에도 남는다.
|
||||
*/
|
||||
.record-kind[data-state="OPEN"] { color: var(--warning, #b8791f); font-weight: 650; }
|
||||
.record-kind[data-state="SETTLED"] { color: var(--muted); }
|
||||
.record-kind {
|
||||
padding-top: 2px;
|
||||
padding-left: 9px;
|
||||
border-left: 2px solid var(--line-strong);
|
||||
color: var(--muted);
|
||||
font-size: 12px;
|
||||
font-weight: 560;
|
||||
letter-spacing: -0.01em;
|
||||
}
|
||||
|
||||
/* 확인한 것 — 실제로 만들어 보고 관찰한 기록. 가장 단단하므로 글자를 제일 진하게 둔다. */
|
||||
.record-kind[data-state="CONFIRMED"] { border-left-color: var(--ink); color: var(--ink-soft); }
|
||||
|
||||
/* 정리한 것 — 판단의 기준. 확인한 것에서 나오므로 한 단계 물러선다. */
|
||||
.record-kind[data-state="SETTLED"] { border-left-color: var(--line-strong); color: var(--muted); }
|
||||
|
||||
/* 아직 모르는 것. 이 기록에서 가장 정직한 신호이고, 지금까지 가장 안 보였다. */
|
||||
.record-kind[data-state="OPEN"] {
|
||||
border-left-color: var(--warning, #b8791f);
|
||||
color: var(--warning, #b8791f);
|
||||
font-weight: 660;
|
||||
}
|
||||
.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; }
|
||||
|
||||
@@ -2982,3 +3005,10 @@ textarea.studio-control { min-height: 118px; resize: vertical; line-height: 1.65
|
||||
gap: 8px;
|
||||
}
|
||||
}
|
||||
|
||||
.topic-variants-note {
|
||||
margin: -8px 0 18px;
|
||||
color: var(--faint);
|
||||
font-size: 12px;
|
||||
line-height: 1.6;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
import assert from "node:assert/strict";
|
||||
import { readFileSync } from "node:fs";
|
||||
import { test } from "vitest";
|
||||
|
||||
import { knowledgeListItemToRecord } from "../../../src/features/tech-log/adapters/http/public-content-mapping.ts";
|
||||
|
||||
/**
|
||||
* 지식 목록이 계약이 보내는 종류를 하나도 버리지 않는지 본다.
|
||||
*
|
||||
* <p>매퍼가 CASE 와 REFERENCE 만 알던 동안 개념은 `null` 로 버려졌다. 서버는 개념을 보내고
|
||||
* 탐색 필터에는 「동작 원리」가 있는데 결과는 0건이었다 — 독자에게는 기록이 없는 것으로
|
||||
* 보였고, 필터에 있는데 결과가 없으니 오해가 남았다.
|
||||
*
|
||||
* <p>기대 목록을 손으로 적지 않고 계약에서 읽는다. 종류가 늘면 여기서 먼저 멈춘다.
|
||||
*/
|
||||
const CONTRACT = readFileSync(
|
||||
"src/features/tech-log/contracts/public/public-api.openapi.yaml",
|
||||
"utf8",
|
||||
);
|
||||
|
||||
function contractKnowledgeKinds(): string[] {
|
||||
const block = /\n {4}KnowledgeListItem:[\s\S]*?(?=\n {4}[A-Z]\w+:)/u.exec(CONTRACT)?.[0] ?? "";
|
||||
const typeBlock = /\n {8}type:\n {10}type: string\n {10}enum:\n((?: {10}- \w+\n)+)/u.exec(block);
|
||||
return [...(typeBlock?.[1] ?? "").matchAll(/- (\w+)/gu)].map((match) => match[1]!);
|
||||
}
|
||||
|
||||
test("계약이 보내는 지식 종류를 매퍼가 하나도 버리지 않는다", () => {
|
||||
const kinds = contractKnowledgeKinds();
|
||||
assert.deepEqual(
|
||||
[...kinds].sort(),
|
||||
["CASE", "CONCEPT", "REFERENCE"],
|
||||
"계약이 보내는 종류가 바뀌었다 — 매퍼의 표도 함께 봐야 한다",
|
||||
);
|
||||
|
||||
for (const type of kinds) {
|
||||
const record = knowledgeListItemToRecord({
|
||||
type,
|
||||
title: "제목",
|
||||
path: `/x/${type.toLowerCase()}`,
|
||||
primarySummary: "요약",
|
||||
publishedAt: "2026-01-01T00:00:00Z",
|
||||
primaryTopic: { name: "주제", slug: "topic" },
|
||||
primaryProject: { name: "프로젝트", slug: "project" },
|
||||
});
|
||||
assert.ok(record, `${type} 이 목록에서 버려진다`);
|
||||
assert.equal(record.kind, type, `${type} 이 다른 종류로 읽힌다`);
|
||||
// 맥락 줄이 이 두 값을 읽는다. 비면 「· 프로젝트」처럼 앞이 잘린 줄이 남는다.
|
||||
assert.equal(record.topic, "주제");
|
||||
assert.equal(record.projectTitle, "프로젝트");
|
||||
}
|
||||
});
|
||||
@@ -160,6 +160,11 @@ describe("TechLog home discovery", () => {
|
||||
);
|
||||
}
|
||||
|
||||
/*
|
||||
홈은 앞의 몇 편만 편다. 주제 허브가 생긴 지금 홈이 할 일은 목록을 통째로 펴 두는 것이
|
||||
아니라 무엇을 견줬고 지금 무엇을 하고 있는지를 보여 주는 것이다 — 목록이 홈의 절반을
|
||||
차지하면 그 둘이 스크롤 아래로 밀린다.
|
||||
*/
|
||||
const latest = screen.getByRole("region", { name: "최근 기록" });
|
||||
expect(
|
||||
within(latest).getAllByRole("heading", { level: 3 }).map((heading) =>
|
||||
@@ -170,9 +175,17 @@ describe("TechLog home discovery", () => {
|
||||
"파일 저장소 계약을 하나로 통합했습니다",
|
||||
"Authorization Code Flow에서 state와 nonce의 경계",
|
||||
"oauth2-proxy 뒤에서 토큰을 다시 검증할 것인가",
|
||||
"Redis Adapter가 도메인 TTL 정책을 소유하지 않는 이유",
|
||||
"TechLog Public·Studio 경계를 확정했습니다",
|
||||
]);
|
||||
/*
|
||||
종류 이름은 목록도 범례도 같은 표에서 가져온다. 목록만 영문 대문자로 나가던 동안 홈 한
|
||||
화면에 종류 이름이 아홉 개 떠 있었고, 독자는 `CASE` 와 「검증 기록」이 같은 것이라는
|
||||
단서를 어디서도 받지 못했다.
|
||||
*/
|
||||
expect(
|
||||
[...new Set(
|
||||
Array.from(latest.querySelectorAll(".latest-time > span"), (span) => span.textContent),
|
||||
)].every((label) => /^[가-힣 ]+$/u.test(label ?? "")),
|
||||
).toBe(true);
|
||||
/*
|
||||
종류별 입구. 예전에는 이 자리가 낱말 뜻풀이였고 이름이 `Case`·`OpenQuestion` 같은
|
||||
저장소의 말이었다. 이름이 하는 일을 말하도록 바뀌었으므로 설명도 함께 바뀐다.
|
||||
|
||||
@@ -245,7 +245,9 @@ describe("TechLog canonical Public documents", () => {
|
||||
}
|
||||
|
||||
expect(
|
||||
Array.from(container.querySelectorAll(".document-relations li a"), (link) =>
|
||||
Array.from(
|
||||
container.querySelectorAll(".document-relations")[0]!.querySelectorAll("li a"),
|
||||
(link) =>
|
||||
link.getAttribute("href"),
|
||||
),
|
||||
).toEqual(relations);
|
||||
@@ -338,14 +340,44 @@ describe("TechLog canonical Public documents", () => {
|
||||
|
||||
describe("TechLog topics and Public not-found routing", () => {
|
||||
it.each([
|
||||
["jpa", "JPA", "3개의 관련 기록"],
|
||||
["authentication", "Authentication", "2개의 관련 기록"],
|
||||
["redis", "Redis", "1개의 관련 기록"],
|
||||
])("aggregates /topics/%s with its own name and count", async (slug, title, count) => {
|
||||
["jpa", "JPA"],
|
||||
["authentication", "Authentication"],
|
||||
["redis", "Redis"],
|
||||
])("aggregates /topics/%s under its own name", async (slug, title) => {
|
||||
await renderDocumentRoute("TECH_LOG_TOPIC", `/topics/${slug}`);
|
||||
|
||||
expect(screen.getByRole("heading", { level: 1, name: title })).toBeVisible();
|
||||
expect(screen.getByText(count)).toBeVisible();
|
||||
expect(screen.getByRole("heading", { name: "먼저 읽을 것" })).toBeVisible();
|
||||
});
|
||||
|
||||
/*
|
||||
서버가 주는 대표 기록은 작성자가 주제마다 손으로 골라 두는 값이라 대부분 비어 있다. 비면
|
||||
열린 질문만 남아, 아직 답이 없는 질문을 모아 두고 「먼저 읽을 것」이라 부르게 된다 —
|
||||
처음 온 사람에게 가장 나쁜 첫 화면이다. 그래서 기록에서 순서를 만든다:
|
||||
원리 → 확인한 기록 → 기준 → 아직 모르는 것.
|
||||
*/
|
||||
it("orders the first reads by kind and does not repeat them below", async () => {
|
||||
const { container } = await renderDocumentRoute("TECH_LOG_TOPIC", "/topics/jpa");
|
||||
|
||||
const firstReads = [
|
||||
...(container.querySelectorAll(".document-relations")[0]?.querySelectorAll("li a") ?? []),
|
||||
].map((link) => ({
|
||||
label: link.querySelector("span")?.textContent,
|
||||
href: link.getAttribute("href"),
|
||||
}));
|
||||
expect(firstReads.map((entry) => entry.label)).toEqual([
|
||||
"검증 기록",
|
||||
"적용 기준",
|
||||
"열린 질문",
|
||||
]);
|
||||
|
||||
// 위에 오른 편은 아래 목록에서 빠진다 — 같은 편이 두 번 나오면 순서를 정해 준 뜻이 없다.
|
||||
const rest = [...container.querySelectorAll(".public-record-list > li > a")].map((link) =>
|
||||
link.getAttribute("href"),
|
||||
);
|
||||
for (const entry of firstReads) {
|
||||
expect(rest).not.toContain(entry.href);
|
||||
}
|
||||
});
|
||||
|
||||
/*
|
||||
@@ -357,7 +389,6 @@ describe("TechLog topics and Public not-found routing", () => {
|
||||
await renderDocumentRoute("TECH_LOG_TOPIC", "/topics/kubernetes");
|
||||
|
||||
expect(screen.getByRole("heading", { level: 1, name: "Kubernetes" })).toBeVisible();
|
||||
expect(screen.getByText("1개의 관련 기록")).toBeVisible();
|
||||
expect(
|
||||
screen.queryByRole("heading", { name: "페이지를 찾을 수 없습니다." }),
|
||||
).not.toBeInTheDocument();
|
||||
@@ -366,9 +397,11 @@ describe("TechLog topics and Public not-found routing", () => {
|
||||
it("keeps JPA topic records in canonical published order", async () => {
|
||||
const { container } = await renderDocumentRoute("TECH_LOG_TOPIC", "/topics/jpa");
|
||||
|
||||
// 픽스처의 JPA 주제는 종류마다 한 편씩이라 셋 다 「먼저 읽을 것」으로 올라가고 아래는 빈다.
|
||||
expect(
|
||||
Array.from(container.querySelectorAll(".public-record-list > li > a"), (link) =>
|
||||
link.getAttribute("href"),
|
||||
Array.from(
|
||||
container.querySelectorAll(".document-relations")[0]!.querySelectorAll("li a"),
|
||||
(link) => link.getAttribute("href"),
|
||||
),
|
||||
).toEqual([
|
||||
"/cases/collection-fetch-join-pagination",
|
||||
|
||||
Reference in New Issue
Block a user