Skip to content

šŸ› use SUR date instead of the infostore one to have an update LastMod…#6121

Open
DarkIsDude wants to merge 1 commit intodevelopment/9.1from
bugfix/CLDSRV-878/use-sur-date
Open

šŸ› use SUR date instead of the infostore one to have an update LastMod…#6121
DarkIsDude wants to merge 1 commit intodevelopment/9.1from
bugfix/CLDSRV-878/use-sur-date

Conversation

@DarkIsDude
Copy link
Copy Markdown
Contributor

@DarkIsDude DarkIsDude commented Mar 27, 2026

Issue: CLDSRV-878

Pull request template

Description

https://scality.atlassian.net/browse/CLDSRV-631 this PR introduce a regression. The associated cronjob was removed https://github.com/scality/zenko-operator/pull/540/changes#diff-c76a6b4555478f74e4c871dbf370d4e6e5ae54c4b8590b0581b1cc0894e83ae5R55 but the date used is still the one associated with it. The goal of this PR is to use the date from SUR.

curl -v --insecure https://10.160.99.90:8443/zenko/s3/test2/.system-d26a9498-cb7c-4a87-a44a-8ae204f5ba6c/capacity.xml?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=FRFIWTEZRPYUSHVY6WEP%2F20260327%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20260327T155955Z&X-Amz-Expires=900&X-Amz-Security-Token=eyJzYWx0IjoiQ0Z2bzd2Y29BY1ZZRHBZTXJ4Y0dpM2ExZ1NYcVBGaGpWdis5QThhU0NSMD0iLCJ0YWciOiJXaHNFWDUyMWlQWEFkWnV1WnRCOXNnPT0iLCJjaXBoZXJ0ZXh0IjoienBFRmpzeHMvYmRORzZZbU5mWFpJbGlHS01yWFliR3RaZW9NcUx0N3JXVjVJR1JnR0F1RExlZVdGSkUwdHVBNjBPbWpqeUhINkszWkp1Q1hkVWt5VGhrcUVsWStYTUpCdE5haWRjOHZBek9uUjJnc2p1L1pKRUdVUnZnMmVHMjRXS2JPZUQra1h0Q25nQWpFTjFWTWRsd25OcTBUMmw4WWNMaVBrY2owa1BaWnB2M2I0MEZCaVFsbFowOThnN2JSanhTZ2daVEtQNnNpY1hrYU0rK2tZbjMrMHhl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nR0hzalFsa29MUjFsWTJGQ2t1bHF3NTlCUjJkVzJaRmptdFQ3aTJkWnk5T2pWZFRDUFc2QXM5N1Q4T3d5SXlKUytVZ3Q2YzA2a1JVZ2dNVHhETFBpQ2FUbDFJbS9rZ3YxTmZzVWg0aFhabFBvdnkrYlJHTWFrRW5sMXdQYXVzSzlIZHMxR3FvcGVkSjlNK0svSXhqeHpkS3B4YU1ZZUcwSDBVbGVnSkRQSjl0TmRhVE15MXZqZ0F4VzlXWm9qSkpMSXNXWHhDQzlIai95MGoySFN5WGFLWGdqYnZtMlFOcWFLckFHN1lXRUVSQkdQeG1HWktwRHlhcmFLdGVaQzVNWXU4ckNVdVdTc1U3ekQrMFlHMU9CVWlMTTJyUXdWQmdSWFZ2QlRRUlVUZTJPbFplUVNZY1dZNUg2aWNON1dYZ3pEdndOUm5SeWIvVzM5R2hUMGFCL0diYTlYRVI0K0NLT1A5UXgifQ%3D%3D&X-Amz-Signature=4ca11d205c394debb177a26b8e292493a1478a91364ffd96b306628db0e0ddc2&X-Amz-SignedHeaders=host

With the fix < last-modified: Fri, 27 Mar 2026 16:04:16 GMT
Without the fix < last-modified: Wed, 25 Mar 2026 14:12:11 GMT

@DarkIsDude DarkIsDude self-assigned this Mar 27, 2026
@bert-e
Copy link
Copy Markdown
Contributor

bert-e commented Mar 27, 2026

Hello darkisdude,

My role is to assist you with the merge of this
pull request. Please type @bert-e help to get information
on this process, or consult the user documentation.

Available options
name description privileged authored
/after_pull_request Wait for the given pull request id to be merged before continuing with the current one.
/bypass_author_approval Bypass the pull request author's approval ⭐
/bypass_build_status Bypass the build and test status ⭐
/bypass_commit_size Bypass the check on the size of the changeset TBA ⭐
/bypass_incompatible_branch Bypass the check on the source branch prefix ⭐
/bypass_jira_check Bypass the Jira issue check ⭐
/bypass_peer_approval Bypass the pull request peers' approval ⭐
/bypass_leader_approval Bypass the pull request leaders' approval ⭐
/approve Instruct Bert-E that the author has approved the pull request. āœļø
/create_pull_requests Allow the creation of integration pull requests.
/create_integration_branches Allow the creation of integration branches.
/no_octopus Prevent Wall-E from doing any octopus merge and use multiple consecutive merge instead
/unanimity Change review acceptance criteria from one reviewer at least to all reviewers
/wait Instruct Bert-E not to run until further notice.
Available commands
name description privileged
/help Print Bert-E's manual in the pull request.
/status Print Bert-E's current status in the pull request TBA
/clear Remove all comments from Bert-E from the history TBA
/retry Re-start a fresh build TBA
/build Re-start a fresh build TBA
/force_reset Delete integration branches & pull requests, and restart merge process from the beginning.
/reset Try to remove integration branches unless there are commits on them which do not appear on the source branch.

Status report is not available.

