8000 Revert "Append the tags" by gauravakto · Pull Request #2732 · akto-api-security/akto · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Revert "Append the tags" #2732

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

Merged

Conversation

gauravakto
Copy link
Contributor

Reverts #2731

@Copilot Copilot AI review requested due to automatic review settings June 30, 2025 07:44
Copy link
Contributor
@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR reverts the previous “Append the tags” behavior by introducing a new getPreservedTags method to merge existing and incoming tags and switching MongoDB tag updates from addEachToSet to a full set.

  • Replace getFilteredTags with getPreservedTags(apiCollection, tags) that preserves non-KUBERNETES tags and merges them with the new list.
  • Change MongoDB updates in DbLayer to use Updates.set instead of Updates.addEachToSet.
  • Update CollectionTags’s hashCode implementation and remove the custom equals override.

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
libs/utils/src/main/java/com/akto/data_actor/DbLayer.java Renamed and rewrote filtering logic, updated update calls.
libs/dao/src/main/java/com/akto/dto/traffic/CollectionTags.java Removed equals, adjusted hashCode, added unused imports.
Comments suppressed due to low confidence (1)

libs/utils/src/main/java/com/akto/data_actor/DbLayer.java:493

  • [nitpick] Using addAll can introduce duplicate tags since the MongoDB update now uses $set. If duplicates are undesirable, consider using a Set to dedupe or switch back to an additive operator like addEachToSet.
        preservedTags.addAll(tags);

@@ -39,17 +43,7 @@ public enum TagSource {

@Override
public int hashCode() {
Copy link
Preview
Copilot AI Jun 30, 2025

Choose a reason for hiding this comment

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

The custom equals override was removed but hashCode remains overridden, breaking the equals/hashCode contract. Reintroduce a matching equals method or remove the custom hashCode to maintain consistency.

Copilot uses AI. Check for mistakes.

@@ -8,7 +8,11 @@
import java.util.Objects;

import com.akto.dao.context.Context;
import com.fasterxml.jackson.core.JsonProcessingException;
Copy link
Preview
Copilot AI Jun 30, 2025

Choose a reason for hiding this comment

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

[nitpick] Several imports (JsonProcessingException, ObjectMapper, BasicDBObject) are not used. Consider removing them to keep the code clean.

Copilot uses AI. Check for mistakes.

@gauravakto gauravakto merged commit 943a19f into feature/cyborg-release Jun 30, 2025
3 checks passed
@gauravakto gauravakto deleted the revert-2731-fix/tags-fix-append-pnly branch June 30, 2025 08:15
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
0