Skip to content

Honor transitionOneDayEarlier in v1 lifecycle transitions - #2844

Open
maeldonn wants to merge 1 commit into
development/9.4from
bugfix/BB-867/one-day-earlier
Open

maeldonn wants to merge 1 commit into
development/9.4from
bugfix/BB-867/one-day-earlier

Conversation

@maeldonn

@maeldonn maeldonn commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

The v1 eligibility pre-filter and the noncurrent version transition apply compared raw rule days, ignoring transitionOneDayEarlier, so eligible objects were silently skipped while the current version apply stage honors the flag. Compute eligibility with LifecycleDateTime, as the apply stage does.

Issue: BB-867

@bert-e

bert-e commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

Hello maeldonn,

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
/bypass_source_branch_lineage Bypass the cross-branch contamination check
/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.
/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

bert-e commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

Incorrect fix version

The Fix Version/s in issue BB-867 contains:

  • None

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

  • 9.5.3

  • 9.6.0

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

(t.NoncurrentDays !== undefined && daysSinceInitiated >= t.NoncurrentDays));
return rule.NoncurrentVersionTransitions.some(t => {
const transitionTime = this._lifecycleDateTime
.getNCVTransitionTimestamp(t, entity.LastModified);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

entity.LastModified should be staleDate here. For noncurrent versions, NoncurrentDays counts from when the version became noncurrent (staleDate), not from its creation date (LastModified). The apply stage at line 1392 correctly passes staleDate to the same method. Using LastModified causes a mismatch between eligibility filtering and actual rule application when the two dates differ.

Suggested change
.getNCVTransitionTimestamp(t, entity.LastModified);
.getNCVTransitionTimestamp(t, staleDate);

},
];
nonCurrentVersion.LastModified = new Date(Date.now() - HOUR).toISOString();
nonCurrentVersion.staleDate = new Date(Date.now() - HOUR).toISOString();

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Setting both LastModified and staleDate to the same value masks the bug above — the test passes regardless of which date getNCVTransitionTimestamp receives. Use different values to actually verify the correct date is used, e.g. set LastModified far in the past and staleDate to one hour ago.

@maeldonn
maeldonn changed the base branch from development/9.5 to development/9.4 September 9, 2026 12:50
@bert-e

bert-e commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

Foreign commits detected in source branch

The source branch bugfix/BB-867/one-day-earlier shares history with the following
release line(s), which are not ancestors of development/9.4:

  • development/9.5

  • development/9.6

This typically happens when the feature branch was accidentally based on
commits from a higher release line rather than directly on development/9.4.
Common causes include:

  • Rebasing on a Bert-E integration branch (e.g. a w/ branch) instead of
    directly on development/9.4
  • Branching from a higher development branch instead of development/9.4
  • Merging a higher development branch into the feature branch

How to fix

Create a new branch directly from development/9.4 and cherry-pick your
changes onto it:

git checkout -b <new-branch-name> origin/development/9.4
git cherry-pick <your-commits>

Then open a new pull request from that branch.

If this is a false positive

If your branch is a legitimate backport and was previously merged into one
of the branches above before being extended with new commits, an
administrator can bypass this check with:

@bert-e bypass_source_branch_lineage

The v1 eligibility pre-filter and the noncurrent version transition
apply compared raw rule days, ignoring transitionOneDayEarlier, so
eligible objects were silently skipped while the current version
apply stage honors the flag. Compute eligibility with
LifecycleDateTime, as the apply stage does.

Issue: BB-867
@maeldonn
maeldonn force-pushed the bugfix/BB-867/one-day-earlier branch from fe41097 to d65472e Compare September 9, 2026 12:50
@bert-e

bert-e commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

Incorrect fix version

The Fix Version/s in issue BB-867 contains:

  • 9.5.3

  • 9.6.0

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

  • 9.4.4

  • 9.5.3

  • 9.6.0

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

@codecov

codecov Bot commented Sep 9, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 74.63%. Comparing base (1f35ed7) to head (d65472e).

Additional details and impacted files

Impacted file tree graph

Files with missing lines Coverage Δ
extensions/lifecycle/tasks/LifecycleTask.js 91.88% <100.00%> (+0.32%) ⬆️

... and 6 files with indirect coverage changes

