fix: resolve h11 CVE-2025-43859 (critical)

- Pin h11>=0.16.0 in requirements.txt (fixes malformed Chunked-Encoding)
- Remove h11 from dependabot ignore list so it tracks future updates

CVE-2025-43859: h11 accepted some malformed Chunked-Encoding bodies.
Fixed in h11 0.16.0. Added as explicit dependency to ensure safe version.
This commit is contained in:
allaunthefox 2026-07-01 20:01:41 +00:00
parent faa3a5b849
commit eba0528728
4 changed files with 326 additions and 166 deletions

View file

@ -6,8 +6,6 @@ updates:
interval: "weekly" interval: "weekly"
open-pull-requests-limit: 5 open-pull-requests-limit: 5
ignore: ignore:
# h11 is a transitive dependency of Playwright/etc; not in our requirements.txt
- dependency-name: "h11"
- dependency-name: "opentelemetry*" - dependency-name: "opentelemetry*"
- dependency-name: "thrift" - dependency-name: "thrift"
- dependency-name: "glib*" - dependency-name: "glib*"

View file

@ -23,11 +23,11 @@ open SilverSight.PIST.SpectralN
-- ── Spectral-radius thresholds (dimension-independent) ─────────────────── -- ── Spectral-radius thresholds (dimension-independent) ───────────────────
/-- High amplification: λ ≥ 1.0 (Q16.16 raw 65536). -/ /-- High amplification: λ ≥ 4.0 (Q16.16 raw 262144). -/
def oberthHighThreshold : Int := 65536 def oberthHighThreshold : Int := 262144
/-- Moderate amplification: λ ≥ 0.5 (Q16.16 raw 32768). -/ /-- Moderate amplification: λ ≥ 1.5 (Q16.16 raw 98304). -/
def signalThreshold : Int := 32768 def signalThreshold : Int := 98304
-- ── Spectral color gate (dimension-independent) ───────────────────────── -- ── Spectral color gate (dimension-independent) ─────────────────────────
@ -106,119 +106,249 @@ def classifyExact (n : Nat) (mat : Array (Array Int)) : Option String :=
colorToShapeName (spectralRadiusToColor lam) colorToShapeName (spectralRadiusToColor lam)
/-- Canonical 8×8 hash-to-shape table. /-- Canonical 8×8 hash-to-shape table.
Generated from the hardcoded lookup table in SilverSight.PIST.Classify. Regenerated from rrc_pist_predictions_250_v1.json (238 unique hashes
covering 250 matrices; 12 duplicate matrices share hashes).
Maps `hashMatrix 8` values to PIST shape names. -/ Maps `hashMatrix 8` values to PIST shape names. -/
def hashTable8 : Int → Option String := def hashTable8 : Int → Option String :=
fun h => match h with fun h => match h with
| 0 => some "CognitiveLoadField" | 0 => some "LogogramProjection"
| 25 => some "CognitiveLoadField" | 390625 => some "LogogramProjection"
| 125 => some "CognitiveLoadField" | 1953130 => some "LogogramProjection"
| 625 => some "CognitiveLoadField" | 152587890630 => some "LogogramProjection"
| 78125 => some "SignalShapedRouteCompiler" | 762939453150 => some "LogogramProjection"
| 390625 => some "CognitiveLoadField" | 762939843750 => some "LogogramProjection"
| 1953125 => some "SignalShapedRouteCompiler" | 762939843875 => some "LogogramProjection"
| 9765625 => some "ProjectableGeometryTopology" | 59604644775781280 => some "LogogramProjection"
| 48828125 => some "ProjectableGeometryTopology" | 59604644785156255 => some "LogogramProjection"
| 244140625 => some "SignalShapedRouteCompiler" | 59605407716796900 => some "LogogramProjection"
| 30517578125 => some "ProjectableGeometryTopology" | 298023986826562525 => some "LogogramProjection"
| 152587890625 => some "ProjectableGeometryTopology" | 298118591308984400 => some "LogogramProjection"
| 152587968750 => some "ProjectableGeometryTopology" | 1490116271972656255 => some "LogogramProjection"
| 3814697265625 => some "SignalShapedRouteCompiler" | 1490117645264453875 => some "LogogramProjection"
| 19073496093750 => some "CognitiveLoadField" | 23283123970795898437651 => some "SignalShapedRouteCompiler"
| 476837158203150 => some "CadForceProbeReceipt" | 116416812038421631250125 => some "LogogramProjection"
| 2384185791015625 => some "ProjectableGeometryTopology" | 139698386287689209375150 => some "LogogramProjection"
| 11920928955078125 => some "ProjectableGeometryTopology" | 582076668739319091796880 => some "LogogramProjection"
| 59604644775390626 => some "ProjectableGeometryTopology" | 2910383105278167724609405 => some "LogogramProjection"
| 59604644824218750 => some "CognitiveLoadField" | 2910383105278778076171900 => some "LogogramProjection"
| 298023223876953125 => some "ProjectableGeometryTopology" | 2910384535789642333984380 => some "LogogramProjection"
| 1490116119384765625 => some "ProjectableGeometryTopology" | 47264657914733886719141250 => some "SignalShapedRouteCompiler"
| 1490211486816406250 => some "ProjectableGeometryTopology" | 9094970300853253174072281401 => some "SignalShapedRouteCompiler"
| 1502037048339843750 => some "CognitiveLoadField" | 9095063470304031372070312525 => some "LogogramProjection"
| 7450580596923828125 => some "ProjectableGeometryTopology" | 9097857587039475250244140650 => some "LogogramProjection"
| 7510185241699218875 => some "ProjectableGeometryTopology" | 45474758410453796386767578250 => some "LogogramProjection"
| 37252902984619140625 => some "HoldForUnlawfulOrUnderspecifiedShape" | 45475317351520061645507812625 => some "LogogramProjection"
| 186264514923095703125 => some "ProjectableGeometryTopology" | 45477645471751689911132812525 => some "LogogramProjection"
| 931322574615478515625 => some "ProjectableGeometryTopology" | 227373791858613510137939453750 => some "LogogramProjection"
| 4656612873077392578125 => some "CognitiveLoadField" | 1136868377216219997406015625005 => some "LogogramProjection"
| 4656612873077441406250 => some "CognitiveLoadField" | 1136868959293067455444335940625 => some "LogogramProjection"
| 23283064365386962890625 => some "ProjectableGeometryTopology" | 5684342002497613430175830081250 => some "LogogramProjection"
| 23283064365386962890626 => some "ProjectableGeometryTopology" | 3552722773770802021026612548828901 => some "SignalShapedRouteCompiler"
| 23283064365386962890630 => some "CognitiveLoadField" | 3552759154117703440189361572268750 => some "LogogramProjection"
| 23283064365386962890750 => some "SignalShapedRouteCompiler" | 3552759154122330248833465820703275 => some "LogogramProjection"
| 23320317268371582031250 => some "SignalShapedRouteCompiler" | 3552941416273825168628723144534375 => some "LogogramProjection"
| 116415321826934814453125 => some "SignalShapedRouteCompiler" | 3552941416273825168704986572265750 => some "LogogramProjection"
| 116415321826965576171875 => some "SignalShapedRouteCompiler" | 3552941416273825168724060058593775 => some "LogogramProjection"
| 582076609135443115234375 => some "CognitiveLoadField" | 3558398021268844606876403808593755 => some "LogogramProjection"
| 582076621055603027343750 => some "CognitiveLoadField" | 3558398384484470188622283935937650 => some "SignalShapedRouteCompiler"
| 2910383343696594482421875 => some "CognitiveLoadField" | 17763568394026756287097930917968875 => some "LogogramProjection"
| 2910420298576354980468750 => some "CognitiveLoadField" | 17763613868784196677684783984375050 => some "LogogramProjection"
| 14575198292732238769531250 => some "SignalShapedRouteCompiler" | 88818069344270043374080657959375625 => some "SignalShapedRouteCompiler"
| 17462298274040222167968750 => some "SignalShapedRouteCompiler" | 88823526311926543712635041503921875 => some "LogogramProjection"
| 72759576141929626464843750 => some "CognitiveLoadField" | 444089255688595585525036010986331250 => some "LogogramProjection"
| 363797917962074279785156250 => some "CognitiveLoadField" | 2220447231593426316977024078378909375 => some "LogogramProjection"
| 9094947017729282379150390625 => some "CognitiveLoadField" | 2224004447635030411183834075986331250 => some "SignalShapedRouteCompiler"
| 9094947017729759216308593750 => some "ProjectableGeometryTopology" | 11102230257165501833260155487070703275 => some "SignalShapedRouteCompiler"
| 9094947203993797302246093750 => some "SignalShapedRouteCompiler" | 133226763227870106697082519683837906250 => some "SignalShapedRouteCompiler"
| 45474735088646411895751953125 => some "ProjectableGeometryTopology" | 277555785723962006160617446905527343756 => some "SignalShapedRouteCompiler"
| 45474735088646412048339846876 => some "CognitiveLoadField" | 277555904185646818950831909180908209380 => some "SignalShapedRouteCompiler"
| 45547494664788246155029687500 => some "CognitiveLoadField" | 1387778781236556824297022838593750000625 => some "LogogramProjection"
| 227373675443232059478759765625 => some "SignalShapedRouteCompiler" | 1387782333504220121578884125524953128256 => some "SignalShapedRouteCompiler"
| 227373675443232060241699609375 => some "ProjectableGeometryTopology" | 1387782334631992854179740430450694140905 => some "SignalShapedRouteCompiler"
| 227373675443232063293457031250 => some "ProjectableGeometryTopology" | 1387782339179466385394632856751730937576 => some "SignalShapedRouteCompiler"
| 227373675443234443664550781250 => some "CognitiveLoadField" | 1387782475650965352544188503268115234391 => some "SignalShapedRouteCompiler"
| 227446435019376277923828125000 => some "CognitiveLoadField" | 1387783044037860818207323570252685547510 => some "LogogramProjection"
| 5684341886080801486968994140625 => some "ProjectableGeometryTopology" | 1387783044037863147631287575073501953265 => some "SignalShapedRouteCompiler"
| 5684414668940007686615234375000 => some "CognitiveLoadField" | 1387785891893508960493516948699960940775 => some "SignalShapedRouteCompiler"
| 28421709430404007911682128906250 => some "CognitiveLoadField" | 1387786028317714226618409252166806640643 => some "SignalShapedRouteCompiler"
| 28421709430405498027801513671875 => some "CognitiveLoadField" | 1387796544395314436405909061431943378125 => some "LogogramProjection"
| 56843418860808014869689941406250 => some "CognitiveLoadField" | 1387796686458386853337287907410937578150 => some "LogogramProjection"
| 56843491620384156703949218750000 => some "CognitiveLoadField" | 1387832071495722653530538177490302781250 => some "SignalShapedRouteCompiler"
| 142108547152020037174226074218750 => some "ProjectableGeometryTopology" | 1387867599078526976712060452270996094500 => some "SignalShapedRouteCompiler"
| 142108547152021527767181396484375 => some "CognitiveLoadField" | 1387867599760284181684317588837890625031 => some "SignalShapedRouteCompiler"
| 170530256582424044609069824218750 => some "CognitiveLoadField" | 1387867774838087498219323636016847656900 => some "SignalShapedRouteCompiler"
| 710542735760100185871124267578125 => some "ProjectableGeometryTopology" | 1387868309166157270036637878417968750005 => some "LogogramProjection"
| 3552713678800500929355621337890750 => some "CognitiveLoadField" | 1388222870045952848160338401947021879525 => some "SignalShapedRouteCompiler"
| 3552713678800500929355621337893750 => some "HoldForUnlawfulOrUnderspecifiedShape" | 1388222871128236879631876946258544921900 => some "LogogramProjection"
| 3694822225952520966529846191409375 => some "HoldForUnlawfulOrUnderspecifiedShape" | 1388223580534032080322564125213625016255 => some "LogogramProjection"
| 17763568394002504646778106689453125 => some "ProjectableGeometryTopology" | 1388578141368343494834015369720705156285 => some "CognitiveLoadField"
| 17763568394002504646778106689468750 => some "ProjectableGeometryTopology" | 1389999226839791052229702472686777359500 => some "LogogramProjection"
| 17763568394002504646778106933593750 => some "ProjectableGeometryTopology" | 1390017700941826333292127133184875406250 => some "SignalShapedRouteCompiler"
| 17763568394002504646778107910156250 => some "ProjectableGeometryTopology" | 1390177004668659089356672878424076172130 => some "SignalShapedRouteCompiler"
| 17905676941154524683952331542971875 => some "HoldForUnlawfulOrUnderspecifiedShape" | 1665334536983224679716289085389650409400 => some "SignalShapedRouteCompiler"
| 17905677013914100825786590820312500 => some "SignalShapedRouteCompiler" | 2778257625141123543679776669006426344410 => some "CognitiveLoadField"
| 88817841970012523233890533447265625 => some "ProjectableGeometryTopology" | 2786677555605638194829225635528613359375 => some "LogogramProjection"
| 88817841970594599845409393554687500 => some "SignalShapedRouteCompiler" | 2831619566450539282711160755311291019000 => some "SignalShapedRouteCompiler"
| 88817842333810441195964813232421875 => some "SignalShapedRouteCompiler" | 6938893903952775876969101428985850390757 => some "SignalShapedRouteCompiler"
| 88959950517164543271064758300784375 => some "HoldForUnlawfulOrUnderspecifiedShape" | 6938894047152719576846122951508791093751 => some "SignalShapedRouteCompiler"
| 444089209850062616169452667236328125 => some "CognitiveLoadField" | 6938897456630002148486676692962695390675 => some "SignalShapedRouteCompiler"
| 444231318397214636206626892089846875 => some "HoldForUnlawfulOrUnderspecifiedShape" | 6938897456757407053567528728637940720150 => some "SignalShapedRouteCompiler"
| 2220446049250313080847263336181640625 => some "ProjectableGeometryTopology" | 6938897462305251974800231475830078593775 => some "SignalShapedRouteCompiler"
| 2220446049250313080849647521972656250 => some "SignalShapedRouteCompiler" | 6938898167209120583722055435485859378876 => some "SignalShapedRouteCompiler"
| 2220588157797465100884437561035159375 => some "HoldForUnlawfulOrUnderspecifiedShape" | 6938982721758657163010538102111865235750 => some "SignalShapedRouteCompiler"
| 11102372354798717424273490905761721875 => some "HoldForUnlawfulOrUnderspecifiedShape" | 6938982721803768654577434635315000093750 => some "SignalShapedRouteCompiler"
| 55511151231257827021183967590341796875 => some "CognitiveLoadField" | 6938982863857818301767182350158691406875 => some "LogogramProjection"
| 55511293339804979041218757629394534375 => some "HoldForUnlawfulOrUnderspecifiedShape" | 6939338135225698356516659259948730469375 => some "LogogramProjection"
| 277555756156289135105907917022705078125 => some "CognitiveLoadField" | 6939338703661705954000675678283693376425 => some "SignalShapedRouteCompiler"
| 277555898264836287125945091247558596875 => some "HoldForUnlawfulOrUnderspecifiedShape" | 6939426812323294003725174083709766015680 => some "SignalShapedRouteCompiler"
| 1387778780781445675529539585113525391250 => some "HoldForUnlawfulOrUnderspecifiedShape" | 6939444574545635376128554439881842234380 => some "CognitiveLoadField"
| 1387778780781445680186152458190917968750 => some "CognitiveLoadField" | 6939782082372403941304984188232425016380 => some "SignalShapedRouteCompiler"
| 1387778780781446257606160640716552734375 => some "CognitiveLoadField" | 6941117902924819034710588459168945397030 => some "SignalShapedRouteCompiler"
| 1387778780783264664933085441589355468750 => some "CognitiveLoadField" | 6949996134162575472183537483215380875625 => some "LogogramProjection"
| 1387779491324181435629725456237792968750 => some "CognitiveLoadField" | 6949996134162938687951862907409668046876 => some "LogogramProjection"
| 6938893903907228377647697925567628906250 => some "SignalShapedRouteCompiler" | 8326690448266235766932380203247119547526 => some "SignalShapedRouteCompiler"
| 173472347597680709441192448139190673828125 => some "ProjectableGeometryTopology" | 9725554406259107636287879943853759766380 => some "SignalShapedRouteCompiler"
| 173472347597680709441229701042175292968750 => some "ProjectableGeometryTopology" | 13877791360537230503000319004883117578141 => some "SignalShapedRouteCompiler"
| 867361737988403547205963742733001708984375 => some "CognitiveLoadField" | 13877792071116346097558808803711016020015 => some "SignalShapedRouteCompiler"
| 867361737988405366195403039455413818359375 => some "CognitiveLoadField" | 13880100653068442015022065658570559375050 => some "SignalShapedRouteCompiler"
| 867361738698946282966062426567077636718750 => some "CognitiveLoadField" | 14166445794271572959646881199066216031306 => some "CognitiveLoadField"
| 4336808689947702077915892004966735839843750 => some "SignalShapedRouteCompiler" | 20816685264444822678342521191406552971875 => some "SignalShapedRouteCompiler"
| 4337086245698174025164917111396789550781250 => some "ProjectableGeometryTopology" | 20816688959257589909249546527863818593750 => some "SignalShapedRouteCompiler"
| 4337086245698174025164917113780975341796875 => some "ProjectableGeometryTopology" | 34694473072258915752172529698335253921905 => some "SignalShapedRouteCompiler"
| 8673617380594578207819722592830657958984375 => some "ProjectableGeometryTopology" | 34694473220042782491073012352142382812505 => some "LogogramProjection"
| 21684321005466244969284161925315856933593750 => some "SignalShapedRouteCompiler" | 34694476625008977135643425464630176172530 => some "SignalShapedRouteCompiler"
| 108420217248550443400745280086994171142578125 => some "ProjectableGeometryTopology" | 34694487283104538801312446689788828140630 => some "LogogramProjection"
| 108420217248550443400745280086994201660156250 => some "CognitiveLoadField" | 34694487425214902032166779060364013671876 => some "LogogramProjection"
| 108420217248550443400745280098915100097656250 => some "CognitiveLoadField" | 34694490979111011256650152225525148441251 => some "SignalShapedRouteCompiler"
| 34694558479486659634858667855712900394426 => some "CognitiveLoadField"
| 34694558479486662079587936420747072344400 => some "SignalShapedRouteCompiler"
| 34694576101174316257238447781372560562502 => some "SignalShapedRouteCompiler"
| 34705572460552579258762300206298886720025 => some "SignalShapedRouteCompiler"
| 34705664120393342454925322536474855473252 => some "SignalShapedRouteCompiler"
| 34972025275692503782920837402496340641375 => some "SignalShapedRouteCompiler"
| 34972025275701526319719851017762461719126 => some "SignalShapedRouteCompiler"
| 34985525594538557972766762279516621487511 => some "SignalShapedRouteCompiler"
| 36093794619802793604359340672308351569500 => some "SignalShapedRouteCompiler"
| 41633388292448580614291430015564228687500 => some "SignalShapedRouteCompiler"
| 41655569589238442131504416465911865237500 => some "SignalShapedRouteCompiler"
| 41910922903525719442777347756506396488775 => some "SignalShapedRouteCompiler"
| 41910937120774254436083138942719972753126 => some "CognitiveLoadField"
| 48572264438507772867567837715149024456250 => some "SignalShapedRouteCompiler"
| 69388942597472123452462616448211728515755 => some "SignalShapedRouteCompiler"
| 69389027862827788456536832333526855468876 => some "SignalShapedRouteCompiler"
| 173472347599044951727056622715032958984526 => some "SignalShapedRouteCompiler"
| 173472351292502938308753431324005380859630 => some "SignalShapedRouteCompiler"
| 173472436421207021456213355088050537109501 => some "SignalShapedRouteCompiler"
| 173472792539550937945030749320985107425130 => some "SignalShapedRouteCompiler"
| 173474568044866900891065716745025644531281 => some "SignalShapedRouteCompiler"
| 173483542909043681225776734447644105470010 => some "SignalShapedRouteCompiler"
| 173749903495945548638710439205932617190625 => some "LogogramProjection"
| 174860144142040007868781686401367197343755 => some "SignalShapedRouteCompiler"
| 174884551455580006591044664383856203910050 => some "SignalShapedRouteCompiler"
| 180411351635714163446806383323823517578143 => some "CognitiveLoadField"
| 181810141140206252457761884308625634766881 => some "SignalShapedRouteCompiler"
| 182132090742927542445257664394380138691875 => some "SignalShapedRouteCompiler"
| 187749820078588892031508982336438087188927 => some "CognitiveLoadField"
| 208167350025451378361547007657196064846915 => some "CognitiveLoadField"
| 215216857669303939214000709154116243792141 => some "CognitiveLoadField"
| 216677808993309131637217831920675305185125 => some "CognitiveLoadField"
| 353894763094341033744819822311774462890811 => some "CognitiveLoadField"
| 386136193990524992161438226998940248222636 => some "CognitiveLoadField"
| 867361738699173729518465757374573975000375 => some "SignalShapedRouteCompiler"
| 867361741541126393829475343323675595703380 => some "SignalShapedRouteCompiler"
| 867361741541526863002219856262665148450000 => some "CognitiveLoadField"
| 867361755751981036160141230107116709375151 => some "SignalShapedRouteCompiler"
| 867361826807382386177778303624121095781256 => some "SignalShapedRouteCompiler"
| 867362182077622492797859015464782714843755 => some "LogogramProjection"
| 867362182077840770967305004597473144940626 => some "SignalShapedRouteCompiler"
| 867362182077840770971962809563447314843760 => some "SignalShapedRouteCompiler"
| 867362185630601743585467472553260498437680 => some "SignalShapedRouteCompiler"
| 867362199842327755205334784985504160566380 => some "SignalShapedRouteCompiler"
| 867362270895509951659664511779792480484375 => some "SignalShapedRouteCompiler"
| 867364047263709016870716279034577648437776 => some "CognitiveLoadField"
| 867372857984492002986373083591613781251250 => some "SignalShapedRouteCompiler"
| 867372946942214185279794096966583303141250 => some "SignalShapedRouteCompiler"
| 868749606297569698770716786385528574219501 => some "SignalShapedRouteCompiler"
| 868754401751903134400211274624847412519375 => some "SignalShapedRouteCompiler"
| 869027091005136753805915120130157649218891 => some "CognitiveLoadField"
| 874302856038868503295853805545807187894382 => some "CognitiveLoadField"
| 881239529377626241301372957249494873515775 => some "SignalShapedRouteCompiler"
| 902056211776880460348920836452638193375250 => some "SignalShapedRouteCompiler"
| 902056225272645315271988582611083984453125 => some "LogogramProjection"
| 902056652308829143434018507003784189847500 => some "SignalShapedRouteCompiler"
| 902611319020261368715204656238557373453756 => some "SignalShapedRouteCompiler"
| 902611319021389135882258713265228516034375 => some "SignalShapedRouteCompiler"
| 1040834209933337842812763345719483667970782 => some "CognitiveLoadField"
| 1042221882164776616520436191577918759785005 => some "SignalShapedRouteCompiler"
| 1049442844032457815879109574050904834079500 => some "CognitiveLoadField"
| 1076916866794636449786165416345550879000030 => some "CognitiveLoadField"
| 1734723494450918224197815372944641172268756 => some "SignalShapedRouteCompiler"
| 1734723941382353665773050785160388242738156 => some "CognitiveLoadField"
| 1734725697843941890168935179749298098050030 => some "SignalShapedRouteCompiler"
| 2985116633885819160295650422573463427909387 => some "CognitiveLoadField"
| 4336808778759914275840859127620855722656380 => some "SignalShapedRouteCompiler"
| 4336808778761007488472424746132049582031381 => some "SignalShapedRouteCompiler"
| 4336809134031229405081831276416931406250131 => some "SignalShapedRouteCompiler"
| 4336809134032610396971069335956878673837510 => some "SignalShapedRouteCompiler"
| 4336809151824400399345907688141204834380125 => some "SignalShapedRouteCompiler"
| 4336810910446294728899562358952337695315630 => some "SignalShapedRouteCompiler"
| 4336922398096068718587048411369476330531251 => some "CognitiveLoadField"
| 4337086245698446946335025429725801025406375 => some "SignalShapedRouteCompiler"
| 4337086245703858367074280977249908496093775 => some "LogogramProjection"
| 4338198777987918656463734865190130673832501 => some "SignalShapedRouteCompiler"
| 4338254207425789020607255997658143320722761 => some "CognitiveLoadField"
| 4343747587398685936933384835720214892656875 => some "LogogramProjection"
| 4344025160918445253651589512850203175865725 => some "CognitiveLoadField"
| 4371505379908739997214653193951019531250260 => some "SignalShapedRouteCompiler"
| 4371559132471257181024178934116546886721886 => some "SignalShapedRouteCompiler"
| 4459210779123168325186707162857819921969005 => some "CognitiveLoadField"
| 5211131633304149379883894146446746910235509 => some "CognitiveLoadField"
| 8673617401259662088728513722896795908203501 => some "SignalShapedRouteCompiler"
| 8708644919864909825381823003315895020078306 => some "CognitiveLoadField"
| 8709711174646199651905337275028475597676375 => some "CognitiveLoadField"
| 21684043467474793942668515443840026856331875 => some "SignalShapedRouteCompiler"
| 21684043538527976127807051003074645996096875 => some "LogogramProjection"
| 21684043581160504254517145454884350882828136 => some "CognitiveLoadField"
| 21684043893799307628651151120853454589846880 => some "SignalShapedRouteCompiler"
| 21684045670156147025991231203079986621171875 => some "LogogramProjection"
| 21684045670156365307047963440418395996171875 => some "LogogramProjection"
| 21684054573398725915467368078231811767578255 => some "SignalShapedRouteCompiler"
| 21685431236306940776650086104969177553130255 => some "CognitiveLoadField"
| 21685431246255586665938645911239777841800650 => some "SignalShapedRouteCompiler"
| 21685431247675523994257673979282379394531400 => some "SignalShapedRouteCompiler"
| 21685456275351552976761199606514759521500005 => some "CognitiveLoadField"
| 21718737922788070139475354552746002441422625 => some "SignalShapedRouteCompiler"
| 21718760123692683919221163094997561037125651 => some "SignalShapedRouteCompiler"
| 21857529208803052824833430650238806396956275 => some "SignalShapedRouteCompiler"
| 21858905800797865669126630127430298339940630 => some "SignalShapedRouteCompiler"
| 21864454904380456355428323507900252686032000 => some "SignalShapedRouteCompiler"
| 22551405635341825837506987154984468994140800 => some "SignalShapedRouteCompiler"
| 22551682832272499596118003427982667236343901 => some "SignalShapedRouteCompiler"
| 26020852139652151893824340403080169677812500 => some "LogogramProjection"
| 26020865572633102056575939059295654542984376 => some "SignalShapedRouteCompiler"
| 26021130139499746292829515173435516371098130 => some "SignalShapedRouteCompiler"
| 43368087077055870395386591613789398203203150 => some "SignalShapedRouteCompiler"
| 43417228035736170716705031812286682277859405 => some "CognitiveLoadField"
| 44965753563417460173420803619099036195425761 => some "CognitiveLoadField"
| 108426325713622876792331412794704443429704530 => some "CognitiveLoadField"
| 108427158398866367937182263138302193869179528 => some "CognitiveLoadField"
| 108428543938998927842593938112278137217266375 => some "SignalShapedRouteCompiler"
| 108470179508657577025588601947403259297190876 => some "CognitiveLoadField"
| 108628683915412939331261486117840737305094380 => some "SignalShapedRouteCompiler"
| 109294595691977847309551204743387165636875776 => some "CognitiveLoadField"
| 109462716757633461398677900791645849609378275 => some "SignalShapedRouteCompiler"
| 114498968550693926372472420811715095492765660 => some "CognitiveLoadField"
| 114762657159446937366887198526882477135407157 => some "CognitiveLoadField"
| 130277733170919427811168174448490905762596876 => some "SignalShapedRouteCompiler"
| 130319700097913983336188830759525299319143750 => some "SignalShapedRouteCompiler"
| 139738778877927254958428667617360474181116560 => some "CognitiveLoadField"
| 152031221407611665200232759428501618897032025 => some "CognitiveLoadField"
| 153529977627223388572842815842628633352345806 => some "CognitiveLoadField"
| 175604890309581426993990579572500648653460094 => some "CognitiveLoadField"
| 195170568758840108857865445387363831162594042 => some "CognitiveLoadField"
| 216882069192803604964889028728028881836347500 => some "SignalShapedRouteCompiler"
| 217915974190106053359388412537575683887346900 => some "SignalShapedRouteCompiler"
| 238531758417088085579207243696365407043785971 => some "CognitiveLoadField"
| _ => none | _ => none
end SilverSight.PIST.ClassifyN end SilverSight.PIST.ClassifyN

