Skip to content

serve: bound the CloudEvents id on consume, catch DriverError from idempotency_release, declare Idempotency-Key maxLength in OpenAPI #261

Closed

Description

@choiyounggi

Context

PR #259 (#258) bounded the Idempotency-Key header at 255 bytes (400 idempotency-key-too-long) and moved the rollback before idempotency_release on the event-consume failure path. Three neighbouring gaps were found during that work and left out of scope.

1. CloudEvents id on the consume route is unbounded

POST /-/events/<slug> keys its idempotency claim on the CloudEvents id (impl/lnpl/wsgi.py _respond_event_consume). That key lands in the same lnpl_idempotency (workflow_id, key) btree index on lnpl-postgres, so an id of about 4000 characters fails with an unhandled 500, the same failure #258 fixed for the header. The CloudEvents spec sets no maximum length, so the bound and its status code need a decision.

2. DriverError from idempotency_release escapes as a raw 500

On the consume escape path, a DriverError raised by idempotency_release itself is not caught and leaves the WSGI app as a raw 500. This predates #258 and was not made worse by it.

3. OpenAPI does not declare the header bound

impl/lnpl/openapi.py:592 declares Idempotency-Key as {"type": "string"} with no maxLength: 255. Adding it changes 7 golden files.

Done when

  • Each item fixed (or explicitly decided against) with a test; Postgres behaviour pinned via the TCK or lnpl-postgres where relevant.

Activity

  1. added a commit that references this issue on Oct 26, 2026
  2. choiyounggi commented on Oct 26, 2026

    @choiyounggi
    OwnerAuthor

    PR #269(main a310017)로 해결됐다. 완료 기준 중 "Postgres 동작은 TCK 또는 lnpl-postgres로 고정(해당되는 경우)" 항목은 해당 없음으로 결정했다(계획 결정 D14). 근거:

    • id 길이 바운드(255 UTF-8 바이트 초과 → 400 cloudevents-id-too-long)와 비-UTF-8 id 거부(400 cloudevents-invalid)는 WSGI 라우트에서 repository_factory()를 호출하기 전에 판정한다. 드라이버가 열리지 않으므로 백엔드마다 동작이 갈릴 여지가 없다. 테스트는 드라이버 생성 횟수가 늘지 않는 것까지 단언한다(impl/tests/test_wsgi_event_consume.py).
    • claim 해제 가드는 드라이버가 던진 DriverError를 WSGI 계층에서 잡아 503 event-retry-later를 유지한다. 드라이버 구현에 의존하지 않는다.

    그래서 lnpl-postgres 테스트는 추가하지 않았다. 이 변경은 이전에 받아들이던 입력을 거부하므로 CHANGELOG Unreleased에 **Breaking**으로 적혀 있다.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    production-readinessGaps blocking real production use (beyond the Phase 1 reference impl)

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions