Skip to content

v0.4.3-alpha - Transport Extensibility, WebSocket Runtime, Execution Hardening | Transport 확장성, WebSocket 런타임, 실행 안정화

Choose a tag to compare

@NARUBROWN NARUBROWN released this 20 Jul 01:32
· 190 commits to main since this release
538572387-2613ab5e-cf90-443b-925f-82a2d436fcbd

🦴 Spine v0.4.0 ~ v0.4.3

Transport Extensibility, WebSocket Runtime, Execution Hardening | Transport 확장성, WebSocket 런타임, 실행 안정화

Spine v0.4.0부터 v0.4.3까지는 v0.3.9에서 안정화한 HTTP 실행 모델을 WebSocket과 사용자 정의 Transport까지 확장한 구간입니다.
전역 인터셉터를 라우팅 이전 단계로 이동하고, HTTP 런타임 위에 WebSocket 실행 모델을 추가했으며, 이벤트 발행·DI 컨테이너·라우팅·오류 처리의 동시성과 안정성을 강화했습니다.

From v0.4.0 to v0.4.3, Spine expands the HTTP execution model stabilized in v0.3.9 with WebSocket and custom transport support.
This range moves global interceptors before routing, adds a WebSocket execution model on top of the HTTP runtime, and strengthens concurrency and error handling across events, dependency injection, and routing.


✨ 주요 변경 사항 | Highlights

  • 전역 인터셉터를 라우팅 전으로 이동하고 라우팅 전 명시적 중단 지원
  • HTTP 런타임 위에 Registry·DI·Pipeline 기반 WebSocket 지원 추가
  • HTTP 외 프로토콜 확장을 위한 CustomTransport 인터페이스 추가
  • HTTP timeout, header/body 제한 및 WebSocket 보호 옵션 추가
  • WebSocket ping/pong, 동시 쓰기 직렬화, 종료 처리 강화
  • Pipeline panic 복구 및 내부 오류 메시지 비공개 처리
  • 이벤트별 Publisher 병렬 실행과 발행 오류 전파
  • DI singleton의 동시 생성, cycle 및 constructor panic 처리 강화
  • Trie 기반 라우터와 Handler path metadata 도입
  • CI 품질 검사, race detector 및 단위·통합 테스트 확대
  • Moved global interceptors before routing and enabled explicit pre-routing aborts
  • Added Registry, DI, and Pipeline-based WebSocket support on top of HTTP
  • Added CustomTransport for non-HTTP protocol extensions
  • Added HTTP timeouts, header/body limits, and WebSocket protection options
  • Hardened WebSocket ping/pong, concurrent writes, and shutdown behavior
  • Added pipeline panic recovery and protected internal error details
  • Parallelized publishers per event and propagated publishing failures
  • Strengthened concurrent DI singleton creation, cycle detection, and constructor panic handling
  • Introduced trie-based routing and handler path metadata
  • Expanded CI quality checks, race detection, and unit/integration coverage

🚀 버전별 업데이트 | Version-by-Version

v0.4.0 (2026-02-19)

  • 전역 인터셉터의 PreHandle을 라우팅 이전으로 이동
  • 미등록 경로에서도 전역 PreHandle과 AfterCompletion 실행
  • 전역 인터셉터에서 core.ErrAbortPipeline을 반환해 라우팅 전 실행 중단 지원
  • 성공 경로에서 Route Interceptor 이후 Global Interceptor 순서로 PostHandle 실행
  • Error 반환값의 handler 오류 전파와 처리 종료 의미론 보강
  • Unit/Integration 작업을 분리한 GitHub Actions CI 도입
  • Moved global interceptor PreHandle execution before route resolution
  • Executes global PreHandle and AfterCompletion for unmatched routes
  • Enables global interceptors to abort before routing with core.ErrAbortPipeline
  • Runs route interceptor PostHandle before global interceptor PostHandle
  • Strengthened error-return handling and handler error propagation
  • Introduced GitHub Actions CI with separate unit and integration jobs

