chore: sync the frontend template from ebea300 to af3d8e6
Carries 359 template commits, tag v0.2.0 plus one documentation commit: the generator-built feature index with its app, bounded-context and feature declarations, the src/platform kernel and scale tooling, the 2026-09-24 src review fixes, and the 2026-09-25 maturity review round with its CHANGELOG [보안]/[계약] rows. 691 of the 824 template paths are applied, 85 of them merged with product changes; 127 are not carried. Product identity is unchanged: name, version 0.1.0, routes, design and the TechLog domain. Three decisions worth naming. TechLog stays composed directly, as the last two syncs recorded; its directory carries a NOT_INSTALLED marker that says so, and every installed-* composer takes the template's projection with TechLog added on top. The reference sample is no longer installed: the template now installs a feature only through feature-module.ts and context-routes.ts, which load the screens this product deleted, so its three operations, six schemas and one topic leave the registries, recorded as registry change evidence. And AppRouter mounts the platform and TechLog routes only; the template's bounded-context route gateway waits for a generator-installed feature. Required fixes: readSubject on the BFF session owner (without it every HTTP Studio session would close as integration-failed), zod through the facade in nine TechLog files, noUnusedLocals, and public/config.json written out to match the local profile. Derived baselines were recomputed after reproducing both sides' values: CI contract 101 commands / 106 references / 141 artifacts, gate shape c9adcf85; registry approval 2dc6c3a3; the runtime config schema baseline equals the schema at8210d48. Verified here: types, lint, architecture, adapter inventory, CI contract, i18n, design system, diagnostics, browser security, dev release manifest, TechLog contract and build pass; 220 component, 155 integration, 15 contract, 418 TechLog, 43 reference-feature, 18 recipe and 46 release-coherence tests pass, and 2381 of 2383 unit tests. Reproduced at8210d48first and unchanged: check:registries (byte-identical), test:runtime-schema, verify:documentation. Brought by the template and escalated rather than suppressed: check:request-fanout on TechLog's cursor pagination, check:remediation-ledger (fails upstream too), the shared-chunk hash test, and the registry-dependent sample removal and second-feature tests. Playwright suites were not run. Full record, the five open questions and the follow-ups in docs/operations/template-sync-2026-09-29.md. (cherry picked from commit b2170cf265dea45dc9cc05d3c61e627e97f31cdb)
This commit is contained in:
@@ -13,6 +13,7 @@ import {
|
||||
DirtyNavigationDialog,
|
||||
ErrorSummary,
|
||||
Form,
|
||||
FormFailureStatus,
|
||||
FormField,
|
||||
useAppForm,
|
||||
useDirtyNavigationGuard,
|
||||
@@ -34,6 +35,7 @@ function FormHarness(props: Readonly<{
|
||||
| Readonly<{ ok: false; error: ReturnType<typeof createFailure> }>
|
||||
>;
|
||||
resetOnSuccess?: boolean;
|
||||
onFailureAction?(): void;
|
||||
}>) {
|
||||
const form = useAppForm({
|
||||
schema,
|
||||
@@ -57,6 +59,14 @@ function FormHarness(props: Readonly<{
|
||||
fieldId={form.fieldId}
|
||||
onFocusField={form.focusField}
|
||||
/>
|
||||
<FormFailureStatus
|
||||
failure={form.failure}
|
||||
onAction={
|
||||
form.result === "retry-later"
|
||||
? () => void form.submitForm()
|
||||
: props.onFailureAction
|
||||
}
|
||||
/>
|
||||
<FormField {...form.field("name")} label="Name" required />
|
||||
<FormField {...form.field("note")} label="Note" />
|
||||
<Button type="submit" disabled={form.pending}>
|
||||
@@ -137,6 +147,96 @@ describe("local form facade", () => {
|
||||
expect(document.body).not.toHaveTextContent("raw-secret-message");
|
||||
});
|
||||
|
||||
it.each([
|
||||
[
|
||||
"AUTH_REQUIRED",
|
||||
"reauth-required",
|
||||
"계속하려면 로그인이 필요합니다.",
|
||||
"로그인",
|
||||
],
|
||||
[
|
||||
"FORBIDDEN",
|
||||
"forbidden",
|
||||
"이 작업을 수행할 권한이 없습니다.",
|
||||
"안전한 화면으로 이동",
|
||||
],
|
||||
[
|
||||
"RATE_LIMITED",
|
||||
"retry-later",
|
||||
"요청이 많습니다. 잠시 후 다시 시도해 주세요.",
|
||||
"다시 시도",
|
||||
],
|
||||
] as const)(
|
||||
"shows %s as its own save state, not an input error",
|
||||
async (kind, result, copy, action) => {
|
||||
const user = userEvent.setup();
|
||||
const onFailureAction = vi.fn();
|
||||
const submit = vi.fn(async () => ({
|
||||
ok: false as const,
|
||||
error: createFailure(kind, "CREATE_ENTITY", 0, {
|
||||
effect: "NOT_APPLIED",
|
||||
}),
|
||||
}));
|
||||
render(
|
||||
<FormHarness submit={submit} onFailureAction={onFailureAction} />,
|
||||
);
|
||||
await user.type(screen.getByRole("textbox", { name: /Name/ }), "Valid");
|
||||
await user.click(screen.getByRole("button", { name: "Submit" }));
|
||||
|
||||
expect(await screen.findByTestId("result")).toHaveTextContent(result);
|
||||
expect(screen.getByRole("alert")).toHaveTextContent(copy);
|
||||
expect(document.body).not.toHaveTextContent("입력 내용을 확인해 주세요.");
|
||||
expect(document.body).not.toHaveTextContent("저장하지 못했습니다.");
|
||||
expect(
|
||||
document.body.textContent?.includes("입력한 내용은 사라집니다"),
|
||||
).toBe(kind === "AUTH_REQUIRED");
|
||||
expect(screen.getByRole("textbox", { name: /Name/ })).toHaveValue("Valid");
|
||||
|
||||
await user.click(screen.getByRole("button", { name: action }));
|
||||
if (kind === "RATE_LIMITED") {
|
||||
expect(submit).toHaveBeenCalledTimes(2);
|
||||
expect(onFailureAction).not.toHaveBeenCalled();
|
||||
} else {
|
||||
expect(onFailureAction).toHaveBeenCalledOnce();
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
// F-10 (08-01). A save that failed for a reason the user cannot fix in the
|
||||
// input is a status with its own action, never an input error summary.
|
||||
it.each([
|
||||
["NOT_FOUND", "요청한 항목을 찾을 수 없습니다.", "안전한 화면으로 이동"],
|
||||
// This product's catalog copy (the template says "요청을 처리할 수 없습니다.").
|
||||
["UNKNOWN_CLIENT_FAILURE", "요청을 처리하지 못했습니다.", "지원 정보 확인"],
|
||||
] as const)(
|
||||
"shows an unavailable %s save as a status, not an input error",
|
||||
async (kind, copy, action) => {
|
||||
const user = userEvent.setup();
|
||||
const onFailureAction = vi.fn();
|
||||
render(
|
||||
<FormHarness
|
||||
submit={async () => ({
|
||||
ok: false,
|
||||
error: createFailure(kind, "CREATE_ENTITY", 0, {
|
||||
effect: "NOT_APPLIED",
|
||||
}),
|
||||
})}
|
||||
onFailureAction={onFailureAction}
|
||||
/>,
|
||||
);
|
||||
await user.type(screen.getByRole("textbox", { name: /Name/ }), "Valid");
|
||||
await user.click(screen.getByRole("button", { name: "Submit" }));
|
||||
|
||||
expect(await screen.findByTestId("result")).toHaveTextContent(
|
||||
"unavailable",
|
||||
);
|
||||
expect(screen.getByRole("alert")).toHaveTextContent(copy);
|
||||
expect(document.body).not.toHaveTextContent("입력 내용을 확인해 주세요.");
|
||||
await user.click(screen.getByRole("button", { name: action }));
|
||||
expect(onFailureAction).toHaveBeenCalledOnce();
|
||||
},
|
||||
);
|
||||
|
||||
it("keeps conflict input out of URL and storage", async () => {
|
||||
const user = userEvent.setup();
|
||||
localStorage.clear();
|
||||
@@ -278,3 +378,92 @@ describe("dirty navigation guard", () => {
|
||||
expect(await screen.findByRole("heading", { name: "Target" })).toBeVisible();
|
||||
});
|
||||
});
|
||||
|
||||
describe("submission timing", () => {
|
||||
it("submits once when a second submit arrives during async validation", async () => {
|
||||
const user = userEvent.setup();
|
||||
let releaseValidation: () => void = () => {};
|
||||
const validationGate = new Promise<void>((resolve) => {
|
||||
releaseValidation = resolve;
|
||||
});
|
||||
const asyncSchema = schema.refine(async () => {
|
||||
await validationGate;
|
||||
return true;
|
||||
});
|
||||
const submit = vi.fn(async () => ({ ok: true as const, value: "saved" }));
|
||||
|
||||
function AsyncForm() {
|
||||
const form = useAppForm({
|
||||
schema: asyncSchema,
|
||||
defaultValues: defaults,
|
||||
allowedServerFields: ["name", "note"],
|
||||
mapToCommand: (values) => ({ name: values.name }),
|
||||
submit,
|
||||
});
|
||||
return (
|
||||
<Form pending={form.pending} onSubmit={(event) => void form.submitForm(event)}>
|
||||
<FormField {...form.field("name")} label="Name" required />
|
||||
<Button type="submit">Submit</Button>
|
||||
<output data-testid="result">{form.result}</output>
|
||||
</Form>
|
||||
);
|
||||
}
|
||||
|
||||
render(<AsyncForm />);
|
||||
await user.type(screen.getByRole("textbox", { name: /Name/ }), "Ready");
|
||||
await user.click(screen.getByRole("button", { name: "Submit" }));
|
||||
await user.click(screen.getByRole("button", { name: "Submit" }));
|
||||
releaseValidation();
|
||||
|
||||
await waitFor(() =>
|
||||
expect(screen.getByTestId("result")).toHaveTextContent("success"),
|
||||
);
|
||||
expect(submit).toHaveBeenCalledOnce();
|
||||
});
|
||||
|
||||
it("does not ask to discard changes when navigating right after a save", async () => {
|
||||
const user = userEvent.setup();
|
||||
|
||||
function SaveThenLeave() {
|
||||
const navigate = useNavigate();
|
||||
const form = useAppForm({
|
||||
schema,
|
||||
defaultValues: defaults,
|
||||
allowedServerFields: ["name", "note"],
|
||||
mapToCommand: (values) => ({ name: values.name }),
|
||||
submit: async () => ({ ok: true as const, value: "saved" }),
|
||||
});
|
||||
const guard = useDirtyNavigationGuard(form.dirty);
|
||||
return (
|
||||
<Form
|
||||
onSubmit={(event) => {
|
||||
void form.submitForm(event).then((outcome) => {
|
||||
if (outcome?.ok) void navigate("/done");
|
||||
});
|
||||
}}
|
||||
pending={form.pending}
|
||||
>
|
||||
<FormField {...form.field("name")} label="Name" required />
|
||||
<Button type="submit">Save</Button>
|
||||
<DirtyNavigationDialog guard={guard} />
|
||||
</Form>
|
||||
);
|
||||
}
|
||||
|
||||
const router = createMemoryRouter(
|
||||
[
|
||||
{ path: "/", element: <SaveThenLeave /> },
|
||||
{ path: "/done", element: <h1>Done</h1> },
|
||||
],
|
||||
{ initialEntries: ["/"] },
|
||||
);
|
||||
render(<RouterProvider router={router} />);
|
||||
await user.type(screen.getByRole("textbox", { name: /Name/ }), "Ready");
|
||||
await user.click(screen.getByRole("button", { name: "Save" }));
|
||||
|
||||
expect(await screen.findByRole("heading", { name: "Done" })).toBeVisible();
|
||||
expect(
|
||||
screen.queryByRole("dialog", { name: "저장하지 않은 변경이 있습니다." }),
|
||||
).not.toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user