forked from 1b-agent/opencadstudio-upstream
Review of the image wave (with empirical reproduction against the
vendored image 0.25) found the budget contract did not hold across
formats: the decoder's Limits reserve checks NATIVE bytes-per-pixel,
so a grayscale/RGB JPEG/PNG/BMP over the RGBA budget decoded anyway
and into_rgba8() then ballooned to up to 4x it — the tab death the
budgets exist to prevent. The probed dimensions already prove an
OverBudget image cannot fit, so it is now refused without decoding,
removing all dependence on per-decoder limit fidelity.
Conversely, image's TIFF codec stacks ~3x scratch buffers on top of
the reserve, so an in-budget TIFF (the flagship GIS scenario) was
refused with a self-contradictory note ('400 MB, over the 512 MB
limit'); the decoder allowance for TIFF is now 3x while tier math
stays on the real budget.
Also: the refusal message saturates instead of overflowing on crafted
headers, the image pick only matches the refusal note naming ITS file
(peek, not drain — other references' notes survive for their own
drains), and the Georgian Supplement range ends at U+2D2F (U+2D30.. is
Tifinagh, which ships no font).
Build tooling: the font files missing from dist was a trunk
finalize_dist failure (Windows file-lock during the dist wipe; staging
had them, the exit code was missed) — not a copy-dir skip; it did not
reproduce in two clean cycles. scripts/build-web.sh is now the
canonical wrapper (MSYS_NO_PATHCONV, trunk, font copy + byte
verification that hard-fails), wired into README, Trunk.toml, and the
Pages workflow.
43 lines
1.6 KiB
Bash
43 lines
1.6 KiB
Bash
#!/bin/sh
|
|
# Canonical web bundle build: Trunk plus a fonts sanity sync.
|
|
#
|
|
# Trunk's copy-dir pipeline always copies web/fonts in full, but its final
|
|
# "apply staging to dist" step wipes the old dist and then moves dist/app/.stage
|
|
# into place. If that wipe fails on Windows (typically a transient lock from a
|
|
# local file server or antivirus with a file open under dist), the build exits
|
|
# non-zero and leaves dist stale with .stage fully populated — easy to miss,
|
|
# and a stale bundle would 404 the fonts the app fetches from fonts/*.ttf.
|
|
# This wrapper therefore re-syncs web/fonts into dist/app/fonts after a
|
|
# successful Trunk build and verifies every font byte-for-byte, so a bundle
|
|
# produced through it can never ship without the font set.
|
|
#
|
|
# Usage: sh scripts/build-web.sh [extra trunk build args]
|
|
# local: sh scripts/build-web.sh
|
|
# CI: sh scripts/build-web.sh --locked --html-output index.html web-app.html
|
|
set -eu
|
|
|
|
root=$(CDPATH= cd -- "$(dirname -- "$0")/.." && pwd)
|
|
cd "$root"
|
|
|
|
# Git Bash rewrites leading-slash arguments such as --public-url /app/ into
|
|
# Windows paths; keep them verbatim. Harmless on other platforms.
|
|
MSYS_NO_PATHCONV=1
|
|
export MSYS_NO_PATHCONV
|
|
|
|
trunk build --release --dist dist/app --public-url /app/ "$@"
|
|
|
|
# Mirror the font sources over the bundle and verify the copy-dir output.
|
|
mkdir -p dist/app/fonts
|
|
cp -f web/fonts/* dist/app/fonts/
|
|
|
|
count=0
|
|
for font in web/fonts/*.ttf; do
|
|
name=$(basename "$font")
|
|
cmp -s "$font" "dist/app/fonts/$name" || {
|
|
echo "error: dist/app/fonts/$name differs from $font" >&2
|
|
exit 1
|
|
}
|
|
count=$((count + 1))
|
|
done
|
|
echo "web bundle built; verified $count fonts in dist/app/fonts"
|