@@ -405,6 +405,103 @@ describe("qa coverage report", () => {
405405 expect ( report ) . not . toContain ( "### Unknown Scenario Coverage IDs" ) ;
406406 } ) ;
407407
408+ it . each ( [ "script" , "vitest" , "playwright" ] as const ) (
409+ "finds %s scenarios by execution paths outside their code refs" ,
410+ ( executionKind ) => {
411+ const executionPath = `test/producers/${ executionKind } -only.ts` ;
412+ const scenario = scenarioWithCoverage ( {
413+ primary : [ TEST_EXECUTABLE_COVERAGE_ID ] ,
414+ executionKind,
415+ executionPath,
416+ } ) ;
417+
418+ expect ( findQaScenarioMatches ( [ scenario ] , executionPath ) ) . toMatchObject ( [
419+ { id : scenario . id , executionKind, executionPath } ,
420+ ] ) ;
421+ } ,
422+ ) ;
423+
424+ it ( "finds every shared execution-path owner in deterministic scenario order" , ( ) => {
425+ const executionPath = "test/producers/shared-evidence.ts" ;
426+ const scenario = scenarioWithCoverage ( {
427+ primary : [ TEST_EXECUTABLE_COVERAGE_ID ] ,
428+ executionKind : "script" ,
429+ executionPath,
430+ } ) ;
431+ const scenarios = [
432+ { ...scenario , id : "zulu-owner" } ,
433+ { ...scenario , id : "alpha-owner" } ,
434+ ] ;
435+
436+ expect ( findQaScenarioMatches ( scenarios , executionPath ) . map ( ( { id } ) => id ) ) . toStrictEqual ( [
437+ "alpha-owner" ,
438+ "zulu-owner" ,
439+ ] ) ;
440+ } ) ;
441+
442+ it ( "normalizes portable execution-path query separators" , ( ) => {
443+ const executionPath = "test/producers/windows-evidence.ts" ;
444+ const scenario = scenarioWithCoverage ( {
445+ primary : [ TEST_EXECUTABLE_COVERAGE_ID ] ,
446+ executionKind : "script" ,
447+ executionPath,
448+ } ) ;
449+
450+ expect ( findQaScenarioMatches ( [ scenario ] , executionPath . replaceAll ( "/" , "\\" ) ) ) . toMatchObject ( [
451+ { id : scenario . id , executionPath } ,
452+ ] ) ;
453+ } ) ;
454+
455+ it ( "finds every cataloged native scenario by its authoritative execution path" , ( ) => {
456+ const scenarios = readQaScenarioPack ( ) . scenarios ;
457+ for ( const scenario of scenarios ) {
458+ if ( scenario . execution . kind !== "flow" ) {
459+ expect (
460+ findQaScenarioMatches ( scenarios , scenario . execution . path ) . map ( ( { id } ) => id ) ,
461+ scenario . id ,
462+ ) . toContain ( scenario . id ) ;
463+ }
464+ }
465+ } ) ;
466+
467+ it . each ( [
468+ [ "name" , "metadata-proof" ] ,
469+ [ "title" , "scenario-title" ] ,
470+ [ "tag" , "scenario-category" ] ,
471+ [ "coverage" , TEST_EXECUTABLE_COVERAGE_ID ] ,
472+ [ "code reference" , "src/metadata/code-reference.ts" ] ,
473+ [ "documentation reference" , "docs/metadata/reference.md" ] ,
474+ [ "source path" , "qa/scenarios/metadata/flow-proof.yaml" ] ,
475+ [ "capability" , "scenario-capability" ] ,
476+ ] as const ) ( "preserves existing flow scenario matching by %s" , ( _field , query ) => {
477+ const scenario = {
478+ ...scenarioWithCoverage ( {
479+ primary : [ TEST_EXECUTABLE_COVERAGE_ID ] ,
480+ sourcePath : "qa/scenarios/metadata/flow-proof.yaml" ,
481+ } ) ,
482+ id : "metadata-proof" ,
483+ title : "scenario-title" ,
484+ category : "scenario-category" ,
485+ capabilities : [ "scenario-capability" ] ,
486+ codeRefs : [ "src/metadata/code-reference.ts" ] ,
487+ docsRefs : [ "docs/metadata/reference.md" ] ,
488+ } ;
489+
490+ expect ( findQaScenarioMatches ( [ scenario ] , query ) . map ( ( { id } ) => id ) ) . toStrictEqual ( [
491+ scenario . id ,
492+ ] ) ;
493+ } ) ;
494+
495+ it . each ( [
496+ [ "Gateway loopback and LAN access" , "docker-gateway-network" ] ,
497+ [ "qa-lab" , "docker-gateway-network" ] ,
498+ [ "runtime" , "clawhub-marketplace-list" ] ,
499+ ] as const ) ( "does not broaden ordinary metadata query %s" , ( query , unrelatedScenarioId ) => {
500+ const matches = findQaScenarioMatches ( readQaScenarioPack ( ) . scenarios , query ) ;
501+
502+ expect ( matches . map ( ( { id } ) => id ) ) . not . toContain ( unrelatedScenarioId ) ;
503+ } ) ;
504+
408505 it ( "renders Playwright matches as qa suite targets" , ( ) => {
409506 const matches = findQaScenarioMatches (
410507 readQaScenarioPack ( ) . scenarios ,
0 commit comments