Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Disallow mapping updates for doc ingestion privileges #58784
Disallow mapping updates for doc ingestion privileges #58784
Changes from 33 commits
d62250d
547faa3
9dce3fc
00bbb0f
f4fb1c7
ac0966d
63e7ade
905e458
e2dc3f9
9a5ff34
ec96511
e155998
04f95a9
a99f9f0
0e7efed
4dfe44a
66e244d
2d34b46
44e0517
3c53f41
008ec5a
aa62846
c09a20b
3ec62d3
774a423
4c6383c
75bb67e
b114c13
4a2394c
e08624a
4071e95
e6bd53f
eb50c54
49b92c6
50f393b
f5a85d7
3d3f64d
44c3473
fd45d7b
3e4f130
148057c
9e12382
f3fec33
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this can be optimised as
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't like this minor optimisation because it makes it harder to reason about the meaning of the check.
There is some overlapping between the
actionCheck
and thebwcMappingActionCheck
flags (they can both be true) because it is easier to express them.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do agree this by itself makes the code harder to read. Since I made a few comments around this code block, I think what I am really suggesting is to re-arrange in a broader context, e.g.:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I understand now, but I don't see an improvement.
bwcGrantMappingUpdate
is updated totrue
in the if branch, but I slightly prefer it when its value is the expression of the if branch itself; I find it easier to follow like this.Also, you need a similar flag for the
if (group.checkAction(action))
if branch, because deprecation logs must only be present if the action is exclusively granted by the deprecation behaviour.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't quite follow.
Once the logic is inside the
else if
branch, we can already be sure the action is granted by bwc and can go ahead and prepare the deprecation logs within the branch (i.e.populateDeprecationLogs(...)
). With this approach, we can get rid of two variablesactionCheck
andbwcMappingActionCheck
. We still needgranted
andbwcGrantMappingUpdate
, but only one of them needs to be updated for each loop.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, you're right, I got lost.
I'm tempted to not change the code as you're suggesting, because the goal to get rid of
actionCheck
andbwcMappingActionCheck
is not worthwhile IMO. To me these look like different approaches with no substantial differences.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not a fan of this wording - I'll propose an alternative during my day.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder whether it would be better to display a single deprecation log per
indexOrAlias
, e.g.... is granted by [privA, privB] ...
.Also this
if
block can be placed inside the previousif (actionCheck || bwcMappingActionCheck)
so its own if check can become justif (false == actionCheck)
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I dunno. I've chosen the current variant because it is easier to code.
The
deprecationLogger.deprecate
method has built-in logic to deduplicate frequent log entries with the same key.If a log message contains a list of privileges, instead of a single one, the deduplication logic would have to be smarter to compare that "all (or some of) the privileges (given the index) on this deprecation log entry have appeared in (some) previous entries". It sounds too complicated to implement.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can make the move, I don't know of any heuristic that could help me choose between the two.