Switch MSC Code Utils to download csv file lazy when feature is enabled#15883
Switch MSC Code Utils to download csv file lazy when feature is enabled#15883Siedlerchr wants to merge 18 commits into
Conversation
Review Summary by QodoImplement lazy MSC code loading with runtime CSV download and MVStore storage
WalkthroughsDescription• Migrate MSC code loading from static JSON to lazy CSV download at runtime • Add preference toggle to enable/disable MSC keyword descriptions feature • Wrap CSV data in MVStore for efficient storage and retrieval • Refactor MSC code utilities to support multiple loading strategies Diagramflowchart LR
A["User enables MSC feature"] --> B["Download CSV from URL"]
B --> C["Convert to MVStore"]
C --> D["Store in user data directory"]
D --> E["Load on demand for keyword descriptions"]
E --> F["Display MSC descriptions in UI"]
File Changes1. jablib/src/main/java/org/jabref/logic/msc/MscCodeLoader.java
|
Code Review by Qodo
1. setEnableMscKeywordDescriptions boolean parameter
|
| boolean shouldEnableMscKeywordDescriptions(); | ||
|
|
||
| void setEnableMscKeywordDescriptions(boolean enabled); | ||
|
|
There was a problem hiding this comment.
1. setenablemsckeyworddescriptions boolean parameter 📘 Rule violation ⚙ Maintainability
A new public API setEnableMscKeywordDescriptions(boolean enabled) was introduced, which creates ambiguous call sites and violates the guideline to avoid boolean flags in public methods. This reduces readability and makes future API evolution harder.
Agent Prompt
## Issue description
A public method was added with a boolean parameter (`setEnableMscKeywordDescriptions(boolean enabled)`), which is discouraged because boolean flags make call sites unclear.
## Issue Context
This method is part of `CliPreferences` and is called from GUI/logic to toggle the MSC keyword description feature.
## Fix Focus Areas
- jablib/src/main/java/org/jabref/logic/preferences/CliPreferences.java[73-76]
- jablib/src/main/java/org/jabref/logic/preferences/JabRefCliPreferences.java[1851-1859]
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
koppor
left a comment
There was a problem hiding this comment.
small changes
The file ´CC-BY-SA-NC` cannot be downloaded too just automically.
The UI needs to have a warning and clearly link the license. We also need to cache the file.
A new dir needs to be added at org.jabref.logic.util.Directories - maybe "mvcodes"? There, the csv and the .mv can live in.
| String mscClassification = mscmap.get(tagLabel.getText()); | ||
| Tooltip tooltip = new Tooltip(mscClassification); | ||
| tagLabel.setTooltip(tooltip); | ||
| if (!preferences.shouldEnableMscKeywordDescriptions()) { |
There was a problem hiding this comment.
Can we just store these preferences locally? (I think we also do that elsewhere)
| dialogService.notify(Localization.lang("Downloading MSC codes...")); | ||
|
|
||
| BackgroundTask.wrap(() -> { | ||
| MscCodeLoader.downloadAndConvert(URLUtil.create(MscCodeLoader.MSC_CSV_URL), mscMvFile); |
| "Jabref123,Search theory,Hello Jabref,Direct methods ( G-spaces of Busemann etc.)", | ||
| "Jabref123,Search theory,Hello Jabref,Direct methods (\\\\(G\\\\)-spaces of Busemann\\, etc.)", |
There was a problem hiding this comment.
The test is about NON-MSC keywords preserved - why does JabRef change them?
There was a problem hiding this comment.
the non MSC keyword is JabRef 123. The others are valid msc codes and expected to be formatted. I renamed the test to make it clear.
"53C70" "Direct methods (\(G\)-spaces of Busemann, etc.)" "Direct methods (\(G\)-spaces of Busemann, etc.)"
| public static Path getMscDirectory() { | ||
| return Path.of( | ||
| AppDirsFactory.getInstance() | ||
| .getUserDataDir( |
* upstream/main: Fix formatter annotation script and dedupe CI formatting checks (#15895) Introduce workflow permissions (#15881) Chore(deps): Bump org.xmlunit:xmlunit-matchers in /versions (#15890) Fix formatter annotation script: apostrophes broke awk quoting Annotate only changed lines in CI formatting check (#15880) Chore(deps): Bump net.bytebuddy:byte-buddy in /versions (#15893) Chore(deps): Bump net.java.dev.jna:jna-jpms in /versions (#15888) Chore(deps): Bump com.github.javaparser:javaparser-core in /versions (#15892) Chore(deps): Bump tools.jackson:jackson-bom in /versions (#15891) Chore(deps): Bump io.zonky.test.postgres:embedded-postgres-binaries-bom (#15889) Chore(deps): Bump net.java.dev.jna:jna-platform in /versions (#15886) Chore(deps): Bump com.github.javaparser:javaparser-symbol-solver-core (#15887) Chore(deps): Bump com.autonomousapps:dependency-analysis-gradle-plugin (#15884)
Related issues and pull requests
Closes https://github.com/JabRef/jabref-issue-melting-pot/issues/1312
PR Description
TODO: Decide in which preferences we store this MSC Switch, maybe wait for the cleanup preferences migration
´´
Steps to test
AI usage
chat gpt codex 5.4 mini and gemini flash 3
Reviewd the code myself
Checklist
CHANGELOG.mdin a way that can be understood by the average user (if change is visible to the user)