Skip to content

Improved overflow support: Scaffolding - #18

Merged
sungshik merged 10 commits into
improved-overflow-support-mainfrom
improved-overflow-support/scaffolding
Feb 24, 2025
Merged

Improved overflow support: Scaffolding#18
sungshik merged 10 commits into
improved-overflow-support-mainfrom
improved-overflow-support/scaffolding

Conversation

@sungshik

@sungshiksungshik commented Feb 21, 2025

Copy link
Copy Markdown
Contributor

This PR makes a few changes to the existing code, originally made during the implementation of improved overflow support. I isolated them in this separate PR to make reviewing easier. (They would pollute the future improved-overflow-support PR.)

@codecov

codecovBot commented Feb 21, 2025

Copy link
Copy Markdown

Codecov Report

Attention: Patch coverage is 79.16667% with 5 lines in your changes missing coverage. Please review.

Project coverage is 80.2%. Comparing base (e23a194) to head (c365b4a).
Report is 11 commits behind head on improved-overflow-support-main.

Files with missing linesPatch %Lines
...c/main/java/engineering/swat/watch/WatchEvent.java0.0%2 Missing ⚠️
.../engineering/swat/watch/impl/jdk/JDKBaseWatch.java81.8%1 Missing and 1 partial ⚠️
.../engineering/swat/watch/impl/jdk/JDKFileWatch.java90.0%0 Missing and 1 partial ⚠️
Additional details and impacted files
@@ Coverage Diff @@## improved-overflow-support-main #18 +/- ##
==================================================================
+ Coverage 80.0% 80.2% +0.2% - Complexity 88 90 +2 
==================================================================
Files 11 11 Lines 415 416 +1 Branches 41 41 ==================================================================
+ Hits 332 334 +2 - Misses 57 59 +2 + Partials 26 23 -3 

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@sungshiksungshik left a comment

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

Clarifying comments

Comment thread.github/workflows/build.yaml
@sungshik
sungshik marked this pull request as ready for review February 21, 2025 15:50

@DavyLandmanDavyLandman left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Some minor things, but looks good

var kind = translate(jdkKind);
var rootPath = path;
var relativePath = kind == WatchEvent.Kind.OVERFLOW ? Path.of("") : (@Nullable Path)jdkEvent.context();
var relativePath = context == null ? Path.of("") : (Path)context;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

this is now moved from the constructor of WatchEvent to the consumer, is that a win?

nit: looks like we could context inside of this definition.

varrelativePath = jdkKind == StandardWatchEventKinds.OVERFLOW ? Path.of("") : (Path)jdkEvent.context();

?

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

is that a win?

Mja, maybe not. It seemed like a good idea at the time to get rid of the @Nullable and simplify the constructor a bit. But reading the consumer code now after the weekend, it's not so nice actually. I'm changing this back! (But keeping the 2-arg constructor in WatchEvent because I'll need it in the next PRs anyway.)

assert !parent.equals(file);

this.internal = new JDKDirectoryWatch(parent, exec, e -> {
if (fileName.equals(e.getRelativePath())) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

what if an overflow happens for the whole directory, we would still need to deal with that event and mark this file as overflow? or is that bugfix happening later?

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

Yes, I think this will/should be "magically" covered by one of the next PRs. But, we'll need a test to check this. I added a reminder for this to #12.

…WatchEvent` (because having it outside didn't lead to significantly simpler code overall)
@sungshik
sungshik merged commit 53f3038 into improved-overflow-support-mainFeb 24, 2025
@sungshik
sungshik deleted the improved-overflow-support/scaffolding branch February 24, 2025 08:48
@sungshiksungshik mentioned this pull request Feb 24, 2025
7 tasks
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@sungshik@DavyLandman