Skip to content

Conversation

@DarkIsDude
Copy link
Contributor

@DarkIsDude DarkIsDude commented Nov 10, 2025

@DarkIsDude DarkIsDude self-assigned this Nov 10, 2025
@bert-e
Copy link
Contributor

bert-e commented Nov 10, 2025

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.

@DarkIsDude DarkIsDude changed the title ✨(ARSN-538) Accept undefine prefix for ReplicationConfiguration ✨(ARSN-538) Accept undefined prefix for ReplicationConfiguration Nov 10, 2025
@bert-e
Copy link
Contributor

bert-e commented Nov 10, 2025

Incorrect fix version

The Fix Version/s in issue ARSN-538 contains:

  • None

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

  • 8.2.38

  • 8.3.0

  • 8.4.0

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

@codecov
Copy link

codecov bot commented Nov 10, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 71.40%. Comparing base (a000b51) to head (aec1b5a).
⚠️ Report is 1 commits behind head on development/8.2.

Additional details and impacted files
@@               Coverage Diff                @@
##           development/8.2    #2571   +/-   ##
================================================
  Coverage            71.40%   71.40%           
================================================
  Files                  221      221           
  Lines                17816    17817    +1     
  Branches              3705     3706    +1     
================================================
+ Hits                 12721    12723    +2     
+ Misses                5091     5090    -1     
  Partials                 4        4           

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

🚀 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.

expect(rules[0].prefix).toEqual('');
});

it('should succeed for a valid configuration without a prefix', () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Add William as a reviewer as it's touching the db, I'm not too sure I can review confidently.
Also, is it documented on aws that replication configurations may not have a prefix anymore ? Can it impact some logic elsewhere if prefix is sometimes removed ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't think so, with Typescript I hope we are safe in Arsenal 🙏

if (!prefix && prefix !== '') {
const prefix = rule.Prefix?.[0] ?? '';

if (typeof prefix !== 'string') {
Copy link
Contributor

Choose a reason for hiding this comment

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

when can this happen?
rule.Prefix is types as optional string[], then we it gets a default if null/undefined : so it may only be a string....

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Maybe the typing is not the right one, but prefix can be an array, an object. Indeed, at this step we just parsed the XML without any validation. That's why we have this check. Does it make sense ?

Copy link
Contributor

Choose a reason for hiding this comment

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

Indeed no need to check for the type here , can only be a string if it's not undefined/null

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@benzekrimaha are you double sure ? This is accepted with the current version:

<?xml version="1.0" encoding="UTF-8"?>
<ReplicationConfiguration
	xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
	<Role>arn:aws:iam::003641996138:role/scality-internal/storage-manager-role</Role>
	<Role>arn:aws:iam::003641996138:role/scality-internal/storage-manager-role</Role>
	<Rule>
		<ID>testfdg</ID>
		<Prefix>
			<Test>OUI</Test>
		</Prefix>
		<Filter>
			<Prefix>fd</Prefix>
		</Filter>
		<Status>Enabled</Status>
		<Destination>
			<Bucket>arn:aws:s3:::aa-bb-2</Bucket>
		</Destination>
	</Rule>
</ReplicationConfiguration>

When I guess it should not. That's why we have this check (you can check new tests).

Copy link
Contributor

Choose a reason for hiding this comment

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

Side question, with this request, would (and should) prefix be equal to String('OUI') ?

Also other side question, why is XMLRule.Prefix an array ? It doesn't make much sense, on top of that we see in the function that we are getting the first element only. What am I missing 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That good questions ! For the first one I tried with AWS and the request is rejected in that case, so I guess the answer is no, the request should be rejected (what I did). The second part it's how the xml parser works. In that case for example the Test will be an array of length 1 and a string OUI. Should I add one more check to make sure const prefix length is one and only one ?

Copy link
Contributor

Choose a reason for hiding this comment

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

Test is up to you, but no need if you wanna merge now.
Ah yeah the xml parser parse everything as an array

expect(typeof rules[0].id).toBe('string');
expect(rules[0].prefix).toEqual('');
});

Copy link
Contributor

Choose a reason for hiding this comment

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

Should have a test validating that we return malformed xml when the "prefix is invalid" (whatever it means) - or return that test if not relevant anymore (c.f. earlier comment).

the expression used to get prefix in _parsePrefix (and later malformed xml condition) is not trivial, would be better to make this plain with unit tests for _parsePrefix : which show exactly what "works" and what does not, and covers the 4 code-path (I think) in

const prefix = rule.Prefix?.[0] ?? '';
if (typeof prefix !== 'string') {

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Make sense 🙏. I added them

const base = {
id: '',
prefix: rule.Prefix[0],
prefix: rule.Prefix?.[0] ?? '',
Copy link
Contributor

Choose a reason for hiding this comment

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

this is duplicated with _parsePrefix, can we avoid this and do the "parsing" just once?

(though parsePrefix name is actually incorrect, it really just validates the prefix...)

Copy link
Contributor

Choose a reason for hiding this comment

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

The caller of _buildRuleObject is already doing all the parsing verifications. I think it would be complicated to use _parsePrefix in this function, as it would now have to return an error.

What I would do is rename the rule parameter like this :

Suggested change
prefix: rule.Prefix?.[0] ?? '',
_buildRuleObject(rule: XMLRule) {
_buildRuleObject(validRule: XMLRule) {

@bert-e
Copy link
Contributor

bert-e commented Nov 12, 2025

Request integration branches

Waiting for integration branch creation to be requested by the user.

To request integration branches, please comment on this pull request with the following command:

/create_integration_branches

Alternatively, the /approve and /create_pull_requests commands will automatically
create the integration branches.

Copy link
Contributor

@SylvainSenechal SylvainSenechal left a comment

Choose a reason for hiding this comment

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

approved but review the few comments from the others

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.

6 participants