Skip to content

Conversation

@SLin417
Copy link

@SLin417 SLin417 commented Oct 16, 2025

This PR enhances the citation key generation and reliability of the INSPIRE fetcher. For issue #12292

Key Improvements:

Smarter Citation Keys: The INSPIRE fetcher now automatically uses short, readable texkeys from the INSPIRE API as citation keys, instead of generating long, less-readable ones. This provides a much better user experience out-of-the-box.

More Reliable Fetching: The search logic is optimized to preferentially route arXiv identifiers through the INSPIRE fetcher. If it fails, it gracefully falls back to the arXiv fetcher, increasing success rates without breaking existing functionality.

Robust API Integration: The INSPIRE API connection has been strengthened with better error handling and retry logic, ensuring a more stable and dependable data retrieval process.

Configurable & Safe: Includes a user preference to toggle the new key generation behavior off if desired, and adds better logging for transparency. The changes are fully backward-compatible.

SLin417 and others added 19 commits October 8, 2025 07:53
- Prioritize 'texkeys' field as citation key if present, and clear it after use
- Add post-cleanup logic to detect and replace bad citation keys
- Implement texkeys-style citekey generation
Improve INSPIRE citekey handling and cleanup
- Implement retry mechanism with 3 attempts and exponential backoff
- Add timeout configuration (10s connect, 30s read)
- Add comprehensive logging (INFO/WARN/DEBUG levels)
- Add citation key validation to detect URL-like keys
- Improve error messages with actionable suggestions
- Add test guide for validation

Part of issue JabRef#12292 - Task 3.2: INSPIRE API optimization
Provides stable data source for other team members' tasks
- Integrated Sonia's 3.1 task (texkeys extraction and key cleanup)
- Kept retry mechanism and validation from 3.2 task
- Combined both features for complete INSPIRE fetcher improvement
- Removed test documentation file
- Import java.time.Duration for timeout settings
- Use Duration.ofMillis() for setConnectTimeout (URLDownload only supports connect timeout)
- Remove setReadTimeout (not supported by URLDownload class)
- Change catch block to ParseException | FetcherException (IOException not thrown)
- Code now compiles successfully
feat(3.2): Add retry mechanism and validation to INSPIRE fetcher
Pull from main to branch
Generate new citation key on upper stream
Overall this is a well-structured and consistent addition.  
The new 'Prefer INSPIRE texkeys' option is correctly integrated across the UI, ViewModel, and preferences layers, maintaining JabRef's clean MVVM architecture. The binding logic and persistence flow look solid.
Nice addition! The identifier detection and hint work well.
You could slightly improve by throttling detection during typing and maybe tweaking the label’s visibility or color for clarity. Clean and useful update overall.
Add long citation key detection with user guidance notification.
@github-actions
Copy link
Contributor

Hey @SLin417!

Thank you for contributing to JabRef! Your help is truly appreciated ❤️.

We have automatic checks in place, based on which you will soon get automated feedback if any of them are failing. We also use TragBot with custom rules that scans your changes and provides some preliminary comments, before a maintainer takes a look. TragBot is still learning, and may not always be accurate. In the "Files changed" tab, you can go through its comments and just click on "Resolve conversation" if you are sure that it is incorrect, or comment on the conversation if you are doubtful.

Please re-check our contribution guide in case of any other doubts related to our contribution workflow.

@jabref-machine
Copy link
Collaborator

You committed your code on the main brach of your fork. This is a bad practice. The right way is to branch out from main, work on your patch/feature in that new branch, and then get that branch merged via the pull request (see GitHub flow).

For this pull request, this is OK. For subsequent pull requests, please start with a different branch with a proper branch name. See CONTRIBUTING.md for more details.

@jabref-machine
Copy link
Collaborator

Your code currently does not meet JabRef's code guidelines. IntelliJ auto format covers some cases. There seem to be issues with your code style and autoformat configuration. Please reformat your code (Ctrl+Alt+L) and commit, then push.

In special cases, consider using // formatter:off and // formatter:on annotations to allow deviation from the code style.

@SLin417 SLin417 marked this pull request as ready for review October 26, 2025 06:44
@Siedlerchr
Copy link
Member

Please fix the failing tests. Otherwise we won't review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants