0.2.6-dev: the maintainer's decisions of 2026-10-12 — the 玩法说明 pages' WebP copies are lossy at quality 90 (25.6 MB of PNG → 4.2 MB; lossless stays a GUIDE_WEBP_MODE away) and /healthz?traffic=1 answers the counters to a loopback or private-network client only (a public visitor, also one a local tunnel or proxy forwards, gets the plain report; TRUST_PROXY applies as for the WebSocket limits); golden: unchanged
This commit is contained in:
1 parent
35f4895219
commit
79bb26b317
10 files changed
+71
-26
No files matched your search
@@ -210,11 +210,11 @@ print(json.dumps(e.prefab_node(go)))`);
|
||||
assert.equal(raw.stdout.trim(), '[0.0, 0, 0.0]');
|
||||
});
|
||||
|
||||
test('guide pages (host bandwidth layer 0): --webp writes a lossless WebP copy of every page PNG, the manifest lists it, the PNG stays',
|
||||
test('guide pages (host bandwidth layer 0): --webp writes a WebP copy of every page PNG (lossy q90 by default, lossless on request), the manifest lists it, the PNG stays',
|
||||
{ skip: spawnSync(PY, ['-c', "import sys; from PIL import features; sys.exit(0 if features.check('webp') else 1)"], { env: ENV }).status !== 0 && 'no Pillow with WebP' }, () => {
|
||||
const jobs = JSON.parse(spawnSync(PY, [path.join(TOOL, 'extract.py'), '--print-jobs'], { encoding: 'utf8', env: ENV }).stdout);
|
||||
assert.deepEqual(jobs.guideWebp.sub, 'guide');
|
||||
assert.equal(jobs.guideWebp.mode, 'lossless', 'lossy pages wait for the maintainer\'s comparison');
|
||||
assert.equal(jobs.guideWebp.mode, 'lossy', 'quality 90, the maintainer\'s choice of 2026-10-12');
|
||||
assert.ok(!jobs.webp.some((w) => w.sub === 'guide'), 'the board texture table is unchanged');
|
||||
const out = py(`
|
||||
import tempfile, pathlib
|
||||
@@ -235,20 +235,25 @@ mf.write_text(json.dumps({'version': 1, 'source': 'local-client', 'count': 4, 'g
|
||||
code = e.webp_only(root, mf, lambda *a: None)
|
||||
doc = json.loads(mf.read_text())
|
||||
g = doc['groups']['guide']
|
||||
modes = {k: v.get('webp') for k, v in g.items()}
|
||||
px = lambda p: list(Image.open(p).convert('RGBA').getdata())
|
||||
print(json.dumps({'code': code, 'paths': {k: v['path'] for k, v in g.items()}, 'modes': {k: v.get('webp') for k, v in g.items()},
|
||||
e.GUIDE_WEBP_MODE = 'lossless'
|
||||
again = e.run_webp(root, 'guide', doc['groups'], lambda *a: None)
|
||||
print(json.dumps({'code': code, 'paths': {k: v['path'] for k, v in g.items()}, 'modes': modes,
|
||||
'relisted': {k: v.get('webp') for k, v in g.items()},
|
||||
'other': doc['groups']['ui/battle']['x']['path'],
|
||||
'same': all(px(sub / f'{n}.png') == px(sub / f'{n}.webp') for n in ['autochess_home_1', 'autochess_shop_2']),
|
||||
'png': all((sub / f'{n}.png').exists() for n in ['autochess_home_1', 'autochess_shop_2']),
|
||||
'again': e.run_webp(root, 'guide', doc['groups'], lambda *a: None)}))`);
|
||||
'again': again}))`);
|
||||
assert.equal(out.code, 0);
|
||||
const at = (n, ext) => `/assets/local/guide/${n}.${ext}`;
|
||||
assert.deepEqual(out.paths, { autochess_home_1: at('autochess_home_1', 'webp'), autochess_shop_2: at('autochess_shop_2', 'webp'), autochess_handbook_9: at('autochess_handbook_9', 'png') });
|
||||
assert.deepEqual(out.modes, { autochess_home_1: 'lossless', autochess_shop_2: 'lossless', autochess_handbook_9: null });
|
||||
assert.deepEqual(out.modes, { autochess_home_1: 'lossy', autochess_shop_2: 'lossy', autochess_handbook_9: null });
|
||||
assert.equal(out.other, '/assets/local/ui/battle/x.png', 'other groups keep their PNGs');
|
||||
assert.ok(out.same, 'lossless: the same pixels, alpha included');
|
||||
assert.ok(out.png, 'the PNG stays beside the copy');
|
||||
assert.equal(out.again, 2, 'a second run (another GUIDE_WEBP_MODE) rewrites the copies the manifest already lists');
|
||||
assert.deepEqual(out.relisted, { autochess_home_1: 'lossless', autochess_shop_2: 'lossless', autochess_handbook_9: null });
|
||||
assert.ok(out.same, 'lossless: the same pixels, alpha included');
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Reference in new issue
Block a user