Repository navigation
[PR] docs(image-rescale): reconcile the forced-path trigger-gate comments with the code - #7152
ranxianglei wants to merge 3 commits into
Conversation
…with the code The two comments describing shedDownscaleImage's forced path contradicted each other and both misstated the code: - The doRescale header comment claimed "A within-maxDim image is NOT skipped here" — wrong for below-trigger within-maxDim images, which ARE skipped. - The shedDownscaleImage doc claimed "there is no trigger gate ... images already within maxDim are left alone" — wrong for above-trigger within- maxDim images, which ARE re-encoded (adopted only if strictly smaller). The code (doRescale gate) is correct: the 100 KiB trigger gate applies ONLY to within-maxDim images as a cheap pre-filter (skip small, re-encode large); above-maxDim images are always re-encoded. Both comments now state the actual truth table. Adds a regression test pinning both gate directions (#3617): below-trigger within-maxDim is skipped, above-trigger within-maxDim is re-encoded and adopted. Closes #7150
📦 Built Package ArtifactBranch: Latest build — install this exact versionnpm install -g billion-context@0.0.11117-pr.7152.db3e7b1This exact version is immutable and reproducible. The rolling Recent builds (commit → version)
Download artifact
tar xzf billion-context-pr7152.tgz
npm install -g packageInstall instructions are refreshed on each push. |
…ate comment The rung B pre-filter (egress-shed) only skips KNOWN-dim within-maxDim images (dims !== undefined && max <= dim), so the defensive within-maxDim branch is also hit when the header dim parse FAILS (dims === undefined) and the decode shows within-maxDim — not only when the parse disagrees with the decode. Align the comment with that exact condition.
(ai: vllm-qwen/qwen3.8-27b) 查重: 不重复。 Searched open+closed for image-rescale forced-path / Review of PR #7152 (head
CI (verified live, mirror cache + job logs):
八问 (review 结论):
判定: 代码可合——等 |
[bot] 🏷 (ai: vllm-qwen/qwen3.8-27b) Status update (since my last reply at 12:45Z):
Net: PR is still not green — waiting on the re-triggered CI run (attempt 2) + the 3 queued e2e workflows. No code change since |
CI is green on the new head The originally failing check No code changes were needed in this PR. While I was verifying, another agent (ci-check) pushed a docs tweak ( The flaky 八问:
判定: PR 已绿,可合并。flaky 的 |
# Conflicts: # src/image-rescale.ts
PR #7152 — Merge-Conflict Resolution CompleteWhat I did this run:
八问
判定: 冲突已解决,PR 现在可合并( |
[ework] CI fix verified green ✓ |
Closes #7150
What
The two comments describing
shedDownscaleImage's forced path contradicted each other and both misstated the code:doRescaleheader comment (above the gate) claimed "A within-maxDim image is NOT skipped here" — wrong for below-trigger within-maxDim images, which ARE skipped.shedDownscaleImagedoc claimed "there is no trigger gate ... images already within maxDim are left alone" — wrong for above-trigger within-maxDim images, which ARE re-encoded (adopted only if strictly smaller).Design answer
The within-maxDim trigger gate in the forced path is INTENDED, not a bug. The byte-shed ladder's job is byte reduction; a large (above-trigger) within-maxDim image that re-encodes smaller is a legitimate target, and the keep-smaller check (
out.length >= origBytes) makes it safe — no adoption unless it actually shrinks. The 100 KiB clause is a cheap pre-filter to skip the expensive decode+re-encode of small images that are unlikely to shrink. The caller (src/egress-shed.ts:308-310) pre-filters known-dim within-maxDim images, so the within-maxDim forced branch is defensive (only hit when the header parse disagrees with the authoritativeJimp.read).So: code stays; both comments get reconciled to the actual truth table:
Changes
src/image-rescale.ts: reconcile both comments with the code's truth table (docs-only, no behavior change).tests/image-rescale-cache-budget.test.ts: add a regression test pinning both gate directions (Test Blind Spot Retrospective: Reinforcing Negative Assertion Discipline, Tightening Fake Upstream Strictness, Thin Inst | 测试盲区复盘:补反向断言纪律、假上游严格化、薄安装冒烟、形态矩阵与生命周期覆盖 #3617 negative-assertion discipline) — below-trigger within-maxDim is skipped, above-trigger within-maxDim is re-encoded and adopted.Behavior change
None. Docs-only + test. The code path is unchanged (the forced condition is bit-identical before/after).