Skip to content

fix: allow clearing unique optional attributes in bulk edit#9963

Open
lancamat1 wants to merge 6 commits into
stablefrom
ai-bug-pipeline-bulk-edit-unique-optional-attribute
Open

fix: allow clearing unique optional attributes in bulk edit#9963
lancamat1 wants to merge 6 commits into
stablefrom
ai-bug-pipeline-bulk-edit-unique-optional-attribute

Conversation

@lancamat1

@lancamat1 lancamat1 commented Jul 18, 2026

Copy link
Copy Markdown
Contributor

Why

In the bulk-edit UI, an attribute that is both unique and optional did not
appear at all. The form dropped every unique attribute, so there was no way to act
on a unique+optional one — even though clearing it to null across the selected rows
is a perfectly safe operation (uniqueness never collides on null).

Goal: let users clear (set-to-empty) a unique+optional attribute in bulk, without
offering a shared value that would violate the uniqueness constraint.

Non-goals: unique+required attributes remain excluded from bulk edit (no safe
bulk action exists for them). No change to how the value is written — only which
fields the bulk form exposes and how a unique one is presented.

What changed

Behavioral changes:

  • Unique + optional attributes now show up in the bulk-edit form as clear-only:
    a label plus the existing "Set empty" checkbox, and no value input.
  • Ticking "Set empty" clears the attribute to null on every selected object.
  • Unique + required attributes are still hidden in bulk edit (unchanged).

Implementation notes:

  • getFormFieldsFromSchema filter relaxed from !unique to !unique || optional
    in bulk update.
  • DynamicField routes isBulkUpdate && unique fields to a new small
    bulk-update-unique.field.tsx that renders label + the existing ResetAction
    only. The disabled prop was deliberately not reused — it also hides the
    reset action.
  • The clear-to-null mutation path (getUpdateMutationFromFormData) is unchanged;
    it already produced { value: null } for the "user/null" state.

What stayed the same: no schema changes, no GraphQL/API contract changes, mutation
building untouched.

How to review

  • getFormFieldsFromSchema.ts — the one-line filter change.
  • bulk-update-unique.field.tsx — new clear-only presentation (reuses ResetAction
    / LabelFormField).
  • dynamic-form.tsx — dispatch guard.
  • The pre-existing test removes unique fields… was updated to optional: false
    (it previously asserted the buggy removal of a unique+optional field); the new
    test keeps unique optional attributes… locks in the fix.

How to test

cd frontend/app && pnpm run test src/shared/components/form/utils/getFormFieldsFromSchema.test.ts

Manual: bulk-select objects of a kind that has a unique+optional attribute → open
bulk edit → the attribute appears with a "Set empty" checkbox and no value input →
submitting with it ticked clears the value on all selected rows.

Impact & rollout

  • Backward compatibility: none affected; purely additive UI behavior.
  • Config/env changes: none.
  • Deployment notes: safe to deploy.

Checklist

  • Tests added/updated
  • Changelog entry added
  • External docs updated (n/a — no user-facing docs cover this form behavior)
  • Internal .md docs updated (n/a — no internal doc describes the filter)
  • I have reviewed AI generated content

Summary by cubic

Enable clearing unique + optional attributes in bulk edit by showing them as clear-only with a “Set empty” checkbox. Unique + required attributes remain hidden, and disabled unique fields keep their normal, non-clearable presentation.

  • Bug Fixes

    • Show unique+optional fields in bulk edit with “Set empty” only; no value input. Applies null to all selected rows.
    • Keep unique+required fields excluded from bulk edit.
    • In bulk edit, leave disabled unique fields on the normal presentation to suppress the reset action.
    • Relaxed schema filter for bulk update and routed unique optional fields to a new clear-only component; tests added/updated to lock behavior.
  • Refactors

    • Updated Betterer results for dynamic-form.tsx line shifts and refreshed hash for getFormFieldsFromSchema.test.ts after test additions; no new or removed TS errors.

Written for commit b7594ac. Summary will update on new commits.

Review in cubic

lancamat1 and others added 3 commits July 18, 2026 15:47
A unique + optional attribute is dropped entirely from the bulk-edit form,
so its "Set empty" (set-to-null) action is never available. This test asserts
the attribute is retained in bulk update while unique + required stays removed.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The bulk-edit form dropped every unique attribute, so a unique + optional
attribute could not be edited at all -- even though clearing it to null on all
selected rows is safe (uniqueness never collides on null).

Keep unique + optional attributes in bulk update and render them clear-only:
label plus the existing "Set empty" reset action, with no value input (a shared
value would violate uniqueness). Unique + required attributes stay excluded.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@lancamat1
lancamat1 requested a review from a team as a code owner July 18, 2026 14:31
@lancamat1 lancamat1 added type/bug Something isn't working as expected group/frontend Issue related to the frontend (React) labels Jul 18, 2026

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 5 files

Confidence score: 5/5

  • Safe to merge after the addressed issues were fixed.

Shadow auto-approve: would not auto-approve because issues were found.

Re-trigger cubic

Comment thread frontend/app/src/shared/components/form/dynamic-form.tsx Outdated
Adding the unique-bulk dispatch guard shifted two pre-existing tracked TS
errors in dynamic-form.tsx (no new/removed errors); regenerate the results
entry (content hash + line numbers) so betterer CI passes.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

0 issues found across 1 file (changes from recent commits).

Shadow auto-approve: would not auto-approve. Auto-approval blocked by 1 unresolved issue from previous reviews.

Re-trigger cubic

The bulk-edit test additions changed getFormFieldsFromSchema.test.ts content
without refreshing its betterer results key hash, so betterer ci failed with
"212 issues stayed the same, but your code has changed in other ways". The
tracked TS-issue set is unchanged; only the file content hash needed updating.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

0 issues found across 1 file (changes from recent commits).

Shadow auto-approve: would not auto-approve. Auto-approval blocked by 1 unresolved issue from previous reviews.

Re-trigger cubic

…bulk edit

Gate the clear-only dispatch on !props.disabled so a disabled unique
attribute is not routed to BulkUpdateUniqueField, whose ResetAction would
otherwise let it be cleared despite being disabled -- matching how every
other field suppresses its reset action when disabled. Addresses cubic review.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

0 issues found across 2 files (changes from recent commits).

Shadow auto-approve: would auto-approve. Fixes a clear bug where unique+optional attributes were hidden in bulk edit, with the diff showing a focused filter change and clear-only UI using existing components. Tests lock the corrected behavior, and the change is bounded — no schema, API, or mutation changes.

Re-trigger cubic

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

group/frontend Issue related to the frontend (React) type/bug Something isn't working as expected

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant