Skip to content

Conversation

@shashank-elastic
Copy link
Contributor

Pull Request

Issue link(s): #5283

Summary - What I changed

How To Test

Unit Test on dev setup
detection-rules on  issue-5283 [$!?] is 📦 v1.5.12 via 🐍 v3.12.8 (.venv) on ☁️  shashank.suryanarayana@elastic.co pytest tests/test_all_rules.py::TestIntegrationRules::test_preserve_upstream_protected_rule_id_name
=================================================================================================== test session starts ====================================================================================================
platform darwin -- Python 3.12.8, pytest-8.4.1, pluggy-1.6.0
rootdir: /Users/shashankks/elastic_workspace/detection-rules
configfile: pyproject.toml
plugins: typeguard-4.4.4
collected 1 item                                                                                                                                                                                                           

tests/test_all_rules.py .                                                                                                                                                                                            [100%]

=============================================================================================== 1 passed in 69.33s (0:01:09) ===============================================================================================

detection-rules on  issue-5283 [$!?] is 📦 v1.5.12 via 🐍 v3.12.8 (.venv) on ☁️  shashank.suryanarayana@elastic.co took 1m12s 
Unit Test on DAC Setup
mkdir tmp-custom                                                                                   

detection-rules on  issue-5283 [$!?] is 📦 v1.5.12 via 🐍 v3.12.8 (.venv) on ☁️  shashank.suryanarayana@elastic.co python -m detection_rules custom-rules setup-config tmp-custom
Loaded config file: /Users/shashankks/elastic_workspace/detection-rules/.detection-rules-cfg.json

█▀▀▄ ▄▄▄ ▄▄▄ ▄▄▄ ▄▄▄ ▄▄▄ ▄▄▄ ▄▄▄ ▄   ▄      █▀▀▄ ▄  ▄ ▄   ▄▄▄ ▄▄▄
█  █ █▄▄  █  █▄▄ █    █   █  █ █ █▀▄ █      █▄▄▀ █  █ █   █▄▄ █▄▄
█▄▄▀ █▄▄  █  █▄▄ █▄▄  █  ▄█▄ █▄█ █ ▀▄█      █ ▀▄ █▄▄█ █▄▄ █▄▄ ▄▄█

Created directory: tmp-custom/actions
Created directory: tmp-custom/action_connectors
Created directory: tmp-custom/exceptions
Created directory: tmp-custom/rules
Created directory: tmp-custom/rules_building_block
Created directory: tmp-custom/etc
Created file with default content: tmp-custom/etc/deprecated_rules.json
Created file with default content: tmp-custom/etc/version.lock.json
Created file with default content: tmp-custom/etc/packages.yaml
Created file with default content: tmp-custom/etc/stack-schema-map.yaml
Created file with default content: tmp-custom/etc/test_config.yaml
Created file with default content: tmp-custom/_config.yaml

# For details on how to configure the _config.yaml file,
# consult: /Users/shashankks/elastic_workspace/detection-rules/detection_rules/etc/_config.yaml
# or the docs: /Users/shashankks/elastic_workspace/detection-rules/docs-dev/custom-rules-management.md

detection-rules on  issue-5283 [$!?] is 📦 v1.5.12 via 🐍 v3.12.8 (.venv) on ☁️  shashank.suryanarayana@elastic.co export CUSTOM_RULES_DIR=./tmp-custom/

detection-rules on  issue-5283 [$!?] is 📦 v1.5.12 via 🐍 v3.12.8 (.venv) on ☁️  shashank.suryanarayana@elastic.co pytest tests/test_all_rules.py::TestIntegrationRules::test_preserve_upstream_protected_rule_id_name
=================================================================================================== test session starts ====================================================================================================
platform darwin -- Python 3.12.8, pytest-8.4.1, pluggy-1.6.0
rootdir: /Users/shashankks/elastic_workspace/detection-rules
configfile: pyproject.toml
plugins: typeguard-4.4.4
collected 1 item                                                                                                                                                                                                           

tests/test_all_rules.py s                                                                                                                                                                                            [100%]

==================================================================================================== 1 skipped in 0.51s ================================

