refactor(anthropic): isolate the image normalize codec and cache (split S03 L1/3) - #3567
refactor(anthropic): isolate the image normalize codec and cache (split S03 L1/3)#3567lidge-jun wants to merge 2 commits into
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
✅ Deterministic PR hygiene checks passed. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Team Run ID: 📒 Files selected for processing (3)
Included review availability: Your plan provides up to 10 included reviews per hour; 5 remain after this review. 📝 WalkthroughWalkthroughThe PR extracts Anthropic image normalization into a codec module. The codec owns tier processing, validation, JPEG encoding, byte-weighted LRU caching, memory-budget hooks, and test seams. The normalize module re-exports the codec API, and tests verify shared state ownership. ChangesAnthropic image normalization
Estimated code review effort: 3 (Moderate) | ~25 minutes Merge Risk: ⚪ Minimal · up to The image normalization codec is extracted while existing normalize-module imports remain available and cache ownership is consolidated. No concrete current-head merge-blocking risk remains. Sequence Diagram(s)sequenceDiagram
participant Caller
participant processAt
participant Cache
participant BunImage
Caller->>processAt: Submit base64 image and tier position
processAt->>Cache: Read cached tier result
processAt->>BunImage: Validate native payload or encode JPEG
BunImage-->>processAt: Return validation result or encoded image
processAt->>Cache: Store pass, encoded, or miss result
processAt-->>Caller: Return normalization result
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
리뷰 · 우선순위 71 / 80이 PR은 adapters-anthropic 스플릿 열차 S03의 맨 아래 칸(L1/3) 입니다. 지금 src/adapters/anthropic-image-codec.ts - src/adapters/anthropic-image-normalize.ts 30–32 - codec에서 가져오는 import가 세 줄로 갈라져 있고, src/adapters/anthropic-image-normalize.ts re-export - 기존 소비자( tests/adapters/anthropic/anthropic-image-normalize.test.ts - 훅 identity + residual에 top-level 경로 S03 L2/L3 (TBD) - 위층은 이 브랜치를 base로 쌓습니다. 이 칸이 먼저 초록이어야 기차가 앞으로 갑니다. 메인테이너의 판단이 필요한 지점
너의 추천 이 댓글은 grok-bot이 작성했습니다 |
Ingwannu
left a comment
There was a problem hiding this comment.
Approved on exact head c1d436738c5fb012b666cc15e87e777a66e7648d. The codec/cache extraction preserves all facade bindings, keeps the mutable normalization cache under one module owner, and introduces no new dependency cycle. Independent isolated verification exercised the real Bun.Image path and cache/accounting seam at 25/25; exact-head cross-platform CI and CodeRabbit are green with no unresolved thread.
|
Superseded by aggregate PR #3668, admin-merged into dev as 6585e6a after exact-head CI and tested-tree verification. This original PR was not individually merged; its rebased content and historical records were consolidated in #3668. The original branch is preserved. Further unimplemented debt layers remain deferred. |
Summary
processAt(src/adapters/anthropic-image-normalize.ts:25–66, 71–261, 282–347) — moves verbatim tosrc/adapters/anthropic-image-codec.ts(304 lines).anthropic-image-normalize.tskeeps the message walker and target normalizer (228 lines) and re-exports all 13 moved public names, so every existing import path (10 consumers) keeps working. The mutable cache state now has exactly one owner.devlog/_plan/260905_now_split_train/080_adapters_anthropic_image_normalize.md; rules003_parent_decisions.md(PURE-MOVE-SIZE-01).Stack (S03 adapters-anthropic; merge bottom-up):
Base: dev. Review this PR's diff only (3 files, +327/−298; non-move diff: 2 codec imports, 8 wiring lines, 6 export modifiers, 15 test lines). Move-aware view:
git diff --color-moved=dimmed-zebra dev...HEAD.Verification
bun run typecheck→ exit 0cacheGetforced to miss fails the cache-hit assertion (anthropic-image-normalize.test.ts:213); skipping sentinel accounting incachePutfails:91.bun run privacy:scan→ passedrgfor original-path importers: 10 (unchanged); residual declares no cache state.lidge) at this exact SHA: recorded in the devlog doc.Checklist
Summary by CodeRabbit
New Features
Bug Fixes