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

Fix the reported modification time of reports. #16

Merged
merged 3 commits into from
Jan 15, 2025

Conversation

plietar
Copy link
Member

@plietar plietar commented Jan 10, 2025

The /report/list endpoint uses the git_ls function to enumerate reports, and supposedly includes the modification time is the response.

Unfortunately the modification time returned by git_ls is pretty useless, and actually refers to the modification times in the local worktree, which has nothing to do with commit times.

The proper way to do this is to identify the last commit to have touched the file, and then get the time of that commit. Unfortunately gert does not have an easy way to list commits on just one file (and in fact neither does libgit2), so we fallback to using the git rev-list command.

Additionally I have re-written the code that was used to compare reports against the default branch to use Git plumbing commands instead of the high-level porcelain ones.

@plietar plietar force-pushed the mrc-6154-fix-modification-time branch 3 times, most recently from 068cbe1 to 35b9fdb Compare January 10, 2025 16:41
Copy link

codecov bot commented Jan 11, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.42%. Comparing base (b69faac) to head (8b8b699).
Report is 91 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #16      +/-   ##
==========================================
- Coverage   99.44%   98.42%   -1.02%     
==========================================
  Files           8        8              
  Lines         179      254      +75     
==========================================
+ Hits          178      250      +72     
- Misses          1        4       +3     

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

@plietar plietar marked this pull request as ready for review January 11, 2025 09:20
@plietar plietar requested a review from M-Kusumgar January 11, 2025 09:20
@plietar plietar force-pushed the mrc-6154-fix-modification-time branch from 8b8b699 to 327ca1c Compare January 13, 2025 15:57
The `/report/list` endpoint uses the `git_ls` function to enumerate
reports, and supposedly includes the modification time is the response.

Unfortunately the modification time returned by `git_ls` is pretty
useless, and actually refers to the modification times in the local
worktree, which has nothing to do with commit times.

The proper way to do this is to identify the last commit to have touched
the file, and then get the time of that commit. Unfortunately gert does
not have an easy way to list commits on just one file (and in fact
neither does libgit2), so we fallback to using the `git rev-list`
command.

Additionally I have re-written the code that was used to compare reports
against the default branch to use Git plumbing commands instead of the
high-level porcelain ones.
@plietar plietar force-pushed the mrc-6154-fix-modification-time branch 2 times, most recently from c5e5c06 to d6557fc Compare January 14, 2025 17:53
The `as.POSIXct.numeric` function was relaxed a bit in R 4.3.0 and made
its "origin" parameter optional, and we need that feature.

For some reason the dependency installation was failing. Using `pak`
seems to fix it. pak is generally a bit faster and more reliable anyway.
@plietar plietar force-pushed the mrc-6154-fix-modification-time branch from d6557fc to 6b3e83a Compare January 14, 2025 17:53
@plietar plietar force-pushed the mrc-6154-fix-modification-time branch from 499ef62 to 2d078a4 Compare January 14, 2025 18:13
Copy link
Contributor

@M-Kusumgar M-Kusumgar left a comment

Choose a reason for hiding this comment

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

Looks good to me! have put a comment about upgrading the R version, would be nice not to upgrade it if not necessary and then look at upgrading it later

@@ -1,27 +1,15 @@
FROM rocker/r-ver:4.1
FROM rocker/r-ver:4.4
Copy link
Contributor

Choose a reason for hiding this comment

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

maybe code has changed since but we intentionally pinned to 4.1 because of url params decoding issues in this PR #7 (comment), i dont remember the exact details but the url params parser changed to expect a different arg in base R with this change and that was breaking stuff when the image was built with 4.4. Just something to potentially be wary of if the docker image fails for a random reason

Copy link
Member Author

Choose a reason for hiding this comment

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

Interesting. Thanks for the context.

I did try to use this new image with Packit yesterday and it seemed to work fine. Will keep this in mind though.

@plietar plietar merged commit 6287f46 into main Jan 15, 2025
7 checks passed
@plietar plietar deleted the mrc-6154-fix-modification-time branch January 15, 2025 15:40
Sign up for free to 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