Checklist

  • Added a label for the type of pr: bug, enhancement, schema, maintenance, Rule: New, Rule: Deprecation, Rule: Tuning, Hunt: New, or Hunt: Tuning so guidelines can be generated
  • Added the meta:rapid-merge label if planning to merge within 24 hours
  • Secret and sensitive material has been managed correctly
  • Automated testing was updated or added to match the most common scenarios
  • Documentation and comments were added for features that require explanation

Contributor checklist

@github-actions
Copy link
Contributor

Bug - Guidelines

These guidelines serve as a reminder set of considerations when addressing a bug in the code.

Documentation and Context

  • Provide detailed documentation (description, screenshots, reproducing the bug, etc.) of the bug if not already documented in an issue.
  • Include additional context or details about the problem.
  • Ensure the fix includes necessary updates to the release documentation and versioning.

Code Standards and Practices

  • Code follows established design patterns within the repo and avoids duplication.
  • Ensure that the code is modular and reusable where applicable.

Testing

  • New unit tests have been added to cover the bug fix or edge cases.
  • Existing unit tests have been updated to reflect the changes.
  • Provide evidence of testing and detecting the bug fix (e.g., test logs, screenshots).
  • Validate that any rules affected by the bug are correctly updated.
  • Ensure that performance is not negatively impacted by the changes.
  • Verify that any release artifacts are properly generated and tested.
  • Conducted system testing, including fleet, import, and create APIs (e.g., run make test-cli, make test-remote-cli, make test-hunting-cli)

Additional Checks

  • Verify that the bug fix works across all relevant environments (e.g., different OS versions).
  • Confirm that the proper version label is applied to the PR patch, minor, major.

@eric-forte-elastic
Copy link
Contributor

Independent testing 🟢

Details

detection-rules on  issue-5283 is  v1.5.13 via  v3.12.12 (detection-rules-build) on  eric.forte
❯ env | grep CUSTOM_RULES_DIR

detection-rules on  issue-5283 is  v1.5.13 via  v3.12.12 (detection-rules-build) on  eric.forte
❯ pytest tests/test_all_rules.py::TestIntegrationRules::test_preserve_upstream_protected_rule_id_name
===================================================================================================================== test session starts =====================================================================================================================
platform linux -- Python 3.12.12, pytest-9.0.1, pluggy-1.6.0
rootdir: /tmp/detection-rules
configfile: pyproject.toml
plugins: typeguard-4.4.4
collected 1 item

tests/test_all_rules.py .                                                                                                                                                                                                                               [100%]

================================================================================================================ 1 passed in 116.21s (0:01:56) ================================================================================================================

detection-rules on  issue-5283 is  v1.5.13 via  v3.12.12 (detection-rules-build) on  eric.forte took 2s
❯ export CUSTOM_RULES_DIR=/home/forteea1/Code/dac_demo/dac_clean/detection-rules/dac_test


detection-rules on  issue-5283 is  v1.5.13 via  v3.12.12 (detection-rules-build) on  eric.forte
❯ env | grep CUSTOM_RULES_DIR
CUSTOM_RULES_DIR=/home/forteea1/Code/dac_demo/dac_clean/detection-rules/dac_test

detection-rules on  issue-5283 is  v1.5.13 via  v3.12.12 (detection-rules-build) on  eric.forte
❯ pytest tests/test_all_rules.py::TestIntegrationRules::test_preserve_upstream_protected_rule_id_name
===================================================================================================================== test session starts =====================================================================================================================
platform linux -- Python 3.12.12, pytest-9.0.1, pluggy-1.6.0
rootdir: /tmp/detection-rules
configfile: pyproject.toml
plugins: typeguard-4.4.4
collected 1 item

tests/test_all_rules.py s                                                                                                                                                                                                                               [100%]

===================================================================================================================== 1 skipped in 1.08s ======================================================================================================================


Copy link
Contributor

@eric-forte-elastic eric-forte-elastic left a comment

Choose a reason for hiding this comment

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

🟢 Peer review, looks good to me! 👍

@shashank-elastic shashank-elastic merged commit 5db396f into main Nov 17, 2025
22 of 23 checks passed
@shashank-elastic shashank-elastic deleted the issue-5283 branch November 17, 2025 16:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] test_preserve_upstream_protected_rule_id_name fails when CUSTOM_RULES_DIR is set

4 participants