@@ -14,7 +14,9 @@ use serde_json::json;
1414use tempfile:: TempDir ;
1515use tracedecay:: agents:: { get_integration, InstallContext , UpdatePluginOutcome } ;
1616
17- use crate :: common:: { assert_schema_valid, compile_schema, EnvVarGuard , PROCESS_ENV_LOCK } ;
17+ use crate :: common:: {
18+ assert_schema_valid, compile_schema, relative_files_under, EnvVarGuard , PROCESS_ENV_LOCK ,
19+ } ;
1820
1921const OLD_BIN : & str = "/old/bin/tracedecay" ;
2022const NEW_BIN : & str = "/new/bin/tracedecay" ;
@@ -105,27 +107,6 @@ fn write_stale_codex_skill(plugin_dir: &Path) {
105107 . unwrap ( ) ;
106108}
107109
108- /// Every regular file under `root`, relative to it, sorted.
109- fn file_listing ( root : & Path ) -> Vec < PathBuf > {
110- fn walk ( dir : & Path , root : & Path , out : & mut Vec < PathBuf > ) {
111- let Ok ( entries) = std:: fs:: read_dir ( dir) else {
112- return ;
113- } ;
114- for entry in entries. flatten ( ) {
115- let path = entry. path ( ) ;
116- if path. is_dir ( ) {
117- walk ( & path, root, out) ;
118- } else {
119- out. push ( path. strip_prefix ( root) . unwrap ( ) . to_path_buf ( ) ) ;
120- }
121- }
122- }
123- let mut out = Vec :: new ( ) ;
124- walk ( root, root, & mut out) ;
125- out. sort ( ) ;
126- out
127- }
128-
129110// ---------------------------------------------------------------------------
130111// Hermes
131112// ---------------------------------------------------------------------------
@@ -637,7 +618,7 @@ fn config_only_integrations_report_config_only_and_write_nothing() {
637618 "{id} should be config-only"
638619 ) ;
639620 assert ! (
640- file_listing ( home. path( ) ) . is_empty( ) ,
621+ relative_files_under ( home. path( ) ) . is_empty( ) ,
641622 "{id} update_plugin wrote files into the home dir"
642623 ) ;
643624 }
@@ -727,7 +708,7 @@ fn rendered_json_placeholders(install_dir: &Path) -> Vec<(String, String, String
727708 }
728709 }
729710 let mut found = Vec :: new ( ) ;
730- for relative in file_listing ( install_dir) {
711+ for relative in relative_files_under ( install_dir) {
731712 if relative. extension ( ) . and_then ( |ext| ext. to_str ( ) ) != Some ( "json" ) {
732713 continue ;
733714 }
@@ -748,20 +729,20 @@ fn rendered_json_placeholders(install_dir: &Path) -> Vec<(String, String, String
748729/// wipes the previous managed files first. The rendered dir may hold extras
749730/// (managed skill overlay, user files); source ⊆ rendered is the contract.
750731fn assert_source_bundle_fully_rendered ( source_dir : & Path , install_dir : & Path ) {
751- let source = file_listing ( source_dir) ;
732+ let source = relative_files_under ( source_dir) ;
752733 assert ! (
753734 !source. is_empty( ) ,
754735 "source bundle {} should not be empty" ,
755736 source_dir. display( )
756737 ) ;
757- let rendered = file_listing ( install_dir) ;
738+ let rendered = relative_files_under ( install_dir) ;
758739 let missing: Vec < & PathBuf > = source
759740 . iter ( )
760741 . filter ( |relative| !rendered. contains ( relative) )
761742 . collect ( ) ;
762743 assert ! (
763744 missing. is_empty( ) ,
764- "files present in {} but silently dropped from the rendered install {}: {missing:?}" ,
745+ "files present in {} but missing from rendered install {}: {missing:?}" ,
765746 source_dir. display( ) ,
766747 install_dir. display( )
767748 ) ;
0 commit comments