V3#28
Merged
Merged
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.