Skip to content
This repository was archived by the owner on Apr 25, 2026. It is now read-only.

[codex] Fix alive cats sort crash after quick refresh - #97

Merged
frankieg33 merged 3 commits into
mainfrom
codex/fix-alive-cats-sort-crash
Apr 23, 2026
Merged

frankieg33 merged 3 commits into
mainfrom
codex/fix-alive-cats-sort-crash

Conversation

@frankieg33

Copy link
Copy Markdown
Owner

What changed

  • route quick room/status patches through a dedicated CatTableModel.apply_room_patch() path
  • reset the source model before invalidating the proxy so Qt drops stale sorted/filter indexes
  • reapply the active table sort after the quick-refresh patch
  • add a regression test covering a sorted roster receiving a quick room patch

Why

The remaining crash report pointed to sorting the Alive Cats tab right after the save updated. The quick-refresh path was mutating live cats and emitting a raw layoutChanged, which left the sorted roster in a riskier state than a full model reset.

Impact

This makes the post-update Alive Cats table refresh more defensively, especially when the user clicks a sort header right after the game writes a new save.

Root cause

Quick room refresh updated cat.room/cat.status underneath an already sorted proxy/view pair and only emitted layoutChanged. That was too weak for the sorted roster path; resetting the model is the safer way to force Qt to rebuild indexes cleanly.

Validation

  • pytest -q tests/test_game_update_crash_fixes.py -k "QuickRefreshGenerationGuard or FileWatcherDebounce"
  • pytest -q tests/test_room_button_rebuild.py
  • added a targeted regression test for sorted quick-refresh patching

Notes

I could not run the entire tests/test_game_update_crash_fixes.py file on this machine because pytest temp-dir setup/cleanup is hitting a separate Windows permission issue unrelated to this fix.

Preserves table selection and scroll position during quick room
refreshes by emitting layoutAboutToBeChanged + changePersistentIndexList
+ layoutChanged on the source model instead of a full reset. The proxy's
dynamic sort/filter handles re-sorting automatically, so the explicit
proxy invalidate and sortByColumn re-apply in _on_room_patch are no
longer needed.
@frankieg33

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Swish!

ℹ️ 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".

@frankieg33
frankieg33 marked this pull request as ready for review April 23, 2026 01:51
@frankieg33
frankieg33 merged commit 1bc7176 into main Apr 23, 2026
3 checks passed
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant