Skip to content

V3#28

Merged
SerhiyGreench merged 11 commits into
masterfrom
v3
Jul 8, 2026
Merged

V3#28
SerhiyGreench merged 11 commits into
masterfrom
v3

Conversation

@SerhiyGreench

Copy link
Copy Markdown
Contributor

No description provided.

SerhiyGreench and others added 11 commits July 7, 2026 17:57
Migrate to standard TC39 decorators and modern tooling, dropping legacy
runtime reflection in favor of JSDoc-driven type metadata.

Decorators:
- Convert all decorators to standard (TC39 stage-3) decorators using the
  (value, context) signature and context.metadata; drop reflect-metadata
  and emitDecoratorMetadata.
- Add @classtype() class decorator (companion to @Property) and a
  Symbol.metadata polyfill.
- Parse JSDoc via acorn to preserve generated CLI client output.

Dependencies:
- Replace native farmhash with pure-WASM farmhash-modern (identical hashes,
  no node-gyp build).
- Replace unmaintained node-machine-id with an in-tree implementation using
  the same OS commands/parsing (node:child_process + node:crypto).
- Upgrade typescript to 6.0.3; move @types/node to devDependencies.

Testing:
- Migrate the whole suite from mocha/chai/sinon/nyc to node:test +
  node:assert + node:test mock; rename specs to *.spec.ts. Drops 11 test
  dependencies.
- Enable source-map-mapped coverage (.ts attribution) and add a
  test-coverage-html report script that prints a file:// link.

Tooling:
- Replace tslint/prettier config with oxlint/oxfmt.
- Make tsc idempotent by cleaning compiled artifacts before every build
  (fixes TS5055 on npm install via the file:../core prepare step).
- Add typedoc.json (zero warnings), print a docs file:// link.
- Remove obsolete @access/@constructor JSDoc tags.
- Refresh CI workflow and README.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01S7M9ZZCRc9SUFAchcuPLw6
Decorators (dual-mode):
- Make every decorator work as BOTH a standard (TC39) and a legacy
  (experimentalDecorators) decorator via runtime mode detection:
  @Property, @expose, @classtype, @indexed, @Remote, @lock, @Logged,
  @cache. This lets services that must keep legacy decorators (e.g.
  sequelize-typescript consumers such as auth/api) use them alongside the
  modernized standard-decorator implementations. JSDoc type-source is
  preserved (no reflect-metadata needed).

Reliability:
- Add opt-in per-call timeout (IMQClientOptions.callTimeout): remote calls
  that get no response within callTimeout + delay reject with
  IMQ_RPC_CALL_TIMEOUT and release their pending resolver (fixes hung
  promises and the resolver leak on service death / lost responses).
- Guard the service message handler so a failure while processing or
  publishing a response is logged instead of crashing the process with an
  unhandled rejection.
- Reference-count the shared singleQueue transport so one client's
  destroy() no longer tears it down for the others; reset it afterwards;
  make destroy() idempotent; destroy the per-client subscription queue.
- Track and remove process signal handlers in destroy() (client + service);
  stop calling process.setMaxListeners at import time.
- Make signature() deterministic (key-sorted) and circular-safe, so
  @cache/@lock key generation is order-insensitive and never throws.
- Share a single RedisCache connection attempt across concurrent init()
  calls (was opening/leaking a second connection); reset on destroy().
- Memoize osUuid() so the machine-id command runs once per process instead
  of on every client construction.

Type safety, JSDoc & DX:
- Broad type-safety pass: reduce unnecessary any, add explicit return
  types, tighten boundary types (unknown), readonly, definite-assignment
  where appropriate; correct and complete JSDoc; fix English grammar.
- Replace require() with imports and import-star with named imports where
  safe (dynamic/config require() kept where a static import is impossible).
- Build the local @imqueue/core dependency before rpc (build:deps) so the
  test suite works from a clean core; keep tsc idempotent.

Tests:
- Fix migrated specs (explicit mockImplementationOnce call indices;
  mockRequire('@imqueue/rpc') for the generator test).
- Add reliability specs: call timeout, reply-failure, singleQueue
  lifecycle, signal cleanup, signature determinism, RedisCache init race.
- 162/162 passing; auth and api compile clean against the linked build.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01S7M9ZZCRc9SUFAchcuPLw6
@SerhiyGreench SerhiyGreench merged commit 2377c72 into master Jul 8, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant