Repository navigation
feat(photos): zenc:bench, a byte-identity gate and timer for zenc speed work - #888
Merged
Merged
Conversation
…ed work bun run zenc:bench builds the merge-base as a baseline, gates every zenc square output and all 258 histograms byte for byte, runs a control that must fire, and only then times both binaries interleaved. A moved byte prints no timing at all, because /i/ is content-addressed and a faster encoder with different output re-mints URLs. Its first run found where the time goes: libavif is about 72% of a photo and its knobs are quality flags, zenc's own code is 28%, and rotated sources spend 225-360 ms in orient() alone. That is the first target for the loop. Also corrects CLAUDE.md's stale "~19s histogram bake": it is 0.6 s now.
Contributor
Wire-size diff vs merge base
Brotli q11, the quality the edge serves. Every number here is deterministic: Client assetsNo change. 26 files, 87.55 KiB Brotli total. PagesNo change. 57 files, 585.04 KiB Brotli total. Worker bundleNo change. 250.16 KiB gzip. Dictionary transportFamily dictionary acquisition: no change, 14.41 KiB q11.
|
…t test Two flaws the first loop through the bench turned up. Wall-clock cannot see a throughput change. add-photos.sh runs 8 photos at once and the pipeline is CPU-bound, so the tiled orient() read 1.004x at --parallel 8 (load 7.4, noise +-11.7%) while saving 5.4-7.0% of CPU per rotated photo. Every run now prints a CPU (user + sys) table beside the wall one. The per-source verdict called false wins. "beyond its own (max - min) / median spread" called one of six sources faster, in both tables, on a noise-floor run of identical source at 3 trials. Each source is now judged by an exact two-sided Mann-Whitney U at p < 0.01, with 7 trials by default; below 5 per side no ordering can reach that, so the CLI refuses. The noise-floor control at 7 trials calls nothing, every p at 0.38 or above.
oddharsh
added a commit
that referenced
this pull request
Oct 6, 2026
…s they hid The token contract read oklch() only, and the site writes most of its colour in hex: 2,248 hex and 82 rgb() literals on 2026-10-06. Measured against the tokens by OKLab distance, 87 were a token retyped in sRGB (#f3f6fa for --row-alt 51 times over, #888 for --ink-faint, #e8eef7 for --surface-desktop). - colorLiteralsIn() reads oklch(), hex and rgb()/rgba() with one set of guards: SVG presentation attributes, and for the sRGB spellings anything outside a declaration value, so #fab in a selector or a hex in a comment (access's note on why its greys moved) is never a colour. - tokenCopiesIn() and colors:drift both use it. The report now covers 3,884 literals and lists 156 colours hand-written in 3+ files with no token. - 84 copies swept to var(): 55 in pages, stylesheets and Workers, 29 inside garage and lwe spec CSS (pageCss/demoCss lines only, never demoJs), with every generated page regenerated. Two whole gradients were --grad-raised stop for stop (luna's button face, serendipity's) and now say so. Invisible: every swap is under dE 0.004 of its token.
oddharsh
added a commit
that referenced
this pull request
Oct 6, 2026
…s they hid The token contract read oklch() only, and the site writes most of its colour in hex: 2,248 hex and 82 rgb() literals on 2026-10-06. Measured against the tokens by OKLab distance, 87 were a token retyped in sRGB (#f3f6fa for --row-alt 51 times over, #888 for --ink-faint, #e8eef7 for --surface-desktop). - colorLiteralsIn() reads oklch(), hex and rgb()/rgba() with one set of guards: SVG presentation attributes, and for the sRGB spellings anything outside a declaration value, so #fab in a selector or a hex in a comment (access's note on why its greys moved) is never a colour. - tokenCopiesIn() and colors:drift both use it. The report now covers 3,884 literals and lists 156 colours hand-written in 3+ files with no token. - 84 copies swept to var(): 55 in pages, stylesheets and Workers, 29 inside garage and lwe spec CSS (pageCss/demoCss lines only, never demoJs), with every generated page regenerated. Two whole gradients were --grad-raised stop for stop (luna's button face, serendipity's) and now say so. Invisible: every swap is under dE 0.004 of its token.
oddharsh
added a commit
that referenced
this pull request
Oct 6, 2026
…s they hid The token contract read oklch() only, and the site writes most of its colour in hex: 2,248 hex and 82 rgb() literals on 2026-10-06. Measured against the tokens by OKLab distance, 87 were a token retyped in sRGB (#f3f6fa for --row-alt 51 times over, #888 for --ink-faint, #e8eef7 for --surface-desktop). - colorLiteralsIn() reads oklch(), hex and rgb()/rgba() with one set of guards: SVG presentation attributes, and for the sRGB spellings anything outside a declaration value, so #fab in a selector or a hex in a comment (access's note on why its greys moved) is never a colour. - tokenCopiesIn() and colors:drift both use it. The report now covers 3,884 literals and lists 156 colours hand-written in 3+ files with no token. - 84 copies swept to var(): 55 in pages, stylesheets and Workers, 29 inside garage and lwe spec CSS (pageCss/demoCss lines only, never demoJs), with every generated page regenerated. Two whole gradients were --grad-raised stop for stop (luna's button face, serendipity's) and now say so. Invisible: every swap is under dE 0.004 of its token.
oddharsh
added a commit
that referenced
this pull request
Oct 6, 2026
…s they hid (#1183) The token contract read oklch() only, and the site writes most of its colour in hex: 2,248 hex and 82 rgb() literals on 2026-10-06. Measured against the tokens by OKLab distance, 87 were a token retyped in sRGB (#f3f6fa for --row-alt 51 times over, #888 for --ink-faint, #e8eef7 for --surface-desktop). - colorLiteralsIn() reads oklch(), hex and rgb()/rgba() with one set of guards: SVG presentation attributes, and for the sRGB spellings anything outside a declaration value, so #fab in a selector or a hex in a comment (access's note on why its greys moved) is never a colour. - tokenCopiesIn() and colors:drift both use it. The report now covers 3,884 literals and lists 156 colours hand-written in 3+ files with no token. - 84 copies swept to var(): 55 in pages, stylesheets and Workers, 29 inside garage and lwe spec CSS (pageCss/demoCss lines only, never demoJs), with every generated page regenerated. Two whole gradients were --grad-raised stop for stop (luna's button face, serendipity's) and now say so. Invisible: every swap is under dE 0.004 of its token. Co-authored-by: Aadharsh Pannirselvam <19518661+oddharsh@users.noreply.github.com>
oddharsh
added a commit
that referenced
this pull request
Oct 6, 2026
…ue holds (#1193) * feat(type): every pt size and font family names a typography token typography.css has carried a pt scale and three family stacks since the design system was written. On 2026-10-06 the scale had 23 consumers against 1,072 hand-written sizes in 70 distinct values, and 55 family stacks were spelled out by hand (31 of them "Courier New",monospace, the mono token with its fallbacks dropped). - The scale grows to what the site sets: --text-lg 13pt, --text-lede 11pt, --text-2xs 8pt, --text-3xs 7.5pt, --text-4xs 7pt. 8pt alone had 98 uses. - 989 declarations in the sources rewritten to tokens; generated garage and lwe pages regenerated from their specs and generators. - 121 off-grid declarations snapped to the nearest step, ties down. Most move 0.2pt or less (8.6 and 8.4 -> 8.5, 8.8 -> 9, 8.2 and 7.8 -> 8). Six move 0.4-0.5pt: 12.5 -> 12 and 11.5 -> 11 (two each), 6.5 and 6.6 -> 7. - contract-type-comes-from-the-tokens refuses a pt size up to 14pt or a family stack outside var(--font-*). px (pixel-exact chrome, SVG text), relative units and display sizes over 14pt stay legal; three rules say @type demo (horizon's console caret, the polaroid's handwriting, lwe's CJK avatar). - The homepage loads luna.css without blocking, so it inlines the five size tokens it reads; the contract holds that copy to typography.css. - cssSources() now reads lwe specs' demoCss, which neither contract saw. - colors.css's --text-body: var(--ink) is gone. typography.css's --text-body (10.5pt) loads after it in luna.css, so the colour alias never applied. Checked in a browser: no element on 8 sampled pages computes to the 16px default; /garage/useragent's size histogram moves exactly by the snaps. * fix(tokens): read hex and rgb() as colours, and sweep the token copies they hid The token contract read oklch() only, and the site writes most of its colour in hex: 2,248 hex and 82 rgb() literals on 2026-10-06. Measured against the tokens by OKLab distance, 87 were a token retyped in sRGB (#f3f6fa for --row-alt 51 times over, #888 for --ink-faint, #e8eef7 for --surface-desktop). - colorLiteralsIn() reads oklch(), hex and rgb()/rgba() with one set of guards: SVG presentation attributes, and for the sRGB spellings anything outside a declaration value, so #fab in a selector or a hex in a comment (access's note on why its greys moved) is never a colour. - tokenCopiesIn() and colors:drift both use it. The report now covers 3,884 literals and lists 156 colours hand-written in 3+ files with no token. - 84 copies swept to var(): 55 in pages, stylesheets and Workers, 29 inside garage and lwe spec CSS (pageCss/demoCss lines only, never demoJs), with every generated page regenerated. Two whole gradients were --grad-raised stop for stop (luna's button face, serendipity's) and now say so. Invisible: every swap is under dE 0.004 of its token. * fix(tokens): the chrome and title blues resolve to the XP hex their comments name colors.css said its values "resolve to period-correct Luna" and never measured it. They came in with a generated design system on 2026-06-05 and sat up to dE 0.040 from their hex (--darkshadow vs #716F64) and 0.042 for the title blues (--blue-95 vs #3D95FF): every chrome colour darker and greyer than XP, with round-number lightness that read like an estimate. - Chrome: --hue-chrome 96.85, --chroma-chrome 0.0228, exact lightness and chroma per token. One knob still drives all four; each lands within dE 0.0008 of ButtonFace, ButtonLight, ButtonShadow and the 3D dark shadow. - Title blues: --chroma-luna 0.2274 and a per-token hue offset (the ramp already used them) put --blue-65, --blue-95, --blue-inactive and --blue-50 within dE 0.0001 of ActiveTitle, GradientActiveTitle, InactiveTitle and Highlight. Every title bar and the selection colour move with this. - The contract now reads a hex in a token's comment as a claim and holds it within dE 0.002. Control: the old values fail it on seven tokens. - With the tokens on XP, 12 hand-typed XP hex values became copies and are swept (#316ac5, #ece9d8, #aca899, #0054e3). - A var() fallback is now legal for a colour literal, as it already was for a font stack. luna's client edge says var(--face,#ece9d8): build.ts mirrors it into the homepage, which paints before luna.css defines --face, and a bare var() would drop the 6px border the mirror exists to keep. build.ts's extractor and its homepage check accept that form. Rendered (local build, 9 pages): the chrome retune moves 0 to 0.4% of pixels on 8 pages by at most 5/255; the title blues move about 2% (the title bars) by up to 28/255. * feat(tokens): snap near-miss colours onto their token only when the hue holds Decision C from the palette proposal. 1,054 literals sat 0.004 to 0.02 from a token, and the prototype that snapped all of them turned /whoareyou's content pane cream. Two causes, both measured: - 357 of them were white. White is four tokens' value, so the contract never calls it a copy, and the prototype read #fff as a near-miss of the warm --paper. White and black are never near-misses of one token now. - A move that changes hue, or puts a tint on a neutral, changes temperature even under the just-noticeable difference. Each near-miss is split into its lightness, chroma and hue parts, and it snaps only when the hue part is under 0.003 and the chroma change under 0.004: greys onto the ink ramp, blue-greys onto --surface-desktop and --rule, a lighter --row-alt. - New --paper-cool, oklch(98% 0.004) at --hue-luna - 13: the cool twin of the warm --paper, which the site already wrote as a hand-mixed near-white in 18 files. 22 copies of it swept. - 252 literals in 55 source files now name a token, garage and lwe spec CSS included (pageCss/demoCss lines only); every generated page regenerated. - 400 near-misses stay literal because the move would shift their hue or tint. colors:drift keeps listing them. Rendered against #1190 (local build, 9 pages): 0 to 2.1% of pixels move on eight pages and 15.9% on /access, and nothing anywhere moves by more than 6 of 255 levels. The all-in prototype moved up to 60% of a page past that. * fix(tokens): the chrome and title blues resolve to the XP hex their comments name colors.css said its values "resolve to period-correct Luna" and never measured it. They came in with a generated design system on 2026-06-05 and sat up to dE 0.040 from their hex (--darkshadow vs #716F64) and 0.042 for the title blues (--blue-95 vs #3D95FF): every chrome colour darker and greyer than XP, with round-number lightness that read like an estimate. - Chrome: --hue-chrome 96.85, --chroma-chrome 0.0228, exact lightness and chroma per token. One knob still drives all four; each lands within dE 0.0008 of ButtonFace, ButtonLight, ButtonShadow and the 3D dark shadow. - Title blues: --chroma-luna 0.2274 and a per-token hue offset (the ramp already used them) put --blue-65, --blue-95, --blue-inactive and --blue-50 within dE 0.0001 of ActiveTitle, GradientActiveTitle, InactiveTitle and Highlight. Every title bar and the selection colour move with this. - The contract now reads a hex in a token's comment as a claim and holds it within dE 0.002. Control: the old values fail it on seven tokens. - With the tokens on XP, 12 hand-typed XP hex values became copies and are swept (#316ac5, #ece9d8, #aca899, #0054e3). - A var() fallback is now legal for a colour literal, as it already was for a font stack. luna's client edge says var(--face,#ece9d8): build.ts mirrors it into the homepage, which paints before luna.css defines --face, and a bare var() would drop the 6px border the mirror exists to keep. build.ts's extractor and its homepage check accept that form. Rendered (local build, 9 pages): the chrome retune moves 0 to 0.4% of pixels on 8 pages by at most 5/255; the title blues move about 2% (the title bars) by up to 28/255. * fix(test): guard the hex-claim test's parses so typecheck holds its baseline parseOklch and parseSrgb return null for input they cannot read, and the test used both results without a check: two TS2531 errors that validate's typecheck refused against config/ts-baseline.json. Assert both parsed, then use them. * fix(tokens): narrow the parsed colours before measuring them parseOklch and parseSrgb return null on a miss, so typecheck refused the hex-claim test against the baseline. Assert both parsed, then measure. * fix(tokens): the chrome and title blues resolve to the XP hex their comments name colors.css said its values "resolve to period-correct Luna" and never measured it. They came in with a generated design system on 2026-06-05 and sat up to dE 0.040 from their hex (--darkshadow vs #716F64) and 0.042 for the title blues (--blue-95 vs #3D95FF): every chrome colour darker and greyer than XP, with round-number lightness that read like an estimate. - Chrome: --hue-chrome 96.85, --chroma-chrome 0.0228, exact lightness and chroma per token. One knob still drives all four; each lands within dE 0.0008 of ButtonFace, ButtonLight, ButtonShadow and the 3D dark shadow. - Title blues: --chroma-luna 0.2274 and a per-token hue offset (the ramp already used them) put --blue-65, --blue-95, --blue-inactive and --blue-50 within dE 0.0001 of ActiveTitle, GradientActiveTitle, InactiveTitle and Highlight. Every title bar and the selection colour move with this. - The contract now reads a hex in a token's comment as a claim and holds it within dE 0.002. Control: the old values fail it on seven tokens. - With the tokens on XP, 12 hand-typed XP hex values became copies and are swept (#316ac5, #ece9d8, #aca899, #0054e3). - A var() fallback is now legal for a colour literal, as it already was for a font stack. luna's client edge says var(--face,#ece9d8): build.ts mirrors it into the homepage, which paints before luna.css defines --face, and a bare var() would drop the 6px border the mirror exists to keep. build.ts's extractor and its homepage check accept that form. Rendered (local build, 9 pages): the chrome retune moves 0 to 0.4% of pixels on 8 pages by at most 5/255; the title blues move about 2% (the title bars) by up to 28/255. * fix(tokens): narrow the parsed colours before measuring them parseOklch and parseSrgb return null on a miss, so typecheck refused the hex-claim test against the baseline. Assert both parsed, then measure. --------- Co-authored-by: Aadharsh Pannirselvam <19518661+oddharsh@users.noreply.github.com>
oddharsh
added a commit
that referenced
this pull request
Oct 6, 2026
…iles (#1196) * feat(type): every pt size and font family names a typography token typography.css has carried a pt scale and three family stacks since the design system was written. On 2026-10-06 the scale had 23 consumers against 1,072 hand-written sizes in 70 distinct values, and 55 family stacks were spelled out by hand (31 of them "Courier New",monospace, the mono token with its fallbacks dropped). - The scale grows to what the site sets: --text-lg 13pt, --text-lede 11pt, --text-2xs 8pt, --text-3xs 7.5pt, --text-4xs 7pt. 8pt alone had 98 uses. - 989 declarations in the sources rewritten to tokens; generated garage and lwe pages regenerated from their specs and generators. - 121 off-grid declarations snapped to the nearest step, ties down. Most move 0.2pt or less (8.6 and 8.4 -> 8.5, 8.8 -> 9, 8.2 and 7.8 -> 8). Six move 0.4-0.5pt: 12.5 -> 12 and 11.5 -> 11 (two each), 6.5 and 6.6 -> 7. - contract-type-comes-from-the-tokens refuses a pt size up to 14pt or a family stack outside var(--font-*). px (pixel-exact chrome, SVG text), relative units and display sizes over 14pt stay legal; three rules say @type demo (horizon's console caret, the polaroid's handwriting, lwe's CJK avatar). - The homepage loads luna.css without blocking, so it inlines the five size tokens it reads; the contract holds that copy to typography.css. - cssSources() now reads lwe specs' demoCss, which neither contract saw. - colors.css's --text-body: var(--ink) is gone. typography.css's --text-body (10.5pt) loads after it in luna.css, so the colour alias never applied. Checked in a browser: no element on 8 sampled pages computes to the 16px default; /garage/useragent's size histogram moves exactly by the snaps. * fix(tokens): read hex and rgb() as colours, and sweep the token copies they hid The token contract read oklch() only, and the site writes most of its colour in hex: 2,248 hex and 82 rgb() literals on 2026-10-06. Measured against the tokens by OKLab distance, 87 were a token retyped in sRGB (#f3f6fa for --row-alt 51 times over, #888 for --ink-faint, #e8eef7 for --surface-desktop). - colorLiteralsIn() reads oklch(), hex and rgb()/rgba() with one set of guards: SVG presentation attributes, and for the sRGB spellings anything outside a declaration value, so #fab in a selector or a hex in a comment (access's note on why its greys moved) is never a colour. - tokenCopiesIn() and colors:drift both use it. The report now covers 3,884 literals and lists 156 colours hand-written in 3+ files with no token. - 84 copies swept to var(): 55 in pages, stylesheets and Workers, 29 inside garage and lwe spec CSS (pageCss/demoCss lines only, never demoJs), with every generated page regenerated. Two whole gradients were --grad-raised stop for stop (luna's button face, serendipity's) and now say so. Invisible: every swap is under dE 0.004 of its token. * fix(tokens): the chrome and title blues resolve to the XP hex their comments name colors.css said its values "resolve to period-correct Luna" and never measured it. They came in with a generated design system on 2026-06-05 and sat up to dE 0.040 from their hex (--darkshadow vs #716F64) and 0.042 for the title blues (--blue-95 vs #3D95FF): every chrome colour darker and greyer than XP, with round-number lightness that read like an estimate. - Chrome: --hue-chrome 96.85, --chroma-chrome 0.0228, exact lightness and chroma per token. One knob still drives all four; each lands within dE 0.0008 of ButtonFace, ButtonLight, ButtonShadow and the 3D dark shadow. - Title blues: --chroma-luna 0.2274 and a per-token hue offset (the ramp already used them) put --blue-65, --blue-95, --blue-inactive and --blue-50 within dE 0.0001 of ActiveTitle, GradientActiveTitle, InactiveTitle and Highlight. Every title bar and the selection colour move with this. - The contract now reads a hex in a token's comment as a claim and holds it within dE 0.002. Control: the old values fail it on seven tokens. - With the tokens on XP, 12 hand-typed XP hex values became copies and are swept (#316ac5, #ece9d8, #aca899, #0054e3). - A var() fallback is now legal for a colour literal, as it already was for a font stack. luna's client edge says var(--face,#ece9d8): build.ts mirrors it into the homepage, which paints before luna.css defines --face, and a bare var() would drop the 6px border the mirror exists to keep. build.ts's extractor and its homepage check accept that form. Rendered (local build, 9 pages): the chrome retune moves 0 to 0.4% of pixels on 8 pages by at most 5/255; the title blues move about 2% (the title bars) by up to 28/255. * feat(tokens): snap near-miss colours onto their token only when the hue holds Decision C from the palette proposal. 1,054 literals sat 0.004 to 0.02 from a token, and the prototype that snapped all of them turned /whoareyou's content pane cream. Two causes, both measured: - 357 of them were white. White is four tokens' value, so the contract never calls it a copy, and the prototype read #fff as a near-miss of the warm --paper. White and black are never near-misses of one token now. - A move that changes hue, or puts a tint on a neutral, changes temperature even under the just-noticeable difference. Each near-miss is split into its lightness, chroma and hue parts, and it snaps only when the hue part is under 0.003 and the chroma change under 0.004: greys onto the ink ramp, blue-greys onto --surface-desktop and --rule, a lighter --row-alt. - New --paper-cool, oklch(98% 0.004) at --hue-luna - 13: the cool twin of the warm --paper, which the site already wrote as a hand-mixed near-white in 18 files. 22 copies of it swept. - 252 literals in 55 source files now name a token, garage and lwe spec CSS included (pageCss/demoCss lines only); every generated page regenerated. - 400 near-misses stay literal because the move would shift their hue or tint. colors:drift keeps listing them. Rendered against #1190 (local build, 9 pages): 0 to 2.1% of pixels move on eight pages and 15.9% on /access, and nothing anywhere moves by more than 6 of 255 levels. The all-in prototype moved up to 60% of a page past that. * fix(tokens): the chrome and title blues resolve to the XP hex their comments name colors.css said its values "resolve to period-correct Luna" and never measured it. They came in with a generated design system on 2026-06-05 and sat up to dE 0.040 from their hex (--darkshadow vs #716F64) and 0.042 for the title blues (--blue-95 vs #3D95FF): every chrome colour darker and greyer than XP, with round-number lightness that read like an estimate. - Chrome: --hue-chrome 96.85, --chroma-chrome 0.0228, exact lightness and chroma per token. One knob still drives all four; each lands within dE 0.0008 of ButtonFace, ButtonLight, ButtonShadow and the 3D dark shadow. - Title blues: --chroma-luna 0.2274 and a per-token hue offset (the ramp already used them) put --blue-65, --blue-95, --blue-inactive and --blue-50 within dE 0.0001 of ActiveTitle, GradientActiveTitle, InactiveTitle and Highlight. Every title bar and the selection colour move with this. - The contract now reads a hex in a token's comment as a claim and holds it within dE 0.002. Control: the old values fail it on seven tokens. - With the tokens on XP, 12 hand-typed XP hex values became copies and are swept (#316ac5, #ece9d8, #aca899, #0054e3). - A var() fallback is now legal for a colour literal, as it already was for a font stack. luna's client edge says var(--face,#ece9d8): build.ts mirrors it into the homepage, which paints before luna.css defines --face, and a bare var() would drop the 6px border the mirror exists to keep. build.ts's extractor and its homepage check accept that form. Rendered (local build, 9 pages): the chrome retune moves 0 to 0.4% of pixels on 8 pages by at most 5/255; the title blues move about 2% (the title bars) by up to 28/255. * fix(test): guard the hex-claim test's parses so typecheck holds its baseline parseOklch and parseSrgb return null for input they cannot read, and the test used both results without a check: two TS2531 errors that validate's typecheck refused against config/ts-baseline.json. Assert both parsed, then use them. * fix(tokens): narrow the parsed colours before measuring them parseOklch and parseSrgb return null on a miss, so typecheck refused the hex-claim test against the baseline. Assert both parsed, then measure. * fix(tokens): the chrome and title blues resolve to the XP hex their comments name colors.css said its values "resolve to period-correct Luna" and never measured it. They came in with a generated design system on 2026-06-05 and sat up to dE 0.040 from their hex (--darkshadow vs #716F64) and 0.042 for the title blues (--blue-95 vs #3D95FF): every chrome colour darker and greyer than XP, with round-number lightness that read like an estimate. - Chrome: --hue-chrome 96.85, --chroma-chrome 0.0228, exact lightness and chroma per token. One knob still drives all four; each lands within dE 0.0008 of ButtonFace, ButtonLight, ButtonShadow and the 3D dark shadow. - Title blues: --chroma-luna 0.2274 and a per-token hue offset (the ramp already used them) put --blue-65, --blue-95, --blue-inactive and --blue-50 within dE 0.0001 of ActiveTitle, GradientActiveTitle, InactiveTitle and Highlight. Every title bar and the selection colour move with this. - The contract now reads a hex in a token's comment as a claim and holds it within dE 0.002. Control: the old values fail it on seven tokens. - With the tokens on XP, 12 hand-typed XP hex values became copies and are swept (#316ac5, #ece9d8, #aca899, #0054e3). - A var() fallback is now legal for a colour literal, as it already was for a font stack. luna's client edge says var(--face,#ece9d8): build.ts mirrors it into the homepage, which paints before luna.css defines --face, and a bare var() would drop the 6px border the mirror exists to keep. build.ts's extractor and its homepage check accept that form. Rendered (local build, 9 pages): the chrome retune moves 0 to 0.4% of pixels on 8 pages by at most 5/255; the title blues move about 2% (the title bars) by up to 28/255. * fix(tokens): narrow the parsed colours before measuring them parseOklch and parseSrgb return null on a miss, so typecheck refused the hex-claim test against the baseline. Assert both parsed, then measure. * feat(tokens): name the 64 colours the site already shared across 5+ files The palette proposal's alternative to hue ramps: name what the site already uses rather than snapping it onto a scale. After #1193, 73 colours were still hand-written in 5+ files. Each is a cluster of near-duplicates within dE 0.01, and the token's value is the cluster's most-used colour, so those uses move by nothing (worst dE 0.0001). - 64 tokens in a SHARED PALETTE block in colors.css (and luna.css's copy), named family + OKLCH lightness: --grey-*, --mist-*, --slate-*, --luna-* (the window-frame blues), --violet-96, --red-*, --amber-*, --green-*. --slate-84 is a slate at L 84%; two same-lightness pairs take a -b suffix. Hues hang off the existing knobs, so a knob turn retunes these too. - Nine clusters within dE 0.01 of an existing token are not named: a second name for nearly the same colour would make the choice ambiguous. - 687 copies swept to var(), 80 near-misses snapped under #1193's hue-aware rule, 103 literals in garage and lwe spec CSS, two in the garage generator's scaffold, and lwe's encoding concept's accentSoft now names --mist-96. Every generated page regenerated. Rendered against #1193 (local build, 9 pages): 0.5 to 4.8% of pixels move, none by more than 5 of 255 levels. * feat(tokens): merge the near-twin greys, and --red-46 into --danger-deep The owner's call on the merges #1196 listed: - --grey-30 into --grey-28, --grey-33 into --grey-35, --grey-72 into --grey-70. Each pair sat 0.02 apart, the just-noticeable difference; the more-used member of each pair stays, so the fewest uses move. - --red-46 into --danger-deep. --red-46 was exactly #AA0000, the red the site has written by hand since the initial import; --danger-deep arrived with the generated design system as #AA0018, a bluer approximation of it. The name stays and takes the period value: --danger-deep's 2 uses move dE 0.014, --red-46's 13 do not move, and its comment's #AA0000 is now held by the hex-claim contract. 18 files repointed, specs included; every generated page regenerated. * fix(email): keep mail colours literal; a token in an email paints nothing #1183 swept eight colours in two email templates into var(): four #888s in the coffee-booking mail (cal/src/email.ts) and the webmention moderation mail's #888s and #555 (src/worker/webmention.ts) became var(--ink-faint) and var(--ink-quiet). No mail client loads luna.css and many ignore var() outright, so since #1183 deployed those borders, notes and dates have rendered in the client's default colour. The cause was the shared walk: cssSources() read every Worker source as page CSS that links luna.css. Email HTML does not. - Both files are back to their pre-#1183 text (it was their only change). - EMAIL_TEMPLATES lists them, and cssSources() skips them, so neither the colour nor the type contract asks them to name a token again. - A contract test holds both directions: no var() in an email template, and every file that calls resendSend is listed. Control: main's current email.ts fails it. --------- Co-authored-by: Aadharsh Pannirselvam <19518661+oddharsh@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
bun run zenc:benchanswers one question: is the working tree's zenc faster than a baseline, with byte-identical output? It's the instrument for running Max Woolf's agentic-iteration loop on this crate.How it works
origin/mainas the baseline (cached by zenc tree, so a loop pays for it once), and the working tree as the candidate.add-photos.sh's exactsquarecommand. Every output and all 258 histograms must match byte for byte.600.jpgto move. A comparison that has never found anything proves nothing.--parallel 8measures throughput, which is howadd-photos.shruns.A moved byte prints no timing at all.
/i/is content-addressed, so a faster zenc with different output is a different encoder, and it re-mints URLs (gotchas 35, 46). That also closes every cheat Woolf caught (skipping work, loosening a knob, trimming epochs): each one failscmpon the first source.What its first run found
So byte-identical wins on our code cap at about 1.39x. The sharpest lead: rotated sources spend 39-47% in our code against 13% upright. On one 26 MP JPEG the floor reads 520 ms upright and 745-880 ms rotated, so
orient()costs 225-360 ms, and 135 of 185 sources are rotated. Reading the source through the orientation inside the resample is identity-safe by construction. That's the next PR, not this one.Proven on real binaries
Fixed by running it
The first loop through the bench (#889) found two flaws in it, fixed in the second commit here:
--parallel 8while saving 5.4-7.0% of CPU per rotated photo. Every run now prints a CPU table.Deliberately not here
Cargo.lock, a declared input to the histogram derivation, and compile insidevalidateviaclippy --all-targets.Also
contract-zenc-bench-times-the-production-commandpins the bench's argv toadd-photos.sh, with three controls proving the comparison has teeth.zenc/README.mdgains "Optimizing zenc": Woolf's AGENTS.md benchmarking rules adapted to a content-addressed crate.Checks:
lint, fulltypecheck,test(847 pass / 0 fail),test:node(837 pass / 0 fail on the first commit),derive:check,tools:check.