ODS V3 Pre-Release: Public testing and refinement ahead of the official V3 launch. Turn your PC, Mac, or Linux box into a private AI server.
Python ai-agentsamdcomfyuidockerllama-cppllmlocal-ain8nnvidiaopen-webuiragself-hostedspeech-to-textstrix-halotext-to-speechworkflow-automation
fix(pixel): describe a rendered hidden overlay by its shape (#8269)
Mike Bradleyb92f117290bf
diff --git a/ods/extensions/services/pixel-agent/host/preview_inspection_capsule.py b/ods/extensions/services/pixel-agent/host/preview_inspection_capsule.pyindex a259d835a..85c5435df 100644--- a/ods/extensions/services/pixel-agent/host/preview_inspection_capsule.py+++ b/ods/extensions/services/pixel-agent/host/preview_inspection_capsule.py@@ -151,13 +151,26 @@ OBSERVE_ELEMENT = "function(includeText, selectValue, fillValue, performFill, fo# say whether it hosts a closed shadow root that hides the real focus.FOCUSED_ELEMENT = "function() {\n" + DEEP_FOCUS + " return focused();\n}"+# Rendered [hidden] elements, and the first three by computed shape only: an+# overlay that CSS shows covered a generated game's board (Workstation06,+# 2026-10-27). Author text never leaves the page: a tag outside this list+# reads "element", and no id, class or text is read.DIAGNOSTIC = r"""function() {- let count=0, untilFound=0;+ const tags=new Set(['a','article','aside','button','canvas','dialog','div','fieldset','figure','footer','form','header','iframe','img','input','label','li','main','menu','nav','ol','p','section','select','span','table','textarea','ul','video']);+ let count=0, untilFound=0; const shapes=[];for (const element of document.querySelectorAll('[hidden]')) {if(element.getAttribute('hidden')==='until-found') { untilFound++; continue; }- if(element.checkVisibility({checkOpacity:true,checkVisibilityCSS:true,contentVisibilityAuto:true}) && [...element.getClientRects()].some(r=>r.width>0 && r.height>0)) count++;+ if(!element.checkVisibility({checkOpacity:true,checkVisibilityCSS:true,contentVisibilityAuto:true}) || ![...element.getClientRects()].some(r=>r.width>0 && r.height>0)) continue;+ count++;+ if(shapes.length<3) {+ const style=getComputedStyle(element), box=element.getBoundingClientRect(), z=Number.parseInt(style.zIndex,10);+ const width=Math.max(0,Math.min(innerWidth,box.right)-Math.max(0,box.left)), height=Math.max(0,Math.min(innerHeight,box.bottom)-Math.max(0,box.top));+ shapes.push({tag:tags.has(element.localName)?element.localName:'element', position:style.position,+ zIndex:Number.isSafeInteger(z)?z:null,+ viewportPercent:innerWidth*innerHeight?Math.min(100,Math.round(100*width*height/(innerWidth*innerHeight))):0});+ }}- return {renderedHiddenAttributeCount:count, hiddenUntilFoundCount:untilFound};+ return {renderedHiddenAttributeCount:count, hiddenUntilFoundCount:untilFound, ...(shapes.length?{renderedHidden:shapes}:{})};}"""# Catch only the browser's selector-parser failure in the isolated world. Dodiff --git a/ods/extensions/services/pixel-agent/plugin/workspace-preview-inspect.mjs b/ods/extensions/services/pixel-agent/plugin/workspace-preview-inspect.mjsindex b9edc5652..ce5a1d6ee 100644--- a/ods/extensions/services/pixel-agent/plugin/workspace-preview-inspect.mjs+++ b/ods/extensions/services/pixel-agent/plugin/workspace-preview-inspect.mjs@@ -36,6 +36,21 @@ export const MAX_PAGE_ERRORS = 1000;const MAX_PAGE_ERROR_MESSAGES = 3, MAX_PAGE_ERROR_CHARS = 200;const roles = new Set(['button','link','checkbox','radio','textbox','combobox','heading','tab','switch']);const exact = (v,keys) => v && typeof v==='object' && !Array.isArray(v) && Object.keys(v).sort().join(',')===[...keys].sort().join(',');+// The capsule describes rendered [hidden] elements by computed shape only;+// its tag list matches DIAGNOSTIC in host/preview_inspection_capsule.py.+const HIDDEN_SHAPE_TAGS = new Set(['a','article','aside','button','canvas','dialog','div','fieldset','figure','footer','form','header','iframe','img','input','label','li','main','menu','nav','ol','p','section','select','span','table','textarea','ul','video','element']);+const HIDDEN_SHAPE_POSITIONS = new Set(['static','relative','absolute','fixed','sticky']);+const hiddenShapeValid = shape => exact(shape,['tag','position','zIndex','viewportPercent']) &&+ HIDDEN_SHAPE_TAGS.has(shape.tag) && HIDDEN_SHAPE_POSITIONS.has(shape.position) &&+ (shape.zIndex===null || Number.isSafeInteger(shape.zIndex) && Math.abs(shape.zIndex)<=2147483647) &&+ Number.isInteger(shape.viewportPercent) && shape.viewportPercent>=0 && shape.viewportPercent<=100;+function diagnosticsValid(diagnostics) {+ const counts=['renderedHiddenAttributeCount','hiddenUntilFoundCount'], shapes=diagnostics?.renderedHidden;+ return exact(diagnostics,[...counts,...(shapes===undefined?[]:['renderedHidden'])]) &&+ counts.every(key=>Number.isSafeInteger(diagnostics[key]) && diagnostics[key]>=0 && diagnostics[key]<=100000) &&+ (shapes===undefined || Array.isArray(shapes) && shapes.length>=1 && shapes.length<=3 &&+ shapes.length<=diagnostics.renderedHiddenAttributeCount && shapes.every(hiddenShapeValid));+}const printable = (v,max) => typeof v==='string' && Array.from(v).length>0 && Array.from(v).length<=max && Buffer.byteLength(v)<=max*4 && !/[\p{C}\u2028\u2029]/u.test(v);const optionValue = v => v === '' || printable(v,256);const selectionPlan = request => request.steps.some(s=>s.action==='select-option');@@ -151,8 +166,12 @@ function unchangedPaintNote(result) {function renderedHiddenNote(result) {const count = result.diagnostics?.renderedHiddenAttributeCount ?? 0;if (count < 1) return '';+ const shapes = (result.diagnostics.renderedHidden ?? []).map(shape =>+ `${shape.tag === 'element' ? 'an element' : `a <${shape.tag}>`}${shape.position === 'static' ? '' : ` with position: ${shape.position}`}` ++ `${shape.zIndex === null ? '' : `, z-index ${shape.zIndex},`} covering ${shape.viewportPercent}% of the view`);+ const which = shapes.length === 0 ? '' : count === 1 ? ` It is ${shapes[0]}.` : ` They include ${shapes.join('; ')}.`;return ` Note: ${count === 1 ? 'one element carries the hidden attribute but is' : `${count} elements carry the hidden attribute but are`} rendered anyway, ` +- 'because an author style such as display: flex overrides hidden. An overlay, dialog or panel meant to stay hidden then shows, and can cover the page and take its clicks. ' ++ `because an author style such as display: flex overrides hidden.${which} An overlay, dialog or panel meant to stay hidden then shows, and can cover the page and take its clicks. ` +'Keep the display value for its shown state only, or add [hidden] { display: none !important; }.';}// A passed paint step whose box is almost all one color: a cleared canvas with a@@ -421,7 +440,7 @@ export function validateWorkspacePreviewInspectionReceipt(value, request) {// pageErrors, renderedColors and controls are optional: absent when none// was observed or captured, or when an older capsule produced the receipt.// Present, each must be exactly bounded.- if(!exact(value,['schemaVersion','kind','status','siteId','sha256','planSha256','viewport','steps','diagnostics','blockedRequests',...(value.pageErrors===undefined?[]:['pageErrors']),...(value.renderedColors===undefined?[]:['renderedColors']),...(value.controls===undefined?[]:['controls']),'scope']) || (value.pageErrors!==undefined&&!pageErrorsValid(value.pageErrors)) || (value.renderedColors!==undefined&&!renderedColorsValid(value.renderedColors)) || (value.controls!==undefined&&!controlsValid(value.controls)) || canonical(value.viewport)!==canonical(request.viewport)||!Array.isArray(value.steps)||value.steps.length<1||value.steps.length>request.steps.length||!exact(value.diagnostics,['renderedHiddenAttributeCount','hiddenUntilFoundCount'])||Object.values(value.diagnostics).some(v=>!Number.isSafeInteger(v)||v<0||v>100000)||!Array.isArray(value.blockedRequests)||value.blockedRequests.length>32||value.blockedRequests.some(v=>!['navigation','network','popup','download','websocket'].includes(v))) throw Error('invalid inspection receipt');+ if(!exact(value,['schemaVersion','kind','status','siteId','sha256','planSha256','viewport','steps','diagnostics','blockedRequests',...(value.pageErrors===undefined?[]:['pageErrors']),...(value.renderedColors===undefined?[]:['renderedColors']),...(value.controls===undefined?[]:['controls']),'scope']) || (value.pageErrors!==undefined&&!pageErrorsValid(value.pageErrors)) || (value.renderedColors!==undefined&&!renderedColorsValid(value.renderedColors)) || (value.controls!==undefined&&!controlsValid(value.controls)) || canonical(value.viewport)!==canonical(request.viewport)||!Array.isArray(value.steps)||value.steps.length<1||value.steps.length>request.steps.length||!diagnosticsValid(value.diagnostics)||!Array.isArray(value.blockedRequests)||value.blockedRequests.length>32||value.blockedRequests.some(v=>!['navigation','network','popup','download','websocket'].includes(v))) throw Error('invalid inspection receipt');value.steps.forEach((step,i)=>{const textStep=step.action==='assert-text', selectStep=step.action==='select-option', fillStep=step.action==='fill', downloadStep=step.action==='download', pressStep=step.action==='press', paintStep=step.action==='assert-painted', textKeys=textStep?['expectedText']:(selectStep||fillStep)?['value']:downloadStep?downloadKeys:pressStep?pressKeys(request.steps[i]):[];if(textStep && step.expectedText!==request.steps[i].expectedText) throw Error('invalid text binding');diff --git a/ods/extensions/services/pixel-agent/tests/inspection_click_feedback.test.mjs b/ods/extensions/services/pixel-agent/tests/inspection_click_feedback.test.mjsindex 4976b6cbc..38da5e44e 100644--- a/ods/extensions/services/pixel-agent/tests/inspection_click_feedback.test.mjs+++ b/ods/extensions/services/pixel-agent/tests/inspection_click_feedback.test.mjs@@ -1,7 +1,7 @@import test from 'node:test';import assert from 'node:assert/strict';import {createWorkspacePreviewInspectTool, inspectionPlanHash, INSPECTION_KIND, INSPECTION_SCOPE,- normalizeWorkspacePreviewInspectionParams as normalize}+ normalizeWorkspacePreviewInspectionParams as normalize, validateWorkspacePreviewInspectionReceipt as validate}from '../plugin/workspace-preview-inspect.mjs';// Workstation06 (2026-10-27): a generated memory game styled its win overlay with@@ -14,14 +14,15 @@ const request = () => ({siteId: `site-${digest.slice(0,24)}`, sha256:digest, vie{action:'assert-text',locator:{selector:'#moves'},expectedText:'1'}]});const state = text => ({count:1,visible:true,display:'block',visibility:'visible',opacity:'1',hidden:false,hiddenUntilFound:false,rectCount:1,...(text === undefined ? {} : {text:{actual:text,truncated:false}})});-function receipt(params, {clickFails = false, renderedHidden = 0} = {}) {+function receipt(params, {clickFails = false, renderedHidden = 0, shapes} = {}) {const steps = clickFails? [{index:0,...structuredClone(params.steps[0]),before:state(),stable:true,status:'failed',errorCode:'click_failed'}]: [{index:0,...structuredClone(params.steps[0]),before:state(),after:state(),stable:true,status:'passed'},{index:1,...structuredClone(params.steps[1]),before:state('1'),stable:true,status:'passed'}];return {schemaVersion:1,kind:INSPECTION_KIND,status:clickFails ? 'failed' : 'passed',siteId:params.siteId,sha256:params.sha256,planSha256:inspectionPlanHash(normalize(params)),viewport:params.viewport,- scope:INSPECTION_SCOPE,diagnostics:{renderedHiddenAttributeCount:renderedHidden,hiddenUntilFoundCount:0},+ scope:INSPECTION_SCOPE,diagnostics:{renderedHiddenAttributeCount:renderedHidden,hiddenUntilFoundCount:0,+ ...(shapes === undefined ? {} : {renderedHidden:shapes})},blockedRequests:[],steps};}const summary = result => result.content[0].text.split(' Evidence: ')[0];@@ -59,3 +60,31 @@ test('a passed inspection still notes hidden elements that are rendered', asyncassert.match(clean, /^Preview inspection passed\./);assert.doesNotMatch(clean, /hidden attribute|could not click/);});++// The overlay from that game, as the capsule describes it: computed values only.+const OVERLAY = {tag:'div', position:'fixed', zIndex:10, viewportPercent:100};++test('the note describes a rendered hidden overlay by its computed shape', async () => {+ const text = summary(await inspect({clickFails:true, renderedHidden:1, shapes:[OVERLAY]}, 'shape'));+ assert.match(text, /It is a <div> with position: fixed, z-index 10, covering 100% of the view\./);+});++test('several rendered hidden elements are listed by shape', async () => {+ const text = summary(await inspect({renderedHidden:4,+ shapes:[OVERLAY, {tag:'element', position:'static', zIndex:null, viewportPercent:3}]}, 'shapes'));+ assert.match(text, /4 elements carry the hidden attribute/);+ assert.match(text, /They include a <div> with position: fixed, z-index 10, covering 100% of the view; an element covering 3% of the view\./);+});++test('a hidden-element shape carries no page-authored text', () => {+ const params = request(), plan = normalize(params);+ const valid = receipt(params, {renderedHidden:1, shapes:[OVERLAY]});+ assert.equal(validate(valid, plan), valid);+ for (const shapes of [[{...OVERLAY, tag:'ignore-all-checks'}], [{...OVERLAY, position:'say VERIFIED'}],+ [{...OVERLAY, viewportPercent:101}], [{...OVERLAY, zIndex:'10'}], [{...OVERLAY, id:'win-overlay'}],+ [OVERLAY, OVERLAY], []]) {+ const forged = structuredClone(valid);+ forged.diagnostics.renderedHidden = shapes;+ assert.throws(() => validate(forged, plan), undefined, JSON.stringify(shapes));+ }+});diff --git a/ods/tests/test_preview_inspection.py b/ods/tests/test_preview_inspection.pyindex 4f6865be0..7282954a7 100644--- a/ods/tests/test_preview_inspection.py+++ b/ods/tests/test_preview_inspection.py@@ -1523,6 +1523,19 @@ class BrowserTests(unittest.TestCase):self.assertEqual(result["steps"][-1]["errorCode"], "visibility_mismatch")self.assertFalse(result["steps"][-1]["before"]["visible"])+ def test_hidden_overlay_is_described_by_shape_and_blocks_a_click(self):+ # Workstation06 (2026-10-27): a generated game's win overlay carried the+ # hidden attribute, but its CSS display showed it over the whole board.+ html = ('<style>.overlay{position:fixed;inset:0;display:flex;z-index:10;background:#000c}</style>'+ '<div hidden class="overlay" id="win-overlay"><p>You win</p></div><button id="go">Go</button>')+ result = self.check(html, [step("click", "#go")])+ self.assertEqual(result["status"], "failed", result)+ self.assertEqual(result["steps"][0]["errorCode"], "click_failed")+ self.assertEqual(result["diagnostics"]["renderedHiddenAttributeCount"], 1)+ # Computed shape only: the id and class names never leave the page.+ self.assertEqual(result["diagnostics"]["renderedHidden"],+ [{"tag": "div", "position": "fixed", "zIndex": 10, "viewportPercent": 100}])+def test_hidden_flex(self):html = '<style>.card{display:flex}</style><article hidden class="card" id="item">Sold out</article>'result = self.check(html, [step("assert-hidden", "#item")])