Conversation
TODO: fix save actions
Review Summary by QodoFix cleanup and save actions functionality
WalkthroughsDescription• Fix cleanup and save actions not working after PR #14568 • Add checkbox to enable/disable field formatter cleanups • Restore proper binding between cleanup enabled state and UI • Fix boolean condition logic in cleanup initialization Diagramflowchart LR
A["CleanupSingleFieldPanel"] -->|sets showCleanupEnabledButton| B["FieldFormatterCleanupsPanel"]
B -->|manages enabled state| C["CheckBox cleanupsEnabled"]
C -->|controls| D["Cleanup UI Elements"]
E["SavingPropertiesView"] -->|binds cleanupsDisableProperty| F["FieldFormatterCleanupsPanel"]
G["FieldFormatterCleanupsPanelViewModel"] -->|provides properties| B
File Changes1. jabgui/src/main/java/org/jabref/gui/cleanup/CleanupSingleFieldPanel.java
|
Code Review by Qodo
1. Save actions may still not apply
|
| saveOrderConfigPanel.sortableFieldsProperty().bind(viewModel.sortableFieldsProperty()); | ||
| saveOrderConfigPanel.sortCriteriaProperty().bindBidirectional(viewModel.sortCriteriaProperty()); | ||
|
|
||
| fieldFormatterCleanupsPanel.cleanupsDisableProperty().bindBidirectional(viewModel.cleanupsDisableProperty()); |
There was a problem hiding this comment.
1. Save actions may still not apply 🐞 Bug ✓ Correctness
Even with the new enable/disable UI binding, save actions are applied only when MetaData.getSaveActions() is present; clearing/omitting save actions metadata results in no save actions being run during save, which can still look like “save actions not working” if the UI shows a default configuration.
Agent Prompt
### Issue description
Save actions are only executed during save when `MetaData.getSaveActions()` is present. If the library properties UI can represent “default” save actions without writing them into metadata (or clears them), users will still observe save actions not being applied.
### Issue Context
`SavingPropertiesView` now binds `cleanupsDisableProperty` to the panel, but `BibDatabaseWriter` executes save actions only if `MetaData.getSaveActions()` is present.
### Fix Focus Areas
- jabgui/src/main/java/org/jabref/gui/libraryproperties/saving/SavingPropertiesView.java[38-52]
- jablib/src/main/java/org/jabref/logic/exporter/BibDatabaseWriter.java[104-113]
- jablib/src/main/java/org/jabref/model/metadata/MetaData.java[167-173]
### Notes
Prefer fixing persistence: store save actions metadata whenever the UI indicates save actions should be active (enabled and/or non-empty list), so the save pipeline reliably applies them.
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
| cleanupsEnabled.set(true); | ||
| cleanups.setAll(initialCleanups.getConfiguredActions()); |
There was a problem hiding this comment.
2. Cleanup forces enabled true 🐞 Bug ✓ Correctness
The cleanup dialog’s formatter tab now hard-codes cleanupsEnabled=true, ignoring the user’s persisted cleanup preference (default is disabled). Because the dialog persists updated formatter cleanups back to preferences, running cleanup can unexpectedly flip the global cleanup setting to enabled.
Agent Prompt
### Issue description
The cleanup dialog formatter tab forces `enabled=true` and then persists that selection back to global cleanup preferences. This can unexpectedly override a user’s preference.
### Issue Context
Defaults set `CLEANUP_FIELD_FORMATTERS_ENABLED` to false. The dialog writes formatter settings back to preferences when applying a formatter tab selection.
### Fix Focus Areas
- jabgui/src/main/java/org/jabref/gui/cleanup/CleanupSingleFieldViewModel.java[12-23]
- jabgui/src/main/java/org/jabref/gui/cleanup/CleanupDialogViewModel.java[119-131]
- jablib/src/main/java/org/jabref/logic/preferences/JabRefCliPreferences.java[660-664]
### Suggested directions
- Either restore `cleanupsEnabled.set(initialCleanups.isEnabled())` and expose a user-controlled toggle, or
- Keep formatters always enabled for the one-off cleanup run, but do **not** persist the forced enabled flag back into preferences.
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
✅ All tests passed ✅🏷️ Commit: dd680d8 Learn more about TestLens at testlens.app. |
Related issues and pull requests
Closes #15096
Closes #15112
PR Description
Make cleanup and save actions working again
Revert issues arising from the change in #14568
Steps to test
LIbrary save actions also works
Checklist
CHANGELOG.mdin a way that can be understood by the average user (if change is visible to the user)