Merge: archive and unarchive pipelines

# Conflicts:
#	internal/cli/commands.go
#	internal/pipeline/store.go
This commit is contained in:
2026-11-04 23:39:02 +00:00
30 changed files with 1206 additions and 78 deletions
@@ -225,7 +225,19 @@ List<JsonMap> probeRuns() => [
..._fillerRuns(),
];
/// Pipelines this fixture session archived, with their archive time.
final _probeArchived = <int, String>{};
List<JsonMap> probePipelines() => [
for (final pipeline in _probePipelineRows())
{
...pipeline,
if (_probeArchived[pipeline['id']] != null)
'archived_at': _probeArchived[pipeline['id']],
},
];
List<JsonMap> _probePipelineRows() => [
{
'id': 24,
'name': 'Release train',
@@ -503,6 +515,29 @@ JsonMap? probeReply(JsonMap request) {
'type': 'pipeline',
'detail': probePipelineDetail(pipelineId, version is int ? version : 0),
};
case 'archive_pipeline':
case 'unarchive_pipeline':
// Mirrors the server: an enabled schedule blocks archiving.
final pipelineId = request['pipeline_id'];
final row = probePipelines().where((p) => p['id'] == pipelineId);
if (row.isEmpty) return error('pipeline not found');
final archive = type == 'archive_pipeline';
if (archive && (row.first['enabled_schedule_count'] as int) > 0) {
return error(
'pipeline "${row.first['name']}" has enabled schedule(s) '
'"Nightly docs" (#3); pause or repoint them before archiving',
);
}
if (archive) {
_probeArchived[pipelineId as int] = '2026-10-20T09:30:00Z';
} else {
_probeArchived.remove(pipelineId);
}
return {
'id': id,
'type': archive ? 'pipeline_archived' : 'pipeline_unarchived',
'detail': probePipelineDetail(pipelineId as int, 0),
};
case 'search':
// The app must send exactly the browser's SearchRequest body; anything
// else is answered with a visible refusal so the capture cannot pass.