Artifacts: runner-internal turn files move to a Debugging files group

Each recorded artifact now carries a server group (deliverable or debug).
public/ files are deliverables; input/memory/history/output.md, session
exports and private/ scratch are debugging files. The app's Artifacts tab
lists deliverables and the Debug toggle reveals a separate Debugging files
group (older servers fall back to the filename rule); the TUI lists
deliverables first and marks debug rows; artifact search excludes debug
files unless include_debug / --debug-files is set.
This commit is contained in:
2026-11-04 17:43:47 +00:00
parent b5927505cc
commit 57f5219628
24 changed files with 541 additions and 30 deletions
@@ -0,0 +1,91 @@
import 'dart:typed_data';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:pipelines_app/core/api_gateway.dart';
import 'package:pipelines_app/features/artifacts/ui/artifact_gallery_page.dart';
import 'package:pipelines_app/features/artifacts/ui/artifact_viewer_fetch.dart';
import '../domain/artifact_fixtures.dart';
enum _Platform { material, cupertino }
JsonMap _file(String name, String group) => artifact(
name,
contentType: 'text/markdown',
sizeBytes: 10,
extra: <String, dynamic>{'group': group},
);
/// One turn visit as the current server records it: a public deliverable plus
/// runner-internal files, including history.md and a private capture.
List<JsonMap> _steps() => <JsonMap>[
step(
stage: 'build',
sequence: 1,
visit: 1,
artifacts: [
_file('input.md', 'debug'),
_file('memory.md', 'debug'),
_file('history.md', 'debug'),
_file('output.md', 'debug'),
_file('private/scratch.md', 'debug'),
_file('public/report.md', 'deliverable'),
],
),
];
Future<void> _pump(WidgetTester tester, _Platform platform) async {
tester.view.physicalSize = const Size(900, 2600);
tester.view.devicePixelRatio = 1;
addTearDown(tester.view.resetPhysicalSize);
addTearDown(tester.view.resetDevicePixelRatio);
final page = ArtifactGalleryPage(
steps: _steps(),
configuredEndpoint: 'ws://127.0.0.1:8081/connect',
openExternal: (_) async => true,
fetch: (_) async =>
ArtifactFetchResult(status: 200, bytes: Uint8List.fromList([35])),
markdownBuilder: (context, value) => Text(value),
);
await tester.pumpWidget(
platform == _Platform.material
? MaterialApp(home: page)
: CupertinoApp(home: page),
);
await tester.pumpAndSettle();
}
void main() {
for (final platform in _Platform.values) {
testWidgets('${platform.name}: only deliverables show until Debugging '
'files is revealed', (tester) async {
await _pump(tester, platform);
expect(find.text('public/report.md'), findsOneWidget);
for (final name in [
'history.md',
'memory.md',
'input.md',
'private/scratch.md',
]) {
expect(find.text(name), findsNothing, reason: name);
}
expect(find.text('Debugging files'), findsNothing);
await tester.tap(find.byKey(const Key('artifact-debug-toggle')));
await tester.pumpAndSettle();
expect(find.text('Debugging files'), findsOneWidget);
for (final name in [
'history.md',
'memory.md',
'input.md',
'output.md',
'private/scratch.md',
]) {
expect(find.text(name), findsOneWidget, reason: name);
}
expect(find.text('public/report.md'), findsOneWidget);
});
}
}
@@ -99,9 +99,9 @@ void main() {
await _pump(tester, platform);
expect(find.text('input.md'), findsNothing);
expect(find.textContaining('Turn documents'), findsNothing);
expect(find.byTooltip('Show turn documents'), findsOneWidget);
expect(find.byTooltip('Show debugging files'), findsOneWidget);
await _showTurnDocuments(tester);
expect(find.byTooltip('Hide turn documents'), findsOneWidget);
expect(find.byTooltip('Hide debugging files'), findsOneWidget);
expect(find.text('input.md'), findsNWidgets(2));
expect(find.text('output.md'), findsNWidgets(2));
expect(find.text('session.html'), findsNWidgets(2));