48108 frontend [ tasks ] Correct output field order and stale draft handling - #268
Open
aicarma-artyom-maslov wants to merge 23 commits into
Open
48108 frontend [ tasks ] Correct output field order and stale draft handling#268aicarma-artyom-maslov wants to merge 23 commits into
aicarma-artyom-maslov wants to merge 23 commits into
Conversation
aicarma-artyom-maslov
requested review from
EBirkenfeld,
Maria-Lordwill,
pneumatic-ilyacedrik and
pneumojoseph
July 13, 2026 12:02
pneumatic-ilyacedrik
previously approved these changes
Jul 15, 2026
EBirkenfeld
previously approved these changes
Jul 15, 2026
…8__fix_task_output_fields # Conflicts: # frontend/src/public/components/Highlights/FeedItemHeader.tsx # frontend/src/public/components/TaskCard/TaskCard.tsx # frontend/src/public/components/TaskCard/__tests__/TaskCard.test.tsx # frontend/src/public/components/Team/Users/CreateUserModal/__tests__/CreateUserModal.test.tsx # frontend/src/public/components/TemplateEdit/ExtraFields/File/ExtraFieldFile.tsx # frontend/src/public/components/TemplateEdit/ExtraFields/File/__tests__/ExtraFieldFile.test.tsx # frontend/src/public/redux/task/__tests__/saga.test.ts
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 2 potential issues.
There are 4 total unresolved issues (including 2 from previous reviews).
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit d9e70f6. Configure here.
…8__fix_task_output_fields # Conflicts: # frontend/src/public/components/Highlights/types.ts # frontend/src/public/components/Team/Users/CreateUserModal/__tests__/CreateUserModal.test.tsx
…8__fix_task_output_fields # Conflicts: # frontend/src/public/components/TaskCard/TaskActions.tsx # frontend/src/public/components/TaskCard/TaskCard.tsx # frontend/src/public/components/TaskCard/TaskCardHeader.tsx # frontend/src/public/components/TaskCard/TaskOutputFields.tsx # frontend/src/public/components/TaskCard/TaskPerformers.tsx # frontend/src/public/components/TaskCard/TaskWorkflowLog.tsx # frontend/src/public/components/TaskCard/__tests__/TaskCard.test.tsx # frontend/src/public/components/TaskCard/hooks/__tests__/useTaskOutput.test.tsx # frontend/src/public/components/TaskCard/hooks/useTaskOutput.ts # frontend/src/public/components/TaskCard/types.ts # frontend/src/public/components/TaskCard/utils/__tests__/storageOutputs.test.ts # frontend/src/public/components/TaskCard/utils/storageOutputs.ts # frontend/src/public/components/TemplateEdit/ExtraFields/File/ExtraFieldFile.tsx # frontend/src/public/components/TemplateEdit/ExtraFields/File/__tests__/ExtraFieldFile.test.tsx # frontend/src/public/redux/task/saga.ts
aicarma-artyom-maslov
requested review from
EBirkenfeld,
andrey-usov and
pneumatic-ilyacedrik
August 4, 2026 13:47
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

