@@ -469,7 +469,58 @@ TEST(cross_repo_pre_cancel_preserves_existing_cross_edges) {
469469 PASS ();
470470}
471471
472+ /* Add the internal "<name>::missed" miss-graph row that indexing writes into
473+ * the SAME db whenever a file parses partially. */
474+ static bool cross_repo_add_missed_shadow (const cross_repo_fixture_t * fixture , const char * project ) {
475+ char path [512 ];
476+ char shadow [256 ];
477+ if (!cross_repo_project_path (fixture , project , path , sizeof (path ))) {
478+ return false;
479+ }
480+ snprintf (shadow , sizeof (shadow ), "%s::missed" , project );
481+ cbm_store_t * store = cbm_store_open_path (path );
482+ if (!store ) {
483+ return false;
484+ }
485+ bool ok = cbm_store_upsert_project (store , shadow , fixture -> cache ) == CBM_STORE_OK ;
486+ cbm_store_close (store );
487+ return ok ;
488+ }
489+
490+ /* #1609: any project that has ever recorded a parse miss carries a
491+ * "<name>::missed" shadow row in its own db. cr_store_has_exact_project
492+ * demanded count == 1 over ALL rows, so that second row made the project
493+ * unresolvable — as source AND as target — and the whole feature failed with
494+ * "not indexed" for a project that plainly was. mcp.c already solved exactly
495+ * this shape for list_projects in #1044; this site never learned it.
496+ *
497+ * The control is the pair without shadow rows: the tests above already prove
498+ * that path returns edges, so a regression here cannot hide behind a fixture
499+ * that never matched in the first place. */
500+ TEST (cross_repo_accepts_project_with_missed_shadow_row_issue1609 ) {
501+ cross_repo_fixture_t fixture ;
502+ bool setup = cross_repo_fixture_begin (& fixture ) &&
503+ cross_repo_seed_http_pair (& fixture , "shadow-source" , "shadow-target" , "/orders" ,
504+ "s" ) &&
505+ cross_repo_add_missed_shadow (& fixture , "shadow-source" ) &&
506+ cross_repo_add_missed_shadow (& fixture , "shadow-target" );
507+ if (!setup ) {
508+ cross_repo_fixture_end (& fixture );
509+ FAIL ("failed to seed shadow-row fixture" );
510+ }
511+
512+ const char * target = "shadow-target" ;
513+ cbm_cross_repo_result_t result = cbm_cross_repo_match ("shadow-source" , & target , 1 );
514+ cross_repo_fixture_end (& fixture );
515+
516+ ASSERT_FALSE (result .failed );
517+ ASSERT_EQ (result .projects_scanned , 1 );
518+ ASSERT_EQ (result .http_edges , 1 );
519+ PASS ();
520+ }
521+
472522SUITE (cross_repo ) {
523+ RUN_TEST (cross_repo_accepts_project_with_missed_shadow_row_issue1609 );
473524 RUN_TEST (cross_repo_null_target_fails_without_dereference );
474525 RUN_TEST (cross_repo_wildcard_keeps_projects_containing_internal_tokens );
475526 RUN_TEST (cross_repo_scan_bound_counts_examined_rows_not_matches );
0 commit comments