Artifacts: badge counts deliverables only; debugging files as a secondary section

The Artifacts badge counted every recorded turn document (input, memory,
output, session.html) while the tab lists only deliverables, so a run whose
visits recorded only debugging files (the Caplens ticket runs) badged dozens
of artifacts and opened to an empty tab. The badge and the header now count
deliverables only; the tab stays reachable when only debugging files exist
and ends with a collapsed 'Show debugging files' entry naming their count.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-12-03 17:23:33 +00:00
parent 1dc992bc27
commit 0791a4702d
10 changed files with 289 additions and 38 deletions
@@ -243,7 +243,7 @@ void main() {
expect(galleryGroups(steps), isEmpty);
});
test('the header counts recorded documents and stage artifacts', () {
test('the header counts deliverables, never debugging documents', () {
final steps = <Map<String, dynamic>>[
step(
stage: 'review',
@@ -256,10 +256,7 @@ void main() {
],
),
];
expect(
artifactsHeader(steps, executing: false),
'Artifacts · 3 recorded',
);
expect(artifactsHeader(steps, executing: false), 'Artifact · 1 recorded');
});
test(
@@ -64,10 +64,14 @@ void main() {
expect(find.text(name), findsNothing, reason: name);
}
expect(find.text('Debugging files'), findsNothing);
// The secondary entry after the deliverables names how many are hidden.
expect(find.text('Show debugging files'), findsOneWidget);
expect(find.textContaining('5 files'), findsOneWidget);
await tester.tap(find.byKey(const Key('artifact-debug-toggle')));
await tester.pumpAndSettle();
expect(find.text('Debugging files'), findsOneWidget);
expect(find.text('Hide debugging files'), findsOneWidget);
for (final name in [
'history.md',
'memory.md',
@@ -79,4 +83,41 @@ void main() {
}
expect(find.text('public/report.md'), findsOneWidget);
});
testWidgets('a run with only debugging files says so and reveals them', (
tester,
) async {
tester.view.physicalSize = const Size(900, 2600);
tester.view.devicePixelRatio = 1;
addTearDown(tester.view.resetPhysicalSize);
addTearDown(tester.view.resetDevicePixelRatio);
final steps = <JsonMap>[
step(
stage: 'build',
artifacts: [
for (final name in ['input.md', 'output.md', 'history.md'])
_file(name, 'debug'),
],
),
];
await tester.pumpWidget(
MaterialApp(
home: ArtifactGalleryPage(
steps: steps,
embedded: true,
openExternal: (_) async => true,
markdownBuilder: (context, value) => Text(value),
),
),
);
await tester.pumpAndSettle();
expect(find.text('No artifacts recorded for this run.'), findsOneWidget);
expect(find.text('output.md'), findsNothing);
await tester.tap(find.byKey(const Key('artifact-debug-reveal')));
await tester.pumpAndSettle();
for (final name in ['input.md', 'output.md', 'history.md']) {
expect(find.text(name), findsOneWidget, reason: name);
}
});
}