Fix step execution range toggle persistence
This commit is contained in:
@@ -341,8 +341,8 @@
|
|||||||
},
|
},
|
||||||
autoRun: {
|
autoRun: {
|
||||||
stepExecutionRange: normalizeStepExecutionRangeEntry(
|
stepExecutionRange: normalizeStepExecutionRangeEntry(
|
||||||
nested?.flows?.openai?.autoRun?.stepExecutionRange
|
stepExecutionRangeByFlow.openai
|
||||||
?? stepExecutionRangeByFlow.openai
|
?? nested?.flows?.openai?.autoRun?.stepExecutionRange
|
||||||
?? {},
|
?? {},
|
||||||
defaults.flows.openai.autoRun.stepExecutionRange
|
defaults.flows.openai.autoRun.stepExecutionRange
|
||||||
),
|
),
|
||||||
@@ -370,8 +370,8 @@
|
|||||||
},
|
},
|
||||||
autoRun: {
|
autoRun: {
|
||||||
stepExecutionRange: normalizeStepExecutionRangeEntry(
|
stepExecutionRange: normalizeStepExecutionRangeEntry(
|
||||||
nested?.flows?.kiro?.autoRun?.stepExecutionRange
|
stepExecutionRangeByFlow.kiro
|
||||||
?? stepExecutionRangeByFlow.kiro
|
?? nested?.flows?.kiro?.autoRun?.stepExecutionRange
|
||||||
?? {},
|
?? {},
|
||||||
defaults.flows.kiro.autoRun.stepExecutionRange
|
defaults.flows.kiro.autoRun.stepExecutionRange
|
||||||
),
|
),
|
||||||
|
|||||||
+14
-1
@@ -2622,6 +2622,19 @@ function getStepExecutionRangeBoundaryNodeId(stepNumber, boundary = 'start') {
|
|||||||
return String(resolvedNodeId || fallbackNode?.nodeId || '').trim();
|
return String(resolvedNodeId || fallbackNode?.nodeId || '').trim();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getStepExecutionRangeStepOptionLabel(node = {}) {
|
||||||
|
const nodeId = String(node?.nodeId || '').trim();
|
||||||
|
const step = getStepIdByNodeIdForCurrentMode(nodeId);
|
||||||
|
const displayOrder = Number(node?.displayOrder);
|
||||||
|
if (Number.isInteger(step) && step > 0) {
|
||||||
|
return String(step);
|
||||||
|
}
|
||||||
|
if (Number.isInteger(displayOrder) && displayOrder > 0) {
|
||||||
|
return String(displayOrder);
|
||||||
|
}
|
||||||
|
return nodeId;
|
||||||
|
}
|
||||||
|
|
||||||
function syncStepExecutionRangeSelectOptions(selectedFromNodeId = '', selectedToNodeId = '') {
|
function syncStepExecutionRangeSelectOptions(selectedFromNodeId = '', selectedToNodeId = '') {
|
||||||
const nodes = getStepExecutionRangeNodes();
|
const nodes = getStepExecutionRangeNodes();
|
||||||
const fromSelect = inputStepExecutionRangeFrom;
|
const fromSelect = inputStepExecutionRangeFrom;
|
||||||
@@ -2632,7 +2645,7 @@ function syncStepExecutionRangeSelectOptions(selectedFromNodeId = '', selectedTo
|
|||||||
|
|
||||||
const buildOptions = (selectedValue) => nodes.map((node) => {
|
const buildOptions = (selectedValue) => nodes.map((node) => {
|
||||||
const nodeId = String(node?.nodeId || '').trim();
|
const nodeId = String(node?.nodeId || '').trim();
|
||||||
const label = getStepExecutionRangeNodeLabel(node);
|
const label = getStepExecutionRangeStepOptionLabel(node);
|
||||||
return `<option value="${escapeHtml(nodeId)}"${nodeId === selectedValue ? ' selected' : ''}>${escapeHtml(label)}</option>`;
|
return `<option value="${escapeHtml(nodeId)}"${nodeId === selectedValue ? ' selected' : ''}>${escapeHtml(label)}</option>`;
|
||||||
}).join('');
|
}).join('');
|
||||||
|
|
||||||
|
|||||||
@@ -87,6 +87,30 @@ test('settings schema normalizes view input into canonical nested namespaces', (
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('settings schema lets explicit flat step range override stale canonical range', () => {
|
||||||
|
const { settingsSchema } = loadApis();
|
||||||
|
const schema = settingsSchema.createSettingsSchema();
|
||||||
|
const oldState = schema.normalizeSettingsState({
|
||||||
|
activeFlowId: 'openai',
|
||||||
|
stepExecutionRangeByFlow: {
|
||||||
|
openai: { enabled: true, fromStep: 3, toStep: 6 },
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
const normalized = schema.normalizeSettingsState({
|
||||||
|
settingsState: oldState,
|
||||||
|
stepExecutionRangeByFlow: {
|
||||||
|
openai: { enabled: false, fromStep: 3, toStep: 6 },
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
assert.deepEqual(normalized.flows.openai.autoRun.stepExecutionRange, {
|
||||||
|
enabled: false,
|
||||||
|
fromStep: 3,
|
||||||
|
toStep: 6,
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
test('settings schema can project canonical state into a read view without legacy rebuild helpers', () => {
|
test('settings schema can project canonical state into a read view without legacy rebuild helpers', () => {
|
||||||
const { settingsSchema } = loadApis();
|
const { settingsSchema } = loadApis();
|
||||||
const schema = settingsSchema.createSettingsSchema();
|
const schema = settingsSchema.createSettingsSchema();
|
||||||
|
|||||||
Reference in New Issue
Block a user