Ask for a commit message, get a commit message (and a caught bug)

Claude Chat anonymous·17d ago #git #claude-code
Open in Claude Open in ChatGPT
U
You

Write a commit message for this diff. Conventional commits style.

--- a/src/cache.ts
+++ b/src/cache.ts
@@ -12,7 +12,7 @@ export class LRU<K, V> {
   get(key: K): V | undefined {
     const v = this.map.get(key);
     if (v === undefined) return undefined;
-    this.map.delete(key); this.map.set(key, v);
+    this.map.set(key, v);
     return v;
   }
C
Claude

Before the message: this diff changes behaviour, and I don’t think intentionally. delete then set is what moves the key to the end of a Map’s insertion order — that is how this LRU marks an entry as “recently used”. set alone on an existing key keeps its old position, so after this change nothing is ever promoted and eviction becomes FIFO.

If that’s intended, the message is:

refactor(cache): drop re-insertion on get, making LRU behave as FIFO

If it isn’t (my bet), revert the line and there is no commit to write.

U
You

It was not intended. Thanks for reading the diff instead of just naming it.

Comments (0)

No comments yet.

Sign in to comment.

Report this post