Let primary summary reads precede optional validation

This commit is contained in:
2026-11-05 15:47:19 +00:00
parent 3a9ba55277
commit b8d3eaad35
3 changed files with 43 additions and 8 deletions
@@ -44,20 +44,24 @@ class _PipelineDefinitionValidationState
}
void _load({bool retry = false}) {
if (widget.source.trim().isEmpty) {
final source = widget.source;
final gateway = widget.gateway;
if (source.trim().isEmpty) {
_result = Future.value({'type': 'validated'});
return;
}
final cache = _checks[widget.gateway] ??= {};
if (retry) cache.remove(widget.source);
if (!cache.containsKey(widget.source) && cache.length >= 16) {
final cache = _checks[gateway] ??= {};
if (retry) cache.remove(source);
if (!cache.containsKey(source) && cache.length >= 16) {
cache.remove(cache.keys.first);
}
_result = cache.putIfAbsent(
widget.source,
() => Future.sync(
() => widget.gateway.call('validate', {'source': widget.source}),
),
source,
// Primary summary sections enqueue their reads while mounting. The
// transport serializes replies, so optional validation waits until those
// reads have been queued. A microtask adds no lingering timer on dispose.
() =>
Future.microtask(() => gateway.call('validate', {'source': source})),
);
}
+22
View File
@@ -34,3 +34,25 @@ The initial capture attempt used waitfor on a static heading; the kit does not
index that static label, although the saved PNG visibly showed the warning.
Final captures use screenshots and a real Copy Input interaction instead.
No physical device or Safari claim is made here. Nothing was deployed.
## Summary request ordering follow-up
The integrated application test exposed a real ordering dependency: the shared
PipelinesClient serializes each request until its reply. Definition validation
was enqueued immediately while its widget mounted, before the schedule section
had enqueued `list_schedules`, so a delayed or unanswered optional validation
held up primary Summary content.
Validation now starts in a microtask after synchronous Summary mounting. This
lets the schedule request enter the existing transport queue first, without
adding a timer or changing the client's serialization contract. The selected
source and gateway are captured before deferral, so a later selection cannot
change a queued request's source. The application fixture answers the new
validation request and asserts that schedules and launch controls are available
while validation is still unanswered. No selection, backend or transport code
was changed. Focused application/definition-warning tests and analysis are
recorded in the follow-up handoff; no full suite or deployment was run here.
Follow-up result: 149 application/definition-warning tests pass through the
memory watchdog (`/tmp/memwatch/out.35VDe8`, peak 2105 MB, 49 s). Focused analysis
is clean (`flutter-analyze.NVN15m`).
@@ -93,10 +93,19 @@ void main() {
await tester.tap(find.byKey(const Key('pipeline-row-1')));
await tester.pump();
await replyPipelineDetail(tester, channel, fixture);
// Optional validation must not get ahead of the Summary's primary read.
expect(requestsOf(channel, 'validate'), isEmpty);
await reply(tester, channel, 'list_schedules', 1, {
'type': 'schedules',
'schedules': <dynamic>[],
});
await waitForCount(tester, channel, 'validate', 1);
// Schedule content and launch controls remain available while the optional
// validation response is still outstanding.
expect(find.text('Loading schedules…'), findsNothing);
expect(find.byKey(runPipelineActionKey), findsOneWidget);
expect(find.text('Checking definition…'), findsOneWidget);
await reply(tester, channel, 'validate', 1, {'type': 'validated'});
await tester.tap(find.byKey(runPipelineActionKey));
await tester.pumpAndSettle();