Skip to content

Fix stale save metadata handling#33

Merged
GordonBeeming merged 2 commits into
mainfrom
gb/fix-stale-save-metadata
Jun 24, 2026
Merged

Fix stale save metadata handling#33
GordonBeeming merged 2 commits into
mainfrom
gb/fix-stale-save-metadata

Conversation

@GordonBeeming

Copy link
Copy Markdown
Owner

Summary

  • Refresh file metadata from disk when opening, restoring, and reloading tabs so save conflict checks use the file version that was actually loaded.
  • Refresh saved tab metadata from a direct file stat after writes instead of relying on potentially stale tree scan entries.
  • Move save/error toasts away from Git status UI and mark them as alert-style errors with an icon.

Test plan

  • npm test -- src/App.test.tsx
  • npm test
  • npm run build

Co-authored-by: Codex <noreply@openai.com>
Co-authored-by: GitButler <gitbutler@gitbutler.com>
@GordonBeeming GordonBeeming marked this pull request as ready for review June 24, 2026 03:52
Copilot AI review requested due to automatic review settings June 24, 2026 03:52

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review

This pull request refactors file operations in the application by introducing a centralized readOpenFileFromDisk helper to load file contents and metadata, updating file saving and reloading logic, and improving the error toast UI with alert roles and styling. The review feedback suggests optimizing readOpenFileFromDisk by executing readFile and statFile in parallel with Promise.all, and improving UI responsiveness during saves by updating the open files state before awaiting the file refresh process.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread src/App.tsx
Comment thread src/App.tsx Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 4e327d74b4

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/App.tsx Outdated

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR improves correctness of save conflict detection by ensuring open/reloaded tabs and post-save state use fresh on-disk metadata (instead of potentially stale tree-scan entries), and it updates error toast presentation to be a top-right alert-style message with an icon.

Changes:

  • Read file contents + metadata from disk when opening/restoring/reloading tabs so conflict checks use the loaded file’s actual on-disk version.
  • After writes, refresh saved tab metadata via a direct statFile() rather than relying on the workspace scan result.
  • Rework error toasts to be an alert-style UI element (top-right, icon + text) and update tests accordingly.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
src/styles.css Repositions/restyles the toast to be a top-right alert with danger styling and icon support.
src/App.tsx Introduces disk-based open/reload metadata refresh and updates toast rendering to role="alert" with an icon.
src/App.test.tsx Adjusts statFile mocking and adds coverage to validate fresh metadata usage + alert-style toast behavior.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/App.tsx
Comment thread src/App.test.tsx
Co-authored-by: Codex <noreply@openai.com>
Co-authored-by: GitButler <gitbutler@gitbutler.com>
@GordonBeeming GordonBeeming merged commit 3a47d43 into main Jun 24, 2026
2 of 4 checks passed
@GordonBeeming GordonBeeming deleted the gb/fix-stale-save-metadata branch June 24, 2026 06:34
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.

2 participants