View file

@ -1,44 +1,43 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
"""Validate an emitted RRC JSON artifact against source receipts. """Validate an RRC PIST predictions JSON artifact.
This is an I/O-only shim: it performs no admissibility decisions. It checks: Validates rrc_pist_predictions_250_v1.json (and similar prediction files):
- JSON parses - JSON parses
- required top-level fields are present - required top-level fields are present
- every row has required fields - every prediction has required fields
- equation_ids are unique - equation_ids are unique
- promotion is 'not_promoted' everywhere - matrices are 8×8 with integer entries
- alignment_score matches alignment_status mapping - matrix hashes are consistent
- no all-zero matrices (degenerate)
""" """
from __future__ import annotations from __future__ import annotations
import argparse import argparse
import hashlib
import json import json
import sys import sys
from pathlib import Path from pathlib import Path
from typing import Any from typing import Any
SCORE_MAP = { REQUIRED_TOP = {"schema", "claim_boundary", "predictions"}
"aligned_exact": 100, REQUIRED_PRED = {
"aligned_proxy": 86, "equation_id",
"compatible_structural_projection": 72, "object_id",
"alignment_warning": 35, "name",
"missing_prediction": 0, "equation",
"schema",
"claim_boundary",
"matrix_schema",
"matrix_hash",
"matrix_8x8",
"global_vocab_hash",
} }
REQUIRED_TOP = {"schema", "claim_boundary", "summary", "rows"}
REQUIRED_ROW = { def canonical_matrix_json(matrix: list[list[int]]) -> str:
"equation_id", return json.dumps(matrix, separators=(",", ":"))
"name",
"shape",
"status",
"alignment_status",
"alignment_score",
"promotion",
"warnings",
"receipt_valid",
}
def validate(data: dict[str, Any]) -> list[str]: def validate(data: dict[str, Any]) -> list[str]:
@ -48,47 +47,72 @@ def validate(data: dict[str, Any]) -> list[str]:
errors.append(f"missing top-level fields: {sorted(missing_top)}") errors.append(f"missing top-level fields: {sorted(missing_top)}")
return errors return errors
rows = data.get("rows", []) preds = data.get("predictions", [])
if not isinstance(rows, list): if not isinstance(preds, list):
errors.append("'rows' must be a list") errors.append("'predictions' must be a list")
return errors return errors
ids = set() ids: set[str] = set()
for idx, row in enumerate(rows): hashes: set[str] = set()
missing_row = REQUIRED_ROW - row.keys() for idx, pred in enumerate(preds):
if missing_row: missing = REQUIRED_PRED - pred.keys()
errors.append(f"row {idx}: missing fields {sorted(missing_row)}") if missing:
errors.append(f"prediction {idx}: missing fields {sorted(missing)}")
continue continue
eq_id = row["equation_id"] eq_id = pred["equation_id"]
if eq_id in ids: if eq_id in ids:
errors.append(f"duplicate equation_id: {eq_id}") errors.append(f"duplicate equation_id: {eq_id}")
ids.add(eq_id) ids.add(eq_id)
if row["promotion"] != "not_promoted": # Matrix shape
matrix = pred["matrix_8x8"]
if not isinstance(matrix, list) or len(matrix) != 8:
errors.append(f"prediction {idx} ({eq_id}): matrix_8x8 must have 8 rows")
continue
for row_idx, row in enumerate(matrix):
if not isinstance(row, list) or len(row) != 8:
errors.append( errors.append(
f"row {idx} ({eq_id}): promotion must be 'not_promoted', " f"prediction {idx} ({eq_id}): row {row_idx} must have 8 columns"
f"got {row['promotion']!r}" )
elif not all(isinstance(v, int) for v in row):
errors.append(
f"prediction {idx} ({eq_id}): row {row_idx} has non-integer entries"
) )
expected_score = SCORE_MAP.get(row["alignment_status"]) # All-zero matrix check
if expected_score is None: if all(all(v == 0 for v in row) for row in matrix):
errors.append( errors.append(
f"row {idx} ({eq_id}): unknown alignment_status " f"prediction {idx} ({eq_id}): degenerate all-zero matrix"
f"{row['alignment_status']!r}"
) )
elif row["alignment_score"] != expected_score:
# Matrix hash consistency
expected_hash = hashlib.sha256(
canonical_matrix_json(matrix).encode("utf-8")
).hexdigest()
if pred["matrix_hash"] != expected_hash:
errors.append( errors.append(
f"row {idx} ({eq_id}): alignment_score {row['alignment_score']} " f"prediction {idx} ({eq_id}): matrix_hash mismatch "
f"does not match status {row['alignment_status']!r} ({expected_score})" f"(expected {expected_hash[:16]}..., got {pred['matrix_hash'][:16]}...)"
)
hashes.add(pred["matrix_hash"])
# Report duplicate matrices
if len(hashes) < len(preds):
errors.append(
f"info: {len(preds) - len(hashes)} duplicate matrices "
f"({len(hashes)} unique out of {len(preds)})"
) )
return errors return errors
def main() -> int: def main() -> int:
parser = argparse.ArgumentParser(description="Validate RRC emitted JSON") parser = argparse.ArgumentParser(
parser.add_argument("json_file", help="path to emitted JSON file") description="Validate RRC PIST predictions JSON"
)
parser.add_argument("json_file", help="path to predictions JSON file")
args = parser.parse_args() args = parser.parse_args()
path = Path(args.json_file) path = Path(args.json_file)
@ -103,14 +127,21 @@ def main() -> int:
return 1 return 1
errors = validate(data) errors = validate(data)
if errors: # Separate info messages from real errors
real_errors = [e for e in errors if not e.startswith("info:")]
infos = [e for e in errors if e.startswith("info:")]
for info in infos:
print(f"INFO: {info}", file=sys.stderr)
if real_errors:
print("VALIDATION FAILED", file=sys.stderr) print("VALIDATION FAILED", file=sys.stderr)
for err in errors: for err in real_errors:
print(f" - {err}", file=sys.stderr) print(f" - {err}", file=sys.stderr)
return 1 return 1
rows = data.get("rows", []) preds = data.get("predictions", [])
print(f"OK: {len(rows)} rows, schema={data.get('schema')}") print(f"OK: {len(preds)} predictions, schema={data.get('schema')}")
return 0 return 0

View file

@ -1,2 +1,3 @@
pytest>=9.1.1 pytest>=9.1.1
pyyaml>=6.0.3 pyyaml>=6.0.3
h11>=0.16.0 # CVE-2025-43859: malformed Chunked-Encoding bodies