@bert-e
Copy link
Copy Markdown
Contributor

bert-e commented Mar 27, 2026

Incorrect fix version

The Fix Version/s in issue CLDSRV-878 contains:

  • 9.1.14

  • 9.2.32

  • 9.3.6

  • 9.4.0

Considering where you are trying to merge, I ignored possible hotfix versions and I expected to find:

  • 9.1.14

  • 9.2.33

  • 9.3.6

  • 9.4.0

Please check the Fix Version/s of CLDSRV-878, or the target
branch of this pull request.

// Extract the last modified date, but do not include it when computing
// the file's ETag (md5)
const modified = fileToBuild.value.LastModified;
const modified = bucketMetrics?.date || fileToBuild.value.LastModified;
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Should we remove fileToBuild.value.LastModified. IMO yes ?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

we would still need a "default" value though, we cannot pass "undefined" as the date?

Copy link
Copy Markdown
Contributor Author

@DarkIsDude DarkIsDude Mar 27, 2026

Choose a reason for hiding this comment

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

We don't call the SUR backend on this route. So we can't use the new date. It's not an issue as Veeam is not doing head but can lead to weird behaviour. We have the same "issue" in the list.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Please be advised that the UI is using the List/Head...

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

  • HEAD: Clear-cut: add the UtilizationService call for capacity.xml, same pattern as GET. HEAD is contractually required to return the same headers as GET — inconsistent Last-Modified between GET and HEAD would be a spec violation.

  • LIST: This is the tricky one. Without calling UtilizationService, there are really only two options:

  1. Keep the metadata date — Stale, and actively harmful: if the LIST LastModified for capacity.xml doesn't change, Veeam may cache the entry and skip re-fetching via GET, which defeats the entire purpose of using the metrics date.
  2. Use new Date().toISOString() in LIST for capacity.xml — Always returns current time. This signals to Veeam: "this file is always potentially fresh, always re-fetch via GET/HEAD." Since GET/HEAD now return the accurate bucketMetrics.date, Veeam gets the right value on the actual fetch. Capacity metrics do change constantly, so this is semantically honest.

Option 2 is the pragmatic fix: no extra service call, no stale caching problem, and the accurate date is still served on GET/HEAD.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nothing currently implemented: this is the same code as before, right?

Fetching metrics in HEAD and returning current date in LIST seem ok to me, though Veeam may still do weird things: e.g. it may not like that LIST returns a date which is newer than the GET/HEAD call it makes next... Could we make a call to utilization api for LIST as well?

@codecov
Copy link
Copy Markdown

codecov bot commented Mar 27, 2026

Codecov Report

āœ… All modified and coverable lines are covered by tests.
āœ… Project coverage is 83.84%. Comparing base (4aac273) to head (d9a5aed).
āœ… All tests successful. No failed tests found.

Additional details and impacted files

Impacted file tree graph

Files with missing lines Coverage Ī”
lib/routes/veeam/get.js 97.29% <100.00%> (Ćø)
lib/routes/veeam/head.js 89.47% <100.00%> (-0.53%) ā¬‡ļø
lib/routes/veeam/utils.js 90.00% <100.00%> (Ćø)

... and 4 files with indirect coverage changes

@@                 Coverage Diff                 @@
##           development/9.1    #6121      +/-   ##
===================================================
+ Coverage            83.79%   83.84%   +0.04%     
===================================================
  Files                  191      191              
  Lines                12350    12349       -1     
===================================================
+ Hits                 10349    10354       +5     
+ Misses                2001     1995       -6     
Flag Coverage Ī”
file-ft-tests 66.94% <0.00%> (+0.06%) ā¬†ļø
kmip-ft-tests 27.03% <0.00%> (+<0.01%) ā¬†ļø
mongo-v0-ft-tests 68.20% <0.00%> (+<0.01%) ā¬†ļø
mongo-v1-ft-tests 68.19% <0.00%> (+<0.01%) ā¬†ļø
multiple-backend 34.27% <0.00%> (+<0.01%) ā¬†ļø
sur-tests 35.41% <100.00%> (-0.01%) ā¬‡ļø
sur-tests-inflights 36.51% <100.00%> (-0.01%) ā¬‡ļø
unit 69.66% <100.00%> (-0.01%) ā¬‡ļø
utapi-v2-tests 33.40% <0.00%> (+<0.01%) ā¬†ļø

Flags with carried forward coverage won't be shown. Click here to find out more.

šŸš€ New features to boost your workflow:
  • šŸ“¦ JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@DarkIsDude DarkIsDude force-pushed the bugfix/CLDSRV-878/use-sur-date branch from bb7499d to beee7a8 Compare March 27, 2026 14:03
@DarkIsDude DarkIsDude force-pushed the bugfix/CLDSRV-878/use-sur-date branch from beee7a8 to d9a5aed Compare March 27, 2026 14:10
@DarkIsDude DarkIsDude requested review from a team, delthas and francoisferrand March 27, 2026 14:47
@DarkIsDude DarkIsDude marked this pull request as ready for review March 27, 2026 14:47
return UtilizationService.getUtilizationMetrics('bucket', bucketKey, null, {}, (err, bucketMetrics) => {
if (err) {
// Handle errors from UtilizationService/scubaclient
// axios errors have status in err.response.status
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think this comment was actually useful : we never have err.response.status in our code base, kind of weird to see it checked in addition to the more usual (in our code!) err.statusCode and err.code

const date = moment();
const expectedRetainUntilDate
= date.add(mockConfigWithYears.years * 365, 'days');
= date.add(mockConfigWithYears.years * 365 * 86400000, 'ms');
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

why this change? 'days' is more readable than 864000000ms...

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.

3 participants