Commit Graph

76 Commits

Author SHA1 Message Date
0c6812fcda test(07-10): 末步 set 用例改为断言 paramUsed 的外部可观测偏移
- paramUsed 为私有成员,其正确性只能通过下一条命令参数的写入偏移观测
- 增长与缩短两条末步用例补充参数缓冲区原始字节断言,使「末步起点回退」子缺陷在未修复时可直接失败
2026-09-17 12:59:24 +08:00
5b26539b00 docs(07-10): WR-03 录像参数格式改为类型码只增不改的追加式约定
- 按 Q6=B 不加格式版本字段:array.ts 的类型码表注释写明只增不改约定(新语义必须分配新码,禁止复用),并记录 5/6/7/8 与短字符串基址的一次性重新分配
- types.ts 的 IReplaySystemSave.paramArray 与 IReplayArray.getParamArray jsDoc 同步该约定,并写明不承诺读回旧格式录像
- array.test.ts 新增类型码映射锚定用例(5/6/7/8/9/短字符串基址 9)
- system.ts 无改动(未引入版本字段)
2026-09-17 12:55:50 +08:00
35d4ad6f1c fix(07-10): 编解码自洽 —— bigint 长度字节守卫与参数计数取截断后长度
- WR-01:normalizeParam 的 bigint 分支按长度字节的真实容量(255 字节 = 2^2040)判定,|值| >= 2^2040 触发告警 152 并丢弃该参数;normalizeParamList 过滤被丢弃项,不保留占位
- WR-02:add/insert/set 写入的命令参数计数一律取标准化后的 normalizeParam.length,与 normalizeParamList 的 255 截断一致
- logger.json 的 warn 152 文案改为与真实可表示范围(2^2040 - 1)一致,并写明溢出参数会被忽略
- array.test.ts 新增 bigint 长度字节边界往返、超界丢弃后命令计数/读流对齐、256/300 参数截断计数回归
2026-09-17 12:53:27 +08:00
1f9fb18cf5 fix(07-10): 写入路径越界校验与读流跨读档过期
- insert/delete/set 在 disabled 早退后、任何缓冲读写前校验 index,越界不修改任何缓冲区并告警新码 179(携带操作名/索引/当前长度)
- insert(index === length) 判为合法追加,按 add 语义写入(paramUsed 起、indexArray[length] = paramUsed),insert 合法区间变为 [0, length]
- setReplayArray 在 rebuildIndexArray 后补 expireStreams(),活跃读流跨 ReplaySystem.loadState 标记过期(#06-17-3 / 审计 H)
- types.ts 的 insert/delete/set jsDoc 写明合法区间与越界契约
- logger.json 新增 warn 179(当前最大 warn 码 178 之后)
- array.test.ts 新增 5 条边界回归(含越界前后逐字节不变量);saveLoad.test.ts 新增活跃读流跨读档告警 156 回归
2026-09-17 12:50:45 +08:00
9ae28c68cc fix(07-10): CR-01 ReplayArray.set 索引回退起点与末步终点对齐
- set() 改用 getParamRange(index) 取 [start, end),末步终点取 paramUsed,不再直读未初始化的 indexArray[index + 1]
- 索引回退循环起点由参数字节偏移 paramStart + 1 改为命令索引 index + 1,与 delete() 同口径
- types.ts 的 IReplayArray.set jsDoc 写明允许参数编码长度变化及其后步骤索引平移
- array.test.ts 新增 6 条 CR-01 回归:中间步增长/缩短、末步增长/缩短、读流遍历(IN-03 场景)
2026-09-17 12:42:48 +08:00
fe595b7983 refactor: 存档系统应处于渲染层 2026-09-16 21:54:12 +08:00
49aacb087a refactor: 调整录像命名 2026-09-16 21:51:19 +08:00
0224c2e67e docs(07): align replay param type table with the renumbered codes 2026-09-16 13:27:38 +08:00
9f058650c1 fix(07-06): #06-08-1 keep backward steps on the same axis
- Special 后退分支基准由 getCurrentDirection() 改为 this.faceDirection,避免被本步写入的反方向改写而在多步之间摆动
- 前进分支保持既有 getCurrentDirection() 语义不变
- 同步 IObjectMover.backward jsdoc 与 getCurrentDirection/prepareStep 注释措辞(D-11)
- 取消 mover.test.ts 多步后退用例的 it.skip,断言一字未改(D-10)
2026-09-15 20:57:13 +08:00
40824cc10b fix(07-03): #06-04-4 shift replay params in the insert direction
- Move paramArray bytes to paramStart + length so later steps keep their data
- Move indexArray entries to index + 1 so get(i) sees the inserted step
- Un-skip both insert order cases
2026-09-15 18:50:30 +08:00
45dde1cb1c fix(07-03): #06-04-3 shift param indexes from the command index on delete
- Add a private getParamRange helper using paramUsed as the last-step sentinel
- Roll back indexArray from the command index instead of the param byte offset
- Un-skip the middle-step delete cases
2026-09-15 18:45:31 +08:00
965e002476 fix(07-03): #06-04-2 round-trip multi-byte and negative bigint parameters
- Encode bigint bytes by bit-shift mask instead of the broken accumulator
- Decode the bigint length prefix and payload bytes unsigned
- Encode negative bigint as dedicated type 8 with magnitude payload
- Un-skip the multi-byte and heterogeneous bigint cases, add focused cases
2026-09-15 18:37:21 +08:00
528b8c91a5 fix(07-03): #06-04-1 round-trip negative int64 and renumber param type codes
- Correct the int64 decode multiplier to 2147483648
- Encode negative int64 as dedicated type 5 with magnitude payload
- Shift float/bigint/long-string/short-string type codes to 6/7/9/length+9
- Un-skip the int64 round-trip case and add negative int64 focused cases
2026-09-15 18:35:18 +08:00
83dc4fdaf6 test(06-14): register blocked delete/insert heterogeneous stream order (G-06-04-C) and map coverage
- add correct-expectation it.skip for the heterogeneous route after delete(1) (anchor #06-04-3)
- add correct-expectation it.skip for the heterogeneous route after insert(2, 9, [true, 5]) (anchor #06-04-4)
- add file-inline expectRouteStream helper (stream-only typed reads with index 1..N and terminal null)
- append the create-or-append 06-14 section to 06-COVERAGE-MAP.md; existing 5 skips unchanged
2026-09-15 11:50:30 +08:00
2cffe3ef6c test(06-14): strengthen stream assertions with types, index progression and expiry (G-06-04-C/B)
- rewrite expectHeterogeneousRead to assert per-param typeof + value, stream index i+1, terminal null and stream.index === length
- add per-param typeof/value and stream.index progression to the sequence and expand stream cases
- add 'expires a read stream after the heterogeneous route is mutated': add() expires the old stream (warn 155) and a fresh stream reads the new 7-step order
2026-09-15 11:47:25 +08:00
8ae4588ba4 test(06-14): verify a heterogeneous route exclusively through a read stream (G-06-04-C/A)
- add file-inline expectParamTyped/expectStepTyped helpers asserting typeof + toBe per parameter
- add a 7-command complex route (param counts 1/2/0/1/4/2/3, boolean/int8/int32/float/bigint/string)
- read it only through createReadStream: per-step command, per-param type/value, index 1..7, terminal null
- add a middle-start variant (createReadStream(3) -> indexes 4..7, createReadStream(6) -> index 7)
2026-09-15 11:44:38 +08:00
573402592d test(06-12): register blocked multi-byte bigint/int64 expectation (G-06-04-A) 2026-09-15 10:40:37 +08:00
0a7f25338f test(06-12): cover heterogeneous replay sequence read-back (G-06-04-B) 2026-09-15 10:38:51 +08:00
c08f3f8484 fix(replay): enable recording guard; update tests for replay refactor 2026-09-14 20:14:01 +08:00
17d7c8f46a refactor: refactor replay system record. 2026-09-14 19:55:20 +08:00
c707c87add test(06-09): cover map, replay and flag save/load round trips
- add map/saveLoad.test.ts: StaticTile/DynamicTile/MapLayer/GameMap/MapState round trips, codes 55/122/124
- add replay/saveLoad.test.ts: ReplayArray and ReplaySystem same-instance round trips
- add flag/saveLoad.test.ts: FlagSystem round trip and separated snapshot
2026-09-14 18:57:51 +08:00
82205a9dc1 feat: 录像存储 2026-09-14 18:17:37 +08:00
cee843981f feat: 录像记录 & CoreState 存储接口 2026-09-14 18:09:45 +08:00
6699df9eee test(06-08): extend ObjectMover coverage across its public surface (stage 3)
- cover setPos/setFaceDir/setMoveDir/jump/stepFace/forward/backward/speed/face/animDir/push/clear/start
- add controller stop and start-while-moving contract checks with real timers and await onEnd
- mark the multi-step backward case as skipped suspected bug #06-08-1
2026-09-14 17:00:13 +08:00
2cb9bba3ce test(06-08): cover FlagSystem, FaceManager handlers and RoleFaceBinder (stage 2)
- add system.test.ts covering the full FlagSystem public surface and warn code 111
- add faceManager.test.ts covering FaceManager registry plus Dir4/Dir8 handlers
- add face.test.ts covering RoleFaceBinder malloc/bind/query and error codes 43/44
2026-09-14 16:56:17 +08:00
7394a2591c test(06-08): cover common direction utils and MapLocIndexer (stage 1)
- add utils.test.ts covering getFaceMovement/degradeFace/nextFaceDirection/fromDirectionString for all directions
- add indexer.test.ts covering MapLocIndexer coordinate/index round-trip and setWidth stride
2026-09-14 16:51:59 +08:00
cb9c90abc1 test(06-04): cover ReplaySystem and ReplaySandbox pipeline (stage 3)
- system.test.ts:registerCommand/getCommand、重复注册 163、record + onRecordCommand、沙箱创建/reset、释放与实例独立性
- sandbox.test.ts:step/onStep、失败即停 158、157、notExecuted 175、156、startIndex、play/pause/resume/stop、setSpeed
- 06-COVERAGE-MAP.md 追加 06-04 小节(148–163、175)
- 06-TEST-FINDINGS.md 登记 #06-04-1..4
2026-09-14 15:21:49 +08:00
8832159f8c test(06-04): cover ReplayArray pipeline and replay safety decorators (stage 2)
- 读流/缓冲区组合:createReadStream / setReplayArray / rebuildIndexArray / 位宽切换
- 触发告警码 149 / 150 / 154 / 155
- func.ts 播放安全装饰器:begin/nested/end/detail、ignoreReplay、收集外 end
- 触发告警码 159 / 160 / 161 / 162
- insert 带参数组合按正确预期 it.skip(#06-04-4)
2026-09-14 15:15:14 +08:00
dfe14b12ec test(06-04): add ReplayArray codec and single-operation tests (stage 1)
- 单类型编解码:boolean / 各整数位宽 + 浮点 / bigint / string / 多参数
- 单数组操作:add / insert / delete / set / get 单次读回
- 触发告警码 148 / 151 / 152 / 153
- int64、多字节 bigint、中间步 delete 按正确预期 it.skip(#06-04-1..3)
2026-09-14 15:11:36 +08:00
aa3c7296c7 chore: 将事件执行标记为 ignoreReplay 2026-09-13 20:52:42 +08:00
a66be585d1 feat(event): rework built-ins and centralize trigger collection
- rename deleteBlock -> removeBlock (dynamic tiles need dynamic:true),
  moveHeroStep -> stepHero; touchFront steps forward and lets the mover bump
- GameEventSystem.collectEvent owns point/tile source collection; moverImpl
  enter/leave/hit reuse it with OnEnter/OnLeave/OnTouch
- IBlockEventEnv gains required system field and nullable heroFloor
- MapLayer.removeBlock added and setBlock guarded by inMap; GameMap owns floorId
- IObjectMover.push accepts readonly steps
- update event/eventDispatch tests to the current implementation (fixtures
  supply system, hero location snapshots, renamed registrations)

Verified: data type gate 0 in-scope; vitest 19 files / 112 tests pass; prettier
and eslint clean on touched files.
2026-09-13 20:37:32 +08:00
a701aa6da9 refactor(anon-tokyo): import embedded workspace package everywhere
- rename all anon-tokyo imports to @motajs/anon-tokyo in data-common,
  data-system and data-state
- declare @motajs/anon-tokyo workspace dependency in data-common and
  data-system; refresh pnpm-lock.yaml
2026-09-13 19:17:21 +08:00
b86a060759 feat: 移动器新增 push 方法 2026-09-13 19:01:57 +08:00
46a38fa0c6 refactor: 录像系统指令 2026-09-13 16:38:19 +08:00
dd4e66a335 refactor(replay): rewrite remaining commands and register in CoreState
- ReplayUseItemCommand / ReplayEquipCommand / ReplayUnequipCommand now extend
  BaseReplayCommand with fixed numeric params and per-false-position logger
  error codes (2006-2010); string item/slot params removed, autoUnload is a
  required bool.
- remove isNumber/isItem/isBoolean/isSlot/resolveSlot helpers; all logic now
  lives in the command classes.
- drop createReplayCommandItems/registerReplayCommandItems; CoreState owns a
  private registerReplayCommand() registering the eight stable codes directly.
- prune unused replay boundary types from replay/types.ts.
- fix ReplaySandbox: a replay ending on a run of moves now finalizes the
  trailing run through notExecuted (previously the last move never started).
- rewrite commands.test.ts for the base-class design and direct registration.

Verified: data type gate 0 in-scope; vitest 19 files / 112 tests pass; prettier
and eslint clean on touched files.
2026-09-13 15:39:12 +08:00
37bfb77301 refactor(replay): add command base class and rewrite move/teleport
- BaseReplayCommand with name/paramTypes and assertParameter guard
- add optional IReplayCommand.notExecuted for trailing-step finalization
- sandbox invokes previous command notExecuted when the next command differs
- rewrite ReplayMoveCommand (batched step + notExecuted start/await) and ReplayTeleportCommand
- add replay logger error codes 2001-2005 and warn 175

NOTE: command tests still reference the pre-rewrite class names; updated in follow-up.
2026-09-13 15:16:51 +08:00
4f606d91c7 fix(03-11): remove Phase-3 memory save adapter
- Delete the Phase-3-only in-memory save implementation
- Preserve the existing SaveSystem save barrel exports
2026-09-11 14:09:39 +08:00
7ffc6c4171 fix(03-14): restore synchronous replay command handling
- Remove Promise settlement from replay safety restoration
- Adapt command booleans to the existing Promise boundary
- Preserve stable replay interfaces and user-owned decorator placement
2026-09-11 13:38:38 +08:00
64b97bc515 fix(03-05): close data package type and cycle boundaries 2026-09-10 17:40:29 +08:00
1218504b5c test(03-04): cover Node replay divergence and factory isolation
- Exercise success, false, throw, unknown, hero, and map mismatch paths
- Verify isolated Node CoreState instances and diagnostic parameter fidelity
- Repair replay route parameter encoding required by verifier diagnostics
2026-09-10 17:11:09 +08:00
e7714894a0 feat(03-03): add async-safe replay commands
- Preserve replay collection context through async decorator settlement
- Add stable command items with awaited movement and pathfinding
- Return explicit failures for invalid item and equipment actions
2026-09-10 16:43:30 +08:00
f911ac5989 style(03-06): normalize tile migration formatting
- Apply repository CRLF and Prettier formatting
- Record remaining out-of-scope type diagnostics
2026-09-10 15:57:59 +08:00
89e53a6500 feat(03-06): migrate TileStore to events map
- Store raw tile event mappings for getEvent lookups
- Cover missing, replacement, index, and immutability behavior
2026-09-10 15:53:31 +08:00
4eec08638e feat(03-01): add awaited replay movement tracer
- exercise source-aware event mutation on a fixed map
- verify Node replay reaches its normal end state
2026-09-10 15:43:26 +08:00
a707be4856 feat(03-01): add Node-safe core state construction
- isolate legacy loading behind internal dependencies
- provide memory saves and remove singleton back-edges
2026-09-10 15:35:01 +08:00
7f19773477 chore(03): checkpoint data layer structure 2026-09-10 13:30:53 +08:00
26f7ad6b2e refactor(02-06): align pathfinding structure with user scope 2026-09-10 11:21:53 +08:00
cbcaec83dc refactor(02-02): comply with updated style rules, extract finder and drop temp function consts 2026-09-09 17:44:31 +08:00
e1f61013ac fix(02-02): repair mover step-end coordinate writeback condition per approved P1 decision 2026-09-09 17:09:37 +08:00
9477b2c78a test(02-01): 铺设 L0 mover 坐标回写回归测试脚手架(skip 状态)
- 4 个 it.skip 用例:x 正交 / y 正交 / 斜向 / 传送步的 setPos 回写
- 测试桩逐字复刻 eventDispatch.test.ts 模式(main/location stub + getOrInsertComputed polyfill)
- 最小 ObjectMover 子类驱动 moveProgress,零新依赖;待 02-02 修复 mover.ts:651 后翻绿
2026-09-09 15:33:18 +08:00