@@ -33,13 +33,37 @@ function createAdapter(
3333 return { adapter, rendersDir } ;
3434}
3535
36- function buildApp ( spy : ReturnType < typeof vi . fn > ) : { app : Hono ; cleanup : ( ) => void } {
36+ function buildApp ( spy : ReturnType < typeof vi . fn > ) : {
37+ app : Hono ;
38+ rendersDir : string ;
39+ cleanup : ( ) => void ;
40+ } {
3741 const { adapter, rendersDir } = createAdapter ( spy ) ;
3842 const app = new Hono ( ) ;
3943 registerRenderRoutes ( app , adapter ) ;
40- return { app, cleanup : ( ) => rmSync ( rendersDir , { recursive : true , force : true } ) } ;
44+ return { app, rendersDir , cleanup : ( ) => rmSync ( rendersDir , { recursive : true , force : true } ) } ;
4145}
4246
47+ describe ( "GET /projects/:id/renders — stale sidecar status" , ( ) => {
48+ it ( "does not mark an existing output failed from stale metadata" , async ( ) => {
49+ const spy = vi . fn ( ) ;
50+ const { app, rendersDir, cleanup } = buildApp ( spy ) ;
51+ try {
52+ writeFileSync ( join ( rendersDir , "retry.mp4" ) , "valid-output" ) ;
53+ writeFileSync (
54+ join ( rendersDir , "retry.meta.json" ) ,
55+ JSON . stringify ( { status : "failed" , error : "first attempt" } ) ,
56+ ) ;
57+ const res = await app . request ( "http://localhost/projects/demo/renders" ) ;
58+ expect ( res . status ) . toBe ( 200 ) ;
59+ const body = await res . json ( ) ;
60+ expect ( body . renders ) . toEqual ( [ expect . objectContaining ( { id : "retry" , status : "complete" } ) ] ) ;
61+ } finally {
62+ cleanup ( ) ;
63+ }
64+ } ) ;
65+ } ) ;
66+
4367describe ( "POST /projects/:id/render — outputResolution forwarding" , ( ) => {
4468 it ( "forwards a valid resolution preset to the adapter" , async ( ) => {
4569 const spy = vi . fn ( ) ;
0 commit comments