v0.4.1 (2026-02-20)

  • App.WebSocket().Register() 기반 WebSocket 라우트 등록 API 추가
  • HTTP/Echo 런타임에 WebSocket Registry와 Runtime 마운트
  • WebSocket 전용 ExecutionContext, Registry, Pipeline, ArgumentResolver 도입
  • 핸들러에서 context.Context, Connection ID, raw payload, DTO 주입 지원
  • pkg/ws.Send()를 통한 WebSocket 응답 전송 지원
  • 연결별 ID 생성 및 종료 시 활성 WebSocket 연결 닫기 지원
  • App.RegisterTransport() 및 core.CustomTransport 추가
  • 정상 시작·종료 경로에서 CustomTransport의 Init → Start → Stop 수명주기 지원
  • CustomTransport에서 제한된 DI Container facade 사용 가능
  • HTTP 없이 CustomTransport만 실행하는 애플리케이션 지원
  • core.RequestContext를 제거하고 실행 환경별 Context 계약으로 재구성
  • Added WebSocket registration through App.WebSocket().Register()
  • Mounts WebSocket Registry and Runtime on the HTTP/Echo runtime
  • Introduced WebSocket ExecutionContext, Registry, Pipeline, and argument resolvers
  • Supports injecting context.Context, connection IDs, raw payloads, and DTOs
  • Added WebSocket responses through pkg/ws.Send()
  • Added per-connection IDs and active connection closing during shutdown
  • Added App.RegisterTransport() and core.CustomTransport
  • Supports the Init → Start → Stop lifecycle on normal startup and shutdown paths
  • Provides custom transports with a restricted DI container facade
  • Supports custom-transport applications without an HTTP runtime
  • Removed core.RequestContext and reorganized transport-specific context contracts

v0.4.2 (2026-02-21)

  • HTTP 라우트 관련 Bootstrap 로그를 명확하게 변경
  • GlobalPrefix가 적용된 최종 HTTP 경로 출력
  • WebSocket 등록 라우트 수와 각 path 출력
  • Consumer 등록 라우트 수와 각 topic 출력
  • 시작 시 등록된 라우트 구성의 가시성 개선
  • Clarified HTTP route-related bootstrap logs
  • Logs final HTTP paths after applying GlobalPrefix
  • Logs the number and paths of registered WebSocket routes
  • Logs the number and topics of registered consumer routes
  • Improved visibility into registered routes during startup