1. Release notes
Fixed task completion output ordering and stale draft synchronization. Completion forms now follow template field order, stale
localStoragevalues no longer replace changed server values, file fields resynchronize after task reopen, and file links remain visible in workflow logs.2. Context
/tasks,/tasks/:id) -> Task Completion Form and Workflow Log.3. Solution & Implementation Details
sortFieldsByOrderand apply descending template order before rendering completion fields.getTaskOutputFingerprintto detect submitted-value changes independently from presentation metadata changes.dateStartedand server field fingerprints alongside draft data.dateStartedvalue.markdownValueandattachmentsare normalized into the current file state, including removed attachments and uploads completing during a parent refresh.markdownValueare retained by workflow-log filtering and rendered as attachments with their URLs.4. What to Test
4.1 Preconditions
ordervalues.tasks_outputsandtasks_fieldsets_outputsinlocalStorage.4.2 Positive Scenarios / Testing Report
Result: Fields and fieldsets appear in the same order as configured in the template.
Result: The unchanged field keeps its draft while the changed field displays its new server value.
Result: The stale local value is discarded and the server value is shown.
Result: Metadata updates are rendered without discarding the valid entered value.
Result: Drafts from the previous
dateStartedexecution are not restored.Result: The latest fieldset schema is shown and valid sibling drafts remain.
Result: Only the current attachment list is displayed.
Result: The file is visible and its link opens the expected URL.
Result: The uploaded file is appended to the latest attachment list without duplication.
4.3 Negative Scenarios & Edge Cases
Result: The task loads from server data without crashing.
Result: The draft remains readable and is not assigned an unverified current fingerprint.
Result: The field is empty instead of restoring the stale draft.
Result: The field normalizes to no selection and does not crash.
Result: Current drafts remain available for retry.
Result: Actions remain blocked until all uploads finish; no attachment is duplicated.
4.4 Verification Points
dataand metadata withdateStartedandfieldFingerprints.4.5 API Verification
markdownValueis rendered as an attachment with the original URL.4.6 What Was NOT Tested
5. Affected Areas
6. Unit Tests
TaskCard.test.tsx: Covers output ordering, hidden fields, server synchronization, upload blocking, draft flushing, and return cleanup.useTaskOutput.test.tsx: Covers stale draft filtering, task restarts, metadata-only changes, fieldset merging, sibling draft preservation, debounce persistence, and unmount flushing.getTaskOutputFingerprint.test.ts: Covers stable fingerprints, metadata exclusions, normalized empty values, file attachments, and submitted-value changes.storageOutputs.test.ts: Covers metadata persistence, legacy entries, isolated storage keys, replacement, removal, and corrupted data.ExtraFieldsHelper.test.ts: Covers file normalization, removed attachments, stored values, user IDs, and empty radio values.ExtraFieldFile.test.tsx: Covers attachment synchronization, in-flight uploads, and reopen behavior.redux/task/saga.test.ts: Covers successful/failed return and completion draft cleanup.FeedItemHeader.test.tsx/FeedItemComment.test.tsx: Covers workflow-log output and comment rendering.Automated verification performed after the
mastermerge: ESLint passed, 117 related tests passed, and the webpack build completed successfully.7. Commits
850fff2c—48108 fix(tasks): correct output field order and stale draft handling2f199c05—48108 fix(tasks): avoid output sync races and preserve file attachments1a14d920—48108 fix(fields): normalize empty radio valuesfb5bf009—48108 fix(tasks): harden output synchronization and cleanup4574567e—48108 fix(tasks): prevent stale output drafts during sync4cf89059—48108 refactor(tasks): align output components with project rules7f269fac—48108 fix(tasks): prevent stale resync stated7284030—48108 fix(frontend): stabilize output and async updates9713e44c—48108 fix(tasks): preserve pending output drafts2c2ef123—48108 fix(tasks): clear fieldset drafts on restart935479a7—48108 fix(tasks): preserve valid output drafts50a54f4a—48108 fix(tasks): merge fieldset drafts with server fieldsdef1cb76—48108 fix(tasks): flush drafts and restore user selections077cadb1—48108 fix(tasks): preserve drafts across output updates7e28fc65—48108 fix(tasks): preserve field drafts during sync4bcc8e67—48108 fix(tasks): validate stored drafts on mount41217f0b—48108 fix(tasks): sync output metadata safelyd9e70f6f—48108 fix(tasks): normalize empty drafts on first render4f0d57ba—48108 fix(tasks): avoid invalidating draft fingerprints397c0f3a— mergeorigin/masterintofrontend/tasks/48108__fix_task_output_fieldsNote
Medium Risk
Touches task completion/return payloads and local draft persistence with nuanced server-sync rules; regressions could lose user edits or submit wrong output, but behavior is heavily tested.
Overview
Fixes task output display order and local draft behavior so in-progress edits stay correct when the server updates and when users complete or return tasks.
Task output drafts and ordering: New
useTaskOutputhook owns output/fieldset state, sorts fields withsortFieldsByOrder, and persists debounced drafts to local storage with metadata fingerprints (getTaskOutputFingerprint) so stale drafts drop when server values, task restarts, or mismatcheddateStartedchange—while keeping valid drafts when only field metadata changes.flushOutputsruns before complete/return so pending edits are saved synchronously; drafts clear on successful revert only (setTaskRevertedsaga).Field value merging:
ExtraFieldsHelpernow treats stored drafts explicitly (including file attachments, user/group ids, and empty values) instead of letting empty server values win incorrectly.UI refactors:
TaskCardsplits intoTaskActions,TaskCardHeader,TaskOutputFields,TaskPerformers, andTaskWorkflowLog; highlightsFeedItemHeaderdelegates toFeedItemComment,FeedItemOutputs, andPerformerChange(comment truncation usesscrollHeightand remeasures on text change).FeedItemOutputscounts file fields viamarkdownValue.ExtraFieldFilesyncs attachment state from props and avoids races during upload with a ref.Tests cover the hook, fingerprints, storage metadata, file fields, and related sagas.
Reviewed by Cursor Bugbot for commit 4f0d57b. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Fix output field ordering and stale draft handling in task output storage
useTaskOutputare now sorted by descendingordervia a newsortFieldsByOrderutility in workflows.ts.getTaskOutputFingerprint) and taskdateStarted; stale or mismatched drafts are discarded on task restart.useTaskOutputnow write from pending refs rather than arguments, and aflushOutputscall on unmount ensures no edits are lost.fieldsetsStorageandoutputStorageare unified under a newcreateTaskStoragegeneric in storageOutputs.ts, adding corruption-tolerant reads, metadata persistence, and bulk removal.ExtraFieldsHelper.getFieldValuenow falls back todefaultValuewhen storage holds an empty string or empty array, andFilefield attachment resolution uses an expanded precedence chain.FeedItemHeaderis refactored into subcomponents (FeedItemOutputs,FeedItemComment,PerformerChange) andFeedItemCommentremeasures expandability when text or attachments change.outputStorageandfieldsetsStorageread/write behavior and key semantics have changed; existing stored drafts with the legacyoutputproperty are migrated automatically, but entries with unexpected shapes will silently returnundefined.Macroscope summarized 397c0f3.