fix: clarify schema approval presentation

This commit is contained in:
lda
2026-07-09 06:00:05 +07:00 Verified
parent 28a720b998
commit a86f54d14a
14 changed files with 47 additions and 39 deletions
@@ -51,7 +51,7 @@ describe("SchemaApprovalSurface", () => {
/>,
);
expect(screen.getByText("No additional resume fields are declared by this schema.")).toBeInTheDocument();
expect(screen.getByText("Recorded resume payload for this decision.")).toBeInTheDocument();
expect(screen.getByText("selected_issue_ids")).toBeInTheDocument();
expect(screen.getByText("[\"risk-1\"]")).toBeInTheDocument();
});
@@ -50,7 +50,7 @@ export const SchemaApprovalSurface = ({
</dl>
) : (
<div className="schema-approval-surface__loose">
<p>No additional resume fields are declared by this schema.</p>
<p>Recorded resume payload for this decision.</p>
<dl>
{model.payloadPreview.map((entry) => (
<div key={entry.key}>
@@ -59,6 +59,7 @@ describe("buildSchemaApprovalModel", () => {
const model = buildSchemaApprovalModel({
schema: { type: "object" },
payload: {
approved: true,
selected_issue_ids: ["risk-1"],
comment: "Create the selected issue.",
},
@@ -51,10 +51,16 @@ const labelFor = (name: string): string => name.replaceAll("_", " ");
const payloadEntries = (payload: unknown): ReadonlyArray<{ readonly key: string; readonly value: string }> => {
if (!isObject(payload)) return [];
return Object.entries(payload).map(([key, value]) => ({
key,
value: formatValue(value) ?? "undefined",
}));
return Object.entries(payload)
// Loose resume schemas often carry implementation flags such as
// `approved: true`; the product surface should show the workflow outcome
// (`submitted/cancelled`) and the operator payload, not duplicate flag
// vocabulary that reads like a second outcome system.
.filter(([key]) => key !== "approved")
.map(([key, value]) => ({
key,
value: formatValue(value) ?? "undefined",
}));
};
export const buildSchemaApprovalModel = ({