Remove the read-only "Originaltext" date field that confuses editors #710

Closed
opened 2026-06-01 19:49:31 +02:00 by marcel · 1 comment
Owner

Problem

The document edit form and detail views show an "Originaltext:" field — the verbatim date cell as it came in from the Excel/ODS import (e.g. Sommer 1916), stored in the backend as metaDateRaw.

It confuses people for two reasons:

  1. On the edit form it looks like a form field but is not editable (rendered as static text, never an input).
  2. It sits right next to the structured date fields, so editors expect to be able to change it and can't.

We want to remove this field everywhere it is visible in the frontend. The data stays in the backend untouched — we only stop showing and re-submitting it in the UI.

Key facts established during scoping

  • Backend update is partial / safe. DocumentService (update) only overwrites metaDateRaw when the field is present in the request (if (dto.getMetaDateRaw() != null) { ... }, DocumentService.java:464). The edit form currently re-submits the value via a hidden <input name="metaDateRaw">. Removing that hidden input means edits simply omit the field, and the backend preserves the stored value. No data loss, no backend change required.
  • metaDateRaw has two roles in the frontend:
    1. A visible "Originaltext:" line — the confusing field. Remove.
    2. An invisible input to the date formatter — for SEASON-precision dates, formatDocumentDate reads the raw cell (seasonFromRaw) to pick the correct season word ("Sommer") instead of deriving it from the anchor month. This is not a user-facing field — it just keeps season labels accurate, and seasonFromRaw only matches a fixed allowlist (never emits the raw text).

Decision: remove all visible "Originaltext" rendering, but keep metaDateRaw flowing internally into the season formatter. This way no date label silently changes; we only remove the confusing field and nothing else.

Change inventory

File Change
frontend/src/lib/document/WhoWhenSection.svelte Remove the {#if rawDate && rawDate.trim().length > 0} block (visible text + the hidden metaDateRaw input that re-submits it). Remove the rawDate prop (declaration + type).
frontend/src/lib/document/DocumentEditLayout.svelte (~line 211) Drop rawDate={doc.metaDateRaw ?? ''} passed into WhoWhenSection.
frontend/src/lib/document/DocumentDate.svelte Remove the visible "Originaltext: …" secondary line, plus the showRaw prop and showRawLine derived. Keep the raw prop — it still feeds formatDocumentDate for the season word. Also remove the now-stale CWE-79 / WCAG 1.4.13 "visible secondary line" comment block (the DOM sink it documents is being deleted).
frontend/src/lib/document/DocumentRow.svelte (lines ~169–197) Remove the two showRaw={false} props passed to <DocumentDate> (the prop no longer exists — leaving them in fails svelte-check). Trim the explanatory comment at ~169–170 that justifies showRaw={false}, since the raw line is now gone for every caller.
frontend/src/lib/document/DocumentMetadataDrawer.svelte Keep raw={metaDateRaw} passed into DocumentDate (for the season word). Tighten the date-cell condition from `{#if documentDate
frontend/src/lib/document/DocumentTopBarTitle.svelte No change — it already only uses metaDateRaw internally via formatDocumentDate, with no visible "Originaltext" label.
frontend/src/lib/shared/utils/documentDate.ts Remove the now-stale comment referring to the verbatim German cell being "preserved separately as the visible secondary line" (in seasonLabel). The internal seasonFromRaw use stays.
frontend/messages/{de,en,es}.json Delete the now-unused date_original_label key ("Originaltext:" / "Original:" / "Texto original:"). Confirm no other references remain.

Tests

Test file Change
frontend/src/lib/document/WhoWhenSection.svelte.test.ts (~line 97) The existing test renders with rawDate and asserts the who-when-raw block + HTML-escaping. Flip it to assert the field is no longer rendered, and add an assertion that no hidden input[name="metaDateRaw"] is present — this is the test that guards the core "no round-trip" acceptance criterion.
frontend/src/lib/document/DocumentDate.svelte.test.ts (lines 21, 28) Remove the "shows the verbatim raw cell as a visible secondary line for UNKNOWN" test (line 21) and the "renders a malicious raw value as inert escaped text" XSS test (line 28) — both assert on the raw DOM sink that is being deleted, so the sink no longer exists. Keep the DAY/MONTH tests. (No XSS coverage is lost: the only surviving raw consumer is seasonFromRaw, which matches a fixed allowlist and never emits raw text.)
frontend/src/lib/document/DocumentMetadataDrawer.svelte.test.ts Add coverage for the tightened condition: an undated / raw-only document (documentDate null, metaDateRaw set) renders "—" and does not surface the raw text.

Acceptance criteria

  • The "Originaltext:" line is gone from the edit/new form (WhoWhenSection).
  • The "Originaltext:" line is gone from the detail-view drawer (DocumentMetadataDrawer) and the date component (DocumentDate).
  • Editing and saving a document no longer round-trips metaDateRaw — asserted by a WhoWhenSection test confirming the hidden metaDateRaw input is absent; the stored value is preserved by the backend's partial update.
  • SEASON-precision date labels are unchanged (season word still derived from the raw cell internally).
  • An undated / raw-only document shows "—" in the drawer (covered by a test).
  • date_original_label is removed from all three message files and has no remaining references.
  • Stale metaDateRaw/raw-line comments in DocumentDate.svelte, DocumentRow.svelte, and documentDate.ts are removed.
  • npm run lint, npm run check, and the affected unit tests pass.
  • No backend change.

Out of scope

  • Removing the metaDateRaw column / field from the backend or API.
  • Changing how the importer populates metaDateRaw.

Scoped via brainstorming; reviewed by the review-issue persona panel (findings folded in: DocumentRow showRaw removal, the two named DocumentDate tests, the no-round-trip assertion, drawer-condition test, and stale-comment cleanup).

## Problem The document edit form and detail views show an **"Originaltext:"** field — the verbatim date cell as it came in from the Excel/ODS import (e.g. `Sommer 1916`), stored in the backend as `metaDateRaw`. It confuses people for two reasons: 1. On the **edit form** it looks like a form field but is **not editable** (rendered as static text, never an input). 2. It sits right next to the structured date fields, so editors expect to be able to change it and can't. We want to remove this field **everywhere it is visible in the frontend**. The data stays in the backend untouched — we only stop showing and re-submitting it in the UI. ## Key facts established during scoping - **Backend update is partial / safe.** `DocumentService` (`update`) only overwrites `metaDateRaw` when the field is present in the request (`if (dto.getMetaDateRaw() != null) { ... }`, `DocumentService.java:464`). The edit form currently re-submits the value via a hidden `<input name="metaDateRaw">`. Removing that hidden input means edits simply omit the field, and the backend **preserves** the stored value. No data loss, no backend change required. - **`metaDateRaw` has two roles** in the frontend: 1. A **visible "Originaltext:" line** — the confusing field. ✅ Remove. 2. An **invisible input to the date formatter** — for `SEASON`-precision dates, `formatDocumentDate` reads the raw cell (`seasonFromRaw`) to pick the correct season word ("Sommer") instead of deriving it from the anchor month. This is **not a user-facing field** — it just keeps season labels accurate, and `seasonFromRaw` only matches a fixed allowlist (never emits the raw text). **Decision: remove all _visible_ "Originaltext" rendering, but keep `metaDateRaw` flowing _internally_ into the season formatter.** This way no date label silently changes; we only remove the confusing field and nothing else. ## Change inventory | File | Change | |---|---| | `frontend/src/lib/document/WhoWhenSection.svelte` | Remove the `{#if rawDate && rawDate.trim().length > 0}` block (visible text **+ the hidden `metaDateRaw` input** that re-submits it). Remove the `rawDate` prop (declaration + type). | | `frontend/src/lib/document/DocumentEditLayout.svelte` (~line 211) | Drop `rawDate={doc.metaDateRaw ?? ''}` passed into `WhoWhenSection`. | | `frontend/src/lib/document/DocumentDate.svelte` | Remove the visible "Originaltext: …" secondary line, plus the `showRaw` prop and `showRawLine` derived. **Keep** the `raw` prop — it still feeds `formatDocumentDate` for the season word. Also remove the now-stale CWE-79 / WCAG 1.4.13 "visible secondary line" comment block (the DOM sink it documents is being deleted). | | `frontend/src/lib/document/DocumentRow.svelte` (lines ~169–197) | **Remove the two `showRaw={false}` props** passed to `<DocumentDate>` (the prop no longer exists — leaving them in fails `svelte-check`). Trim the explanatory comment at ~169–170 that justifies `showRaw={false}`, since the raw line is now gone for every caller. | | `frontend/src/lib/document/DocumentMetadataDrawer.svelte` | Keep `raw={metaDateRaw}` passed into `DocumentDate` (for the season word). Tighten the date-cell condition from `{#if documentDate || metaDateRaw}` to `{#if documentDate}` so a raw-only / undated document shows "—" instead of surfacing the raw text. | | `frontend/src/lib/document/DocumentTopBarTitle.svelte` | **No change** — it already only uses `metaDateRaw` internally via `formatDocumentDate`, with no visible "Originaltext" label. | | `frontend/src/lib/shared/utils/documentDate.ts` | Remove the now-stale comment referring to the verbatim German cell being "preserved separately as the visible secondary line" (in `seasonLabel`). The internal `seasonFromRaw` use stays. | | `frontend/messages/{de,en,es}.json` | Delete the now-unused `date_original_label` key (`"Originaltext:"` / `"Original:"` / `"Texto original:"`). Confirm no other references remain. | ## Tests | Test file | Change | |---|---| | `frontend/src/lib/document/WhoWhenSection.svelte.test.ts` (~line 97) | The existing test renders with `rawDate` and asserts the `who-when-raw` block + HTML-escaping. Flip it to assert the field is **no longer rendered**, and add an assertion that **no hidden `input[name="metaDateRaw"]` is present** — this is the test that guards the core "no round-trip" acceptance criterion. | | `frontend/src/lib/document/DocumentDate.svelte.test.ts` (lines 21, 28) | **Remove** the "shows the verbatim raw cell as a visible secondary line for UNKNOWN" test (line 21) and the "renders a malicious raw value as inert escaped text" XSS test (line 28) — both assert on the raw DOM sink that is being deleted, so the sink no longer exists. Keep the DAY/MONTH tests. (No XSS coverage is lost: the only surviving `raw` consumer is `seasonFromRaw`, which matches a fixed allowlist and never emits raw text.) | | `frontend/src/lib/document/DocumentMetadataDrawer.svelte.test.ts` | Add coverage for the tightened condition: an undated / raw-only document (`documentDate` null, `metaDateRaw` set) renders "—" and does **not** surface the raw text. | ## Acceptance criteria - [ ] The "Originaltext:" line is gone from the **edit/new form** (`WhoWhenSection`). - [ ] The "Originaltext:" line is gone from the **detail-view drawer** (`DocumentMetadataDrawer`) and the **date component** (`DocumentDate`). - [ ] Editing and saving a document **no longer round-trips** `metaDateRaw` — asserted by a `WhoWhenSection` test confirming the hidden `metaDateRaw` input is absent; the stored value is preserved by the backend's partial update. - [ ] `SEASON`-precision date labels are **unchanged** (season word still derived from the raw cell internally). - [ ] An undated / raw-only document shows "—" in the drawer (covered by a test). - [ ] `date_original_label` is removed from all three message files and has no remaining references. - [ ] Stale `metaDateRaw`/raw-line comments in `DocumentDate.svelte`, `DocumentRow.svelte`, and `documentDate.ts` are removed. - [ ] `npm run lint`, `npm run check`, and the affected unit tests pass. - [ ] No backend change. ## Out of scope - Removing the `metaDateRaw` column / field from the backend or API. - Changing how the importer populates `metaDateRaw`. --- <sub>Scoped via brainstorming; reviewed by the `review-issue` persona panel (findings folded in: DocumentRow `showRaw` removal, the two named DocumentDate tests, the no-round-trip assertion, drawer-condition test, and stale-comment cleanup).</sub>
marcel added the P2-mediumcleanupui labels 2026-06-01 19:49:35 +02:00
Author
Owner

Implemented in PR #712 (branch feat/issue-710-remove-originaltext, worktree-based on main, TDD).

Commits

  • 914eadf3 feat(document): drop the read-only Originaltext field from the edit form
  • bd54ea80 feat(document): remove the visible Originaltext line from DocumentDate
  • cf922100 feat(document): stop surfacing the raw cell in the detail drawer
  • 73712d11 chore(i18n): drop the unused date_original_label key and stale comments

Acceptance criteria

  • "Originaltext:" gone from the edit/new form (WhoWhenSection)
  • "Originaltext:" gone from the detail drawer (DocumentMetadataDrawer) and DocumentDate
  • Editing no longer round-trips metaDateRaw — asserted by a WhoWhenSection test confirming the hidden input is absent
  • SEASON-precision labels unchanged (season word still derived from the raw cell internally)
  • Undated/raw-only document shows "—" in the drawer (covered by a test)
  • date_original_label removed from all three message files; no remaining references
  • Stale metaDateRaw/raw-line comments removed in DocumentDate.svelte, DocumentRow.svelte, documentDate.ts
  • npm run lint and npm run check pass (no new errors vs. main baseline); browser-project tests run in CI
  • No backend change

Next: multi-persona review running on PR #712.

Implemented in PR #712 (branch `feat/issue-710-remove-originaltext`, worktree-based on `main`, TDD). **Commits** - `914eadf3` feat(document): drop the read-only Originaltext field from the edit form - `bd54ea80` feat(document): remove the visible Originaltext line from DocumentDate - `cf922100` feat(document): stop surfacing the raw cell in the detail drawer - `73712d11` chore(i18n): drop the unused date_original_label key and stale comments **Acceptance criteria** - [x] "Originaltext:" gone from the edit/new form (`WhoWhenSection`) - [x] "Originaltext:" gone from the detail drawer (`DocumentMetadataDrawer`) and `DocumentDate` - [x] Editing no longer round-trips `metaDateRaw` — asserted by a `WhoWhenSection` test confirming the hidden input is absent - [x] `SEASON`-precision labels unchanged (season word still derived from the raw cell internally) - [x] Undated/raw-only document shows "—" in the drawer (covered by a test) - [x] `date_original_label` removed from all three message files; no remaining references - [x] Stale `metaDateRaw`/raw-line comments removed in `DocumentDate.svelte`, `DocumentRow.svelte`, `documentDate.ts` - [x] `npm run lint` and `npm run check` pass (no new errors vs. `main` baseline); browser-project tests run in CI - [x] No backend change Next: multi-persona review running on PR #712.
Sign in to join this conversation.
No Label P2-medium cleanup ui
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: marcel/familienarchiv#710