Components Coverage Δ
Bucket Notification 80.27% <ø> (ø)
Core Library 80.78% <ø> (-0.69%) ⬇️
Ingestion 70.98% <ø> (+0.34%) ⬆️
Lifecycle 79.11% <100.00%> (+0.05%) ⬆️
Oplog Populator 85.83% <ø> (ø)
Replication 59.65% <ø> (-0.04%) ⬇️
Bucket Scanner 85.76% <ø> (ø)
@@                 Coverage Diff                 @@
##           development/9.4    #2844      +/-   ##
===================================================
- Coverage            74.88%   74.63%   -0.26%     
===================================================
  Files                  201      201              
  Lines                13761    13759       -2     
===================================================
- Hits                 10305    10269      -36     
- Misses                3446     3480      +34     
  Partials                10       10              
Flag Coverage Δ
api:retry 9.09% <0.00%> (+<0.01%) ⬆️
api:routes 8.91% <0.00%> (+<0.01%) ⬆️
bucket-scanner 85.76% <ø> (ø)
ft_test:queuepopulator 9.13% <0.00%> (-1.84%) ⬇️
ingestion 12.59% <0.00%> (+0.03%) ⬆️
lib 8.86% <0.00%> (+<0.01%) ⬆️
lifecycle 19.04% <66.66%> (+0.01%) ⬆️
notification 1.03% <0.00%> (+<0.01%) ⬆️
oplogPopulator 0.14% <0.00%> (+<0.01%) ⬆️
replication 18.60% <0.00%> (-0.04%) ⬇️
unit 51.68% <100.00%> (+0.06%) ⬆️

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@francoisferrand francoisferrand left a comment

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 wonder if we should really fix this:

  • transitionOneDayEarlier is not really needed, since we can configure the system to transition after 0 day (expireOneDayEarlier is more useful, since the minimum delay for expiration is 1 day)
  • both flags are kind of deprecated, timeProgressionFactor should be used instead
  • while sound in principle (e.g. use getTransitionTimestamp consistently to filter), I fear it may be complicated to insert cleanly in the code, without breaking abstractions levels...

* @return {boolean} true if rule applies - false otherwise.
*/
_isRuleApplying(rule, daysSinceInitiated, currentDate) {
_isRuleApplying(rule, daysSinceInitiated, currentDate, lastModified) {

@francoisferrand francoisferrand Sep 9, 2026

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.

it seems weird to add lastModified here: since daysSinceInitiated is already computed from lastModified...

looking at the code in LifecycleDateTime.findDaysSince(), it seems the issue is really that findDaysSince() uses expireOneDayEarlier systematically: so that flag affects both transition & expiration, instead of only expiration and the other flag affecting transitions...

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.

Looking at the code structure of isRuleApplying : Before the change, the code was similar for both expiration and transition. Now transition uses Arsenal helper while expiration manually checks the date.
It's a bit annoying to create another ticket in arsenal, but maybe we should have a getExpirationTimestamp helper in arsenal ? and this way, this fuction isRuleApplying will probably only need 2 parameters rule + lastModified I guess

@SylvainSenechal

Copy link
Copy Markdown
Contributor

I wonder if we should really fix this:

  • transitionOneDayEarlier is not really needed, since we can configure the system to transition after 0 day (expireOneDayEarlier is more useful, since the minimum delay for expiration is 1 day)
  • both flags are kind of deprecated, timeProgressionFactor should be used instead
  • while sound in principle (e.g. use getTransitionTimestamp consistently to filter), I fear it may be complicated to insert cleanly in the code, without breaking abstractions levels...

I just saw this comment : I wonder, are these only used for our own testing, or do we have clients using them ?
I know timeProgressionFactor is used in the zenko cucumber tests.

If we can confirm that these 2 expire/transitionOneDayEarlier are only used for easier testing and not by clients, then yeah imo we should leave or deprecate them more actively

@SylvainSenechal

SylvainSenechal commented Sep 14, 2026

Copy link
Copy Markdown
Contributor
  • transitionOneDayEarlier

in zenko operator, they are called "xxxforTesting" :

transitionsOneDayEarlier := cr.Spec.Backbeat.LifecycleBucketProcessor.TriggerTransitionsOneDayEarlierForTesting
expirationsOneDayEarlier := cr.Spec.Backbeat.TriggerExpirationsOneDayEarlierForTesting
timeProgressionFactor := cr.Annotations[timeProgressionFactorAnnotation]

Probably worth to take a look and see if we can just remove that code and just keep time progression factor 🤔

@SylvainSenechal SylvainSenechal left a comment

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.

discussion, see comments

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.

4 participants