diff --git a/docs/site/app.js b/docs/site/app.js index dec057d0f..30f2377fc 100644 --- a/docs/site/app.js +++ b/docs/site/app.js @@ -1,6 +1,6 @@ -import {verifiedJSON, verifiedBytes, validateStatus, validateCoefficient, safeSourceURL, hex40, hex64} from './core.mjs?site-release=ce4cc9c4ecb150312c85c9125729a04d05b118679807deb631951a311dbd86c6'; -import {connectCatalogQuery} from './catalog-query.mjs?site-release=ce4cc9c4ecb150312c85c9125729a04d05b118679807deb631951a311dbd86c6'; -import {prepareWorkspaceFragment} from './workspace-fragment.mjs?site-release=ce4cc9c4ecb150312c85c9125729a04d05b118679807deb631951a311dbd86c6'; +import {verifiedJSON, verifiedBytes, validateStatus, validateCoefficient, safeSourceURL, hex40, hex64} from './core.mjs?site-release=4ec25edbe710c46618bf3d41c98095262202d484bcad5b9e956627b23843ed36'; +import {connectCatalogQuery} from './catalog-query.mjs?site-release=4ec25edbe710c46618bf3d41c98095262202d484bcad5b9e956627b23843ed36'; +import {prepareWorkspaceFragment} from './workspace-fragment.mjs?site-release=4ec25edbe710c46618bf3d41c98095262202d484bcad5b9e956627b23843ed36'; const finishFragment=prepareWorkspaceFragment(); const el=id=>document.getElementById(id); const node=(tag,text,cls)=>{const n=document.createElement(tag);if(text!==undefined)n.textContent=text;if(cls)n.className=cls;return n;}; diff --git a/docs/site/brand.css b/docs/site/brand.css index a4f06d3a8..05ea5d64d 100644 --- a/docs/site/brand.css +++ b/docs/site/brand.css @@ -58,7 +58,7 @@ body > header { color: var(--ul-text); font-weight: 750; letter-spacing: .13em; position: relative; padding-left: 57px; min-height: 44px; line-height: 1.65; } -.brand::before { content: ""; position: absolute; left: 0; top: 1px; width: 42px; height: 42px; background: url("brand/mark.svg?site-release=ce4cc9c4ecb150312c85c9125729a04d05b118679807deb631951a311dbd86c6") center/contain no-repeat; } +.brand::before { content: ""; position: absolute; left: 0; top: 1px; width: 42px; height: 42px; background: url("brand/mark.svg?site-release=4ec25edbe710c46618bf3d41c98095262202d484bcad5b9e956627b23843ed36") center/contain no-repeat; } .brand span { color: var(--ul-muted); font-size: 10px; letter-spacing: .18em; } nav { gap: 12px 24px; flex-wrap: wrap; } nav a { color: var(--ul-text); min-height: 36px; display: inline-flex; align-items: center; font-size: 13px; } diff --git a/docs/site/cite.html b/docs/site/cite.html index e1472d6a2..50a991bd5 100644 --- a/docs/site/cite.html +++ b/docs/site/cite.html @@ -4,8 +4,8 @@ Cite · Universal Law - - + +
UNIVERSAL LAW MATHEMATICS IN THE OPEN
diff --git a/docs/site/cite.mjs b/docs/site/cite.mjs index a0ffc425b..a13425187 100644 --- a/docs/site/cite.mjs +++ b/docs/site/cite.mjs @@ -1,4 +1,4 @@ -import {wireReferenceForm} from './source-reference.mjs?site-release=ce4cc9c4ecb150312c85c9125729a04d05b118679807deb631951a311dbd86c6'; +import {wireReferenceForm} from './source-reference.mjs?site-release=4ec25edbe710c46618bf3d41c98095262202d484bcad5b9e956627b23843ed36'; const byId = id => document.getElementById(id); wireReferenceForm({form:byId('reference-form'), repository:byId('reference-repository'), commit:byId('reference-commit'), path:byId('reference-path'), sha256:byId('reference-sha256'), output:byId('reference-output'), json:byId('reference-json'), bibtex:byId('reference-bibtex'), link:byId('reference-link'), status:byId('reference-status'), actions:byId('reference-actions'), copyText:byId('reference-copy'), copyJSON:byId('reference-copy-json'), copyBibTeX:byId('reference-copy-bibtex'), share:byId('reference-share'), clipboard:globalThis.navigator?.clipboard, location:globalThis.location, history:globalThis.history, events:globalThis.window}); byId('reference-builder').hidden = false; diff --git a/docs/site/conditionals.mjs b/docs/site/conditionals.mjs index 9ed52e22d..3342263ac 100644 --- a/docs/site/conditionals.mjs +++ b/docs/site/conditionals.mjs @@ -93,7 +93,7 @@ export function renderProjection(document,host,data,source){ el(document,'p','Generated from verified source bytes. This graph is not formal verification, a proof review, or a scientific-status register.')); host.replaceChildren(article); } -const services=()=>import('./museum.mjs?site-release=ce4cc9c4ecb150312c85c9125729a04d05b118679807deb631951a311dbd86c6'); +const services=()=>import('./museum.mjs?site-release=4ec25edbe710c46618bf3d41c98095262202d484bcad5b9e956627b23843ed36'); // The museum module already verifies config → manifest → index/status once per // page fetch and caches every pinned byte request. This route consumes that same // verified startup, so it adds only the audited-descriptor check and projection. diff --git a/docs/site/curvature-export.mjs b/docs/site/curvature-export.mjs index 2e0fa2514..e23ae685b 100644 --- a/docs/site/curvature-export.mjs +++ b/docs/site/curvature-export.mjs @@ -1,6 +1,6 @@ // Bounded, local export of the Peaks and saddles teaching diagram. No source fetch // or proof verification occurs here; the identity below is recorded provenance. -import { coneModel } from './explore-models.mjs?site-release=ce4cc9c4ecb150312c85c9125729a04d05b118679807deb631951a311dbd86c6'; +import { coneModel } from './explore-models.mjs?site-release=4ec25edbe710c46618bf3d41c98095262202d484bcad5b9e956627b23843ed36'; const SVG_NS = 'http://www.w3.org/2000/svg'; const PUBLIC_EXPLORE = 'https://d6g8k5htny-coder.github.io/main/site/explore.html'; diff --git a/docs/site/dependencies.html b/docs/site/dependencies.html index 7dad0af14..cfac0f15d 100644 --- a/docs/site/dependencies.html +++ b/docs/site/dependencies.html @@ -7,11 +7,11 @@ Claim dependency viewer · Universal Law - - - - - + + + + + diff --git a/docs/site/dependencies.mjs b/docs/site/dependencies.mjs index 6b796ecb4..824d1b6fd 100644 --- a/docs/site/dependencies.mjs +++ b/docs/site/dependencies.mjs @@ -11,7 +11,7 @@ import { parsePinnedGraph, recordedContextRows, unresolvedTargets, -} from './dependency-model.mjs?site-release=ce4cc9c4ecb150312c85c9125729a04d05b118679807deb631951a311dbd86c6'; +} from './dependency-model.mjs?site-release=4ec25edbe710c46618bf3d41c98095262202d484bcad5b9e956627b23843ed36'; const byId = id => document.getElementById(id); diff --git a/docs/site/explore-models.mjs b/docs/site/explore-models.mjs index 28f6b0f20..6ef016704 100644 --- a/docs/site/explore-models.mjs +++ b/docs/site/explore-models.mjs @@ -1,6 +1,6 @@ // NON-CERTIFYING educational arithmetic. These functions illustrate source // definitions; they do not simulate a field or estimate a theorem's constants. -import { annulusModel, p15Model, remoteModel } from './geometry.mjs?site-release=ce4cc9c4ecb150312c85c9125729a04d05b118679807deb631951a311dbd86c6'; +import { annulusModel, p15Model, remoteModel } from './geometry.mjs?site-release=4ec25edbe710c46618bf3d41c98095262202d484bcad5b9e956627b23843ed36'; function finite(value, name) { if (!Number.isFinite(value)) throw new RangeError(`${name} must be finite`); diff --git a/docs/site/explore.html b/docs/site/explore.html index dafa00c20..8d800d541 100644 --- a/docs/site/explore.html +++ b/docs/site/explore.html @@ -7,11 +7,11 @@ Explore the mathematics · Universal Law - - - - - + + + + + diff --git a/docs/site/explore.mjs b/docs/site/explore.mjs index 4aad0ceb9..37aa89640 100644 --- a/docs/site/explore.mjs +++ b/docs/site/explore.mjs @@ -1,10 +1,10 @@ -import { coneModel, pinModel, paletteModel, applyCurvaturePreset } from './explore-models.mjs?site-release=ce4cc9c4ecb150312c85c9125729a04d05b118679807deb631951a311dbd86c6'; -import { readExploreState, exploreStateURL } from './explore-state.mjs?site-release=ce4cc9c4ecb150312c85c9125729a04d05b118679807deb631951a311dbd86c6'; +import { coneModel, pinModel, paletteModel, applyCurvaturePreset } from './explore-models.mjs?site-release=4ec25edbe710c46618bf3d41c98095262202d484bcad5b9e956627b23843ed36'; +import { readExploreState, exploreStateURL } from './explore-state.mjs?site-release=4ec25edbe710c46618bf3d41c98095262202d484bcad5b9e956627b23843ed36'; -import { captureCurvatureDiagram, serializeCurvatureSVG, createCitationController } from './curvature-export.mjs?site-release=ce4cc9c4ecb150312c85c9125729a04d05b118679807deb631951a311dbd86c6'; -import { captureTeachingDiagram, createFigureCitationController } from './teaching-export.mjs?site-release=ce4cc9c4ecb150312c85c9125729a04d05b118679807deb631951a311dbd86c6'; -import { serializePinSVG, pinFigureCitation } from './pin-export.mjs?site-release=ce4cc9c4ecb150312c85c9125729a04d05b118679807deb631951a311dbd86c6'; -import { serializePaletteSVG, paletteFigureCitation } from './palette-export.mjs?site-release=ce4cc9c4ecb150312c85c9125729a04d05b118679807deb631951a311dbd86c6'; +import { captureCurvatureDiagram, serializeCurvatureSVG, createCitationController } from './curvature-export.mjs?site-release=4ec25edbe710c46618bf3d41c98095262202d484bcad5b9e956627b23843ed36'; +import { captureTeachingDiagram, createFigureCitationController } from './teaching-export.mjs?site-release=4ec25edbe710c46618bf3d41c98095262202d484bcad5b9e956627b23843ed36'; +import { serializePinSVG, pinFigureCitation } from './pin-export.mjs?site-release=4ec25edbe710c46618bf3d41c98095262202d484bcad5b9e956627b23843ed36'; +import { serializePaletteSVG, paletteFigureCitation } from './palette-export.mjs?site-release=4ec25edbe710c46618bf3d41c98095262202d484bcad5b9e956627b23843ed36'; const ns = 'http://www.w3.org/2000/svg'; const byId = id => document.getElementById(id); diff --git a/docs/site/formal.html b/docs/site/formal.html index e2a4fd29b..982c8e97d 100644 --- a/docs/site/formal.html +++ b/docs/site/formal.html @@ -4,9 +4,9 @@ Formal verification · Universal Law - - - + + + diff --git a/docs/site/index.html b/docs/site/index.html index c89ed919b..e6333ad28 100644 --- a/docs/site/index.html +++ b/docs/site/index.html @@ -4,8 +4,8 @@ Universal Law · The shape of randomness - - + +
UNIVERSAL LAW MATHEMATICS IN THE OPEN
diff --git a/docs/site/measure.html b/docs/site/measure.html index 899fbc3a2..356a7a976 100644 --- a/docs/site/measure.html +++ b/docs/site/measure.html @@ -7,11 +7,11 @@ From counts to density · Universal Law - - - - - + + + + + diff --git a/docs/site/measure.mjs b/docs/site/measure.mjs index feb4aa735..f313c4b2a 100644 --- a/docs/site/measure.mjs +++ b/docs/site/measure.mjs @@ -1,4 +1,4 @@ -import { measurementModel, parseMeasurementInputs } from './measurement-model.mjs?site-release=ce4cc9c4ecb150312c85c9125729a04d05b118679807deb631951a311dbd86c6'; +import { measurementModel, parseMeasurementInputs } from './measurement-model.mjs?site-release=4ec25edbe710c46618bf3d41c98095262202d484bcad5b9e956627b23843ed36'; const byId = id => document.getElementById(id); const fields = Object.fromEntries(['count', 'realizations', 'lower', 'upper'].map(name => [name, byId(`measure-${name}`)])); diff --git a/docs/site/museum.html b/docs/site/museum.html index 3044133fd..b153daed5 100644 --- a/docs/site/museum.html +++ b/docs/site/museum.html @@ -4,11 +4,11 @@ Source records & exhibits · Universal Law - + - - + + diff --git a/docs/site/museum.mjs b/docs/site/museum.mjs index 592a68459..716ee8018 100644 --- a/docs/site/museum.mjs +++ b/docs/site/museum.mjs @@ -1,5 +1,5 @@ -import {renderSourceQuote} from './source-quote.mjs?site-release=ce4cc9c4ecb150312c85c9125729a04d05b118679807deb631951a311dbd86c6'; -import {verifiedBytes, hex40, hex64} from './core.mjs?site-release=ce4cc9c4ecb150312c85c9125729a04d05b118679807deb631951a311dbd86c6'; +import {renderSourceQuote} from './source-quote.mjs?site-release=4ec25edbe710c46618bf3d41c98095262202d484bcad5b9e956627b23843ed36'; +import {verifiedBytes, hex40, hex64} from './core.mjs?site-release=4ec25edbe710c46618bf3d41c98095262202d484bcad5b9e956627b23843ed36'; export const DISCLAIMER='This canvas explains the pinned source. It is not a proof and does not change status.'; const REVIEWED_IDS=['d2-lifetime-remainder','d3-side24-coefficient','d4-fixed-remote-rn','d5-all-height-annulus','d5-height-window-annulus','d5-two-scale','d5-inner-belt-density','d5-fixed-transverse','cumulative-transfer-correction','p15-demand-one-counterexample','d6-p15-full-price']; @@ -247,7 +247,7 @@ function prepareClaimFragment(document,window,currentHash) { return true; }; } -export async function startMuseum({document=globalThis.document,window=globalThis.window,fetcher=globalThis.fetch,search=globalThis.location?.search||'',geometryLoader=()=>import('./geometry.mjs?site-release=ce4cc9c4ecb150312c85c9125729a04d05b118679807deb631951a311dbd86c6'),currentHash=()=>globalThis.location?.hash||''}={}){ +export async function startMuseum({document=globalThis.document,window=globalThis.window,fetcher=globalThis.fetch,search=globalThis.location?.search||'',geometryLoader=()=>import('./geometry.mjs?site-release=4ec25edbe710c46618bf3d41c98095262202d484bcad5b9e956627b23843ed36'),currentHash=()=>globalThis.location?.hash||''}={}){ const ids=['museum-state','claim-cards','lifetime-fixture','packet-cards','active-exhibit']; const containers=Object.fromEntries(ids.map(id=>{const node=document.getElementById(id);if(!node)throw Error(`Missing museum container: ${id}`);return [id,node];})); const finishFragment=prepareClaimFragment(document,window,currentHash); diff --git a/docs/site/palette-export.mjs b/docs/site/palette-export.mjs index 447309e02..6de880c31 100644 --- a/docs/site/palette-export.mjs +++ b/docs/site/palette-export.mjs @@ -1,7 +1,7 @@ // Bounded teaching export of Explore's current finite P15 diagram. Source // custody is provenance; this module performs no mathematical verification. -import { paletteModel } from './explore-models.mjs?site-release=ce4cc9c4ecb150312c85c9125729a04d05b118679807deb631951a311dbd86c6'; -import { serializeTeachingSVG } from './teaching-export.mjs?site-release=ce4cc9c4ecb150312c85c9125729a04d05b118679807deb631951a311dbd86c6'; +import { paletteModel } from './explore-models.mjs?site-release=4ec25edbe710c46618bf3d41c98095262202d484bcad5b9e956627b23843ed36'; +import { serializeTeachingSVG } from './teaching-export.mjs?site-release=4ec25edbe710c46618bf3d41c98095262202d484bcad5b9e956627b23843ed36'; const PUBLIC_EXPLORE = 'https://d6g8k5htny-coder.github.io/main/site/explore.html'; const SOURCE = Object.freeze({ diff --git a/docs/site/pin-export.mjs b/docs/site/pin-export.mjs index d0d83b7c1..4aff479c6 100644 --- a/docs/site/pin-export.mjs +++ b/docs/site/pin-export.mjs @@ -1,7 +1,7 @@ // Bounded export of the CURRENT displayed Approach-points teaching diagram. // Pinned source identities are provenance, not proof acceptance or verification. -import { pinModel } from './explore-models.mjs?site-release=ce4cc9c4ecb150312c85c9125729a04d05b118679807deb631951a311dbd86c6'; -import { serializeTeachingSVG } from './teaching-export.mjs?site-release=ce4cc9c4ecb150312c85c9125729a04d05b118679807deb631951a311dbd86c6'; +import { pinModel } from './explore-models.mjs?site-release=4ec25edbe710c46618bf3d41c98095262202d484bcad5b9e956627b23843ed36'; +import { serializeTeachingSVG } from './teaching-export.mjs?site-release=4ec25edbe710c46618bf3d41c98095262202d484bcad5b9e956627b23843ed36'; const PUBLIC_EXPLORE='https://d6g8k5htny-coder.github.io/main/site/explore.html'; const COMMIT='d6628da09384728992dcbe6e921cc28ba85aebb0'; diff --git a/docs/site/reproduce.html b/docs/site/reproduce.html index bdaea57bc..08ccbc145 100644 --- a/docs/site/reproduce.html +++ b/docs/site/reproduce.html @@ -4,9 +4,9 @@ Reproduce · Universal Law - + - +
UNIVERSAL LAW MATHEMATICS IN THE OPEN
diff --git a/docs/site/research.html b/docs/site/research.html index b2666ebea..05cc56d64 100644 --- a/docs/site/research.html +++ b/docs/site/research.html @@ -4,7 +4,7 @@ Research · Universal Law - +
UNIVERSAL LAW THE RESEARCH
diff --git a/docs/site/teaching-export.mjs b/docs/site/teaching-export.mjs index 42e322c8f..70186bff6 100644 --- a/docs/site/teaching-export.mjs +++ b/docs/site/teaching-export.mjs @@ -27,6 +27,22 @@ function boundedNumber(value, min=0, max=600, units=false) { if(!/^-?(?:\d+(?:\.\d*)?|\.\d+)$/.test(numberText) || !Number.isFinite(number) || numbermax) refuse('unbounded numeric primitive or style'); return String(number===0?0:number); } +function nativeRectHeightMatches(node,source,displayed) { + try { + // CSSOM can serialize this height with six significant digits. Matching + // that string alone cannot distinguish a genuine nearby CSS override. + // Parse the bounded exact attribute string through the same native parser: + // SVGLength parsing need not equal JavaScript Number-to-Float32 conversion. + // The reference stays detached; getBBox independently observes used geometry. + const reference=node.ownerDocument.createElementNS(SVG_NS,'rect'); + reference.setAttribute('height',source); + const parsed=reference.height.baseVal.value; + const native=node.height?.baseVal?.value,used=node.getBBox().height; + return Number.isFinite(parsed) && parsed>0 && parsed<=600 && parsed===Math.fround(parsed) + && native===parsed && Number.isFinite(used) && used===parsed + && displayed===Number(parsed.toPrecision(6)); + } catch { return false; } +} function color(value, opaque=false) { if(typeof value !== 'string' || value.length>64) refuse('unsupported color'); if(!opaque && value==='none')return value; @@ -145,7 +161,8 @@ export function captureTeachingDiagram(svg,computedStyle=globalThis.getComputedS if(displayed==='auto')refuse('auto CSS geometry suppresses or changes current attributes'); const actual=Number(boundedNumber(displayed,0,key==='r'?300:600,true)); const expected=Object.hasOwn(currentAttributes,key)?Number(boundedNumber(currentAttributes[key])):0; - if(Math.abs(actual-expected)>1e-6)refuse('CSS geometry differs from current attributes'); + if(Math.abs(actual-expected)>1e-6 && !(node.localName==='rect' && key==='height' + && nativeRectHeightMatches(node,currentAttributes[key],actual)))refuse('CSS geometry differs from current attributes'); } if(node.localName==='rect') { const width=Number(boundedNumber(currentAttributes.width)),height=Number(boundedNumber(currentAttributes.height)); diff --git a/docs/site/workspace.html b/docs/site/workspace.html index 4c579b163..03d6dffcb 100644 --- a/docs/site/workspace.html +++ b/docs/site/workspace.html @@ -4,9 +4,9 @@ Research workspace · Universal Law - - - + + + diff --git a/tests/test_teaching_export.mjs b/tests/test_teaching_export.mjs index f4adc4c86..c03d9cc31 100644 --- a/tests/test_teaching_export.mjs +++ b/tests/test_teaching_export.mjs @@ -86,6 +86,94 @@ function rectSVG(attributes,geometry) { Object.assign(rect.style,geometry);return svg; } +// A controlled native-geometry witness exercises the guard, not browser layout. +// The hosted browser harness separately records real SVGLength/getBBox values. +function heightSVG(height='11.888639999999995',displayed='11.8886px') { + const svg=rectSVG({x:'448',y:'78',width:'113',height,class:'diagram-fill'}, + {x:'448px',y:'78px',width:'113px',height:displayed,rx:'auto',ry:'auto'}); + // The first tuple is measured Chromium parsing, which differs from JS fround. + // Other fixture values remain explicitly simulated, not browser evidence. + const parse=value=>value==='11.888639999999995'?11.888639450073242:Math.fround(Number(value)); + const rect=svg.children[2],native=parse(height); + rect.height={baseVal:{value:native}}; + rect.getBBox=()=>({x:448,y:78,width:113,height:native}); + rect.ownerDocument={createElementNS(namespace,tag){ + assert.equal(namespace,ns);assert.equal(tag,'rect'); + return {height:{baseVal:{value:0}},setAttribute(key,value){assert.equal(key,'height');this.height.baseVal.value=parse(value);}}; + }}; + return svg; +} + +test('rounded rectangle height requires a matching native used-height witness',()=>{ + const capture=api('captureTeachingDiagram'); + const svg=heightSVG(); + assert.equal(svg.children[2].height.baseVal.value,11.888639450073242); + assert.equal(capture(svg,computedStyle).nodes[2].attributes.height,'11.888639999999995'); + // The original comparison still suffices without any native witness. + const exact=heightSVG('13.4375','13.4375px');delete exact.children[2].getBBox; + assert.equal(capture(exact,computedStyle).nodes[2].attributes.height,'13.4375'); +}); + +test('captured Chromium attribute parsing need not equal JavaScript Float32 conversion',()=>{ + const svg=heightSVG(),rect=svg.children[2]; + assert.notEqual(rect.height.baseVal.value,Math.fround(Number(rect.attributes.find(a=>a.name==='height').value))); + assert.equal(api('captureTeachingDiagram')(svg,computedStyle).nodes[2].attributes.height,'11.888639999999995'); +}); + +test('native height equality cannot admit real CSS overrides sharing a rounded string',()=>{ + const capture=api('captureTeachingDiagram'); + for(const actual of [11.88861,11.88862,11.88864,11.88865,12,0]) { + const svg=heightSVG();svg.children[2].getBBox=()=>({height:Math.fround(actual)}); + assert.throws(()=>capture(svg,computedStyle),/geometry|refused/i); + } + // Equal reflected/used values cannot disguise a changed source attribute. + const wrong=heightSVG();wrong.children[2].height.baseVal.value=Math.fround(11.88861); + wrong.children[2].getBBox=()=>({height:Math.fround(11.88861)}); + assert.throws(()=>capture(wrong,computedStyle),/geometry|refused/i); +}); + +test('rectangle height witness is finite, bounded and fail-closed',()=>{ + const capture=api('captureTeachingDiagram'); + for(const change of [ + r=>delete r.getBBox,r=>r.getBBox=()=>{throw Error('unavailable');}, + r=>r.getBBox=()=>null,r=>r.getBBox=()=>({}),r=>delete r.height, + r=>r.height={baseVal:null},r=>Object.defineProperty(r,'height',{get(){throw Error('unavailable');}}), + r=>delete r.ownerDocument,r=>r.ownerDocument.createElementNS=()=>{throw Error('unavailable');}, + r=>delete r.ownerDocument.createElementNS, + r=>r.ownerDocument.createElementNS=()=>null, + r=>r.ownerDocument.createElementNS=()=>({setAttribute(){throw Error('unavailable');}}), + r=>r.ownerDocument.createElementNS=()=>({setAttribute(){}}), + r=>r.ownerDocument.createElementNS=()=>({setAttribute(){},get height(){throw Error('unavailable');}}), + r=>r.ownerDocument.createElementNS=()=>({setAttribute(){},height:{baseVal:{value:11.88861}}}), + ...[NaN,Infinity,-Infinity,-1,0,601,'11.888640403747559',11.888639999999995].flatMap(value=>[ + r=>r.getBBox=()=>({height:value}),r=>r.height.baseVal.value=value, + r=>r.ownerDocument.createElementNS=()=>({setAttribute(){},height:{baseVal:{value}}}) + ]) + ]) { + const svg=heightSVG();change(svg.children[2]); + assert.throws(()=>capture(svg,computedStyle),/geometry|refused/i); + } +}); + +test('native representation check is bounded to positive rectangle height roundoff',()=>{ + const capture=api('captureTeachingDiagram'); + for(const [height,displayed] of [['15.99999','16px'],['16.00001','16px'],['40.12416','40.1242px'],['143.08250000000004','143.083px'],['599.99999','600px']]) { + assert.equal(capture(heightSVG(height,displayed),computedStyle).nodes[2].attributes.height,height); + } + // No broad epsilon increase, arbitrary computed string, or other-axis fallback. + for(const displayed of ['11.888638px','11.889px','12px','0px','-1px','NaN','Infinity','auto']) + assert.throws(()=>capture(heightSVG(undefined,displayed),computedStyle),/geometry|refused/i); + for(const height of ['0','-1','601','NaN','Infinity']) + assert.throws(()=>capture(heightSVG(height,'11.8886px'),computedStyle),/geometry|refused/i); + const nonnative=heightSVG();nonnative.children[2].height.baseVal.value=11.888639999999995; + nonnative.children[2].getBBox=()=>({height:11.888639999999995}); + assert.throws(()=>capture(nonnative,computedStyle),/geometry|refused/i); + const otherAxis=heightSVG();otherAxis.children[2].style.width='112.999px'; + assert.throws(()=>capture(otherAxis,computedStyle),/geometry|refused/i); + assert.equal(capture(heightSVG('0','0px'),computedStyle).nodes[2].attributes.height,'0'); + assert.equal(capture(heightSVG('600','600px'),computedStyle).nodes[2].attributes.height,'600'); +}); + test('capture refuses auto rectangle dimensions that suppress otherwise current native geometry',()=>{ const capture=api('captureTeachingDiagram'); const attributes={x:'36',y:'157',width:'178',height:'90',rx:'12',class:'diagram-box'}; diff --git a/tools/public_shop_browser_check.py b/tools/public_shop_browser_check.py index fc4a25cb9..d0c855de2 100644 --- a/tools/public_shop_browser_check.py +++ b/tools/public_shop_browser_check.py @@ -844,6 +844,99 @@ def read_svg(kind, params, fragment, label): page.locator('#' + fragment).screenshot(path=str(shot)) result['other_teaching_screenshots'].append({'path': shot.name, 'sha256': sha256(shot.read_bytes()).hexdigest()}) + # BQ-26: real layout evidence, separate from mocked native-witness unit tests. + result['pin_height_geometry'] = [] + for region in ['annulus', 'remote']: + page.goto(origin + f'explore.html?r=0.25®ion={region}#distance') + distance = page.locator('#pin-distance') + export = page.locator('#pin-export-svg'); copy = page.locator('#pin-copy-citation') + citation = page.locator('#pin-citation-text') + rect = page.locator('#pin-diagram rect') + + def height_observation(label): + observation = rect.evaluate("""async n=>{ + const entry=new URL(document.querySelector('script[src]').src); + const module=new URL('teaching-export.mjs'+entry.search,entry); + const {captureTeachingDiagram}=await import(module.href); + let captureError=null; + try{captureTeachingDiagram(n.ownerSVGElement);}catch(error){captureError=String(error);} + const reference=document.createElementNS(n.namespaceURI,'rect'); + reference.setAttribute('height',n.getAttribute('height')); + return {attribute:n.getAttribute('height'), + computed:getComputedStyle(n).getPropertyValue('height'), + reflected:n.height.baseVal.value,used:n.getBBox().height, + parsed:reference.height.baseVal.value, + float32:Math.fround(Number(n.getAttribute('height'))), + typed:n.computedStyleMap?.().get('height')?.value, + captureError}; + }""") + result['pin_height_geometry'].append({'region':region,'case':label,**observation}) + return observation + + for label, key in [('0.25-before', None), ('0.24-rounded', 'ArrowLeft'), ('0.25-after', 'ArrowRight')]: + if key: + distance.focus(); page.keyboard.press(key) + expect(distance).to_have_value('0.24' if key == 'ArrowLeft' else '0.25') + observation = height_observation(label) + expect(export).to_be_enabled(); expect(copy).to_be_enabled() + require(0 < observation['used'] <= 600 + and observation['used'] == observation['reflected'] == observation['parsed'], + 'Native used-height witness does not match the independently parsed attribute') + if key == 'ArrowLeft': + require(observation['attribute'] == '11.888639999999995' + and observation['computed'] == '11.8886px' + and abs(float(observation['computed'][:-2]) - float(observation['attribute'])) > 1e-6, + 'Native rounding regression did not exercise the original refusal') + with page.expect_download() as pending: + native_button(export) + path = output / f'{result["case"]}-pin-0.24-{region}.svg' + pending.value.save_as(str(path)); data = path.read_bytes() + root = ElementTree.fromstring(data) + metadata = json.loads(root.find('s:metadata', ns).text) + require(metadata['params'] == {'r':0.24,'region':region} + and metadata['height_gap'] == 0.013824 + and metadata['height_window'] == [0.986176,1] + and metadata['verification'] == 'not_performed', + 'Rounded-height export changed canonical teaching metadata') + require(any(n.get('height') == observation['attribute'] and n.get('width') == '113' + for n in root.findall('s:rect', ns)), + 'Rounded-height export rewrote source geometry') + require('non-certifying' in data.decode() and 'No field, count, probability, lifetime or theorem computation.' in data.decode(), + 'Rounded-height export lost teaching/non-certification labels') + result['other_teaching_svgs'].append({'path':path.name,'sha256':sha256(data).hexdigest(),'metadata':metadata}) + + distance.focus(); page.keyboard.press('ArrowLeft') + expect(distance).to_have_value('0.24') + native = height_observation('native-before-overrides') + for css_height in ['11.88861px', '11.88864px', '11.889px', '0px', 'auto']: + fixture = css_fixture(f'#pin-diagram rect{{height:{css_height}}}') + try: + changed = height_observation('CSS-height-' + css_height) + require(changed['attribute'] == native['attribute'] and changed['reflected'] == native['reflected'] + and changed['used'] != native['used'], 'CSS fixture did not change only the used height') + if css_height in ['11.88861px', '11.88864px']: + require(changed['computed'] == native['computed'], + 'Nearby CSS override did not share the native rounded string') + native_button(copy) + expect(export).to_be_disabled(); expect(copy).to_be_disabled(); expect(citation).to_have_value('') + finally: + remove_css_fixture(fixture) + distance.focus(); page.keyboard.press('ArrowRight'); page.keyboard.press('ArrowLeft') + expect(export).to_be_enabled(); expect(copy).to_be_enabled() + + # Full supported hundredth-tick range, using actual native input/layout. + # This is headless Chromium, not emulated computed styles or native zoom. + distance.focus(); page.keyboard.press('Home') + for tick in range(5, 61): + if tick > 5: + page.keyboard.press('ArrowRight') + expect(distance).to_have_value(str(tick / 100)) + expect(export).to_be_enabled(); expect(copy).to_be_enabled() + observed = height_observation(f'tick-{tick}') + require(0 < observed['used'] <= 600 and observed['used'] == observed['reflected'] == observed['parsed'], + 'Supported slider tick lost native geometry identity') + result['steps'].append('BQ-26 native .25/.24/.25 recovery and SVG metadata, same-rounded-string real CSS override refusal, zero/auto refusal, and all 56 ticks in both highlights checked') + # Fresh Explore page, never the previous Formal page. Static output describes # its true starting values even when the URL asks for a different example. static = page.context.browser.new_context(viewport=result['viewport'], color_scheme=result['color_scheme'], java_script_enabled=False)