Skip to content

fix: stop TaskAddForm from freezing Code Review Defaults into new tasks - #6230

Merged
atomantic merged 2 commits into
mainfrom
claim/issue-6219
Sep 4, 2026
Merged

fix: stop TaskAddForm from freezing Code Review Defaults into new tasks#6230
atomantic merged 2 commits into
mainfrom
claim/issue-6219

Conversation

@atomantic

Copy link
Copy Markdown
Owner

Summary

  • TaskAddForm's ReviewerPicker never got a defaults prop, so it always emitted a full snapshot, and the submit payload unconditionally spread all eight reviewer fields whenever a task opened a PR with review-then-merge — freezing that moment's Code Review Defaults into the new task's metadata permanently, even for fields the user never touched.
  • Mirrors the fix already shipped for GlobalConfigControls.jsx (ReviewerPicker persists a defaults snapshot as a task override on first touch #6208): track the fetched Code Review Defaults as a reviewDefaults baseline separate from reviewOverrides (only what the user actually changed), pass the baseline as ReviewerPicker's defaults prop so its onChange only ever emits a real diff, and submit only the overridden fields (mapped to their task-metadata names via a small lookup table).

Test plan

  • Added two regression tests in TaskAddForm.test.jsx: submitting untouched leaves all 8 reviewer fields absent from the payload; touching one control (stop mode) sends only that field.
  • Verified both new tests fail against the pre-fix code and pass after.
  • cd client && npx vitest run src/components/cos/TaskAddForm.test.jsx src/components/cos/ReviewerPicker.test.jsx — 114 passed.
  • npx biome lint --error-on-warnings on the changed files — clean.

Closes #6219

…ks (#6219)

ReviewerPicker never got a `defaults` prop on the task-creation path, so its
onChange emitted a full snapshot every time and the submit payload
unconditionally spread all eight reviewer fields whenever a task opened a PR
with review-then-merge — even fields the user never touched. Every task
created that way permanently pinned that moment's Code Review Defaults,
deaf to later changes.

Mirrors the #6208 fix already applied to GlobalConfigControls: track the
fetched Code Review Defaults as a baseline (reviewDefaults) separate from
what the user actually changed (reviewOverrides), pass the baseline as the
picker's `defaults` prop so it only emits real overrides, and submit only
the overridden keys (mapped to their task-metadata names).
Replaces the 8 repeated ...(overrides.k !== undefined ? {k: ...} : {})
ternaries with a single picker-key-to-payload-key map + a small helper,
mirroring GlobalConfigControls' REVIEWER_OVERRIDE_KEYS loop for the same
purpose. No behavior change.
@atomantic
atomantic merged commit 41109c1 into main Sep 4, 2026
7 checks passed
@atomantic
atomantic deleted the claim/issue-6219 branch September 4, 2026 08:38
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.

TaskAddForm freezes Code Review Defaults into new tasks on create

1 participant