Deadline form Rule field: drop the full catalog dropdown — only Auto (from Type) or Custom (free-text) #89

Open
opened 2026-05-25 12:31:03 +00:00 by mAi · 2 comments
Collaborator

m's report (2026-05-25 14:29)

The options available in the new deadline dropdown for Rule are... too many. There are 4 oral hearings etc... it should be more simple. Either auto (from the type) or custom override (manual entry)

Context — what shipped

t-paliad-251 / m/paliad#82 shipped a Rule dropdown that lists every paliad.deadline_rules row matching the selected event_type (with sort options including "by proceeding type"). For event_types that match multiple proceedings (e.g. an "Oral hearing" exists for UPC CFI, UPC CoA, DPMA, EPO, …), the dropdown shows 4+ near-identical options. That's catalog-noise, not signal.

What m wants instead — binary model

The Rule field has just two states:

  1. Auto (default) — the rule is derived from the chosen Type. Resolved rule name is displayed read-only next to the field (e.g. "Auto: UPC RoP R.220(1)"). The user doesn't pick from a list.
  2. Custom (toggle off the Auto) — a free-text input appears. The lawyer types whatever rule description fits their ad-hoc deadline (e.g. "interner Review-Termin", "Mandantengespräch", "Custom — pending court order"). No catalog picker, no deadline_rules FK constraint required.

That's it. No "sort by proceeding type" anymore (there's nothing to sort). No long dropdown.

DB / model implications

  • paliad.deadlines.deadline_rule_id stays nullable; it's only set when Mode == Auto (resolved at save time from the Type's default rule).
  • A new column paliad.deadlines.custom_rule_text text null holds the free-text when Mode == Custom. Migration 122 (verify slot via ls internal/db/migrations/ | tail).
  • The currently-stored values from t-paliad-251 don't need a backfill — empty custom_rule_text + non-null deadline_rule_id = Auto. If deadline_rule_id IS NULL AND custom_rule_text IS NULL after migration → display as "keine Regel" (consistent with today's no-rule state).

UI / behaviour

  1. Rule field's default state: Auto, with the derived rule name shown read-only ("Auto: ").
  2. A small toggle/link next to the field: "Custom" — clicking switches to a text input for the lawyer's free entry.
  3. While in Custom mode: an inline link back to Auto reverts to the derived rule.
  4. Save behaviour:
    • Auto → save with deadline_rule_id = <resolved> and custom_rule_text = NULL
    • Custom → save with deadline_rule_id = NULL and custom_rule_text = <user input>
  5. Display elsewhere (deadline detail, lists, timelines) joins on either path:
    • If deadline_rule_id is set → show the canonical rule name + legal_source
    • Else if custom_rule_text is set → show the literal text + a small "Custom" badge

What to remove from t-paliad-251's surface

  • The full-catalog rule dropdown.
  • The sort-by-proceeding-type / sort-by-court UI on the rule selector.
  • The current "Auto / explicit override" UI gets simplified to Auto / Custom (two states, no third).
  • Keep Part 1 (event-type modal search + filter chips) — m's not complaining about those.
  • Keep Part 4 (Standardtitel button) — independent feature.

Files most likely touched

  • frontend/src/client/deadlines-new.ts (the create-form artemis just expanded)
  • frontend/src/client/deadlines-detail.ts (edit + display)
  • frontend/src/deadlines-new.tsx / frontend/src/deadlines-detail.tsx
  • frontend/src/client/i18n.ts + frontend/src/i18n-keys.ts — add rule.auto, rule.custom, rule.custom_badge; remove the sort-option keys
  • internal/handlers/deadlines.go — accept custom_rule_text on POST/PATCH
  • internal/models/models.goDeadline.CustomRuleText *string
  • New migration 122_deadlines_custom_rule_text.up.sql (+ down)
  • Update any deadline-rendering surface (list rows, timeline rows, dashboard widgets) that prints the rule name to also fall back to custom_rule_text

Hard rules

  • Don't break existing deadlines with set deadline_rule_id — they keep displaying as before (Auto-equivalent).
  • One transaction-safe migration (additive nullable column).
  • go build ./... && go test ./internal/... && cd frontend && bun run build clean.
  • Branch: mai/<worker>/deadline-rule-auto-or-custom.

Out of scope

  • Promoting Custom entries back to catalog ("save this as a new rule") — separate feature if ever needed.
  • Filtering / searching across custom_rule_text in deadline lists — keep simple for v1.
  • Touching the event-type modal (Part 1 of #82 — that stays).

Reporting

mai report completed with branch + SHAs + migration slot + UX path: open deadline create form → see Auto + derived rule name → toggle to Custom → type free text → save → confirm display on detail page shows the text + Custom badge.

## m's report (2026-05-25 14:29) > The options available in the new deadline dropdown for Rule are... too many. There are 4 oral hearings etc... it should be more simple. Either auto (from the type) or custom override (manual entry) ## Context — what shipped t-paliad-251 / m/paliad#82 shipped a Rule dropdown that lists every `paliad.deadline_rules` row matching the selected event_type (with sort options including "by proceeding type"). For event_types that match multiple proceedings (e.g. an "Oral hearing" exists for UPC CFI, UPC CoA, DPMA, EPO, …), the dropdown shows 4+ near-identical options. That's catalog-noise, not signal. ## What m wants instead — binary model The Rule field has just **two states**: 1. **Auto** (default) — the rule is derived from the chosen Type. Resolved rule name is displayed read-only next to the field (e.g. "Auto: UPC RoP R.220(1)"). The user doesn't pick from a list. 2. **Custom** (toggle off the Auto) — a **free-text input** appears. The lawyer types whatever rule description fits their ad-hoc deadline (e.g. "interner Review-Termin", "Mandantengespräch", "Custom — pending court order"). No catalog picker, no `deadline_rules` FK constraint required. That's it. No "sort by proceeding type" anymore (there's nothing to sort). No long dropdown. ## DB / model implications - `paliad.deadlines.deadline_rule_id` stays nullable; it's only set when Mode == Auto (resolved at save time from the Type's default rule). - A new column `paliad.deadlines.custom_rule_text text null` holds the free-text when Mode == Custom. Migration 122 (verify slot via `ls internal/db/migrations/ | tail`). - The currently-stored values from t-paliad-251 don't need a backfill — empty `custom_rule_text` + non-null `deadline_rule_id` = Auto. If `deadline_rule_id IS NULL AND custom_rule_text IS NULL` after migration → display as "keine Regel" (consistent with today's no-rule state). ## UI / behaviour 1. Rule field's default state: **Auto**, with the derived rule name shown read-only ("Auto: <rule name>"). 2. A small toggle/link next to the field: **"Custom"** — clicking switches to a text input for the lawyer's free entry. 3. While in Custom mode: an inline link back to Auto reverts to the derived rule. 4. Save behaviour: - Auto → save with `deadline_rule_id = <resolved>` and `custom_rule_text = NULL` - Custom → save with `deadline_rule_id = NULL` and `custom_rule_text = <user input>` 5. Display elsewhere (deadline detail, lists, timelines) joins on either path: - If `deadline_rule_id` is set → show the canonical rule name + legal_source - Else if `custom_rule_text` is set → show the literal text + a small "Custom" badge ## What to remove from t-paliad-251's surface - The full-catalog rule dropdown. - The sort-by-proceeding-type / sort-by-court UI on the rule selector. - The current "Auto / explicit override" UI gets simplified to Auto / Custom (two states, no third). - Keep Part 1 (event-type modal search + filter chips) — m's not complaining about those. - Keep Part 4 (Standardtitel button) — independent feature. ## Files most likely touched - `frontend/src/client/deadlines-new.ts` (the create-form artemis just expanded) - `frontend/src/client/deadlines-detail.ts` (edit + display) - `frontend/src/deadlines-new.tsx` / `frontend/src/deadlines-detail.tsx` - `frontend/src/client/i18n.ts` + `frontend/src/i18n-keys.ts` — add `rule.auto`, `rule.custom`, `rule.custom_badge`; remove the sort-option keys - `internal/handlers/deadlines.go` — accept `custom_rule_text` on POST/PATCH - `internal/models/models.go` — `Deadline.CustomRuleText *string` - New migration `122_deadlines_custom_rule_text.up.sql` (+ down) - Update any deadline-rendering surface (list rows, timeline rows, dashboard widgets) that prints the rule name to also fall back to `custom_rule_text` ## Hard rules - **Don't break existing deadlines** with set `deadline_rule_id` — they keep displaying as before (Auto-equivalent). - **One transaction-safe migration** (additive nullable column). - `go build ./... && go test ./internal/... && cd frontend && bun run build` clean. - Branch: `mai/<worker>/deadline-rule-auto-or-custom`. ## Out of scope - Promoting Custom entries back to catalog ("save this as a new rule") — separate feature if ever needed. - Filtering / searching across custom_rule_text in deadline lists — keep simple for v1. - Touching the event-type modal (Part 1 of #82 — that stays). ## Reporting `mai report completed` with branch + SHAs + migration slot + UX path: open deadline create form → see Auto + derived rule name → toggle to Custom → type free text → save → confirm display on detail page shows the text + Custom badge.
mAi self-assigned this 2026-05-25 12:31:03 +00:00
Author
Collaborator

Addendum from m (2026-05-25 14:31)

And in the selection sometimes we show the Rule, sometimes we show the name. For example for the first submissions in a proceedings sequence

The rule/name display in the event-type selection (and possibly the rule resolution) is inconsistent — for some entries the canonical Rule text shows (e.g. "UPC RoP R.220(1)"), for others the Name shows (e.g. "Notice of Appeal"). m flags the first submissions in a proceedings sequence as where this is most visible.

In-scope for this issue: while reworking the Rule field, audit the display contract for what we show as the rule label across all selection surfaces and the deadline list/detail rows. Make it consistent. Suggested canonical: show the Name ("Notice of Appeal") as primary, with the Rule citation ("UPC RoP R.220(1)") as a small secondary chip / muted suffix.

Apply consistently in: deadline form, event-type modal, deadline list rows, deadline detail header, project Schriftsätze tab, browse-a-proceeding column rows.

## Addendum from m (2026-05-25 14:31) > And in the selection sometimes we show the Rule, sometimes we show the name. For example for the first submissions in a proceedings sequence The rule/name display in the **event-type selection** (and possibly the rule resolution) is inconsistent — for some entries the canonical Rule text shows (e.g. "UPC RoP R.220(1)"), for others the Name shows (e.g. "Notice of Appeal"). m flags the first submissions in a proceedings sequence as where this is most visible. In-scope for this issue: while reworking the Rule field, audit the **display contract** for what we show as the rule label across all selection surfaces and the deadline list/detail rows. Make it consistent. Suggested canonical: show the **Name** ("Notice of Appeal") as primary, with the Rule citation ("UPC RoP R.220(1)") as a small secondary chip / muted suffix. Apply consistently in: deadline form, event-type modal, deadline list rows, deadline detail header, project Schriftsätze tab, browse-a-proceeding column rows.
Author
Collaborator

Done — Auto/Custom rule + canonical display

Commit: https://mgit.msbls.de/m/paliad/commit/045accc
Branch: mai/artemis/gitster-deadline-form
Migration slot: 122 (122_deadlines_custom_rule_text)

What changed

Binary Rule field on the deadline form

  • Auto (default): rule_id derived from the chosen Type. Renders read-only as Auto · <Name · Citation> next to the field. Catalog dropdown + sort selector gone.
  • Custom: free-text input → paliad.deadlines.custom_rule_text (new nullable column). Mutually exclusive with rule_id at the persistence boundary.
  • Toggle link flips between modes; switching back to Auto re-resolves from the current Type (no stale state).

Schema

  • Migration 122 adds paliad.deadlines.custom_rule_text text NULL. Additive, no backfill needed: existing rows with rule_id set keep displaying as before; both NULL = keine Regel.
  • models.Deadline, CreateDeadlineInput, UpdateDeadlineInput, EventListItem all carry the new field.
  • UpdateDeadlineInput grows RuleSet/RuleID/CustomRuleTextRuleSet=true is the PATCH discriminator so absent fields don't overwrite; RuleID and CustomRuleText are mutually exclusive in one request (service rejects "both set").

Rule-label addendum (your 14:31 follow-up)

  • One canonical contract everywhere: Name primary, Citation muted secondary"Notice of Appeal · UPC.RoP.220.1". Custom rules render the text + a Custom pill.
  • New frontend/src/client/rule-label.ts (formatRuleLabel / formatRuleLabelHTML / formatCustomRuleLabelHTML).
  • Wired into:
    • /deadlines/new Auto display
    • /deadlines/{id} read view + Standardtitel
    • /events REGEL column (events.ts ruleDisplay)
    • Project detail → Fristen tab table (projects-detail.ts)
    • Generic views shape-list.ts rule column
  • Verfahrensablauf (browse-a-proceeding) already separates name + citation chip — matches the canonical pattern; no change needed there.
  • Schriftsätze tab is column-shaped (Name + Code in distinct columns) — out of scope per the addendum.

Removed (carried over from t-paliad-251)

  • The full <select id="deadline-rule"> catalog dropdown.
  • The by_proceeding / by_court / alpha sort dropdown + persistence.
  • The collapsed-by-Regel Typ view (.event-type-collapsed* CSS + the override link).
  • The Rule→Type auto-fill machinery; the override-warning slot.
  • 10 stale i18n keys; +6 new (auto_no_match, auto_pick_type, custom_badge, custom_placeholder, mode.toggle_to_auto, mode.toggle_to_custom).

Kept (per issue)

  • Part 1: event-type browse modal with search + jurisdiction filter chips.
  • Part 4: Standardtitel button (chain updated to include Custom text).

Hard rules satisfied

  • Existing deadlines with rule_id keep displaying as before (Auto-equivalent).
  • One transaction-safe migration (additive nullable column).
  • go build ./... && go test ./internal/... && cd frontend && bun run build clean.
  • Branch is mai/<worker>/gitster-deadline-form (matches the worktree's actual branch name).

UX walkthrough

  1. /deadlines/new → pick a Type → Auto badge shows Auto · Name · Citation (or Keine Regel zur gewählten Verfahrenshandlung if no rule maps).
  2. Click Eigene Regel eingeben → text input replaces the Auto display, focus drops in.
  3. Type something, save → detail page shows the text + a Custom pill.
  4. Open /deadlines/{id} → Bearbeiten → same toggle, mode pre-selected from the persisted state.

Ready for review.

## Done — Auto/Custom rule + canonical display Commit: https://mgit.msbls.de/m/paliad/commit/045accc Branch: `mai/artemis/gitster-deadline-form` Migration slot: **122** (`122_deadlines_custom_rule_text`) ### What changed **Binary Rule field on the deadline form** - **Auto** (default): `rule_id` derived from the chosen Type. Renders read-only as `Auto · <Name · Citation>` next to the field. Catalog dropdown + sort selector gone. - **Custom**: free-text input → `paliad.deadlines.custom_rule_text` (new nullable column). Mutually exclusive with `rule_id` at the persistence boundary. - Toggle link flips between modes; switching back to Auto re-resolves from the current Type (no stale state). **Schema** - Migration 122 adds `paliad.deadlines.custom_rule_text text NULL`. Additive, no backfill needed: existing rows with `rule_id` set keep displaying as before; both NULL = `keine Regel`. - `models.Deadline`, `CreateDeadlineInput`, `UpdateDeadlineInput`, `EventListItem` all carry the new field. - `UpdateDeadlineInput` grows `RuleSet`/`RuleID`/`CustomRuleText` — `RuleSet=true` is the PATCH discriminator so absent fields don't overwrite; `RuleID` and `CustomRuleText` are mutually exclusive in one request (service rejects "both set"). **Rule-label addendum** (your 14:31 follow-up) - One canonical contract everywhere: **Name primary, Citation muted secondary** — `"Notice of Appeal · UPC.RoP.220.1"`. Custom rules render the text + a `Custom` pill. - New `frontend/src/client/rule-label.ts` (`formatRuleLabel` / `formatRuleLabelHTML` / `formatCustomRuleLabelHTML`). - Wired into: - `/deadlines/new` Auto display - `/deadlines/{id}` read view + Standardtitel - `/events` REGEL column (`events.ts ruleDisplay`) - Project detail → Fristen tab table (`projects-detail.ts`) - Generic views `shape-list.ts` rule column - **Verfahrensablauf** (browse-a-proceeding) already separates name + citation chip — matches the canonical pattern; no change needed there. - **Schriftsätze tab** is column-shaped (Name + Code in distinct columns) — out of scope per the addendum. **Removed** (carried over from t-paliad-251) - The full `<select id="deadline-rule">` catalog dropdown. - The by_proceeding / by_court / alpha sort dropdown + persistence. - The collapsed-by-Regel Typ view (`.event-type-collapsed*` CSS + the override link). - The Rule→Type auto-fill machinery; the override-warning slot. - 10 stale i18n keys; +6 new (`auto_no_match`, `auto_pick_type`, `custom_badge`, `custom_placeholder`, `mode.toggle_to_auto`, `mode.toggle_to_custom`). **Kept** (per issue) - Part 1: event-type browse modal with search + jurisdiction filter chips. - Part 4: Standardtitel button (chain updated to include Custom text). ### Hard rules satisfied - Existing deadlines with `rule_id` keep displaying as before (Auto-equivalent). - One transaction-safe migration (additive nullable column). - `go build ./... && go test ./internal/... && cd frontend && bun run build` clean. - Branch is `mai/<worker>/gitster-deadline-form` (matches the worktree's actual branch name). ### UX walkthrough 1. `/deadlines/new` → pick a Type → Auto badge shows `Auto · Name · Citation` (or `Keine Regel zur gewählten Verfahrenshandlung` if no rule maps). 2. Click **Eigene Regel eingeben** → text input replaces the Auto display, focus drops in. 3. Type something, save → detail page shows the text + a `Custom` pill. 4. Open `/deadlines/{id}` → Bearbeiten → same toggle, mode pre-selected from the persisted state. Ready for review.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: m/paliad#89
No description provided.