Skip to content

Commit 676d753

Browse files
author
ci bot
committed
Merge branch 'qa-fixes' into 'enterprise'
fix: misc qa fixes See merge request dkinternal/testgen/dataops-testgen!579
2 parents d6920ae + d83af2f commit 676d753

8 files changed

Lines changed: 37 additions & 16 deletions

File tree

testgen/common/monitor_forecast.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,11 +120,16 @@ def gated_forecast_prediction(
120120
# typed throughout (baseline is already a float).
121121
lower_tol = float(definition.lower_tolerance) if definition.lower_tolerance is not None else None
122122
upper_tol = float(definition.upper_tolerance) if definition.upper_tolerance is not None else None
123+
# The band carries the next-refresh tolerance across the whole forecast, flat anchor included.
124+
# Anchoring the band to the tolerance — rather than collapsing it to the baseline at the flat
125+
# anchor — keeps it a continuous width that connects to the historical band and avoids a
126+
# zero-width pinch (which renders as an hourglass for a future window, or a band detached from
127+
# history for an imminent one). The mean line still holds flat at baseline, then steps.
123128
return {
124129
"method": "predict",
125130
"mean": {flat_anchor: baseline, window_end: next_refresh_mean},
126-
"lower_tolerance": {flat_anchor: baseline, window_end: lower_tol},
127-
"upper_tolerance": {flat_anchor: baseline, window_end: upper_tol},
131+
"lower_tolerance": {flat_anchor: lower_tol, window_end: lower_tol},
132+
"upper_tolerance": {flat_anchor: upper_tol, window_end: upper_tol},
128133
}
129134

130135

testgen/template/dbsetup_test_types/test_types_Valid_Characters.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ test_types:
2121
default_parm_columns: threshold_value
2222
default_parm_values: |-
2323
0
24-
default_parm_prompts: null
24+
default_parm_prompts: |-
25+
Threshold Invalid Value Count
2526
default_parm_help: |-
2627
The acceptable number of records with invalid character values present.
2728
default_severity: Warning

testgen/template/dbsetup_test_types/test_types_Valid_US_Zip.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ test_types:
2121
default_parm_columns: threshold_value
2222
default_parm_values: |-
2323
0
24-
default_parm_prompts: null
24+
default_parm_prompts: |-
25+
Threshold Invalid Value Count
2526
default_parm_help: null
2627
default_severity: Warning
2728
run_type: CAT

testgen/template/dbsetup_test_types/test_types_Valid_US_Zip3.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ test_types:
2121
default_parm_columns: threshold_value
2222
default_parm_values: |-
2323
0
24-
default_parm_prompts: null
24+
default_parm_prompts: |-
25+
Threshold Invalid Value Count
2526
default_parm_help: null
2627
default_severity: Warning
2728
run_type: CAT

testgen/ui/components/frontend/js/data_profiling/metadata_tags.js

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ const MetadataTagsCard = (props, item) => {
100100
help: TAG_HELP[key],
101101
label: key === 'pii_flag' ? 'PII Data' : capitalize(key.replaceAll('_', ' ')),
102102
state: van.state(value),
103+
initialValue: value,
103104
inheritTableGroup: item[`table_group_${key}`] ?? null, // Table group values inherited by table or column
104105
inheritTable: item[`table_${key}`] ?? null, // Table values inherited by column
105106
};
@@ -198,13 +199,15 @@ const MetadataTagsCard = (props, item) => {
198199
content, editingContent,
199200
onSave: () => {
200201
const items = [{ type: item.type, id: item.id }];
201-
const tags = attributes.reduce((object, { key, state }) => {
202-
object[key] = state.rawVal;
202+
const tags = attributes.reduce((object, { key, state, initialValue }) => {
203+
if (state.rawVal !== initialValue) {
204+
object[key] = state.rawVal;
205+
}
203206
return object;
204207
}, {});
205208

206-
warnCde.val = props.autoflagSettings.profile_flag_cdes && tags.critical_data_element !== item.critical_data_element;
207-
warnPii.val = props.autoflagSettings.profile_flag_pii && tags.pii_flag !== item.pii_flag;
209+
warnCde.val = props.autoflagSettings.profile_flag_cdes && 'critical_data_element' in tags;
210+
warnPii.val = props.autoflagSettings.profile_flag_pii && 'pii_flag' in tags;
208211

209212
if (warnCde.val || warnPii.val) {
210213
const disableFlags = [];
@@ -221,8 +224,8 @@ const MetadataTagsCard = (props, item) => {
221224
}
222225
},
223226
// Reset states to original values on cancel
224-
onCancel: () => attributes.forEach(({ key, state }) => state.val = item[key]),
225-
hasChanges: () => attributes.some(({ key, state }) => state.val !== item[key]),
227+
onCancel: () => attributes.forEach(({ state, initialValue }) => state.val = initialValue),
228+
hasChanges: () => attributes.some(({ state, initialValue }) => state.val !== initialValue),
226229
}),
227230
WarningDialog(warningDialogOpen, pendingSaveAction, warnCde, warnPii),
228231
);

testgen/ui/components/frontend/js/pages/test_definitions.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import { ProfilingResultsDialog } from '../shared/profiling_results_dialog.js';
2121
import { AXES, FACET_AXES, GROUP_BY_AXES, EMPTY, appliesToSelectedColumn } from '/app/static/js/components/test_picker_taxonomy.js';
2222
import { enterPage, exitPage, getPageSignal } from '/app/static/js/page_lifecycle.js';
2323
import { jsonObject, maxLength } from '/app/static/js/form_validators.js';
24+
import { capitalize } from '/app/static/js/display_utils.js';
2425

2526
const { button: btn, div, i: icon, span, strong } = van.tags;
2627

@@ -820,6 +821,8 @@ const DetailPanel = (row) => {
820821
const paramCols = row.default_parm_columns
821822
? row.default_parm_columns.split(',').map(c => c.trim()).filter(Boolean)
822823
: [];
824+
const paramLabels = (row.default_parm_prompts || '').split(',').map(v => v.trim());
825+
const paramHelp = (row.default_parm_help || '').split('|').map(v => v.trim());
823826

824827
return div(
825828
{ class: 'flex-column fx-gap-3 border border-radius-1 p-4 mt-2' },
@@ -836,7 +839,11 @@ const DetailPanel = (row) => {
836839
Attribute({ label: 'Lock Refresh', value: row.lock_refresh_display }),
837840
Attribute({ label: 'Urgency', value: row.urgency }),
838841
Attribute({ label: 'Export to Observability', value: row.export_to_observability_display }),
839-
...paramCols.map(col => Attribute({ label: col, value: String(row[col] ?? '') })),
842+
...paramCols.map((col, index) => Attribute({
843+
label: paramLabels[index] || capitalize(col.replaceAll('_', ' ')),
844+
help: paramHelp[index] || null,
845+
value: String(row[col] ?? ''),
846+
})),
840847
),
841848
div(
842849
{ class: 'flex-column fx-flex fx-gap-3' },

testgen/ui/static/js/components/test_definition_form.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ import { Textarea } from './textarea.js';
7373
import { RadioGroup } from './radio_group.js';
7474
import { Caption } from './caption.js';
7575
import { numberBetween, required } from '../form_validators.js';
76+
import { capitalize } from '../display_utils.js';
7677

7778
const { div, span } = van.tags;
7879

@@ -108,7 +109,7 @@ const TestDefinitionForm = (/** @type Properties */ props) => {
108109
.map((column, index) => ({
109110
...(PARAMETER_CONFIG[column] || { type: 'text' }),
110111
column,
111-
label: paramLabels[index] || column.replaceAll('_', ' '),
112+
label: paramLabels[index] || capitalize(column.replaceAll('_', ' ')),
112113
help: paramHelp[index] || null,
113114
validators: paramRequired[index] ? [required] : undefined,
114115
}))

tests/unit/ui/test_monitors_dashboard.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -135,10 +135,12 @@ def test_gated_prediction_anchors_at_now_when_window_started():
135135
mean = {str(NOW_MS + 3 * HOUR): 1200.0, str(NOW_MS + 27 * HOUR): 1300.0}
136136
result = gated_forecast_prediction(_gated_def(mean=mean), window, LAST_RUN)
137137
assert result["method"] == "predict"
138+
# mean holds flat at baseline then steps to the next-refresh forecast
138139
assert result["mean"] == {NOW_MS: 1000.0, NOW_MS + 3 * HOUR: 1200.0}
139-
# tolerances coerced from VARCHAR to float
140-
assert result["lower_tolerance"] == {NOW_MS: 1000.0, NOW_MS + 3 * HOUR: 950.0}
141-
assert result["upper_tolerance"] == {NOW_MS: 1000.0, NOW_MS + 3 * HOUR: 1400.0}
140+
# band carries the next-refresh tolerance across the whole forecast (continuous width, no
141+
# zero-width pinch at the flat anchor); coerced from VARCHAR to float
142+
assert result["lower_tolerance"] == {NOW_MS: 950.0, NOW_MS + 3 * HOUR: 950.0}
143+
assert result["upper_tolerance"] == {NOW_MS: 1400.0, NOW_MS + 3 * HOUR: 1400.0}
142144

143145

144146
def test_gated_prediction_anchors_at_window_start_when_future():

0 commit comments

Comments
 (0)