Skip to content

Enfyra Server v2.0.3

Choose a tag to compare

@dothinh115 dothinh115 released this 21 Apr 11:26

v2.0.3

Breaking Changes

The DEV_WATCH port-busy retry loop in main.ts has been removed. Previously the server retried server.listen() up to 25 times × 200ms before failing; now it exits immediately on EADDRINUSE with a clear log line, matching Nest-style behavior. If your dev workflow relied on the retry to recover from stale tsx watch processes, kill the old process explicitly before starting a new one (or rely on the process manager to handle restarts).

Features

  • Added bootstrap self-heal for orphaned route handlers. RouteDefinitionProcessor.ensureMissingHandlers now deletes route_handler_definition rows with NULL routeId or NULL methodId before re-seeding per-route CRUD defaults, surviving silent FK cascades from method_definition resets.
  • Tightened route_handler_definition schema in data/snapshot.json: route and method relations are now isNullable: false with onDelete: CASCADE. Fresh installs enforce handler integrity at the DB level; orphan handlers cannot exist.
  • Added file_definition.validateBody=false entry in data/data-migration.json. POST /file_definition multipart uploads are no longer rejected by zod body-validation — the custom handler derives filename, mimetype, filesize from req.file.
  • Converted remaining CommonJS require() calls to ES import across auth services, routes, middleware, and provision layers for a uniform module graph.
  • Refactored provision-schema-migration.ts with typed migration definitions (SchemaMigrationDef, TableMigrationDef, ColumnModifyDef, RelationModifyDef) and batched table migration application.
  • Hardened junction-table provisioning in src/infrastructure/knex/utils/provision/junction-tables.ts with typed JunctionTableDef and cluster-safe create-if-missing semantics (detects already exists races from concurrent instances).

Bug Fixes

  • Fixed GET (and other method) handlers silently losing their methodId after method_definition table resets. FK cascade SET NULL orphaned handlers and the previous ensureMissingHandlers gated re-seed on total handler count, hiding the issue. Self-heal now cleans orphans and re-seeds per-method.
  • Fixed POST /file_definition returning 400 "filename is required". Root cause was canonical-path body-validation firing for routes with custom Express handlers; validateBody=false disables auto-validation for file_definition which has a registered custom handler deriving file metadata server-side.
  • Fixed server blocking up to 5 seconds before surfacing a port conflict during yarn dev restarts. Port-bind failure now fails fast.
  • Fixed test suite formatting inconsistencies in logger.spec.ts, zod-from-metadata.spec.ts, zod-parse.spec.ts, body-validation-middleware.spec.ts, room-size.spec.ts, and vitest.setup.ts.