Commit Graph

177 Commits

Author SHA1 Message Date
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
521413fea4 style(03-19): normalize touched event JSDoc to multiline
- Convert map, hero, event, and registration-assembly function JSDoc
  into multiline form for every touched declaration
- Preserve export-only barrels, class-owned registration order, direct
  Statement[] insertion, hero front-touch ownership, and Chinese event
  test comments
2026-09-12 13:26:13 +08:00
cabee3cc01 style(03-19): normalize touched replay JSDoc to multiline
- Convert replay command, helper, and registry JSDoc into multiline form
- Add declaration-aware script/check-touched-jsdoc.ts scanner that
  inventories constructors as explicit exemptions and fails any other
  touched top-level function or class method without multiline JSDoc
2026-09-12 13:24:06 +08:00
a69130c8ad test(03-18): cover event registration ownership and barrel purity
- Assert the real eight-entry class registry, fresh per-group instances,
  and the three-map/three-hero/two-control ownership split
- Prove every class owns its stable name and function, classes originate
  from their owning modules, and hero owns the front-touch registration
- Verify both event barrels stay export-only while prior public event
  symbols remain reachable from the data-state root index
2026-09-11 23:10:37 +08:00
0dc30aace8 refactor(03-18): move event registration assembly out of the barrel
- Add event/registrations.ts as the sole direct-construction assembler for
  the eight class-based registrations in stable map/hero/control order
- Reduce event/index.ts and data-state/src/index.ts to export-only barrels
  that re-export the four public registration creators
- Point CoreState at event/registrations and record the ownership and
  public-export boundaries in the event contract
2026-09-11 23:02:15 +08:00
cb716f699e refactor(03-18): own event registrations as explicit classes
- Replace generic per-invocation registration factories with explicit
  SetBlock/MoveBlock/DeleteBlock, MoveHero/MoveHeroStep/TouchFront, and
  InsertEvents/InsertEvent registration classes
- Move eventTouchFront, invocation collection, and target resolution into
  the hero event layer while keeping awaited OnTouch behavior
- Keep map and control modules limited to their own registration ownership
2026-09-11 22:59:16 +08:00
febdcdc967 refactor: align state system replay and path contracts 2026-09-11 22:36:09 +08:00
4bd6a463d6 test(03-17): cover replay registry construction
- Assert direct stable registry construction
- Guard against formatter suppressions and duplicate directional classes
- Retain deferred movement and pathfinding ordering coverage
2026-09-11 22:22:21 +08:00
df7d1e12c2 fix(03-17): await replay movement completion
- Remove replay-safety decoration from command implementations
- Await directional and pathfinding controller completion
- Collapse directional commands into one parameterized class
2026-09-11 22:21:01 +08:00
4e318e6ce1 refactor(03-15): order replay class internals consistently
- Keep private command actions before their execute callers per project conventions
2026-09-11 14:32:20 +08:00
f5c6b06c59 test(03-15): cover independent replay command ownership
- Verify distinct command classes, fresh instances, stable order, and extension registration
- Add structural ownership regressions without changing replay or user-owned decorator boundaries
2026-09-11 14:28:24 +08:00
13162b2406 fix(03-15): split replay commands into independent classes
- Replace the shared replay entrance object with eight owned instruction classes
- Preserve stable registration order and replay command extension boundaries
2026-09-11 14:22:01 +08:00
5a206748b2 test(03-11): align Node save regressions
- Assert CoreState instances use the existing SaveSystem
- Preserve independent construction and replay coverage
2026-09-11 14:10:41 +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
45e3b1f05d fix(03-10): restore direct replay fixture path
- Register the fixture event and maps through existing data APIs
- Await the synchronous mutation marker before the final snapshot
2026-09-11 14:00:02 +08:00
e4e39f7b2b fix(03-10): restore compatibility loading path
- Remove Phase 3 legacy dependency and serialized loading adapters
- Restore SaveSystem, converter, bridge, and loading callback assembly
2026-09-11 13:52:54 +08:00
32fb1154e2 test(03-14): cover synchronous replay command completion
- Prove movement and pathfinding return without controller waits
- Assert synchronous nested replay-safety restoration
- Guard user-owned attribute decorator placement
2026-09-11 13:43:23 +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
7315681272 test(03-13): cover direct event body execution
- Exercise eventInsertEvent with an inline Statement[] body
- Prove the body mutates the event layer without an event-store id
- Document the superseding direct-body event contract
2026-09-11 13:28:33 +08:00
2f14d8a0ae fix(03-13): execute single event bodies directly
- Accept anon-tokyo Statement[] bodies for eventInsertEvent
- Execute bodies through the existing interpreter without event-store lookup
- Preserve eventInsertEvents as the ordered id-sequence path
2026-09-11 13:25:48 +08:00
d2ebf1cefc test(03-12): cover module-owned event registrations
- Exercise all eight approved registrations with valid typed parameters
- Retain awaited behavior and missing-target safety without nullish guard tests
2026-09-11 11:11:48 +08:00
9c39895620 refactor(03-12): move event registrations into modules
- Keep the barrel limited to registration assembly and exports
- Give map, hero, and control modules typed registration builders without hot-path shape validation
2026-09-11 11:08:49 +08:00
c0444510d1 chore: 调整引入 2026-09-11 09:56:03 +08:00
4b91a0b84f style(03-07): normalize serialized event files
- Apply repository CRLF and Prettier formatting to changed files
2026-09-10 20:17:23 +08:00
1b93deb8c8 test(03-07): prove serialized event replay path
- Load the fixed replay event through the internal serialized boundary
- Assert trigger, raw statements, coordinate binding, one execution, and final state
2026-09-10 20:13:51 +08:00
a111b8dcd4 feat(03-07): wire serialized event loading boundary
- Register validated serialized events through the CoreState load seam
- Bind raw map event ids with MapState.fromRaw before replay execution
2026-09-10 20:12:47 +08:00
160a0d5c34 test(03-09): prove production replay safety boundaries
- Exercise decorated movement, item, and equipment registry calls\n- Assert deferred collection settlement and pure path/validation exclusion
2026-09-10 19:53:26 +08:00
fc9a1adae3 feat(03-09): decorate production replay command entrances
- Route all five state-changing command entrances through replay safety collection\n- Keep command validation, slot resolution, and registration helpers outside the decoration boundary
2026-09-10 19:49:54 +08:00
82687b2f56 style(03-08): format event guard coverage
- Restore repository CRLF and Prettier layout for the changed event files
2026-09-10 18:50:33 +08:00
f8cae08bd9 test(03-08): cover nullish event registrations
- Exercise all eight registration functions with null and undefined\n- Assert resolved void results and unchanged fixture state
2026-09-10 18:48:57 +08:00
95df6a0198 fix(03-08): guard registered event parameters
- Return safely before parsing nullish or non-object runtime parameters\n- Cover the real eventSetBlock registration with a null regression
2026-09-10 18:47:26 +08:00
2794dfc32d style(03-05): normalize scoped data gate formatting 2026-09-10 17:53:33 +08:00
232df083f7 fix(03-05): complete data closure coverage and Node combat gate 2026-09-10 17:52:28 +08:00
64b97bc515 fix(03-05): close data package type and cycle boundaries 2026-09-10 17:40:29 +08:00
704e23fa2d fix(03-04): share verifier harness with Node replay tests
- Keep Vitest imports inside the data-state test package
- Leave the dedicated script as the direct Node process entry
2026-09-10 17:17:40 +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
c06093839a feat(03-04): add fixed Node replay verifier
- Extend the closed-loop fixture across hero and all map matrices
- Throw deterministic local diagnostics at the first replay divergence
- Add the dedicated test:data-node process gate
2026-09-10 17:05:15 +08:00
09481451d4 feat(03-03): assemble CoreState replay registry
- Bind the L2 pathfinder to each fresh hero state
- Give each CoreState an independent ReplaySystem
- Assert all eight stable commands are assembled at the top level
2026-09-10 16:44:46 +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
3134537d30 feat(03-02): implement approved event built-ins
- Add map, hero, touch, and temporary event controls
- Register exactly eight built-ins through top-level event assembly
- Cover awaited behavior and safe failure with explicit fixtures
2026-09-10 16:25:02 +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
a12b2d2db8 feat(03-06): migrate legacy tiles to events maps
- Convert optional legacy events with safe empty defaults
- Cover TileStore consumption without trigger scalar output
2026-09-10 15:55:32 +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
93453db417 fix(02-04): guard nullable static event sources
- Preserve dynamic event collection while narrowing static tile access
- Record the moverImpl type diagnostic as resolved
2026-09-10 09:38:02 +08:00
a2aedb3969 refactor(02-04): restore authorized path contract
- Match path/types.ts to the user-authored baseline plus nullable returns
- Keep graph contracts implementation-owned and preserve the mover bridge
2026-09-10 09:35:21 +08:00