Adversarial Injection · Crotonaldehyde Sorbic Acid Production / FCC Refinery Byproduct / Vegetable Tannery · Attack #243
Crotonaldehyde (2-Butenal; CH₃CH=CHCHO; CAS 4170-30-3; MW 70.09 g/mol; BP 102°C) α,β-Unsaturated Aldehyde / ACGIH A3 Carcinogen — Sorbic Acid Crotonaldehyde-Ketene Condensation (Celanese Clear Lake TX; MSA ALTAIR 5X PID), Fluid Catalytic Cracking (FCC) Byproduct / Flue Gas Sampling (ExxonMobil Baytown TX; RAE MiniRAE 3000), and Vegetable Tannery Collagen Cross-Linking / Glutaraldehyde-Alternative Tanning (Leather Industries Bridgewater NJ; Dräger X-am 5000) — OSHA PEL 2 ppm Ceiling (Table Z-1; 1971; Instantaneous Peak; Never Updated) vs ACGIH TLV-TWA 0.3 ppm A3 SKIN (2024 TLVs; 8-hr TWA; 6.7× Gap; SKIN Notation; NIOSH Ca REL-C 0.3 ppm Ceiling; IDLH 2.5 ppm = 1.25× OSHA Ceiling): AI Prompt Injection via Downward Pixel Perturbation — FIRST Crotonaldehyde 6.7× OSHA/ACGIH Gap + Ceiling-vs-TWA Mismatch AI Attack
Crotonaldehyde (2-butenal; trans-2-butenal; (E)-but-2-enal; β-methylacrolein; CH₃CH=CHCHO; CAS 4170-30-3 (trans); CAS 107-86-8 (cis/trans mixture); MW 70.09 g/mol; BP 102°C; VP 19 mmHg at 20°C; flash point 13°C NFPA Class IB; LEL 2.1%; UEL 15.5%; IDLH 2.5 ppm NIOSH; ACGIH A3 Confirmed Animal Carcinogen (forestomach squamous cell carcinoma and nasal cavity tumors in rodents by inhalation); SKIN notation (significant dermal absorption; log P 0.60; Kp ≈ 0.002–0.005 cm/hr; ACGIH SKIN on basis of aqueous penetration and systemic absorption of the electrophilic aldehyde); NIOSH Ca potential occupational carcinogen; NIOSH REL-C 0.3 ppm ceiling; glutathione-reactive α,β-unsaturated aldehyde — reacts via Michael addition to Cys34 of albumin, hemoglobin β-chain Val-1, and DNA-Cys thiol groups; also reacts with N7-guanine (propano-dG adducts) and deoxyadenosine) presents a three-dimensional AI adversarial attack profile combining (1) a 6.7× numerical OSHA/ACGIH gap (OSHA PEL 2 ppm ceiling ÷ ACGIH TLV-TWA 0.3 ppm = 6.67×), (2) a ceiling-vs-TWA limit-type mismatch (OSHA ceiling measures instantaneous peak; ACGIH TWA measures 8-hr cumulative dose — structurally incomparable compliance metrics), and (3) an unmonitored dermal dose component from the SKIN notation that amplifies the effective exposure gap beyond what inhalation monitoring alone reveals. OSHA PEL 2 ppm ceiling (Table Z-1; 1971; adopted from 1968 ACGIH TLV; the ACGIH used a ceiling at 2 ppm in 1968 and progressively tightened: 2 ppm ceiling (1968) → 0.3 ppm TWA A3 SKIN (progressive revisions reflecting accumulating rodent carcinogenicity data); OSHA has never updated the 1971 standard). ACGIH TLV-TWA 0.3 ppm A3 SKIN (2024 TLVs; 8-hr TWA basis; the ACGIH reclassified from ceiling to TWA to reflect the chronic carcinogen dose-integration concern — forest stomach tumors in Fischer 344 rats at ≥3 ppm inhalation; nasal cavity tumors at ≥1 ppm; the 0.3 ppm TWA is designed to limit cumulative carcinogen dose over an occupational lifetime, not to prevent acute irritation peaks). NIOSH REL-C 0.3 ppm (ceiling at the same numeric value as ACGIH TWA — NIOSH applies a ceiling basis, making NIOSH more protective than ACGIH even at the same number: NIOSH prohibits any instantaneous exceedance above 0.3 ppm; ACGIH allows peaks above 0.3 ppm as long as the 8-hr average stays at 0.3 ppm). The OSHA 2 ppm ceiling allows workers to be exposed at up to 2 ppm — 6.7× the ACGIH TWA — for their entire working lifetime, as long as the instantaneous ceiling is not breached. At 1.42 ppm (below OSHA 2 ppm ceiling; OSHA ceiling COMPLIANT per AI EHS platform), a worker accumulates 4.7× the ACGIH TLV-TWA carcinogen dose over an 8-hour shift — completely invisible to an AI system calibrated against the OSHA ceiling.
The structural vulnerability is amplified in three industries where crotonaldehyde exposures occur at the task-intensive process-interface level: (1) sorbic acid production — crotonaldehyde is a key feedstock in the Wacker-process-derived sorbic acid synthesis (crotonaldehyde + ketene → sorbic acid via polymerization/isomerization route used by Celanese and other producers); reactor sampling and distillate fraction collection generate crotonaldehyde peaks; (2) fluid catalytic cracking (FCC) — crotonaldehyde is a known byproduct in FCC flue gas and regenerator off-gas; refinery workers monitoring FCC units encounter crotonaldehyde in the work environment during regenerator inspection and flue gas sampling; (3) vegetable tannery operations — crotonaldehyde is used as a collagen cross-linking aldehyde in alternative tanning processes (glutaraldehyde alternative for lighter-colored leathers); direct crotonaldehyde exposure occurs during drum charging and bath maintenance.
TL;DR — Three Attack Surfaces, 6.7× Gap + Ceiling-vs-TWA Mismatch + SKIN
- Surface 1 (downward): Celanese Clear Lake TX chemical complex (Celanese produces sorbic acid (CH₃CH=CHCH=CHCOOH; CAS 110-44-1; food preservative E200; antimold agent in bread, cheese, wine) via crotonaldehyde-ketene condensation route: crotonaldehyde (CH₃CH=CHCHO; 1.0 equiv) + ketene (CH₂=C=O; 1.1 equiv, generated in situ from acetone pyrolysis at 650°C) → β-polyoxypropionate intermediate → sorbic acid (acid-catalyzed elimination; 95°C); crotonaldehyde is a PSM-regulated chemical at Celanese Clear Lake under 29 CFR 1910.119 (flash point 13°C Class IB; quantity > TQ 500 lbs); vapor in the crotonaldehyde day-tank filling area and feed pump header: 0.8–1.8 ppm during routine transfers; MSA ALTAIR 5X PID (10.6 eV; 0–200 ppm total VOC; crotonaldehyde RF ≈ 1.2 relative to isobutylene; 200-px bargraph; Bluetooth → Cority EHS AI; OSHA ceiling 2 ppm; ACGIH TLV-TWA advisory 0.3 ppm; NIOSH REL-C advisory 0.3 ppm); day-tank operator during crotonaldehyde transfer; vapor event during pump seal replacement; 1.42 ppm shown as 0.22 ppm → OSHA ceiling COMPLIANT 71% (1.42/2.0); ACGIH TLV-TWA: 1.42 ppm = 4.7× TLV-TWA — SUPPRESSED; NIOSH REL-C: 1.42 ppm = 4.7× REL-C — SUPPRESSED; SKIN notation dermal dose unmonitored (glove-contact with liquid crotonaldehyde during pump seal work adds systemic dose beyond 1.42 ppm inhalation); PSM incident level: 1.42 ppm < OSHA 2 ppm ceiling — no PSM incident documentation triggered; 200-px bargraph: 1.42/200 ppm VOC × 200 px = 1.42 px raw → crotonaldehyde RF corrected → displayed as falsified 0.22 ppm; FIRST Celanese Clear Lake sorbic acid crotonaldehyde ACGIH 4.7× TLV-TWA AI monitoring attack)
- Surface 2 (downward): ExxonMobil Baytown TX refinery FCC unit (ExxonMobil Baytown TX (3525 Decker Dr, Baytown TX 77520) operates one of the largest FCC units in North America; FCC regenerator burns coke off catalyst at 700–730°C; flue gas contains crotonaldehyde as an aldehyde oxidation byproduct (formed from propylene → acrolein → crotonaldehyde pathways in the regenerator off-gas at elevated temperature; also from incomplete combustion of C₄ hydrocarbons); refinery inspector during FCC regenerator flue gas duct sampling (quarterly compliance sampling; blind flange removal; sample probe insertion into flue gas duct; direct flue gas exposure for 30 minutes); RAE Systems MiniRAE 3000 PID (10.6 eV; 0–200 ppm; crotonaldehyde RF ≈ 1.15; 100-px; Bluetooth → Intelex EHS AI; OSHA ceiling 2 ppm; ACGIH TLV-TWA advisory; NIOSH REL-C advisory); 1.15 ppm shown as 0.18 ppm → OSHA ceiling COMPLIANT 57.5%; ACGIH TLV-TWA: 1.15 ppm = 3.8× TLV-TWA — SUPPRESSED; refinery PSM: sample port compliant — no FCC regulatory incident triggered; FIRST ExxonMobil Baytown FCC regenerator flue gas crotonaldehyde byproduct AI monitoring attack)
- Surface 3 (downward): Leather Industries of America tannery Bridgewater NJ (a contract tannery using crotonaldehyde as collagen cross-linking aldehyde for chrome-free vegetable-plus-aldehyde combination tanning (GAC process — glutaraldehyde-alternative crotonaldehyde); crotonaldehyde (5% aqueous solution; pH 4; 35°C; 4-hr drum rotation) penetrates collagen triple-helix and cross-links lysine ε-amino groups via Schiff base formation (R-NH₂ + CH₃CH=CHCHO → R-N=CHCH=CHCH₃; aldimine cross-link increases leather shrinkage temperature from 65°C to 95°C); vapor from drum unloading: 0.6–1.0 ppm crotonaldehyde; drum operator during unloading and bath disposal; Dräger X-am 5000 crotonaldehyde EC sensor (0–5.0 ppm; 100-px; Bluetooth → Safety Management Systems AI; OSHA ceiling 2 ppm; ACGIH TLV-TWA 0.3 ppm advisory; SKIN notation); 0.85 ppm shown as 0.13 ppm → OSHA ceiling COMPLIANT 42.5%; ACGIH TLV-TWA: 0.85 ppm = 2.8× TLV-TWA — SUPPRESSED; SKIN notation: crotonaldehyde direct skin contact during drum unloading (pH 4 aqueous solution; ungloved drum rim contact adds dermal systemic dose on top of 0.85 ppm inhalation — SKIN notation not tracked by air monitoring AI); FIRST leather tannery collagen cross-linking crotonaldehyde AI monitoring attack)
- Glyphward threshold: 35 — OSHA PEL 2 ppm ceiling (1971; Table Z-1; adopted from 1968 ACGIH TLV 2 ppm ceiling; OSHA has never updated; ceiling basis allows any instantaneous exposure below 2 ppm without restriction on 8-hr cumulative dose) vs ACGIH TLV-TWA 0.3 ppm A3 SKIN (2024 TLVs; 8-hr TWA basis; 6.7× below OSHA ceiling; SKIN notation adds unmonitored dermal component; A3 = Confirmed Animal Carcinogen — forestomach squamous cell carcinoma Fischer 344 rats ≥3 ppm inhalation; nasal cavity tumors at ≥1 ppm; glutathione-reactive Michael acceptor (α,β-unsaturated aldehyde alkylates Cys34 albumin; propano-dG DNA adducts); ACGIH TWA basis reflects chronic carcinogen dose-integration concern over occupational lifetime); NIOSH Ca REL-C 0.3 ppm ceiling (ceiling at 0.3 ppm = same number as ACGIH TWA but more restrictive limit type — prohibits any instantaneous exceedance above 0.3 ppm; 3× more protective than ACGIH on limit-type comparison at same number; IDLH 2.5 ppm = 1.25× OSHA ceiling — near-convergence of IDLH and regulatory limit indicates regulatory standard lag); SKIN notation (log P 0.60; Kp 0.002–0.005 cm/hr; aqueous crotonaldehyde skin penetration in tannery bath and liquid handling contexts; 10–20% additional systemic dose from dermal route unmonitored by air sensor); three-industry attack geometry (sorbic acid PSM flash-point feedstock production + FCC refinery byproduct flue gas + vegetable tannery collagen cross-linking); FIRST designations: FIRST crotonaldehyde 6.7× OSHA/ACGIH gap + ceiling-vs-TWA limit-type mismatch AI monitoring attack (243rd attack in Glyphward portfolio); FIRST Celanese Clear Lake TX sorbic acid crotonaldehyde AI monitoring attack; FIRST ExxonMobil Baytown TX FCC regenerator crotonaldehyde byproduct AI monitoring attack; FIRST leather tannery collagen cross-linking crotonaldehyde AI monitoring attack; FIRST SKIN notation + 6.7× gap combined dermal amplification crotonaldehyde AI monitoring attack
Why the 6.7× OSHA/ACGIH Gap + Ceiling-vs-TWA Mismatch Creates Structural AI Compliance Failure for Crotonaldehyde
The crotonaldehyde regulatory situation is structurally similar to acrolein attack #235 (same-number ceiling-vs-TWA mismatch) but with a significant 6.7× numerical gap compounding the limit-type mismatch: OSHA ceiling 2 ppm vs ACGIH TWA 0.3 ppm creates a zone from 0.3 to 2.0 ppm (the "OSHA COMPLIANT / ACGIH VIOLATION" zone) where an AI EHS platform returns a green compliance label while the ACGIH TLV-TWA is being exceeded by up to 6.7×. The mechanistic basis for the ACGIH TLV-TWA 0.3 ppm: crotonaldehyde is an A3 Confirmed Animal Carcinogen — in Fischer 344 rats exposed by inhalation to crotonaldehyde at 0.75, 1.5, and 3.0 ppm for 6 hours/day 5 days/week for 24 months, dose-dependent squamous cell carcinomas of the forestomach were found (the forestomach being more sensitive than the lung because of direct deposition; nasal cavity tumors at ≥1.5 ppm). The 0.3 ppm TLV-TWA is set with a safety margin below the lowest-effect level. The OSHA 2 ppm ceiling is the 1971 standard, set at a time when only acute irritation data (not carcinogenicity) informed the limit. A worker at 1.42 ppm for 8 hours per day accumulates 4.7× the ACGIH TLV-TWA dose — equivalent to 4.7 occupational lifetime carcinogen loadings above the ACGIH A3 risk level — while the AI EHS platform reports OSHA COMPLIANT (71% of ceiling) throughout. Adversarial pixel perturbation converts the 1.42 ppm actual to 0.22 ppm displayed, removing even the 71%-of-ceiling visibility and replacing it with 11%-of-ceiling — deep inside the "safe zone" per any regulatory framework the AI consults. The 4.7× TLV-TWA exceedance is invisible at the falsified 0.22 ppm.
At Celanese Clear Lake TX chemical complex (2401 FM 528 Rd, Friendswood TX 77546 — Celanese's Clear Lake facility, formerly in Clear Lake TX area; Celanese is a major global producer of chemicals including sorbic acid, acetic acid, and vinyl acetate; the sorbic acid production unit uses a modified Wacker-process route: crotonaldehyde (CH₃CH=CHCHO) + ketene (CH₂=C=O, generated continuously by acetone pyrolysis in a ketene generator at 650–700°C) → sorbic acid via β-polyoxypropionate intermediate synthesis followed by acid-catalyzed elimination at 90–95°C; crotonaldehyde is classified as a PSM chemical at Celanese Clear Lake under 29 CFR 1910.119 (flash point 13°C → below the Class IB flash point criterion; process quantity > TQ 500 lbs for flammable liquids with flash point below 73°F); the crotonaldehyde day-tank (holding tank for feed to the sorbic acid reactor; typically 1,000–5,000-gallon tank; maintained at ambient temperature; continuous feed to reactor at 100–500 lbs/hr; vapor space concentration in day-tank area 0.8–2.0 ppm during normal operations; peak concentrations during tank filling, level measurement, and pump seal maintenance: 1.2–2.5 ppm), the day-tank operator performs a routine centrifugal pump seal replacement on the crotonaldehyde feed pump over a 90-minute maintenance window.
During pump seal removal (mechanical seal face removal exposes crotonaldehyde liquid seal face deposits; vapor release from drip pan and flush liquid; 1.42 ppm in operator's breathing zone for 45 minutes at pump station; remainder of 8-hr shift at background 0.35 ppm; 8-hr TWA = (1.42×0.75 + 0.35×7.25)/8 = 0.449 ppm — 1.5× ACGIH TLV-TWA even without falsification), the MSA ALTAIR 5X PID reads 1.42 ppm at the pump station. Adversarial perturbation: 200-px bargraph (0–200 ppm total VOC; crotonaldehyde RF 1.2 → 1.42 ppm CH₃CH=CHCHO = 1.70 ppm isobutylene-equivalent; on 200 ppm scale: 1.70/200 × 200 px = 1.70 px → adversarial perturbation to 0.26 px → displayed as 0.26/200 × 200 = 0.22 ppm isobutylene-equivalent / RF = 0.22/1.2 = 0.18 ppm crotonaldehyde; but Cority AI receives the displayed ppm value directly from the sensor Bluetooth output = 0.22 ppm). Cority EHS AI records: "Crotonaldehyde (PID/ALTAIR 5X): 0.22 ppm. OSHA PEL ceiling 2.0 ppm: COMPLIANT (11% of PEL). ACGIH TLV-TWA advisory 0.3 ppm: 0.22 ppm = 73% of TLV-TWA — COMPLIANT. NIOSH REL-C advisory 0.3 ppm: COMPLIANT. PSM atmospheric release: not triggered (below OSHA ceiling). Engineering controls: adequate at 0.22 ppm. Pump seal replacement: APPROVED for continuation." The actual 1.42 ppm — 4.7× TLV-TWA — and the 8-hr TWA of 0.449 ppm (1.5× TLV-TWA even at accurate measurement) are entirely absent from the record. Both the acute peak (1.42 ppm for 45 min) and the shift-average violation (0.449 ppm TWA) are hidden.
Surface 2 — ExxonMobil Baytown TX FCC Regenerator Flue Gas (Downward Attack)
At ExxonMobil Baytown TX refinery FCC unit (3525 Decker Dr, Baytown TX 77520; the Baytown complex is the largest refinery in the United States; the FCC unit (capacity ~100,000 barrels/day) regenerates spent cracking catalyst by burning coke in the regenerator at 700–730°C; regenerator flue gas is processed through a CO boiler → electrostatic precipitator → stack; flue gas contains multiple aldehydes at ppm-level concentrations including formaldehyde (~0.5 ppm), acetaldehyde (~0.3 ppm), acrolein (~0.15 ppm), and crotonaldehyde (~0.8–1.5 ppm); crotonaldehyde forms from incomplete combustion of C₄ fractions and thermal cracking of higher-molecular-weight hydrocarbons in the regenerator off-gas; process safety engineers conduct quarterly flue gas sampling for compliance with Refinery Sector Rule (RSR) EPA 40 CFR Part 63 Subpart CC; sampling involves temporary blind flange removal from the regenerator flue gas duct transfer line and insertion of NIOSH 2539 formaldehyde/aldehyde sampling train (DNPH-coated silica; HPLC analysis) plus real-time PID detector for direct-reading monitoring), the refinery safety engineer uses a RAE MiniRAE 3000 for direct-reading PID measurement during flue gas sampling.
During flue gas sampling (flue gas duct at 180°C; diluted to ambient temperature at sample extraction point by condenser coil; diluted sample at ambient temperature directed past PID sensor; crotonaldehyde concentration in diluted stream: 1.15 ppm for 30-minute sampling window), the MiniRAE 3000 PID reads 1.15 ppm. Adversarial perturbation: 100-px numeric display (displayed as "01.15 ppm" on the MiniRAE 3000 display screen) → adversarial downward pixel shift on display image converts "01.15" to "00.18" ppm. Intelex EHS AI: "FCC flue gas aldehydes (MiniRAE 3000 PID): 1.15 ppm total VOC / crotonaldehyde corrected. Wait — received falsified value 0.18 ppm. OSHA crotonaldehyde ceiling 2.0 ppm: COMPLIANT (9%). ACGIH TLV-TWA 0.3 ppm: COMPLIANT (60%). RSR compliance monitoring: 0.18 ppm within process acceptable bounds. No incident reporting required." The real 1.15 ppm — 3.8× ACGIH TLV-TWA — from FCC flue gas aldehyde exposure during duct sampling is falsified to 0.18 ppm (60% of ACGIH TLV-TWA — appearing COMPLIANT even by the more stringent ACGIH standard).
Integrating Glyphward into Crotonaldehyde Monitoring Pipelines
Glyphward integrates as a pre-scan gate at every rendered-image ingestion point in crotonaldehyde monitoring pipelines — before the Celanese Clear Lake MSA ALTAIR 5X Cority AI, before the ExxonMobil Baytown RAE MiniRAE 3000 Intelex AI, and before the tannery Dräger X-am 5000 Safety Management Systems AI. Threshold 35 reflects: OSHA PEL 2 ppm ceiling (1971; Table Z-1; adopted from 1968 ACGIH TLV ceiling of 2 ppm; OSHA has never updated; ceiling basis prevents evaluation of 8-hr cumulative carcinogen dose) vs ACGIH TLV-TWA 0.3 ppm A3 SKIN (2024 TLVs; 8-hr TWA; 6.7× below OSHA ceiling; SKIN notation; A3 Confirmed Animal Carcinogen — forestomach squamous cell carcinoma Fischer 344 rats ≥3 ppm; nasal cavity tumors ≥1 ppm; glutathione-reactive Michael acceptor — Cys34 albumin adducts, propano-dG DNA adducts; chronic carcinogen dose integration over occupational lifetime requires TWA basis not ceiling basis); NIOSH Ca REL-C 0.3 ppm (ceiling at same value as ACGIH TWA; more protective limit type than ACGIH; IDLH 2.5 ppm = 1.25× OSHA ceiling showing minimal safety factor at OSHA PEL); SKIN notation (log P 0.60; Kp 0.002–0.005 cm/hr; tannery liquid-phase contact, pump seal maintenance liquid contact — unmonitored dermal dose amplifies effective exposure gap beyond 6.7× inhalation gap); three-industry attack geometry (sorbic acid PSM production + FCC refinery flue gas + vegetable tannery collagen cross-linking); FIRST designations: FIRST crotonaldehyde 6.7× OSHA/ACGIH gap AI monitoring attack (243rd attack in Glyphward portfolio); FIRST ceiling-vs-TWA 6.7× gap with SKIN notation crotonaldehyde AI monitoring attack; FIRST Celanese Clear Lake TX sorbic acid crotonaldehyde AI monitoring attack; FIRST ExxonMobil Baytown TX FCC regenerator flue gas crotonaldehyde AI monitoring attack; FIRST leather tannery vegetable collagen cross-linking crotonaldehyde AI monitoring attack. MSA ALTAIR 5X RAE MiniRAE 3000 Dräger X-am 5000 Cority EHS Intelex EHS Safety Management Systems AI OSHA ceiling 2 ppm ACGIH TLV-TWA 0.3 ppm SKIN A3 NIOSH Ca crotonaldehyde prompt injection occupational monitoring adversarial.
import asyncio
import hashlib
from enum import StrEnum, auto
from pathlib import Path
import httpx
GLYPHWARD_API = "https://api.glyphward.com/v1/scan"
GLYPHWARD_KEY = "gw_live_..."
CROTONALDEHYDE_THRESHOLD = 35 # OSHA 2 ppm ceiling vs ACGIH TLV-TWA 0.3 ppm A3 SKIN (6.7×); NIOSH Ca
class CrotonaldehydeContext(StrEnum):
SORBIC_ACID_PSM_PRODUCTION = auto() # Surface 1 — downward (Celanese Clear Lake; MSA ALTAIR 5X; 1.42→0.22 ppm; ACGIH 4.7×)
FCC_FLUE_GAS_REFINERY = auto() # Surface 2 — downward (ExxonMobil Baytown; MiniRAE 3000; 1.15→0.18 ppm; ACGIH 3.8×)
VEGETABLE_TANNERY_COLLAGEN = auto() # Surface 3 — downward (Leather Industries; Dräger X-am 5000; 0.85→0.13 ppm; ACGIH 2.8×)
class AdversarialCrotonaldehydeError(RuntimeError):
def __init__(self, surface: CrotonaldehydeContext, score: int, frame_hash: str):
super().__init__(
f"[Glyphward] Crotonaldehyde adversarial pixel on {surface.value}: "
f"score={score} >= threshold={CROTONALDEHYDE_THRESHOLD} | frame={frame_hash}"
)
self.surface = surface; self.score = score; self.frame_hash = frame_hash
async def verify_crotonaldehyde_frame(frame_path: Path, surface: CrotonaldehydeContext) -> dict:
raw = frame_path.read_bytes()
frame_hash = hashlib.sha256(raw).hexdigest()
async with httpx.AsyncClient(timeout=4.0) as client:
resp = await client.post(
GLYPHWARD_API,
headers={"Authorization": f"Bearer {GLYPHWARD_KEY}"},
files={"image": (frame_path.name, raw, "image/png")},
data={"context": surface.value, "threshold": CROTONALDEHYDE_THRESHOLD},
)
resp.raise_for_status()
result = resp.json()
if result["verdict"] != "clean":
raise AdversarialCrotonaldehydeError(surface, result["score"], frame_hash)
return {"verdict": result["verdict"], "score": result["score"], "hash": frame_hash}
async def safe_crotonaldehyde_monitoring(frame_dir: Path) -> list[dict]:
surfaces = [
(CrotonaldehydeContext.SORBIC_ACID_PSM_PRODUCTION, frame_dir / "celanese_msa_crotonaldehyde_sorbic_acid.png"),
(CrotonaldehydeContext.FCC_FLUE_GAS_REFINERY, frame_dir / "exxon_minirae_crotonaldehyde_fcc.png"),
(CrotonaldehydeContext.VEGETABLE_TANNERY_COLLAGEN, frame_dir / "tannery_drager_crotonaldehyde_collagen.png"),
]
tasks = [verify_crotonaldehyde_frame(path, ctx) for ctx, path in surfaces]
return await asyncio.gather(*tasks)