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:
@@ -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);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -98,6 +98,122 @@ void main() {
|
||||
expect(find.text('reviewer · visit 1'), findsOneWidget);
|
||||
});
|
||||
|
||||
/// Shaped like the live Caplens ticket runs (133-139): every visit recorded
|
||||
/// only server-grouped debugging files (turn documents, history, private
|
||||
/// scratch) and no `public/` deliverable.
|
||||
JsonMap debugOnly(String name, {String url = ''}) => artifact(
|
||||
name,
|
||||
url: url.isEmpty ? null : url,
|
||||
contentType: 'text/markdown; charset=utf-8',
|
||||
sizeBytes: 3000,
|
||||
extra: const {'group': 'debug'},
|
||||
);
|
||||
|
||||
testWidgets('debugging files are never badged as artifacts', (tester) async {
|
||||
final gateway = _FakeGateway(
|
||||
_run(
|
||||
steps: [
|
||||
for (final (index, stage) in ['build', 'review', 'verify'].indexed)
|
||||
step(
|
||||
stage: stage,
|
||||
sequence: index + 1,
|
||||
artifacts: [
|
||||
for (final name in [
|
||||
'input.md',
|
||||
'memory.md',
|
||||
'history.md',
|
||||
'output.md',
|
||||
'session.html',
|
||||
'private/notes.md',
|
||||
])
|
||||
debugOnly(name, url: '/artifacts/21/${index + 1}/$name'),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
final controller = await _loaded(gateway);
|
||||
addTearDown(controller.dispose);
|
||||
await _pumpDetail(tester, controller, gateway);
|
||||
|
||||
final tab = find.byKey(const ValueKey('run-detail-tab-artifacts'));
|
||||
// The badge says 0: none of the 18 recorded files is a deliverable.
|
||||
expect(find.descendant(of: tab, matching: find.text('0')), findsOneWidget);
|
||||
expect(find.descendant(of: tab, matching: find.text('18')), findsNothing);
|
||||
// The tab still opens, to an honest summary and a collapsed debug entry.
|
||||
expect(tester.widget<FloatingTabButton>(tab).enabled, isTrue);
|
||||
await tester.ensureVisible(tab);
|
||||
await tester.pumpAndSettle();
|
||||
await tester.tap(tab);
|
||||
await tester.pumpAndSettle();
|
||||
expect(find.text('No artifacts recorded for this run.'), findsOneWidget);
|
||||
final reveal = find.byKey(const Key('artifact-debug-reveal'));
|
||||
expect(reveal, findsOneWidget);
|
||||
expect(find.textContaining('18 files'), findsOneWidget);
|
||||
expect(find.text('history.md'), findsNothing);
|
||||
|
||||
await tester.tap(reveal);
|
||||
await tester.pumpAndSettle();
|
||||
expect(find.text('build · visit 1'), findsOneWidget);
|
||||
expect(find.text('history.md'), findsWidgets);
|
||||
});
|
||||
|
||||
testWidgets('deliverables are badged and listed before debugging files', (
|
||||
tester,
|
||||
) async {
|
||||
// Shaped like the live Research run 132: public/ deliverables beside
|
||||
// stage-root copies and turn files the server groups as debug.
|
||||
JsonMap deliverable(String name, int sequence) => artifact(
|
||||
name,
|
||||
url: '/artifacts/21/$sequence/$name',
|
||||
contentType: 'text/markdown; charset=utf-8',
|
||||
extra: const {'group': 'deliverable'},
|
||||
);
|
||||
final gateway = _FakeGateway(
|
||||
_run(
|
||||
steps: [
|
||||
step(
|
||||
stage: 'ground',
|
||||
sequence: 1,
|
||||
artifacts: [
|
||||
debugOnly('input.md', url: '/artifacts/21/1/input.md'),
|
||||
debugOnly('output.md', url: '/artifacts/21/1/output.md'),
|
||||
debugOnly('ground.md', url: '/artifacts/21/1/ground.md'),
|
||||
deliverable('public/ground.md', 1),
|
||||
],
|
||||
),
|
||||
step(
|
||||
stage: 'research',
|
||||
sequence: 2,
|
||||
artifacts: [
|
||||
debugOnly('input.md', url: '/artifacts/21/2/input.md'),
|
||||
debugOnly('output.md', url: '/artifacts/21/2/output.md'),
|
||||
deliverable('public/ground.md', 2),
|
||||
deliverable('public/research.md', 2),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
final controller = await _loaded(gateway);
|
||||
addTearDown(controller.dispose);
|
||||
await _pumpDetail(tester, controller, gateway);
|
||||
|
||||
final tab = find.byKey(const ValueKey('run-detail-tab-artifacts'));
|
||||
// public/ground.md is shared, so it counts once: 2 deliverables.
|
||||
expect(find.descendant(of: tab, matching: find.text('2')), findsOneWidget);
|
||||
await tester.ensureVisible(tab);
|
||||
await tester.pumpAndSettle();
|
||||
await tester.tap(tab);
|
||||
await tester.pumpAndSettle();
|
||||
expect(find.text('Artifacts · 2 recorded'), findsOneWidget);
|
||||
expect(find.text('public/ground.md'), findsOneWidget);
|
||||
expect(find.text('public/research.md'), findsOneWidget);
|
||||
expect(find.text('ground.md'), findsNothing);
|
||||
expect(find.text('input.md'), findsNothing);
|
||||
expect(find.textContaining('5 files'), findsOneWidget);
|
||||
});
|
||||
|
||||
/// The Artifacts tab keeps its place on a run with none: disabled, badged
|
||||
/// `0`, and its tooltip (and accessibility hint) says why.
|
||||
Future<void> expectDisabledArtifacts(WidgetTester tester, String why) async {
|
||||
|
||||
Reference in New Issue
Block a user