Repository navigation
Collapse unsent receipt replacements while preserving audit history #107358
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If a user replaces a receipt offline, posts a comment in the expense thread, and then replaces the receipt again, this branch replaces the latest request's report rollback with the timestamps from before the first replacement. Posting the comment updates both
lastVisibleActionCreatedandlastReadTimeinsrc/libs/actions/Report/index.ts, and the conflict resolver preserves that comment request ahead of the surviving upload. If the comment succeeds but the upload fails, its inherited rollback therefore rewinds the thread timestamps past a successfully posted comment, leaving incorrect activity ordering and read state. Preserve intervening non-superseded activity when calculating the report rollback instead of unconditionally taking the oldest report update.Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Confirmed by source inspection: Report/index.ts:1034–1040 advances both timestamps for a comment, but Receipt.ts:298–299 still unconditionally inherits the older report rollback. If the retained comment succeeds and the surviving upload fails, the rollback can rewind past the comment.
Simply keeping the newest report rollback would instead retain timestamps from discarded receipt actions. The targeted fix should preserve each timestamp belonging to intervening activity and inherit the original baseline only for timestamps attributable to superseded receipt actions, with a regression covering comment success followed by upload failure.
The snapshot update does not change this behavior, so this finding remains open.
ikevin127, should I implement this timestamp change as well?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rechecked: this P2 is valid and remains open. Report/index.ts:1034–1040 advances both timestamps for a comment, but Receipt.ts:298–299 inherits the oldest report rollback. A successful intervening comment followed by upload failure can therefore rewind activity/read timestamps.
The snapshot fix does not address this. A timestamp fix needs to preserve intervening comment activity without retaining timestamps belonging only to discarded receipt actions, with a regression covering comment success followed by upload failure. The current request asks for a reply to this finding; no timestamp change was made.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Implemented in 863b6138. Receipt.ts:280–307 now handles each timestamp independently: it unwinds a superseded receipt action's timestamp through that request's rollback, but preserves intervening activity. It uses the persisted receipt-added action timestamp, since queued requests do not retain optimistic updates.
Added the queued comment-success/upload-failure regression and independent-field cases. All three new cases failed before the fix; 195 focused tests pass afterward. Full lint, changed-file lint/spelling, typecheck, and Storybook smoke pass. Browser verification remains blocked by unavailable usable UI/failure injection; details are in AI Tests.