test(lance): cover the runtime config boundary - #1162
Conversation
Lance declared only a REQUIRES_TRT,REQUIRES_GPU runtime test, so its VL preprocessing config boundary had no coverage in the public CPU tier. Lance is the only family that resolves that config from two bundle sections at once: plugin.cpp hands lance_parse_preprocess_config() both config.json and preprocessor_config.json. The two sources do not merge in a single direction. apply_preprocessor_config_overrides() runs before apply_config_image_norm_overrides(), so patch_size, merge_size and temporal_patch_size are taken from preprocessor_config.json while image_mean and image_std are taken from config.json. Nothing pinned either direction, and the opposite precedence is invisible at the call site. Add a CPU consumer contract over lance_parse_preprocess_config() covering both directions, the escaped-newline decode applied to vl_prompt_template, and the resample fallback that must stay suppressed whenever config.json states an interpolation of its own. Also pin the surprising half of the first direction: a preprocessor_config.json that omits the geometry keys still overrides them, resetting config.json's values to 14/2/2 rather than preserving them. Mutation-checked three ways. Swapping the two override calls fails the image mean and std checks; dropping the stated-interpolation guard fails the resample check; making the absent overrides preserve config.json instead of resetting fails the three reset checks. Each mutation was reverted and the test returns to green. Follows the CPU contract pattern already established for internvl, qwen_vl, qwen3_5, locateanything and deepseek_ocr. Signed-off-by: Moviw <xvzimo@gmail.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Enterprise Run ID: 📒 Files selected for processing (2)
Included review availability: Your plan provides up to 12 included reviews per hour; 11 remain after this review. 📝 SummarySummaryAdds a CPU-only Lance contract test for The test verifies:
The test compiles Architecture impact
Review statusPASS — CPU compilation, unit tests, formatting, model validation, repository tests, and mutation checks passed. The test detects the documented precedence, interpolation-guard, and geometry-reset mutations. WalkthroughChangesLance runtime configuration
Estimated code review effort: 2 (Simple) | ~10 minutes Merge Risk: ⚪ Minimal · up to This adds CPU coverage for Lance preprocessing configuration precedence, fallback, reset, and prompt-template behavior without changing production behavior. No current merge-blocking risk remains. 🚥 Pre-merge checks | ✅ 8 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (8 passed)
Full details: Docstring CoverageExplanation Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 2 functions across 1 files. (1 skipped: 1 unsupported.) Comment |
Background
lancedeclares a single runtime test,test_lance_vl_pipeline, gated onREQUIRES_TRT,REQUIRES_GPU. Its VL preprocessing config boundary therefore hasno coverage in the public CPU tier.
That boundary is unusual.
lanceis the only family that resolves itspreprocessing config from two bundle sections at once —
plugin.cpphandslance_parse_preprocess_config()bothconfig.jsonandpreprocessor_config.json:The two sources do not merge in a single direction.
apply_preprocessor_config_overrides()runs beforeapply_config_image_norm_overrides(), so:patch_size,merge_size,temporal_patch_sizepreprocessor_config.jsonimage_mean,image_stdconfig.jsonNothing pinned either direction. Both are invisible at the call site, and both
fail by producing plausible wrong pixels rather than an error.
Exit Criteria
lanceVL preprocessing config boundary is covered in the CPU tier, usingthe same entry point
plugin.cppcalls.fails the suite.
resamplefallback is pinned as suppressed wheneverconfig.jsonstatesan
interpolationof its own.Non-goals: no production behavior is changed, and image decoding, pixel
preprocessing and mrope position building stay out of scope — they need image
fixtures rather than a config contract.
Implementation
Add
tests/cpp/models/lance/test_lance_runtime_config_contract.cppand registerit in
src/runtime/models/lance/MODEL.tomlas a CPU test that compilesimage_preprocessor.cppdirectly, mirroring the entry already used bydeepseek_ocrandinternvl.The fixture uses non-default values throughout, so a consumer that stopped
reading a key and fell back to the struct default fails. Beyond the two
precedence directions the test pins:
vl_prompt_template;resample0/2/3 resolving to nearest/bilinear/bicubic, and an unknown valuekeeping the default, only when
config.jsonstates nointerpolation;preprocessor_config.jsonthatomits the geometry keys still overrides them, resetting
config.json's valuesto 14/2/2 rather than preserving them;
preprocessor_config.jsonsection leavingconfig.json's geometrystanding.
No production source is touched.
Change categories
Validation
Commands and Results
Compilation and unit:
Repository gates:
Mutation check, three ways — each mutation applied to
src/runtime/models/lance/image_preprocessor.cpp, then reverted:apply_preprocessor_config_overrides()andapply_config_image_norm_overrides()FAIL: image mean comes from config.json,FAIL: image std comes from config.jsonmaybe_apply_resample_fallback()FAIL: stated interpolation survives the resample fallbackconfig.jsoninstead of resettingFAIL: an absent patch_size override resets to 14and the two sibling checksAfter reverting all three, the test returns to exit 0.
Hardware, Environment, and Revisions
3ee90b6e11d8929849271aaf067ade6bd627e416(upstream/main).TRTMC_BUILD_BACKEND_TRT=OFF,TRTMC_BUILD_BACKEND_RTX=OFF. No TensorRT SDK and no GPU are used by thistest.
JSON text.
Not Run / Remaining Gaps
test_lance_vl_pipelinewas not run: it stays gated onREQUIRES_TRT,REQUIRES_GPUand is unchanged by this PR.
lance_build_mrope_positions()are notcovered here; they need image fixtures rather than a config contract.
Notes For Future Readers
The opposite precedence between the geometry keys and the normalization triplets
is the thing worth remembering. It is a consequence of statement order in
lance_parse_preprocess_config(), not of an explicit policy, so if the merge isever unified in one direction this test is the place that will say so.
The geometry reset is pinned as current behavior, not endorsed as correct: a
preprocessor_config.jsonthat omitspatch_sizesilently discardsconfig.json's value and substitutes 14. If that turns out to be wrong for areal checkpoint, the fix belongs in
apply_preprocessor_config_overrides()andthis test should be updated in the same change.
Suggested review order:
MODEL.tomlregistration, then the fixture, then theassertions.
Risk level
Test-only. No production source is modified, and the new test runs in the CPU
tier without TensorRT or a GPU.