Skip to content

feat(asset-reviews): give review requests a human-readable title#490

Open
larsgeorge-db wants to merge 1 commit into
mainfrom
feat-asset-review-titles
Open

feat(asset-reviews): give review requests a human-readable title#490
larsgeorge-db wants to merge 1 commit into
mainfrom
feat-asset-review-titles

Conversation

@larsgeorge-db

Copy link
Copy Markdown
Collaborator

Summary

Data asset review requests had no name field, so every surface (list, detail header, breadcrumb, notifications, toasts, search results) fell back to displaying the raw UUID like 00c00001-0000-4000-8000-000000000001. This PR introduces an optional, user-editable title with a smart auto-derived fallback, and surfaces it everywhere a review is named.

Before

Surface Display
List column 00c00001-0000-4000-...
Detail H1 Review Request Details + UUID
Breadcrumb Review: 00c00001...
Notification Review request (00c00001-...) assigned to you by ...
Search hit Review Request by foo@x for bar@y (2 assets)

After

Surface Display
List column Review of orders (+2 more) (user-set title takes precedence)
Detail H1 Review of orders (+2 more) with inline edit; UUID demoted to small monospace line with copy button
Breadcrumb the title
Notification New review request: Review of orders (+2 more)
Search hit the title

Derivation rule

Single derive_review_title() helper in the manager, used by API responses, workflow entity_name, notifications, search index, and the Alembic backfill so all surfaces agree.

  1. user-set title if non-empty
  2. Review of {short_name(asset_fqn)} for one asset
  3. Review of {short_name(first)} (+{N-1} more) for many
  4. Review request by {requester_email} as last resort

short_name understands UC FQNs (a.b.c -> c), path-style FQNs (notebooks / volumes -> last segment), and mdm://config/run/candidate URIs (-> candidate id).

Backend changes

  • New title VARCHAR(200) column on data_asset_review_requests via Alembic migration g3_review_title (descends from g2_ontology_gen_runs, single head). Migration backfills existing rows using the same derivation rule the runtime applies.
  • Pydantic: title added to read + create models; new DataAssetReviewRequestUpdate for PATCH.
  • Manager always returns a populated title (no None reaches consumers). Workflow trigger entity_name, fallback notifications (create and status-change), and search-index title all use the derived title; descriptions no longer embed the UUID.
  • New manager.update_review_request() + repo update_request_fields() (uses explicit *_set flags so PATCH can distinguish field omitted from field cleared to null).
  • New PATCH /api/data-asset-reviews/{request_id} route with the same audit-log shape as the other write routes.

Frontend changes

  • Types: DataAssetReviewRequest.title: string, DataAssetReviewRequestCreate.title?, new DataAssetReviewRequestUpdate.
  • useApi gains a patch() method (mirrors put()); useComments test mock updated to match the expanded return shape.
  • Create dialog: optional Title input above Notes (maxLength=200), placeholder explains the auto-derived fallback.
  • List view: dropped the Request ID column. Title is now the primary column; table search runs against it (placeholder auto-adapts).
  • Detail view: breadcrumb and H1 use request.title; UUID demoted to small monospace line with a copy-to-clipboard button. Inline title editor (pencil -> input -> PATCH) with Enter/Esc handling.
  • i18n: 7 locales updated (en, de, fr, es, it, ja, nl). Renamed table.requestId -> table.title, added table.untitled, form.titleLabel, form.titlePlaceholder, actions.editTitle, actions.copyId, toast.titleUpdated, toast.idCopied. toast.requestCreated now interpolates {{title}} instead of {{id}}.

Out of scope

  • No change to per-asset child rows (still keyed by asset_fqn).
  • No change to project_id exposure.
  • No bulk rename UI; backfill happens in the migration only.
  • Title is optional, not unique, validated only by length.

Test plan

  • Run the migration on a populated dev DB; confirm existing rows get sensible titles (one-asset, many-asset, no-asset cases).
  • Create a review request with the Title field left empty; verify the response/list/detail show the auto-derived title.
  • Create a review request with a custom Title; verify it shows everywhere (list, breadcrumb, H1, search, notification).
  • Edit the title via the pencil icon on the detail view; verify PATCH persists and breadcrumb refreshes.
  • Clear the title in the inline editor and save; verify it falls back to the auto-derived value.
  • Copy-ID button copies the UUID to the clipboard.
  • Notifications (create + status change) show the title rather than the UUID.
  • Search results show the derived/user-set title.

Data asset review requests had no name field, so every surface (list,
detail header, breadcrumb, notifications, toasts, search) fell back to
displaying the raw UUID. Introduce an optional, user-editable `title`
with a smart auto-derived fallback and surface it everywhere a review
is named.

Backend

- New `title VARCHAR(200)` column on `data_asset_review_requests` via
  Alembic migration `g3_review_title`, backfilled inline using the
  same derivation rule the runtime applies (so historical rows match
  what the manager would produce).
- New `derive_review_title()` + `_short_asset_label()` helpers in
  `data_asset_reviews_manager.py`. Derivation order:
    1. user-set title if non-empty
    2. `Review of {short_name(fqn)}` for one asset
    3. `Review of {short_name(first)} (+{N-1} more)` for many
    4. `Review request by {requester_email}` as last resort.
  Short-name handles UC FQNs (`a.b.c` -> `c`), path-style FQNs
  (notebooks / volumes), and `mdm://config/run/candidate` URIs.
- Pydantic: `title` on `DataAssetReviewRequest` (response, always
  populated) and `DataAssetReviewRequestCreate` (optional input);
  new `DataAssetReviewRequestUpdate` for partial updates.
- Manager hardens the response so callers never see `None` for title:
  `get_review_request`, `list_review_requests`, and
  `update_review_request_status` all run through the derive helper.
- Workflow trigger `entity_name`, fallback notifications (create and
  status-change), and the search-index `title` now use the derived
  title; descriptions no longer embed the UUID.
- New `manager.update_review_request()` + repo `update_request_fields()`
  with explicit `*_set` flags so PATCH can distinguish field omitted
  from field cleared to null.
- New `PATCH /api/data-asset-reviews/{request_id}` route with the same
  audit-log shape as the other write routes.

Frontend

- `DataAssetReviewRequest.title: string` and matching
  `DataAssetReviewRequestCreate.title?` / `DataAssetReviewRequestUpdate`
  types.
- Added `patch()` to `useApi` (mirrors `put()`); updated the
  `useComments` test mock to match the expanded return shape.
- Create dialog now has an optional Title input above Notes
  (`maxLength=200`) with placeholder explaining the auto-derived
  fallback.
- List view: dropped the Request ID column. Title is now the primary
  column (text-sm font-medium) and the table search runs against it
  (placeholder auto-adapts via `searchColumn="title"`).
- Detail view: breadcrumb and H1 use `request.title`; UUID demoted to
  a small font-mono line with a copy-to-clipboard button. New inline
  title editor (pencil -> input -> PATCH) with Enter/Esc handling and
  a spinner during save.
- i18n: 7 locales (en, de, fr, es, it, ja, nl) updated. Renamed
  `table.requestId` -> `table.title`, added `table.untitled`,
  `form.titleLabel`, `form.titlePlaceholder`,
  `actions.editTitle`, `actions.copyId`, `toast.titleUpdated`,
  `toast.idCopied`. `toast.requestCreated` now interpolates
  `{{title}}` instead of `{{id}}`.
@larsgeorge-db larsgeorge-db requested a review from a team as a code owner June 3, 2026 09:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant