@@ -14,7 +14,8 @@ use homeboy::core::artifact_address::ArtifactAddress;
1414use homeboy:: core:: observation:: evidence_report:: directory_publication_guidance;
1515use homeboy:: core:: observation:: runs_service;
1616use homeboy:: core:: observation:: {
17- merge_metadata, FindingListFilter , ObservationStore , RunListFilter , RunRecord , RunStatus ,
17+ merge_metadata, ArtifactListFilter , FindingListFilter , ObservationStore , RunListFilter ,
18+ RunRecord , RunStatus ,
1819} ;
1920use homeboy:: core:: resource_lifecycle_index:: resource_lifecycle_index_from_artifacts;
2021use homeboy:: core:: validation_progress:: ValidationProgressLedger ;
@@ -27,11 +28,12 @@ use super::common::{run_summaries_with_artifact_indexes, RunSummary};
2728use super :: types:: {
2829 actionable_for_run_detail, actionable_for_run_list, RunDetail , RunsArtifactArgs ,
2930 RunsArtifactCommand , RunsArtifactCommandHint , RunsArtifactGetArgs , RunsArtifactGetOutput ,
30- RunsArtifactPathGuide , RunsArtifactPullEntry , RunsArtifactPullSummary , RunsArtifactsArgs ,
31- RunsArtifactsOutput , RunsCancelOutput , RunsDirectoryArtifactPublicationGuidance ,
32- RunsEnvKeyOutput , RunsEnvOutput , RunsEnvSourceLayerOutput , RunsEnvSummary ,
33- RunsFieldSelectionOutput , RunsListArgs , RunsListOutput , RunsOutput , RunsResumePlanOutput ,
34- RunsSelectedField , RunsShowOutput , RunsStaleRunSummary ,
31+ RunsArtifactPage , RunsArtifactPathGuide , RunsArtifactPullEntry , RunsArtifactPullSummary ,
32+ RunsArtifactsArgs , RunsArtifactsOutput , RunsCancelOutput ,
33+ RunsDirectoryArtifactPublicationGuidance , RunsEnvKeyOutput , RunsEnvOutput ,
34+ RunsEnvSourceLayerOutput , RunsEnvSummary , RunsFieldSelectionOutput , RunsListArgs ,
35+ RunsListOutput , RunsOutput , RunsResumePlanOutput , RunsSelectedField , RunsShowOutput ,
36+ RunsStaleRunSummary ,
3537} ;
3638use super :: { reconcile, remote, remote_artifact, CmdResult } ;
3739
@@ -567,6 +569,20 @@ pub fn artifacts(run_id: &str) -> CmdResult<RunsOutput> {
567569 runner : None ,
568570 pull : false ,
569571 pull_dir : None ,
572+ token : None ,
573+ kind : None ,
574+ mime : None ,
575+ original_path : None ,
576+ path_suffix : None ,
577+ fixture : None ,
578+ surface : None ,
579+ scenario : None ,
580+ name_glob : None ,
581+ limit : 50 ,
582+ offset : 0 ,
583+ // Preserve the direct test helper's historical exhaustive projection;
584+ // the public CLI defaults to the bounded discovery page.
585+ full : true ,
570586 } )
571587}
572588
@@ -582,13 +598,61 @@ pub fn artifacts_from_args(args: RunsArtifactsArgs) -> CmdResult<RunsOutput> {
582598 ] ) ,
583599 ) ) ;
584600 }
585- return remote:: runner_artifacts ( runner_id, & args. run_id ) ;
601+ return remote:: runner_artifacts ( runner_id, & args) ;
586602 }
587603
588604 let store = ObservationStore :: open_initialized ( ) ?;
589605 let run = runs_service:: require_run ( & store, & args. run_id ) ?;
590606 let run_id = run. id ;
591- let artifacts = runs_service:: list_artifacts_for_run ( & store, & run_id) ?;
607+ let filter = ArtifactListFilter {
608+ token : args. token . clone ( ) ,
609+ kind : args. kind . clone ( ) ,
610+ mime : args. mime . clone ( ) ,
611+ original_path : args. original_path . clone ( ) ,
612+ path_suffix : args. path_suffix . clone ( ) ,
613+ fixture : args. fixture . clone ( ) ,
614+ surface : args. surface . clone ( ) ,
615+ scenario : args. scenario . clone ( ) ,
616+ name_glob : args. name_glob . clone ( ) ,
617+ limit : args. limit ,
618+ offset : args. offset ,
619+ } ;
620+ let page = if args. full {
621+ None
622+ } else {
623+ Some ( store. list_artifacts_page ( & run_id, & filter) ?)
624+ } ;
625+ let artifacts = match page. as_ref ( ) {
626+ Some ( page) => page. artifacts . clone ( ) ,
627+ None => runs_service:: list_artifacts_for_run ( & store, & run_id) ?,
628+ } ;
629+ if !args. full {
630+ let page = page. expect ( "bounded artifact page is present" ) ;
631+ return Ok ( (
632+ RunsOutput :: Artifacts ( RunsArtifactsOutput {
633+ command : "runs.artifacts" ,
634+ run_id : run_id. clone ( ) ,
635+ runner_id : None ,
636+ path_guide : RunsArtifactPathGuide :: for_listing ( & run_id, None ) ,
637+ next_commands : artifact_get_command_hints ( & run_id, & artifacts) ,
638+ artifacts,
639+ page : Some ( RunsArtifactPage {
640+ total : page. total ,
641+ limit : page. limit ,
642+ offset : page. offset ,
643+ next_offset : ( page. offset + page. artifacts . len ( ) < page. total )
644+ . then_some ( page. offset + page. artifacts . len ( ) ) ,
645+ } ) ,
646+ resource_lifecycle_index : None ,
647+ directory_publication : Vec :: new ( ) ,
648+ preview_entrypoints : Vec :: new ( ) ,
649+ matrix_summary : None ,
650+ fuzz_result_envelopes : Vec :: new ( ) ,
651+ pull : None ,
652+ } ) ,
653+ 0 ,
654+ ) ) ;
655+ }
592656 let preview_entrypoints = artifacts
593657 . iter ( )
594658 . flat_map ( homeboy:: core:: artifacts:: html_preview_entrypoints)
@@ -624,6 +688,7 @@ pub fn artifacts_from_args(args: RunsArtifactsArgs) -> CmdResult<RunsOutput> {
624688 path_guide : RunsArtifactPathGuide :: for_listing ( & run_id, None ) ,
625689 next_commands : artifact_get_command_hints ( & run_id, & artifacts) ,
626690 artifacts,
691+ page : None ,
627692 resource_lifecycle_index,
628693 directory_publication,
629694 preview_entrypoints,
@@ -1389,6 +1454,18 @@ mod pull_tests {
13891454 runner : Some ( "lab" . to_string ( ) ) ,
13901455 pull : true ,
13911456 pull_dir : None ,
1457+ token : None ,
1458+ kind : None ,
1459+ mime : None ,
1460+ original_path : None ,
1461+ path_suffix : None ,
1462+ fixture : None ,
1463+ surface : None ,
1464+ scenario : None ,
1465+ name_glob : None ,
1466+ limit : 50 ,
1467+ offset : 0 ,
1468+ full : false ,
13921469 } ) ;
13931470 let Err ( err) = result else {
13941471 panic ! ( "--pull with --runner should fail" ) ;
0 commit comments