@@ -416,29 +416,65 @@ test('malformed connect responses retain independent block evidence', () => {
416416 }
417417} ) ;
418418
419- test ( 'page-model discovery requires the exact block-detecting request ' , ( ) => {
419+ test ( 'page-model discovery accepts the safe Geometra schema and expanded defaults ' , ( ) => {
420420 for ( const toolInput of [
421- { sessionId : 'session-1' } ,
422- { ...pageModelInput , blockDetection : false } ,
423- { ...pageModelInput , blockedSitePolicy : 'continue' } ,
424- { ...pageModelInput , includeScreenshot : false } ,
421+ pageModelInput ,
422+ {
423+ ...pageModelInput ,
424+ maxPrimaryActions : 6 ,
425+ maxSectionsPerKind : 8 ,
426+ includeScreenshot : false ,
427+ manualHandoff : false ,
428+ } ,
429+ {
430+ ...pageModelInput ,
431+ maxPrimaryActions : 12 ,
432+ maxSectionsPerKind : 16 ,
433+ includeScreenshot : false ,
434+ manualHandoff : true ,
435+ } ,
425436 ] ) {
426437 const result = evaluateApplyWorkerToolCall ( {
427438 tool_name : 'mcp__geometra__geometra_page_model' ,
428439 tool_input : toolInput ,
429440 } , successfulConnect ( initialGuardState ( JOB_URL , PROJECT_ROOT ) ) ) ;
430- assert . equal ( result . allow , false , JSON . stringify ( toolInput ) ) ;
431- assert . equal ( result . state . pageModelCalls , 0 , JSON . stringify ( toolInput ) ) ;
432- assert . equal ( result . state . pageModelBlockDetectionEnforced , false , JSON . stringify ( toolInput ) ) ;
441+ assert . equal ( result . allow , true , result . reason ) ;
442+ assert . equal ( result . state . pageModelCalls , 1 ) ;
443+ assert . equal ( result . state . pageModelBlockDetectionEnforced , true ) ;
433444 }
445+ } ) ;
434446
435- const allowed = evaluateApplyWorkerToolCall ( {
436- tool_name : 'mcp__geometra__geometra_page_model' ,
437- tool_input : pageModelInput ,
438- } , successfulConnect ( initialGuardState ( JOB_URL , PROJECT_ROOT ) ) ) ;
439- assert . equal ( allowed . allow , true , allowed . reason ) ;
440- assert . equal ( allowed . state . pageModelCalls , 1 ) ;
441- assert . equal ( allowed . state . pageModelBlockDetectionEnforced , true ) ;
447+ test ( 'page-model discovery rejects unsafe schema values with value-free diagnostics' , ( ) => {
448+ for ( const [ label , toolInput ] of [
449+ [ 'missing block detection' , { sessionId : 'session-1' , blockedSitePolicy : 'manual-handoff' } ] ,
450+ [ 'disabled block detection' , { ...pageModelInput , blockDetection : false } ] ,
451+ [ 'wrong blocked-site policy' , { ...pageModelInput , blockedSitePolicy : 'continue' } ] ,
452+ [ 'enabled screenshot' , { ...pageModelInput , includeScreenshot : true } ] ,
453+ [ 'non-boolean screenshot' , { ...pageModelInput , includeScreenshot : 'false' } ] ,
454+ [ 'non-boolean handoff' , { ...pageModelInput , manualHandoff : 'false' } ] ,
455+ [ 'primary cap below range' , { ...pageModelInput , maxPrimaryActions : 0 } ] ,
456+ [ 'primary cap above range' , { ...pageModelInput , maxPrimaryActions : 13 } ] ,
457+ [ 'primary cap non-integer' , { ...pageModelInput , maxPrimaryActions : 1.5 } ] ,
458+ [ 'section cap below range' , { ...pageModelInput , maxSectionsPerKind : 0 } ] ,
459+ [ 'section cap above range' , { ...pageModelInput , maxSectionsPerKind : 17 } ] ,
460+ [ 'section cap non-integer' , { ...pageModelInput , maxSectionsPerKind : 1.5 } ] ,
461+ [ 'unknown key' , { ...pageModelInput , unsupportedOption : 'sensitive-value' } ] ,
462+ ] ) {
463+ const result = evaluateApplyWorkerToolCall ( {
464+ tool_name : 'mcp__geometra__geometra_page_model' ,
465+ tool_input : toolInput ,
466+ } , successfulConnect ( initialGuardState ( JOB_URL , PROJECT_ROOT ) ) ) ;
467+ const expectedKeys = Object . keys ( toolInput ) . sort ( ) ;
468+ assert . equal ( result . allow , false , label ) ;
469+ assert . equal ( result . state . pageModelCalls , 0 , label ) ;
470+ assert . equal ( result . state . pageModelBlockDetectionEnforced , false , label ) ;
471+ assert . equal ( result . state . violations . length , 1 , label ) ;
472+ assert . equal ( result . state . violations [ 0 ] . denialCategory , 'geometra-page-model-input' , label ) ;
473+ assert . deepEqual ( result . state . violations [ 0 ] . inputKeys , expectedKeys , label ) ;
474+ assert . equal ( result . state . events . at ( - 1 ) . denialCategory , 'geometra-page-model-input' , label ) ;
475+ assert . deepEqual ( result . state . events . at ( - 1 ) . inputKeys , expectedKeys , label ) ;
476+ assert . equal ( JSON . stringify ( result . state ) . includes ( 'sensitive-value' ) , false , label ) ;
477+ }
442478} ) ;
443479
444480test ( 'page-model and form-schema capabilities unlock only after successful structured responses' , ( ) => {
0 commit comments