fix: add validation to reject leading/trailing whitespace in target field#1575
fix: add validation to reject leading/trailing whitespace in target field#1575
Conversation
a8089ef to
03129dc
Compare
g3john
left a comment
There was a problem hiding this comment.
Awesome! What if we just trimmed the value for them, would that cause unexpected results?
I thought about removing the trailing whitespaces automatically on save, but in the end I decided to display a validation error message instead, because when you change job/target values (unique identifiers for a check) we lose continuity on metrics, so I didn't want that change to happen without customers noticing when they change a different check value. For this particular customer I did suggest them to remove the whitespace themselves to fix their issue. |
Script size changes
Totals
|
ckbedwell
left a comment
There was a problem hiding this comment.
I'm fine with this but this is a scenes bug as far as I'm concerned (all the more reason to drop it 😬)
You could end up in a situation where a user was managing a check via the UI and Terraform/API and you get two different validations.
It's pretty edge-casey but as this arose from an escalation originally it's not out of the realm of possibility.
|
Even if this is a scenes bug when forming the dashboard URL, I think trailing whitespaces shouldn’t be allowed in job/target fields as it causes confusing scenarios that are hard to spot. |
Summary
Problem
A customer reported that after duplicating a browser check, the dashboard showed no metrics even though the check was running successfully. Investigation revealed:
"FRANCE "instead of"FRANCE"instance="FRANCE "(with trailing space)var-instance=FRANCEsm_check_info{instance="$instance"}uses"FRANCE"(no space)The main Checks list page displayed data correctly because it queries metrics directly without the URL variable interpolation.
Solution
Add validation to show an error when the target field contains leading or trailing whitespace:
This approach:
jobSchemafor rejecting invalid characters