Skip to content

Remove legacy v1 token codec + challenge-heuristic fallback in @prosopo/server #2856

Description

@forgetso

Once the new procaptcha client bundle carrying `captchaType` on every token has been in production long enough that we no longer see legacy tokens being verified, we can retire the backwards-compat scaffolding introduced in PR #2855.

What to remove

  • `packages/types/src/procaptcha/token.ts`
    • `ProcaptchaTokenCodecV1` — the frozen v1 struct kept for decoding old tokens.
    • v1 fallback branch inside `decodeProcaptchaOutput`.
    • Make `captchaType` required on `ProcaptchaOutputSchema` (drop `.optional()`).
  • `packages/server/src/server.ts`
    • Legacy `else` branch in `verifyProvider` (the "presence of challenge → PoW, absence → image" heuristic).
    • The `warn`-level "Verifying legacy token without captchaType field" log.
  • Corresponding test scaffolding in `packages/server/src/tests/`:
    • Legacy-v1 fallback tests in `token.unit.test.ts`.
    • Legacy-token dispatch tests in `server.unit.test.ts`.
    • Remove `ProcaptchaTokenCodecV1` export from the types package.

When it's safe

Grep provider logs (oo2) for the warn line `Verifying legacy token without captchaType field`. Once it stays at zero for a full retention window across peak traffic (probably 30 days from the client-bundle release), pull the fallback.

Why keep it now

Client bundle rollout is not atomic. Customers on cached CDN JS will keep minting legacy tokens for a while. Removing the fallback before the tail dries up would silently regress puzzle-verify for exactly those customers.

Related: PR #2855 fixed the underlying dispatch bug and added the fallback so pow/image tokens minted by old bundles keep verifying.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions