learning_ai_common_plat/packages/fastify-core/src
saravanakumardb1 3a5196417d fix(errors): make ServiceError instanceof cross-instance-safe
When docker-prep packs @bytelyst/* as tarballs, a second physical copy of
@bytelyst/errors can be created, breaking prototype identity. The
fastify-core error handler's 'error instanceof ServiceError' then returned
false, mis-mapping ConflictError/BadRequestError/etc. to HTTP 500.

Fix: brand ServiceError instances with a global Symbol.for() key and add a
Symbol.hasInstance that recognizes any branded instance for the base class,
while preserving prototype-chain semantics for subclasses. Resilient to
duplicated module copies without touching call sites.

- errors: brand + custom hasInstance (+3 cross-instance unit tests)
- fastify-core: regression test (duplicated-copy ServiceError -> 409 not 500)
- bump @bytelyst/errors 0.1.11 -> 0.1.13, published to Gitea registry
2026-05-28 22:02:35 -07:00
..
__tests__ fix(errors): make ServiceError instanceof cross-instance-safe 2026-05-28 22:02:35 -07:00
auth.ts feat(fastify-core): add shared optional jwt context 2026-03-06 12:52:49 -08:00
create-app.ts feat(fastify-core): harden lifecycle and readiness support 2026-03-06 12:47:29 -08:00
index.ts feat(fastify-core): add shared optional jwt context 2026-03-06 12:52:49 -08:00
start.ts feat(fastify-core): harden lifecycle and readiness support 2026-03-06 12:47:29 -08:00
types.ts feat(fastify-core): harden lifecycle and readiness support 2026-03-06 12:47:29 -08:00