v0.4.3 (2026-07-18)

  • HTTP 기본값 추가:
    • ReadHeaderTimeout: 5초
    • ReadTimeout: 30초
    • WriteTimeout: 30초
    • IdleTimeout: 120초
    • MaxHeaderBytes: 1 MiB
    • MaxBodyBytes: 32 MiB
  • Spine HTTP 컨트롤러가 요청 본문을 읽는 중 크기 제한을 초과하면 413 응답
  • WebSocket 기본 메시지 제한 1 MiB 적용
  • WebSocket handshake 10초, read 60초, write 10초 timeout 적용
  • 서버 ping과 pong 기반 read deadline 갱신 추가
  • WebSocket 기본 same-host Origin 검사 적용
  • AllowedOrigins를 통한 정확한 Origin allowlist 및 * 지원
  • WebSocket data/control frame 쓰기를 동일 mutex로 직렬화
  • 런타임 종료 시 normal close frame 전송, 연결 종료, 활성 handler context 취소
  • 종료 이후 신규 WebSocket 연결 거부
  • Pipeline 내부 panic을 실행 오류로 변환
  • 일반 HTTP 500 오류를 Internal server error로 마스킹
  • PostExecutionHook 오류를 실행 계층으로 전파
  • 이벤트 순서는 유지하면서 이벤트별 Publisher를 병렬 실행
  • Publisher 오류 병합 및 nil·typed-nil Publisher 등록 거부
  • Kafka Producer에 TopicPrefix 적용
  • Kafka/RabbitMQ write 옵션 존재 여부 검증 강화
  • httpx.Binary, httpx.Redirect 포인터 반환값 지원
  • 문자열 포인터 응답에 대한 회귀 테스트 보강
  • 동시 Resolve 시 타입별 DI singleton 생성을 직렬화
  • 순환 의존성, constructor panic 및 대기 중인 Resolve 처리 강화
  • 동일 인터페이스에 여러 구현이 등록된 경우 명시적 오류 반환
  • Invoker의 controller reflect value 캐싱 추가
  • Trie 기반 라우터와 HandlerMeta.PathKeys 추가
  • 다수 Bootstrap 구성 오류를 panic 대신 App.Run 오류로 반환
  • CI에 formatting, vet, module consistency 및 race detector 작업 추가
  • HTTP, WebSocket, Pipeline, Router, Container, Event 테스트 확대
  • WebSocket 채팅 예제 프로젝트 링크 추가
  • llms.txt 구현 가이드 추가
  • Added HTTP defaults:
    • ReadHeaderTimeout: 5 seconds
    • ReadTimeout: 30 seconds
    • WriteTimeout: 30 seconds
    • IdleTimeout: 120 seconds
    • MaxHeaderBytes: 1 MiB
    • MaxBodyBytes: 32 MiB
  • Returns 413 when a Spine HTTP controller exceeds the body limit while reading the request
  • Added a default 1 MiB WebSocket message limit
  • Added 10-second handshake, 60-second read, and 10-second write timeouts
  • Added server ping and pong-based read-deadline updates
  • Added default same-host WebSocket Origin validation
  • Added exact Origin allowlists and * support through AllowedOrigins
  • Serialized WebSocket data and control frame writes with a shared mutex
  • Sends a normal close frame, closes connections, and cancels active handler contexts on runtime shutdown
  • Rejects new WebSocket connections after runtime shutdown
  • Converts pipeline panics into execution errors
  • Masks generic HTTP 500 errors as Internal server error
  • Propagates PostExecutionHook failures through the execution layer
  • Preserves event order while running publishers for each event concurrently
  • Aggregates publisher errors and rejects nil or typed-nil publishers
  • Applies TopicPrefix to Kafka producers
  • Strengthened Kafka and RabbitMQ write-option presence validation
  • Added pointer return support for httpx.Binary and httpx.Redirect
  • Added regression coverage for string pointer responses
  • Serializes per-type DI singleton construction during concurrent Resolve
  • Strengthened cycle, constructor panic, and waiting Resolve handling
  • Returns an explicit error when multiple implementations match one interface
  • Added controller reflect-value caching in the Invoker
  • Added trie-based routing and HandlerMeta.PathKeys
  • Converts multiple bootstrap configuration panics into App.Run errors
  • Added formatting, vet, module consistency, and race-detector CI jobs
  • Expanded HTTP, WebSocket, Pipeline, Router, Container, and Event tests
  • Added the WebSocket chat example project link
  • Added the llms.txt implementation guide

