@@ -4449,6 +4449,14 @@ TEST(tool_resolve_store_by_internal_name_issue704) {
44494449
44504450 /* (1) control: filename == internal name */
44514451 ASSERT_TRUE (issue704_make_db (cache , "alpha704.db" , "alpha704" , "alphaFunc704" ));
4452+ /* Coverage materializes a second internal projects row in the same DB.
4453+ * list_projects must ignore this derived graph and still advertise alpha. */
4454+ char alpha_path [700 ];
4455+ snprintf (alpha_path , sizeof (alpha_path ), "%s/alpha704.db" , cache );
4456+ cbm_store_t * alpha_store = cbm_store_open_path (alpha_path );
4457+ ASSERT_NOT_NULL (alpha_store );
4458+ ASSERT_EQ (cbm_store_upsert_project (alpha_store , "alpha704::missed" , "" ), CBM_STORE_OK );
4459+ cbm_store_close (alpha_store );
44524460
44534461 /* (2) DRIFT: build beta704.db (internal "beta704") then rename the file to
44544462 * gamma704.db, so filename "gamma704" != internal "beta704". */
@@ -4526,18 +4534,16 @@ TEST(tool_resolve_store_by_internal_name_issue704) {
45264534 } else {
45274535 cbm_unsetenv ("CBM_CACHE_DIR" );
45284536 }
4529- char a_path [700 ];
4530- snprintf (a_path , sizeof (a_path ), "%s/alpha704.db" , cache );
45314537 char corrupt_path [720 ];
45324538 snprintf (corrupt_path , sizeof (corrupt_path ), "%s.corrupt" , ghost_path );
4533- cbm_unlink (a_path );
4539+ cbm_unlink (alpha_path );
45344540 cbm_unlink (gamma_path );
45354541 cbm_unlink (ghost_path );
45364542 cbm_unlink (corrupt_path ); /* ghost may be quarantined by resolve_store */
45374543 char side [740 ];
4538- snprintf (side , sizeof (side ), "%s-wal" , a_path );
4544+ snprintf (side , sizeof (side ), "%s-wal" , alpha_path );
45394545 cbm_unlink (side );
4540- snprintf (side , sizeof (side ), "%s-shm" , a_path );
4546+ snprintf (side , sizeof (side ), "%s-shm" , alpha_path );
45414547 cbm_unlink (side );
45424548 snprintf (side , sizeof (side ), "%s-wal" , gamma_path );
45434549 cbm_unlink (side );
0 commit comments