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:
@@ -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