Skip to content

Commit c2a709a

Browse files
ndemiancclaude
andcommitted
refactor(ai): drop dead hasUsableContent assignment (PR #19 review)
The string-content branch of withRollingCacheBreakpoint set hasUsableContent = true but never read it — the value is only used in the array branch. Scope it to that branch as a const, which removes both the useless assignment and the now-dead initializer. Behavior unchanged; promptCaching test still green. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent 59dec3d commit c2a709a

1 file changed

Lines changed: 1 addition & 3 deletions

File tree

extensions/levelcode-ai/providers/anthropic.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -169,14 +169,12 @@ function withRollingCacheBreakpoint(messages) {
169169
const m = arr[i];
170170
if (!m) { continue; }
171171
let content = m.content;
172-
let hasUsableContent = false;
173172
if (typeof content === 'string') {
174173
if (!content) { continue; }
175-
hasUsableContent = true;
176174
content = [{ type: 'text', text: content, cache_control: { type: 'ephemeral' } }];
177175
} else if (Array.isArray(content) && content.length) {
178176
// Require at least one non-empty block to count this message as cacheable.
179-
hasUsableContent = content.some((b) => {
177+
const hasUsableContent = content.some((b) => {
180178
if (!b) { return false; }
181179
if (b.type === 'text') { return !!(b.text || '').trim(); }
182180
return b.type === 'tool_result' || b.type === 'tool_use' || !!b.content;

0 commit comments

Comments
 (0)