Skip to content

Carry the detector bundle's keyMap through the pool push - #3325

Merged
forgetso merged 1 commit into
mainfrom
fix/detector-pool-push-keymap
Sep 22, 2026
Merged

forgetso merged 1 commit into
mainfrom
fix/detector-pool-push-keymap

Conversation

@forgetso

@forgetso forgetso commented Sep 22, 2026 •

Copy link
Copy Markdown
Member

What was broken

keyMap is an opaque per-bundle decode parameter. The pool build writes one alongside each bundle, and it is meaningless without that bundle — the same contract as payloadLayout.

The HTTP pool-push route never accepted it. Its body schema didn't list keyMap, and zod quietly deletes anything not listed, so it was thrown away on every push. The code that writes the bundle back to disk then left it out too.

What effect it had

A pool the provider served and could not decode. The push said it worked (persisted: true), the bundles loaded, sessions were assigned them — and what they produced could not be read. Nothing logged an error.

This hit production earlier today, and the affected data went to zero the moment the pool was pushed, staying there until the pool was copied over SSH instead.

Pools copied straight onto the disk volume were always fine, because that path doesn't go through the schema. That is why this was never caught before — it only breaks the HTTP route.

What changed

  • keyMap added to ReplaceDetectorPoolBody, so the route stops discarding it.
  • persistDetectorBundlePool now writes it back to disk, so it survives a restart.

Test coverage

New test in bundlePool.test.ts puts a bundle carrying the parameter through load → persist → reload and checks it is still there. Confirmed it fails without the fix and passes with it. Full file: 18 tests, all passing.

Pairs with a fix in captcha-private, where the push script had to be taught to send the field in the first place.

🤖 Generated with Claude Code

`keyMap` is an opaque per-bundle decode parameter written alongside each
bundle by the pool build, on the same contract as `payloadLayout`. The admin
pool-replace body schema never declared it, so zod stripped it from every
push, and persistDetectorBundlePool then wrote the bundle back to disk
without it.

The result was a pool the provider served but could not decode: the push
returned success with persisted: true, bundles loaded, sessions were assigned
them, and what they produced could not be read. Pools copied onto the volume
were unaffected — that path never goes through the schema, which is why this
survived staging.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@forgetso
forgetso force-pushed the fix/detector-pool-push-keymap branch from b27b188 to 55acd30 Compare September 22, 2026 19:01
@forgetso
forgetso merged commit 1728cd0 into main Sep 22, 2026
19 checks passed
@forgetso
forgetso deleted the fix/detector-pool-push-keymap branch September 22, 2026 19:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant