From 154e48cdd2f9a5133dbc32ea9582b386a741459c Mon Sep 17 00:00:00 2001 From: tegwick Date: Thu, 30 Jul 2026 20:31:50 +0200 Subject: [PATCH] CE-WP-0011: Attributes title migration, guide polish, Add attribute placement. Migrate legacy Demo evidence-backed form titles on capture-state load; move Add attribute below the list; track workplan CE-WP-0011 as finished. --- docs/mvp-workplans-index.md | 4 +- src/app/forms/capture-persistence.test.ts | 15 ++++ src/app/forms/capture-persistence.ts | 16 +++- workplans/CE-WP-0011-attributes-guide-nm.md | 82 +++++++++++++++++++++ 4 files changed, 115 insertions(+), 2 deletions(-) create mode 100644 workplans/CE-WP-0011-attributes-guide-nm.md diff --git a/docs/mvp-workplans-index.md b/docs/mvp-workplans-index.md index 6d8d4e3..63a510d 100644 --- a/docs/mvp-workplans-index.md +++ b/docs/mvp-workplans-index.md @@ -32,10 +32,12 @@ publish tasks wait on ADR-0002 resolution. | Workplan | Title | Status | |----------|-------|--------| | `CE-WP-0010` | Annotate & Attributes UX — labels, filters, layout, evidence connectors | finished | +| `CE-WP-0011` | Attributes guide n:m lines, title migration, Add attribute placement | finished | User-facing polish after manual document review: rename Review→Annotate, keep Evidence column in Capture with Attributes on the right, list filters, and -card→citation connector lines. See `workplans/CE-WP-0010-annotate-attributes-ux.md`. +card→citation connector lines. CE-WP-0011 adds n:m attribute↔evidence guides, +legacy title migration, and Add attribute below the list. ## Order diff --git a/src/app/forms/capture-persistence.test.ts b/src/app/forms/capture-persistence.test.ts index b56257b..f7f408b 100644 --- a/src/app/forms/capture-persistence.test.ts +++ b/src/app/forms/capture-persistence.test.ts @@ -87,6 +87,21 @@ describe("capture-persistence", () => { expect(loaded?.fieldValues).toEqual({ amount: "1500", summary: "Updated" }); }); + it("migrates legacy Demo evidence-backed form title to Attributes", () => { + const storage = memoryStorage(); + const base = defaultCaptureState(); + const raw = { + ...base, + formSchema: { + ...base.formSchema, + title: "Demo evidence-backed form", + }, + }; + storage.setItem(captureStateKey(SESSION), JSON.stringify(raw)); + const loaded = loadCaptureState(SESSION, storage); + expect(loaded?.formSchema.title).toBe("Attributes"); + }); + it("removeCaptureState clears the key", () => { const storage = memoryStorage(); saveCaptureState(SESSION, defaultCaptureState(), storage); diff --git a/src/app/forms/capture-persistence.ts b/src/app/forms/capture-persistence.ts index 1716826..d1cdce9 100644 --- a/src/app/forms/capture-persistence.ts +++ b/src/app/forms/capture-persistence.ts @@ -51,6 +51,20 @@ function isFormSchema(value: unknown): value is FormSchema { }); } +/** Legacy Capture titles from pre-CE-WP-0010 sessions. */ +const LEGACY_FORM_TITLES = new Set([ + "Demo evidence-backed form", + "Demo form", + "Form", +]); + +function normalizeFormSchemaTitle(schema: FormSchema): FormSchema { + if (!LEGACY_FORM_TITLES.has(schema.title) && schema.title.trim().length > 0) { + return schema; + } + return { ...schema, title: DEMO_SCHEMA.title }; +} + function parseCaptureState(raw: unknown): CaptureStateSnapshot | null { if (typeof raw !== "object" || raw === null) return null; const o = raw as Record; @@ -67,7 +81,7 @@ function parseCaptureState(raw: unknown): CaptureStateSnapshot | null { const evidenceLinks = o.evidenceLinks as EvidenceLink[]; return { version: CAPTURE_STATE_VERSION, - formSchema: o.formSchema, + formSchema: normalizeFormSchemaTitle(o.formSchema), fieldValues, evidenceLinks, }; diff --git a/workplans/CE-WP-0011-attributes-guide-nm.md b/workplans/CE-WP-0011-attributes-guide-nm.md new file mode 100644 index 0000000..60fd8de --- /dev/null +++ b/workplans/CE-WP-0011-attributes-guide-nm.md @@ -0,0 +1,82 @@ +--- +id: CE-WP-0011 +type: workplan +title: "Attributes guide n:m lines, title migration, Add attribute placement" +domain: infotech +repo: citation-evidence +repo_id: a677c189-b4e2-4f2a-9e48-faa482c277e6 +topic_slug: citation_evidence_mvp +topic_id: cee7bedf-2b48-46ef-8601-006474f2ad7a +status: finished +owner: codex +created: "2026-07-30" +updated: "2026-07-30" +depends_on_workplan: CE-WP-0010 +planning_order: 11 +planning_priority: high +spec_refs: + - workplans/CE-WP-0010-annotate-attributes-ux.md + - workplans/CE-WP-0003-form-binding-visual-guide.md +--- + +# CE-WP-0011 — Attributes guide polish + +Follow-on after CE-WP-0010 manual review. CE-WP-0010 shipped layout/filters; +this workplan covers residual UX and n:m visual guide behaviour. + +## User requirements (locked) + +1. **Caption is always Attributes** — including sessions that still have the + legacy persisted title `"Demo evidence-backed form"` in capture-state. +2. **Optical links** run from the **right edge of evidence cards** to the + **left edge of attribute rows** (side-by-side Capture columns). +3. **n:m visualisation** — evidence ↔ attributes is many-to-many: + - Selected **evidence** → draw lines to **all** linked attributes. + - Selected **attribute** → draw lines to **all** linked evidence cards. + - Evidence → citation highlight remains as in CE-WP-0010. +4. **Add attribute** control sits **below** the list of captured attributes + (not in the header next to the title). + +## Tasks + +## T01 — Migrate legacy Capture titles on load + +```task +id: CE-WP-0011-T01 +status: done +priority: high +``` + +Normalize `formSchema.title` when loading capture-state from localStorage. + +## T02 — Overlay n:m + edge anchors + +```task +id: CE-WP-0011-T02 +status: done +priority: high +``` + +Update `Overlay` to resolve all links via binding service; card right → +field left. + +## T03 — Move Add attribute below list + +```task +id: CE-WP-0011-T03 +status: done +priority: medium +``` + +`FormRenderer` header keeps title + filter; add button and add form at bottom. + +## T04 — Tests + finish + +```task +id: CE-WP-0011-T04 +status: done +priority: medium +depends_on: [T01, T02, T03] +``` + +Unit/DOM coverage; mark workplan finished.