Skip to content

feat(perf-detectors): Complete PERFORMANCE_DETECTOR_CONFIG_MAPPINGS#109624

Open
kcons wants to merge 4 commits intomasterfrom
kcons/completeit
Open

feat(perf-detectors): Complete PERFORMANCE_DETECTOR_CONFIG_MAPPINGS#109624
kcons wants to merge 4 commits intomasterfrom
kcons/completeit

Conversation

@kcons
Copy link
Member

@kcons kcons commented Feb 27, 2026

A partial mapping is fine, but a complete one forces us to acknowledge all of the corner cases, and allows us to ensure no new one sneak in.

Fixes ISWF-2155.

@kcons kcons requested a review from a team as a code owner February 27, 2026 23:31
@github-actions github-actions bot added the Scope: Backend Automatically applied to PRs that change backend components label Feb 27, 2026
Copy link
Contributor

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

@kcons kcons marked this pull request as draft February 27, 2026 23:34
@kcons kcons marked this pull request as ready for review February 28, 2026 00:00
@kcons kcons requested a review from a team February 28, 2026 00:00
@linear
Copy link

linear bot commented Feb 28, 2026

),
DetectorType.RENDER_BLOCKING_ASSET_SPAN: PerformanceDetectorConfigMapping(
settings_key=DetectorType.RENDER_BLOCKING_ASSET_SPAN,
wfe_detector_type="performance_render_blocking_asset_span",
Copy link
Member

Choose a reason for hiding this comment

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

Could we use the group type slug here to avoid hard coding, or is this the thing you were referring to earlier where you don't want to tie to the group type?

Copy link
Member Author

Choose a reason for hiding this comment

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

This is what I'm currently churning on.
I have some docs written up for Monday discussion, but the fun case here is QueryInjectionVulnerabilityGroupType, which is actually associated with two different Performance Detectors that look for separate things. The 1:1 mapping from Detector to GroupType isn't strictly necessary (it's mostly weird when we want to say which Detector created a group if multiple are involved), and logically it seems true that there can be multiple ways to generate a particular type of Group.

That said, these are strings also for mundane reasons: importing every involved GroupType makes me feel bad if I only really need them because I want to name the Detector that happens to be named after them.
I added a test to validate that all of these are registered group types to make that safer, but maybe I should give in and just use them by name. I don't think it'll actually be a problem.

Comment on lines 830 to 837
for field_name in mapping.option_keys:
assert field_name in detector_settings, (
f"option_keys field '{field_name}' for DetectorType.{detector_type.name} "
f"not found in get_detection_settings()[{detector_type}]"
)

# Every option key value must be a key in get_merged_settings
for field_name, option_key in mapping.option_keys.items():
Copy link
Member

Choose a reason for hiding this comment

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

Could you combine these 2 loops?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Scope: Backend Automatically applied to PRs that change backend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants