chore: migrate engine state-store modules to TypeScript - #398
Merged
Conversation
Convert the engine state-store layer to TypeScript as a type-only migration with no change to public APIs or runtime behavior: - shared_state_store, memory/memcached/redis_state_store, session_state, session_live_state, playhead_state (.js -> .ts via git mv). - Add shared state-store type definitions (IStateStore, ISharedStateStoreOpts, ILeaderCache, SharedStates) in engine/state_store_types.ts. - Keep CommonJS require/module.exports interop (erasable syntax) so the still -.js consumers and specs load the modules unchanged. - Add a jasmine helper that resolves .js requires to .ts sources during the source-tree test run (build/test-time shim only). Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
birme
commented
Sep 4, 2026
birme
left a comment
Contributor
Author
There was a problem hiding this comment.
pr-reviewer verdict: APPROVE
PROOF: npm run build && npm test → 113 specs, 0 failures, 7 pending (matches master baseline). Also verified under NODE_OPTIONS=--no-experimental-strip-types (simulating CI Node 20) → 113/0. CI green on 20.x and 22.x.
- Genuine type-only port: all 7 converted files are byte-identical modulo whitespace/annotations; exported shapes consumed by the still-
.jsfiles (session.js, stream_switcher.js) and specs are preserved. - Class-field emit hazard (target es2022 →
useDefineForClassFieldsdefaults true) handled correctly: subclasses usedeclarefor parent-ownedcache/cacheTTL, so nothis.cache = undefinedclobbers the base-assigned value. Confirmed in emitteddist/. spec/helpers/ts-resolve.jsis sound and strictly test-only:.js→.tsresolve fallback +require.extensions['.ts']transpile via the already-presenttypescriptdevDep; does not touchrequire.extensions['.js']; production runs compileddist/and is unaffected.- No trademarks. Conventional-commit messages referencing #373.
Merging.
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.
Summary
engine/state-store layer to TypeScript, type-only, preserving public APIs and runtime behavior.Changes
git mv.js→.ts for:shared_state_store,memory_state_store,memcached_state_store,redis_state_store,session_state,session_live_state,playhead_state.engine/state_store_types.ts: shared contracts —IStateStore(implemented by memory/memcached/redis backends),ISharedStateStoreOpts,ILeaderCache,SharedStates.const X = require('./x.js')+module.exports = X) andimport typeso still-.jsconsumers (session.js, session_live.js, stream_switcher.js) and specs load the modules unchanged; noexport =/namespace syntax (incompatible with Node native type-stripping used by the jasmine source-tree run).spec/helpers/ts-resolve.js: test-time-only jasmine resolver shim that retries a failed.js/extensionlessrequireagainst the.tssource (matched by the existinghelpers/**/*.jsglob). Production uses compileddist/(all.js) and is unaffected.Test plan
npm run build→ tsc clean (exit 0);npm test→ 113 specs, 0 failures, 7 pending (identical to baseline — no behavior change).Closes #373
🤖 Automated via Channel Engine Dev daily-backlog-pr skill