fix: give each API surface its own error-code enum
The public site answered every screen with the terminal error surface. Three defects stacked, and each one hid the next. The first refused the request outright: `attachCredentials` asks the Studio helper, which returns null for a profile it does not own, and the fallback below read the session and rejected anything not authenticated. Public reads declare the ANONYMOUS profile, so a signed-out visitor — the public site's entire audience — never got a request out of the browser. An anonymous profile carries no credentials by definition and must never consult the session. With requests flowing, the second surfaced: `envelopeError()` pinned `ApiError.code` to the Studio enum and all three surfaces shared it. Public and Management each declare their own enum in their own contract, so every error they returned failed validation and arrived as a CONTRACT_VIOLATION — an unclassifiable transport fault — rather than the domain error it was. A strict enum checked against the wrong surface's contract still looks strict, which is why no gate caught it. Each surface now passes its own contract's codes. The third was the not-found path: it read `status` and `code` off the problem body, but the envelope has no `status` and names the code for its surface (PUBLIC_RESOURCE_NOT_FOUND, not NOT_FOUND). The HTTP status from the transport is the authoritative signal and the only one that holds across both shapes. The regression test composes the real runtime adapters against the deployed backend's actual 404 body. Neither the gateway tests (which stub the executor) nor the screen tests (which stub the gateway) cover this seam, and the whole outage lived in it. Two page-level fixes came out of the same investigation: the profile page asked for two project slugs that only ever existed in the static fixture, and the index pages held their fixed header copy behind a request that had nothing to do with it. Headers now paint immediately; only the sections that are actually waiting show a fallback, and an empty list says so instead of rendering blank.
This commit is contained in:
@@ -23,19 +23,29 @@ const principles = [
|
||||
},
|
||||
] as const;
|
||||
|
||||
const currentProjectSlugs = ["backend-skeleton", "auth-lab"] as const;
|
||||
const topics = ["Backend Architecture", "JPA", "Authentication", "Redis"] as const;
|
||||
|
||||
export function ProfilePage() {
|
||||
// The two project slugs this named were the static fixture's, and they exist
|
||||
// in no real deployment — the page asked the backend for them, took two 404s,
|
||||
// and rendered nothing but an error. "Current projects" means the published
|
||||
// ones, so read them from the catalogue the projects index already reads.
|
||||
const view = usePublicContent(["tech-log", "profile"], async (queries) => {
|
||||
const entries = (await queries.searchPublicContent("")).filter(
|
||||
(item) => item.contentType === "PROJECT",
|
||||
);
|
||||
const resolved = await Promise.all(
|
||||
currentProjectSlugs.map((slug) => queries.getProject(slug)),
|
||||
entries.map((item) => queries.getProject(item.path.replace("/projects/", ""))),
|
||||
);
|
||||
return { currentProjects: resolved.filter((project) => project !== undefined) };
|
||||
});
|
||||
if (!view.ready) return view.fallback;
|
||||
|
||||
const { currentProjects } = view.data;
|
||||
// Only the project list comes from the network. Returning the page-wide
|
||||
// fallback here — as every public screen did — held the operator's name, the
|
||||
// principles, and the topics behind a request that has nothing to do with
|
||||
// them, so a visitor saw a skeleton, then possibly an error, where the page
|
||||
// could have been readable the whole time. The markup below is unchanged;
|
||||
// the fallback now sits in the one section that is actually waiting.
|
||||
return (
|
||||
<main id="main-content" className="shell profile-page">
|
||||
<header className="profile-header">
|
||||
@@ -65,20 +75,26 @@ export function ProfilePage() {
|
||||
<p className="section-kicker">Current</p>
|
||||
<h2 id="profile-projects-title">현재 프로젝트</h2>
|
||||
</div>
|
||||
<ul>
|
||||
{currentProjects.map((project) => (
|
||||
<li key={project.slug}>
|
||||
<Link to={`/projects/${project.slug}`}>
|
||||
<div>
|
||||
<strong>{project.title}</strong>
|
||||
<span>{project.stage}</span>
|
||||
</div>
|
||||
<p>{project.currentGoal}</p>
|
||||
<span aria-hidden="true">↗</span>
|
||||
</Link>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
{!view.ready ? (
|
||||
view.fallback
|
||||
) : view.data.currentProjects.length === 0 ? (
|
||||
<p className="public-empty-note">아직 공개된 프로젝트가 없습니다.</p>
|
||||
) : (
|
||||
<ul>
|
||||
{view.data.currentProjects.map((project) => (
|
||||
<li key={project.slug}>
|
||||
<Link to={`/projects/${project.slug}`}>
|
||||
<div>
|
||||
<strong>{project.title}</strong>
|
||||
<span>{project.stage}</span>
|
||||
</div>
|
||||
<p>{project.currentGoal}</p>
|
||||
<span aria-hidden="true">↗</span>
|
||||
</Link>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
)}
|
||||
</section>
|
||||
<section className="profile-topics" aria-labelledby="profile-topics-title">
|
||||
<p className="section-kicker">Topics</p>
|
||||
|
||||
Reference in New Issue
Block a user