fix: 열리지 않는 주소를 링크로 그리지 않는다

「다음에 읽을 것」에 걸린 결정 링크가 404 였다. 주소는 서버가 게시할 때 만들어 저장한
문자열이라 화면 코드 어디에도 흔적이 없었고, 방문자만 그것을 만났다.

- `resolvesToPublicRoute` 가 route contract 에서 읽은 라우트 표에 주소를 맞춰 본다. 맞는
  라우트가 없는 줄은 관계 목록이 링크로 그리지 않는다.
- 결정 목록의 각 항목이 `slug` 를 element id 로 단다 — 결정의 공개 주소가 이 목록 위의
  앵커이므로, id(UUID)를 달면 다른 기록이 건 링크가 갈 곳을 잃는다.
- 앵커로 들어오면 그 결정까지 내려간다. 목록은 받아온 뒤에 그려지므로 브라우저의 기본
  앵커 이동만으로는 닿지 않는다.

주제 화면 셋을 더하면서 함께 늘려야 했던 것들도 여기서 맞춘다 — nginx 로 나가는 경로
패턴, 라우트마다 하나씩인 수동 접근성 증거, 그리고 그 둘을 세는 CI 게이트 기준값.
게이트 형상 digest 는 이전 gates.json 에서 옛 값(87a22f68…)을 먼저 재현한 뒤 새로 계산했다.
This commit is contained in:
DongHyeonka
2026-09-02 09:54:51 +09:00
parent eedc90b674
commit fe6b56a96c
21 changed files with 239 additions and 19 deletions
@@ -0,0 +1,51 @@
import { describe, expect, it } from "vitest";
import { resolvesToPublicRoute } from "../../../src/features/tech-log/domain/navigation/public-path.ts";
/**
* 서버가 게시 때 만들어 저장하는 공개 주소의 모양들. 백엔드 `PublicPaths.forKind` 와 짝이다 —
* 그쪽에서 라우트 없는 모양을 만들면 여기가 먼저 깨진다.
*/
describe("서버가 만드는 공개 주소", () => {
it.each([
["/cases/collection-fetch-join-in-memory-paging"],
["/references/external-idp-federation-application-boundary"],
["/questions/edge-authorization-scope"],
["/concepts/idp-brokering"],
["/projects/keycloak-patterns"],
["/projects/keycloak-patterns/records"],
["/projects/keycloak-patterns/decisions"],
["/projects/keycloak-patterns/activity"],
["/topics/oauth-oidc-auth-boundary"],
["/topics/oauth-oidc-auth-boundary/spa"],
])("%s 는 열린다", (path) => {
expect(resolvesToPublicRoute(path)).toBe(true);
});
it("결정은 목록 위의 앵커다 — 앵커는 라우트를 고르지 않는다", () => {
expect(
resolvesToPublicRoute(
"/projects/keycloak-patterns/decisions#federation-is-not-an-application-pattern",
),
).toBe(true);
});
it("결정에 상세 라우트는 없다", () => {
expect(
resolvesToPublicRoute(
"/projects/keycloak-patterns/decisions/federation-is-not-an-application-pattern",
),
).toBe(false);
});
it.each([[null], [undefined], [""], ["https://example.com/cases/x"], ["/nope/x"]])(
"%s 는 열리지 않는다",
(path) => {
expect(resolvesToPublicRoute(path)).toBe(false);
},
);
it("Studio 주소는 공개 링크가 아니다", () => {
expect(resolvesToPublicRoute("/studio/projects/abc")).toBe(false);
});
});
+4 -2
View File
@@ -200,8 +200,10 @@ describe("CI gate contract", () => {
// than taking either side's number.
// Task 11 added TECH_LOG_STUDIO_ASSETS's manual accessibility evidence.
// Alignment follow-up item 2 added the TechLog junit report.
expect(contract.gates.reduce((total, gate) => total + gate.evidenceArtifactIds.length, 0)).toBe(114);
expect(contract.artifacts).toHaveLength(135);
// 주제 화면 셋(`/topics`, `/topics/:slug/:variant`, `/studio/topics/:id`)이 라우트마다
// 하나씩인 수동 접근성 증거를 셋 더했다.
expect(contract.gates.reduce((total, gate) => total + gate.evidenceArtifactIds.length, 0)).toBe(117);
expect(contract.artifacts).toHaveLength(138);
expect(contract.stages).toHaveLength(5);
expect(contract.retention.classes).toHaveLength(5);
expect(index.gates.get("FE-GATE-015")?.commandIds).toHaveLength(2);
@@ -192,7 +192,7 @@ describe("selective Task 3 contract closure", () => {
expect(canonical.gates).toHaveLength(27);
expect(canonical.commands).toHaveLength(85);
expect(canonical.gates.reduce((sum, gate) => sum + gate.commandIds.length, 0)).toBe(97);
expect(canonical.artifacts).toHaveLength(135);
expect(canonical.artifacts).toHaveLength(138);
expect(canonical.stages).toHaveLength(5);
expect(canonical.retention.classes).toHaveLength(5);
@@ -33,7 +33,9 @@ describe("TechLog production serving contract", () => {
"^/releases$",
"^/releases/[^/]+$",
"^/search$",
"^/topics$",
"^/topics/[^/]+$",
"^/topics/[^/]+/[^/]+$",
]);
expect(contract.studioPathPrefix).toBe("/studio");
// Derived from the route contract and sorted, exactly like the public half.
@@ -55,6 +57,7 @@ describe("TechLog production serving contract", () => {
"^/studio/releases$",
"^/studio/releases/[^/]+$",
"^/studio/taxonomy$",
"^/studio/topics/[^/]+$",
]);
expect(contract.notFound).toEqual({
status: 404,