SLICE-8: Shopify dialect — detect/map Shopify export at the codec boundary + DOC-2/3 (SD-0002 §7.2) #32

Merged
ben.stull merged 11 commits from slice-8-shopify-dialect into main 2026-06-12 09:37:38 +00:00
4 changed files with 22 additions and 2 deletions
Showing only changes of commit 0aeccf7d2c - Show all commits
+10
View File
@@ -0,0 +1,10 @@
import { describe, expect, it } from "vitest";
import { dialectLabel } from "./productsApi";
describe("dialectLabel", () => {
it("labels canonical", () => expect(dialectLabel("canonical")).toBe("Canonical format"));
it("labels shopify as mapped (PUC-6)", () =>
expect(dialectLabel("shopify")).toBe("Shopify product CSV — mapped"));
it("passes through an unknown dialect verbatim", () =>
expect(dialectLabel("weird")).toBe("weird"));
});
+3 -1
View File
@@ -50,7 +50,9 @@ export type Result<T> = { ok: true; value: T } | { ok: false; error: ApiError; s
// One label rule for CSV dialects, shared by Products history / preview / run detail. // One label rule for CSV dialects, shared by Products history / preview / run detail.
export function dialectLabel(d: string): string { export function dialectLabel(d: string): string {
return d === "canonical" ? "Canonical format" : d; if (d === "canonical") return "Canonical format";
if (d === "shopify") return "Shopify product CSV — mapped";
return d;
} }
export type ExportStatus = "all" | "active" | "draft" | "archived"; export type ExportStatus = "all" | "active" | "draft" | "archived";
@@ -50,9 +50,13 @@ export default function ImportUpload() {
<span className="note">CSV, up to 5,000 rows</span> <span className="note">CSV, up to 5,000 rows</span>
</label> </label>
<p className="note"> <p className="note">
Works with the canonical format.{" "} Works with the canonical format or a Shopify product CSV.{" "}
<a href="/api/products/sample.csv" download> <a href="/api/products/sample.csv" download>
Download sample CSV Download sample CSV
</a>{" "}
·{" "}
<a href="/api/products/columns.md" target="_blank" rel="noopener">
Column reference
</a> </a>
</p> </p>
</div> </div>
@@ -113,6 +113,10 @@ export default function ProductsPage() {
<p className="note"> <p className="note">
<a href="/api/products/sample.csv" download> <a href="/api/products/sample.csv" download>
Download sample CSV Download sample CSV
</a>{" "}
·{" "}
<a href="/api/products/columns.md" target="_blank" rel="noopener">
Column reference
</a> </a>
</p> </p>
</div> </div>