@@ -91,6 +91,37 @@ describe("GET /projects/:id/signature", () => {
9191 expect ( second . signature ) . not . toBe ( first . signature ) ;
9292 } ) ;
9393
94+ it ( "ignores generated cache writes while detecting source edits" , async ( ) => {
95+ const projectDir = createProjectDir ( ) ;
96+ const app = new Hono ( ) ;
97+ registerProjectRoutes ( app , createAdapter ( projectDir ) ) ;
98+ const getSignature = async ( ) =>
99+ (
100+ ( await ( await app . request ( "http://localhost/projects/demo/signature" ) ) . json ( ) ) as {
101+ signature : string ;
102+ }
103+ ) . signature ;
104+
105+ const initial = await getSignature ( ) ;
106+ const generatedFiles = [
107+ [ ".transcode-cache" , "proxy.mp4" ] ,
108+ [ ".thumbnails" , "frame.jpg" ] ,
109+ [ ".waveform-cache" , "peaks.json" ] ,
110+ ] as const ;
111+ const generatedSignatures : string [ ] = [ ] ;
112+ for ( const [ dir , file ] of generatedFiles ) {
113+ mkdirSync ( join ( projectDir , dir ) ) ;
114+ writeFileSync ( join ( projectDir , dir , file ) , `generated ${ dir } ` ) ;
115+ generatedSignatures . push ( await getSignature ( ) ) ;
116+ }
117+
118+ expect ( generatedSignatures ) . toEqual ( [ initial , initial , initial ] ) ;
119+
120+ mkdirSync ( join ( projectDir , "src" ) ) ;
121+ writeFileSync ( join ( projectDir , "src" , "scene.ts" ) , "export const scene = true;" ) ;
122+ expect ( await getSignature ( ) ) . not . toBe ( initial ) ;
123+ } ) ;
124+
94125 it ( "404s for an unknown project" , async ( ) => {
95126 const app = new Hono ( ) ;
96127 registerProjectRoutes ( app , {
@@ -132,4 +163,20 @@ describe("registerProjectRoutes — composition discovery (#1384)", () => {
132163 // Only Studio's own backup snapshots are hidden from the tree (#1366).
133164 expect ( payload . files ) . not . toContain ( ".hyperframes/backup/snapshot.html" ) ;
134165 } ) ;
166+
167+ it ( "omits generated cache files from the project file tree" , async ( ) => {
168+ const projectDir = createProjectDir ( ) ;
169+ mkdirSync ( join ( projectDir , ".transcode-cache" ) ) ;
170+ writeFileSync ( join ( projectDir , ".transcode-cache" , "proxy.mp4" ) , "proxy" ) ;
171+ mkdirSync ( join ( projectDir , ".waveform-cache" ) ) ;
172+ writeFileSync ( join ( projectDir , ".waveform-cache" , "peaks.json" ) , "[]" ) ;
173+ const app = new Hono ( ) ;
174+ registerProjectRoutes ( app , createAdapter ( projectDir ) ) ;
175+
176+ const response = await app . request ( "http://localhost/projects/demo" ) ;
177+ const payload = ( await response . json ( ) ) as { files ?: string [ ] } ;
178+
179+ expect ( payload . files ) . not . toContain ( ".transcode-cache/proxy.mp4" ) ;
180+ expect ( payload . files ) . not . toContain ( ".waveform-cache/peaks.json" ) ;
181+ } ) ;
135182} ) ;
0 commit comments