test(metering): find the actor key in any meterIncr argument

The buffered write now passes the claim key too, which moves the counter
key's position. The image provider's write-ordering test matched it by
index and stopped seeing the write.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
404oopsandClaude Opus 5.5 authored and GitHub committed 2026-11-05 10:23:46 -07:00
1 parent d2cef27085
commit 63a98f89ff
1 file changed
+2 -1
@@ -253,7 +253,8 @@ describe('OpenAiImageProvider.generate credit gate', () => {
});
let blocked = false;
vi.spyOn(redis, 'meterIncr').mockImplementation(async (...args) => {
if (!blocked && args[5].includes(`:actor:${actor.user!.uuid}:`)) {
const actorKey = `:actor:${actor.user!.uuid}:`;
if (!blocked && args.some((arg) => arg.includes(actorKey))) {
blocked = true;
await held;
}