[nodejs] fix remote config polling slowing down multiple tests#6808
[nodejs] fix remote config polling slowing down multiple tests#6808
Conversation
|
|
|
✨ Fix all issues with BitsAI or with Cursor
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ee07ec97c2
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| if context.library.name != "nodejs": | ||
| time.sleep(2) |
There was a problem hiding this comment.
Keep a post-ACK delay for Node remote-config updates
send_state now skips the post-acknowledgement wait entirely for Node.js, even though this function explicitly needs a grace period for subprocess propagation. In setups that call send_state(...) and immediately issue a request (for example AppSec RC setup flows), this can race: the ACK can be observed while some worker processes are still on the previous config, producing intermittent false negatives only on Node.js. A short Node-specific delay (e.g., one poll interval) is still needed to preserve determinism.
Useful? React with 👍 / 👎.
| self.di_initial_disabled = not self.wait_for_all_probes(statuses=["EMITTING"], timeout=TIMEOUT) | ||
|
|
||
| _send_config(enabled=True, reset=False) | ||
| _send_config(enabled=True, reset=False, wait_installed=context.library == "nodejs") |
There was a problem hiding this comment.
Avoid runtime library branching in shared test setup
This introduces Node-specific behavior directly in shared test logic (context.library == "nodejs") instead of splitting behavior via manifests/separate test methods. Per .cursor/rules/pr-review.mdc (rule 2), runtime library branching in tests should be avoided because it hides per-library behavior differences inside one test path and makes scenario coverage and future maintenance error-prone.
Useful? React with 👍 / 👎.
Motivation
That was slowing everything down.
Changes
Fix remote config polling slowing down multiple tests.
Explanation from Claude when I originally asked it to fix
APPSEC_RUNTIME_ACTIVATIONandAPPSEC_AUTO_EVENTS_RCbeing the slowest tests:Two changes made:
utils/_context/_scenarios/init.py — Added DD_REMOTE_CONFIG_POLL_INTERVAL_SECONDS: "0.5" to APPSEC_RUNTIME_ACTIVATION. Without this, each apply() call waited for the default ~5s poll cycle before the tracer acknowledged the config. The scenario had 58 total apply() calls across its test files (34 in test_remote_config_rule_changes.py alone), making this the dominant bottleneck.
utils/_remote_config.py:144 — Reduced time.sleep(2) to time.sleep(0.5). This sleep runs after every send_state() call to give subprocesses time to catch up. With a 0.5s poll interval, 0.5s (one poll cycle) is sufficient — any worker process that hadn't applied yet will poll within that window. The old 2s value was actually already too short for scenarios using the default 5s interval, but 4× too long for scenarios using 0.5s.
Estimated speedup:
APPSEC_RUNTIME_ACTIVATION: each apply goes from ~5s + 2s = ~7s → ~0.5s + 0.5s = ~1s — roughly 7× faster
APPSEC_AUTO_EVENTS_RC: each apply goes from ~0.5s + 2s = ~2.5s → ~0.5s + 0.5s = ~1s — roughly 2.5× faster
I then asked it to apply the same fix to everything else and applied further suggestions. I isolated the changes to Node because system tests seem extremely flaky for other languages, so I don't know how to differentiate flakiness from actual failures caused by a change.
Workflow
🚀 Once your PR is reviewed and the CI green, you can merge it!
🛟 #apm-shared-testing 🛟
Reviewer checklist
tests/ormanifests/is modified ? I have the approval from R&P teambuild-XXX-imagelabel is present