Commit 8e7c6ec
feat(celery Wave 5 P2 chunk 4): vision callsite rewrite + chunk 4b gate self-disable verify
Per §G.2.5.1 spec amend final piece: rewire `_build_vision_worker._embed`
to call `EmbeddingService.embed_image(image_bytes, alt_text)` (chunk 1)
with the actual image bytes the parser persisted (chunk 2 wrote
`derived/parse_<v>/vision/images/<image_id>.<ext>` + a JSONL descriptor
at `vision/source.jsonl`). The chunk 4b vision gate self-disables when
the operator flips `Model.supports_multimodal_embedding=True` (chunk 3).
`aperag/indexing/worker_factory.py`:
* `_embed(image_id, alt_text, image_bytes=None)` — when image_bytes
is provided, route to `embedding_service.embed_image(image_bytes,
alt_text)`. None falls back to the legacy text-concat path so the
T1 simulator + tests that hand the worker synthetic JSON keep
working.
* Gate-raise message reframed: drops "Wave 4 wiring" phrasing (now
Wave 5 wiring is land), names the typed
`Model.supports_multimodal_embedding` flag so an operator can fix
the config directly.
`aperag/indexing/vision.py`:
* `VisionModality.derive` accepts both source-path formats: the
legacy single-JSON-array shape (T1 simulator / pre-Wave-5 tests)
AND the new JSONL-with-image-path shape (parser chunk 2 output).
Format detection is by first non-whitespace byte (`[` → JSON array,
else → JSONL).
* `_load_image_bytes(record)` reads the descriptor's `image_path`
through the object store; missing blob logs a warning and returns
None (embedder still runs on the alt-text/id placeholder digest)
so a partial parser write doesn't block the whole derive cycle.
* `_placeholder_embedding(..., image_bytes=None)` mirrors the new
embedder signature; placeholder ignores bytes.
* Embedder Protocol is widened: `(image_id, alt_text, image_bytes=None)`.
`tests/integration/test_full_indexing_pipeline.py`:
* Renamed Layer 1 `test_phase1_vision_modality_raises_wave4_wiring_gate`
→ `..._gate_raises_when_embedder_not_multimodal`. Asserts the
reframed message names `multimodal embedding model` +
`supports_multimodal_embedding` flag.
* New positive-path Layer 1
`test_phase1_vision_modality_gate_self_disables_when_embedder_multimodal`:
with `is_multimodal()=True`, the factory builds a vision worker
without raising — pins the chunk 4 gate-self-disable contract.
* Layer 2 e2e assertion: vision modality may be ACTIVE (when CI
fixture has multimodal embedder configured) OR FAILED with a gate
marker including `supports_multimodal_embedding`. OR-on-marker
tolerance kept for transition state.
`tests/unit_test/indexing/test_t1_4_summary_vision.py`: 3 new tests
covering JSONL descriptor with image_path (bytes loaded + forwarded),
missing-blob graceful fallback, and legacy JSON-array backward compat.
Production-readiness 三类:
- must-be-real: real `embed_image` callsite + real bytes load from
parser's descriptor
- may-be-gated: legacy text-concat fallback + simulator JSON format
preserved for tests
- fully-resolves: §G.2.5.1 spec items 1+2+3 all wired end-to-end +
chunk 4b vision gate self-disable verify (Wave 5 P2 closure)
Wave 5 P2 (T7 multimodal vision-LLM 3-item bundle) closed. The chunk
4b vision gate self-disables when an operator configures a multimodal
embedder; default-off behaviour preserved for text-only collections.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>1 parent 7fe3f25 commit 8e7c6ec
4 files changed
Lines changed: 334 additions & 47 deletions
File tree
- aperag/indexing
- tests
- integration
- unit_test/indexing
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
112 | 112 | | |
113 | 113 | | |
114 | 114 | | |
115 | | - | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
116 | 130 | | |
117 | 131 | | |
118 | 132 | | |
| |||
144 | 158 | | |
145 | 159 | | |
146 | 160 | | |
147 | | - | |
148 | | - | |
149 | | - | |
150 | | - | |
151 | | - | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
152 | 176 | | |
153 | 177 | | |
154 | 178 | | |
| |||
158 | 182 | | |
159 | 183 | | |
160 | 184 | | |
161 | | - | |
162 | | - | |
163 | | - | |
164 | | - | |
165 | | - | |
166 | | - | |
| 185 | + | |
167 | 186 | | |
168 | 187 | | |
169 | 188 | | |
| |||
179 | 198 | | |
180 | 199 | | |
181 | 200 | | |
182 | | - | |
| 201 | + | |
| 202 | + | |
183 | 203 | | |
184 | 204 | | |
185 | 205 | | |
| |||
251 | 271 | | |
252 | 272 | | |
253 | 273 | | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
254 | 328 | | |
255 | 329 | | |
256 | 330 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
442 | 442 | | |
443 | 443 | | |
444 | 444 | | |
445 | | - | |
446 | | - | |
447 | | - | |
448 | | - | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
449 | 449 | | |
450 | 450 | | |
451 | 451 | | |
452 | 452 | | |
453 | 453 | | |
454 | | - | |
455 | | - | |
456 | | - | |
457 | | - | |
458 | | - | |
459 | | - | |
460 | | - | |
461 | | - | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
462 | 467 | | |
463 | 468 | | |
464 | 469 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
211 | 211 | | |
212 | 212 | | |
213 | 213 | | |
214 | | - | |
215 | | - | |
216 | | - | |
217 | | - | |
218 | | - | |
219 | | - | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
220 | 225 | | |
221 | 226 | | |
222 | | - | |
223 | | - | |
224 | | - | |
225 | | - | |
226 | 227 | | |
227 | 228 | | |
228 | 229 | | |
| |||
256 | 257 | | |
257 | 258 | | |
258 | 259 | | |
259 | | - | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
260 | 330 | | |
261 | 331 | | |
262 | 332 | | |
| |||
452 | 522 | | |
453 | 523 | | |
454 | 524 | | |
455 | | - | |
456 | | - | |
457 | | - | |
| 525 | + | |
458 | 526 | | |
459 | 527 | | |
460 | 528 | | |
| |||
536 | 604 | | |
537 | 605 | | |
538 | 606 | | |
539 | | - | |
540 | 607 | | |
541 | 608 | | |
542 | 609 | | |
| |||
549 | 616 | | |
550 | 617 | | |
551 | 618 | | |
552 | | - | |
| 619 | + | |
553 | 620 | | |
554 | 621 | | |
555 | 622 | | |
| |||
605 | 672 | | |
606 | 673 | | |
607 | 674 | | |
| 675 | + | |
| 676 | + | |
| 677 | + | |
| 678 | + | |
| 679 | + | |
| 680 | + | |
| 681 | + | |
608 | 682 | | |
609 | 683 | | |
| 684 | + | |
| 685 | + | |
| 686 | + | |
| 687 | + | |
| 688 | + | |
610 | 689 | | |
611 | | - | |
612 | | - | |
| 690 | + | |
| 691 | + | |
613 | 692 | | |
614 | 693 | | |
615 | 694 | | |
616 | 695 | | |
617 | | - | |
| 696 | + | |
618 | 697 | | |
619 | 698 | | |
620 | 699 | | |
| |||
657 | 736 | | |
658 | 737 | | |
659 | 738 | | |
660 | | - | |
661 | | - | |
662 | | - | |
| 739 | + | |
663 | 740 | | |
664 | 741 | | |
665 | 742 | | |
| |||
0 commit comments