🧩 호환성/마이그레이션 메모 | Compatibility Notes

  • 전역 인터셉터의 PreHandle은 라우팅 전에 실행되므로 빈 HandlerMeta를 받습니다.
  • 라우팅 성공 후 실행되는 Global PostHandle과 AfterCompletion은 실제 HandlerMeta를 받지만, 라우팅 실패 시 AfterCompletion은 빈 메타를 받습니다.
  • core.ErrAbortPipeline 자체는 기존 API이며, v0.4.0부터 전역 인터셉터가 이를 라우팅 전에 사용할 수 있습니다.
  • core.RequestContext가 제거되었습니다. 이를 참조하는 확장 코드는 ContextCarrier와 EventBusCarrier 조합 또는 실행 환경별 Context 인터페이스로 이전해야 합니다.
  • WebSocket은 HTTP 런타임 위에서 동작하므로 HTTPOptions가 활성화되어야 합니다.
  • WebSocket 등록 경로에는 HTTP.GlobalPrefix가 적용되지 않습니다.
  • 빈 AllowedOrigins는 Origin이 없거나 Origin.Host와 요청 Host가 같은 연결을 허용합니다.
  • AllowedOrigins가 비어 있지 않으면 기본 host 검사 대신 exact Origin 목록이 사용됩니다. 같은 host도 필요하다면 목록에 명시해야 합니다.
  • HTTP 및 WebSocket의 timeout과 크기 제한이 기본 적용됩니다. 장시간 streaming, 대용량 업로드, 느린 클라이언트는 값을 명시적으로 조정해야 합니다.
  • 일반 error의 원문은 HTTP 500 응답에 노출되지 않습니다. 클라이언트에 보여야 하는 오류는 httperr를 사용해야 합니다.
  • Consumer 처리 중 Event Publisher가 실패하면 Pipeline 오류로 이어져 메시지가 NACK될 수 있습니다.
  • RabbitMQ NACK은 requeue되지만 Kafka NACK은 즉시 재발행하는 방식이 아니므로 재시도 의미가 다릅니다.
  • HTTP에서는 Event Publisher 실패 전에 성공 응답이 이미 커밋될 수 있어 500 응답으로 변경되지 않을 수 있습니다.
  • HandlerMeta와 HTTPOptions에 필드가 추가됐습니다. unkeyed struct literal을 사용한 코드는 컴파일되지 않을 수 있으므로 keyed literal을 권장합니다.
  • 동일 인터페이스에 여러 DI 구현이 등록된 경우 임의 구현을 선택하지 않고 오류를 반환합니다.
  • Bootstrap 구성 및 초기화 오류가 App.Run에서 반환될 수 있으므로 반환값을 반드시 처리해야 합니다.
  • App 인터페이스를 사용하는 저장소 내부 mock이나 생성 코드는 새 메서드에 맞게 갱신해야 합니다.
  • Global interceptor PreHandle now runs before routing and receives an empty HandlerMeta.
  • Global PostHandle and AfterCompletion receive resolved metadata after successful routing, while AfterCompletion receives empty metadata on routing failure.
  • core.ErrAbortPipeline already existed; starting in v0.4.0, global interceptors can use it before routing.
  • core.RequestContext was removed. Extensions should migrate to ContextCarrier plus EventBusCarrier or a transport-specific context interface.
  • WebSocket requires an enabled HTTP runtime.
  • WebSocket registration paths do not inherit HTTP.GlobalPrefix.
  • An empty AllowedOrigins permits requests without Origin or with Origin.Host equal to the request Host.
  • A non-empty AllowedOrigins replaces the default host check with an exact Origin allowlist. Include same-host origins explicitly when needed.
  • HTTP and WebSocket timeouts and size limits are now applied by default. Review long-running streams, large uploads, and slow clients.
  • Raw generic errors are no longer exposed in HTTP 500 responses. Use httperr for client-visible errors.
  • Event publisher failures during consumer processing can become Pipeline errors and cause messages to be NACKed.
  • RabbitMQ NACK requeues messages, while Kafka NACK does not perform an immediate republish, so retry behavior differs.
  • HTTP success responses may already be committed before event publishing fails and therefore may not be replaced with HTTP 500.
  • Fields were added to HandlerMeta and HTTPOptions. Prefer keyed struct literals because unkeyed literals may stop compiling.
  • Multiple DI implementations matching one interface now return an error instead of selecting one arbitrarily.
  • Bootstrap and initialization failures may be returned from App.Run; callers should always handle its return value.
  • Repository-local mocks or generated code implementing App must be updated for the new methods.

🧪 테스트 범위 | Test Coverage Boundary

v0.4.3은 Unit, handler-level HTTP integration, httptest.Server 기반 WebSocket integration 및 race detector를 포함합니다.

다음 항목은 v0.4.3 태그의 E2E 범위에 포함되지 않습니다.

  • 실제 Kafka 또는 RabbitMQ 브로커
  • Spine App.Run이 연 실제 listener를 사용하는 별도 프로세스 검증
  • CustomTransport 실제 구현의 전체 수명주기
  • 종료 timeout 내 WebSocket handler 완전 drain 보장

v0.4.3 includes unit tests, handler-level HTTP integration tests, httptest.Server-based WebSocket integration tests, and the race detector.

The following are not covered as end-to-end scenarios by the v0.4.3 tag:

  • Real Kafka or RabbitMQ brokers
  • A separate process using the actual listener opened by Spine App.Run
  • The complete lifecycle of a real CustomTransport implementation
  • Guaranteed draining of WebSocket handlers within the shutdown timeout