Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Harden JarCacheSupport #716

Merged
merged 1 commit into from
Jan 8, 2024
Merged

Harden JarCacheSupport #716

merged 1 commit into from
Jan 8, 2024

Conversation

basil
Copy link
Member

@basil basil commented Jan 8, 2024

An implicit invariant in JarCacheSupport is that DownloadRunnable is only ever processing the promise that is currently recorded in the inprogress map, an invariant which can be proved by reading the code and studying the cases that arise. This PR hardens the code by enforcing this invariant programmatically and throwing an IllegalStateException if the invariant is violated, which would only be the case if a future PR introduced a programming error.

Testing done

I ran a job on an inbound agent to check out a repository with JGit and verified that the new assertion was never thrown (as expected).

@basil basil added the internal label Jan 8, 2024
Copy link
Contributor

@MarkEWaite MarkEWaite left a comment

Choose a reason for hiding this comment

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

Thanks! Looks good to me.

@basil basil merged commit 399fb9b into jenkinsci:master Jan 8, 2024
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants