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:
@@ -15,6 +15,20 @@ const List<String> systemArtifactNames = <String>[
|
||||
'session.html',
|
||||
];
|
||||
|
||||
/// The server's `group` value for a runner-internal debugging file.
|
||||
const String debugArtifactGroup = 'debug';
|
||||
|
||||
/// The server's `group` value for a file the stage published.
|
||||
const String deliverableArtifactGroup = 'deliverable';
|
||||
|
||||
/// Whether [name] is a runner-internal debugging file by name alone. This is
|
||||
/// the fallback for a server that records no `group`: the turn documents, the
|
||||
/// full `history.md`, and the visit's `private/` scratch.
|
||||
bool isDebugArtifactName(String name) =>
|
||||
isSystemArtifactName(name) ||
|
||||
name == 'history.md' ||
|
||||
name.startsWith('private/');
|
||||
|
||||
/// One recorded artifact of a stage visit.
|
||||
///
|
||||
/// The server is the authority: [name], [url], [contentType] and [sizeBytes]
|
||||
@@ -63,6 +77,15 @@ class ArtifactRecord {
|
||||
bool get isSystem => isSystemArtifactName(name);
|
||||
bool get isPublicName => name.startsWith('public/');
|
||||
|
||||
/// Whether this is a runner-internal debugging file rather than a stage
|
||||
/// deliverable. The server's recorded `group` decides; an older server that
|
||||
/// records none falls back to [isDebugArtifactName].
|
||||
bool get isDebug {
|
||||
final group = raw['group'];
|
||||
if (group is String && group.isNotEmpty) return group == debugArtifactGroup;
|
||||
return isDebugArtifactName(name);
|
||||
}
|
||||
|
||||
static String _text(dynamic value) => value == null ? '' : '$value';
|
||||
|
||||
static int _intOf(dynamic value) {
|
||||
|
||||
@@ -36,7 +36,7 @@ List<ArtifactRecord> presentedArtifacts(Iterable<ArtifactRecord> artifacts) {
|
||||
];
|
||||
}
|
||||
|
||||
/// A visit's stage-produced artifacts: everything except the turn-owned files
|
||||
/// A visit's deliverables: everything except runner-internal debugging files
|
||||
/// and repaired session exports. Order is preserved.
|
||||
List<ArtifactRecord> stageArtifactsFrom(
|
||||
Iterable<ArtifactRecord> artifacts, {
|
||||
@@ -44,18 +44,19 @@ List<ArtifactRecord> stageArtifactsFrom(
|
||||
}) {
|
||||
return <ArtifactRecord>[
|
||||
for (final artifact in presentedArtifacts(artifacts))
|
||||
if (!artifact.isSystem && !repairs.contains(artifact.name)) artifact,
|
||||
if (!artifact.isDebug && !repairs.contains(artifact.name)) artifact,
|
||||
];
|
||||
}
|
||||
|
||||
/// A visit's system files and repaired exports, in recorded order.
|
||||
/// A visit's debugging files (turn documents, history.md, private/ scratch)
|
||||
/// and repaired exports, in recorded order.
|
||||
List<ArtifactRecord> systemArtifactsFrom(
|
||||
Iterable<ArtifactRecord> artifacts, {
|
||||
Set<String> repairs = const <String>{},
|
||||
}) {
|
||||
return <ArtifactRecord>[
|
||||
for (final artifact in presentedArtifacts(artifacts))
|
||||
if (artifact.isSystem || repairs.contains(artifact.name)) artifact,
|
||||
if (artifact.isDebug || repairs.contains(artifact.name)) artifact,
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
@@ -8,6 +8,10 @@ import '../domain/artifact_groups.dart';
|
||||
import 'artifact_record_row.dart';
|
||||
import 'artifact_row_labels.dart';
|
||||
|
||||
/// The gallery's label for a visit's runner-internal files (turn documents,
|
||||
/// history.md, private/ scratch, session exports), shown only while Debug is on.
|
||||
const String debuggingFilesTitle = 'Debugging files';
|
||||
|
||||
/// One visit's turn documents, shown below its stage artifacts.
|
||||
///
|
||||
/// A recorded document is a normal gallery row with its recorded name, MIME and
|
||||
@@ -21,8 +25,13 @@ class ArtifactDocumentSection extends StatelessWidget {
|
||||
this.selectedIdentity,
|
||||
this.onSelected,
|
||||
this.showHeader = true,
|
||||
this.title = 'Turn documents',
|
||||
});
|
||||
|
||||
/// The section label: the Session page names the turn documents; the gallery
|
||||
/// names every runner-internal file it lists as debugging files.
|
||||
final String title;
|
||||
|
||||
/// False when a collapsible title above already names the section.
|
||||
final bool showHeader;
|
||||
|
||||
@@ -54,7 +63,7 @@ class ArtifactDocumentSection extends StatelessWidget {
|
||||
container: true,
|
||||
header: true,
|
||||
child: Text(
|
||||
'Turn documents',
|
||||
title,
|
||||
style: cupertino ? SectionHeadingStyle.of(context).title : null,
|
||||
),
|
||||
),
|
||||
|
||||
@@ -124,7 +124,7 @@ class _ArtifactGalleryPageState extends State<ArtifactGalleryPage> {
|
||||
for (final document in group.documents) {
|
||||
final record = document.record;
|
||||
if (record == null || record.url != url) continue;
|
||||
// A turn document is listed only while the debug toggle shows them.
|
||||
// A debugging file is listed only while the debug toggle shows them.
|
||||
_showTurnDocuments = true;
|
||||
_opening = (group: group, artifact: record);
|
||||
}
|
||||
@@ -556,7 +556,7 @@ class _ArtifactGalleryPageState extends State<ArtifactGalleryPage> {
|
||||
|
||||
Widget _debugToggle(BuildContext context) {
|
||||
final showing = _showTurnDocuments;
|
||||
final label = showing ? 'Hide turn documents' : 'Show turn documents';
|
||||
final label = showing ? 'Hide debugging files' : 'Show debugging files';
|
||||
// Cupertino's bundled icon font has no bug glyph; retain the universally
|
||||
// recognisable Material bug icon inside its native Cupertino button.
|
||||
final icon = showing ? Icons.bug_report : Icons.bug_report_outlined;
|
||||
|
||||
@@ -211,7 +211,7 @@ class _ArtifactVisitListState extends State<ArtifactVisitList> {
|
||||
group: group,
|
||||
selectedIdentity: widget.selectedIdentity,
|
||||
onSelected: widget.onSelected,
|
||||
showHeader: false,
|
||||
title: debuggingFilesTitle,
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user