mirror of
https://github.com/motajs/template.git
synced 2026-09-15 11:28:50 +08:00
wip: pause latest Phase 3 correction planning
This commit is contained in:
parent
2b471b83ed
commit
3df11049dd
59
.planning/HANDOFF.json
Normal file
59
.planning/HANDOFF.json
Normal file
@ -0,0 +1,59 @@
|
||||
{
|
||||
"version": "1.0",
|
||||
"timestamp": "2026-09-11T09:34:07.509Z",
|
||||
"phase": "03",
|
||||
"phase_name": "data-completion",
|
||||
"phase_dir": ".planning/phases/03-data-completion",
|
||||
"plan": 17,
|
||||
"task": 0,
|
||||
"total_tasks": 3,
|
||||
"status": "paused",
|
||||
"completed_tasks": [],
|
||||
"remaining_tasks": [
|
||||
{"id": 17, "name": "Replay command and movement completion correction", "status": "plan_review_pending"},
|
||||
{"id": 18, "name": "Class-based event registrations and hero ownership", "status": "plan_review_pending"},
|
||||
{"id": 19, "name": "Multiline JSDoc and style correction", "status": "plan_review_pending"}
|
||||
],
|
||||
"blockers": [
|
||||
{
|
||||
"description": "User requested a session pause before executing the newly revised correction plans.",
|
||||
"type": "human_action",
|
||||
"workaround": "Resume with /gsd-resume-work."
|
||||
}
|
||||
],
|
||||
"async_jobs": [],
|
||||
"human_actions_pending": [],
|
||||
"decisions": [
|
||||
{
|
||||
"decision": "Replay commands must not call shouldReplay; the user will place decorators on lower-level state mutation methods.",
|
||||
"rationale": "Replay is a verifier and should not mark its own command entry points.",
|
||||
"phase": "03"
|
||||
},
|
||||
{
|
||||
"decision": "Movement and pathfinding replay steps must await controller completion before the next step.",
|
||||
"rationale": "A later route step must not overlap an unfinished movement action.",
|
||||
"phase": "03"
|
||||
},
|
||||
{
|
||||
"decision": "Directional replay commands share one parameterized class; event registrations use explicit classes; eventTouchFront belongs to hero events.",
|
||||
"rationale": "Avoid duplicated replay classes and keep event ownership aligned with domain responsibility.",
|
||||
"phase": "03"
|
||||
}
|
||||
],
|
||||
"uncommitted_files": [
|
||||
" M .planning/phases/03-data-completion/03-17-PLAN.md",
|
||||
" M .planning/phases/03-data-completion/03-18-PLAN.md",
|
||||
" M .planning/phases/03-data-completion/03-19-PLAN.md",
|
||||
" M .planning/phases/03-data-completion/03-CONTEXT.md",
|
||||
" M .planning/phases/03-data-completion/03-REPLAY-CONTRACT.md",
|
||||
" M .planning/phases/03-data-completion/03-VERIFICATION.md",
|
||||
" M packages-user/data-common/src/save/index.ts",
|
||||
" M packages-user/data-state/src/core.ts",
|
||||
" M packages-user/data-state/test/coreNode.test.ts",
|
||||
" M packages-user/data-state/test/fixtures/closed-loop.ts",
|
||||
" M packages-user/data-state/test/nodeTracer.test.ts",
|
||||
" M packages-user/data-system/src/types.ts"
|
||||
],
|
||||
"next_action": "Run the plan checker against revised Plans 03-17 through 03-19, then execute Plan 03-17 only after it passes.",
|
||||
"context_notes": "No correction code from the new batch has executed. Preserve unrelated existing working-tree changes. Do not modify user-owned @shouldReplay() placement on lower-level state methods. The seven legacy/client compatibility cycles remain a documented Phase 5 baseline."
|
||||
}
|
||||
50
.planning/phases/03-data-completion/.continue-here.md
Normal file
50
.planning/phases/03-data-completion/.continue-here.md
Normal file
@ -0,0 +1,50 @@
|
||||
---
|
||||
context: phase
|
||||
phase: 03-data-completion
|
||||
task: 0
|
||||
total_tasks: 3
|
||||
status: paused
|
||||
last_updated: 2026-09-11T09:34:07.509Z
|
||||
---
|
||||
|
||||
## Current State
|
||||
|
||||
The latest user review identified seven further issues in the completed Phase 3 correction. New Plans `03-17`, `03-18`, and `03-19` were revised but have not yet been rechecked or executed.
|
||||
|
||||
## New Correction Scope
|
||||
|
||||
- `03-17`: remove command-level `shouldReplay`, await movement/path controllers, merge directional commands, remove `prettier-ignore`.
|
||||
- `03-18`: make `event/index.ts` exports-only, replace registration factories with explicit classes, move `eventTouchFront` to the hero event layer, preserve public exports.
|
||||
- `03-19`: enforce multiline JSDoc for every touched function and method, with source-aware audits.
|
||||
|
||||
## Required Next Order
|
||||
|
||||
1. Run `gsd-plan-checker` against Plans `03-17` through `03-19` after the latest revisions.
|
||||
2. If the checker passes, execute `03-17`, then `03-18`, then `03-19`.
|
||||
3. Run the full data suite, Node replay, type gate, ESLint, Prettier, and verifier.
|
||||
|
||||
## Important Decisions
|
||||
|
||||
- Replay commands must not call `shouldReplay`; the user will add decorators to lower-level state mutation methods.
|
||||
- Movement and pathfinding replay commands must await controller completion before advancing the route.
|
||||
- Four directions share one parameterized command class.
|
||||
- Event registrations use explicit classes; `eventTouchFront` belongs to hero events.
|
||||
- `event/index.ts` may contain exports only.
|
||||
- Do not modify legacy/save architecture, the seven deferred compatibility cycles, or unrelated working-tree changes.
|
||||
|
||||
## Required Reading
|
||||
|
||||
1. `dev.md`
|
||||
2. `.planning/phases/03-data-completion/03-CONTEXT.md`
|
||||
3. `.planning/phases/03-data-completion/03-REPLAY-CONTRACT.md`
|
||||
4. `.planning/phases/03-data-completion/03-EVENT-CONTRACT.md`
|
||||
5. `.planning/phases/03-data-completion/03-VERIFICATION.md`
|
||||
6. `03-17-PLAN.md`, `03-18-PLAN.md`, `03-19-PLAN.md`
|
||||
|
||||
## Uncommitted Files
|
||||
|
||||
The working tree contains revised planning artifacts plus pre-existing source/test files. Preserve them unless a reviewed plan explicitly owns the path.
|
||||
|
||||
## Resume
|
||||
|
||||
Run `/gsd-resume-work` to restore this checkpoint. Do not execute the correction plans before the plan checker passes.
|
||||
@ -20,8 +20,8 @@ estimate:
|
||||
confidence: low
|
||||
must_haves:
|
||||
truths:
|
||||
- "CORR-03-08: replay command implementations contain no replay-safety utility import or constructor-time decoration; decorator placement remains owned by the user on low-level state mutation methods."
|
||||
- "CORR-03-09: directional and auto-pathfinding replay commands await their returned movement controller completion before their Promise<boolean> resolves, so ReplaySandbox cannot begin the next step early."
|
||||
- "CORR-03-08/S-05: replay command implementations do not invoke the replay-safety decorator helper; decorator placement remains owned by the user on low-level state mutation methods, while replay-step completion is still awaited."
|
||||
- "CORR-03-09/S-05: directional and auto-pathfinding replay commands await their returned movement controller completion before their Promise<boolean> resolves, so ReplaySandbox cannot begin the next step early."
|
||||
- "CORR-03-10: up/right/down/left are four registrations of one parameterized directional command class, not four duplicate command classes."
|
||||
- "CORR-03-11: the replay registry uses ordinary formatted construction with no manual formatter-suppression comments."
|
||||
- "ReplayCommandCode values, REPLAY_COMMAND_ORDER, IReplayCommand, IReplayCommandItem, CoreState registry ownership, item/equipment synchronous behavior, and first-divergence verifier boundaries remain stable."
|
||||
@ -41,9 +41,9 @@ must_haves:
|
||||
---
|
||||
|
||||
<objective>
|
||||
Close CORR-03-08 through CORR-03-11 in the replay command implementation. Remove replay-safety decoration from the command layer, make directional and pathfinding commands await their controllers, collapse the four directional implementations into one parameterized class, and remove registry formatter suppressions while preserving every existing replay interface and stable code.
|
||||
Close CORR-03-08 through CORR-03-11 in the replay command implementation. Per S-05, remove replay-safety helper calls from replay commands while making directional and pathfinding commands await their controllers before the next replay step. Collapse the four directional implementations into one parameterized class, remove registry formatter suppressions, and preserve every existing replay interface, stable code, item/equipment boundary, and user-owned decorator placement.
|
||||
|
||||
Purpose: The latest user review supersedes the earlier command-layer decoration and synchronous completion shape. Replay sequencing must observe real movement completion, while the user retains ownership of the eventual low-level state-mutation decorator placement.
|
||||
Purpose: S-05 supersedes S-02 for the replay-step completion boundary: command code must not own replay-safety decoration, but movement and pathfinding commands must observe real controller completion before the next step. The user retains ownership of the eventual low-level state-mutation decorator placement.
|
||||
Output: Corrected replay command source, regression tests, and a replay contract record that matches the latest user-authoritative behavior.
|
||||
</objective>
|
||||
|
||||
@ -72,6 +72,10 @@ Output: Corrected replay command source, regression tests, and a replay contract
|
||||
@dev.md
|
||||
</context>
|
||||
|
||||
<scope_guard>
|
||||
Before the first edit, snapshot the current `git status --porcelain=v1 --untracked-files=all` path list and the bytes/diffs of the pre-existing working tree into `$env:TEMP\mota-phase03-17-scope-baseline`; also save a forbidden-path diff for `packages-user/data-state/src/legacy/**`, `packages-user/data-common/src/save/**`, and `packages-user/data-base/src/hero/attribute.ts`. Do not reset, stash, clean, or overwrite unrelated changes. The final task must compare the post-task path list and forbidden-path diff with those snapshots, fail on any newly changed path outside this plan's allowlist or any changed forbidden diff, and inspect the diff hunks for decorator-placement or unrelated formatting changes. Use a whitespace-aware diff plus `git diff --check`; pre-existing changes are preserved and excluded from the comparison.
|
||||
</scope_guard>
|
||||
|
||||
## Source Audit
|
||||
|
||||
| Source | ID | Item | Plan | Status |
|
||||
@ -79,7 +83,8 @@ Output: Corrected replay command source, regression tests, and a replay contract
|
||||
| GOAL | — | Data-layer replay remains independently usable and deterministic in Node | 03-17 | COVERED |
|
||||
| REQ | DATA-01 | Replay commands remain usable behind the existing data-side interfaces | 03-17 | COVERED |
|
||||
| RESEARCH | D-05/D-07/D-08/D-25 | State-changing replay boundaries, explicit failure, stable top-level codes, and stable order | 03-17 | COVERED |
|
||||
| CONTEXT | S-02 latest user correction | Await movement/pathfinding completion in command Promises; this latest user requirement supersedes the older synchronous correction record | 03-17 | COVERED |
|
||||
| CONTEXT | S-02/S-05 | S-02's synchronous replay-step wording is superseded; S-05 requires movement/pathfinding controller completion before the next step while leaving decorator ownership out of command code | 03-17 | COVERED |
|
||||
| CONTEXT | S-05 | Movement/pathfinding replay steps await controller completion, while replay command code does not call the replay-safety helper; S-05 supersedes S-02 for this boundary | 03-17 | COVERED |
|
||||
| CONTEXT | S-04 | Do not place or relocate user-owned state decorators | 03-17 | COVERED |
|
||||
| CONTEXT | CORR-03-08..11 | Four-gap review cluster's replay implementation corrections | 03-17 | COVERED |
|
||||
|
||||
@ -90,14 +95,14 @@ Output: Corrected replay command source, regression tests, and a replay contract
|
||||
<gap_id>CORR-03-08, CORR-03-09, CORR-03-10</gap_id>
|
||||
<files>packages-user/data-state/src/replay/commands.ts, packages-user/data-state/src/replay/commands.test.ts, .planning/phases/03-data-completion/03-REPLAY-CONTRACT.md</files>
|
||||
<read_first>packages-user/data-state/src/replay/commands.ts, packages-user/data-state/src/replay/commands.test.ts, packages-user/data-state/src/replay/types.ts, packages-user/data-common/src/replay/types.ts, packages-user/data-common/src/replay/sandbox.ts, packages-user/data-system/src/path/types.ts, packages-user/data-system/src/path/system.ts, packages-user/data-base/src/hero/attribute.ts, .planning/phases/03-data-completion/03-REPLAY-CONTRACT.md, .planning/phases/03-data-completion/03-CONTEXT.md, dev.md</read_first>
|
||||
<action>Remove the replay-safety utility import from the command implementation and delete every constructor-time wrapper that manually decorates a command method; do not add a replacement decorator, move a decorator to a state class, or edit `HeroAttribute.set`, `HeroAttribute.mul`, or any other user-owned mutation method (CORR-03-08, S-04). Replace the four directional command class bodies with one `ReplayDirectionCommand` that receives the existing `IReplayCommandState` and a `FaceDirection` in its constructor, stores that direction, starts the mover, awaits the returned controller's `onEnd`, and resolves `true` only after completion; a missing/active/failed move still resolves `false`. Keep the four stable enum entries and construct four fresh parameterized instances in their existing order. Change auto-pathfinding to await `IPathfindingController.controller.onEnd` before resolving, while retaining its numeric parameter validation and null-result failure. Keep item, equip, and unequip calls synchronous behind the unchanged `Promise<boolean>` interface. Replace the old command tests with a real deferred-controller sequence assertion proving the next replay step cannot start before directional movement or pathfinding completion, and assert the four directional entries share the one command constructor while carrying distinct directions. Record this latest user-authoritative completion/ownership rule in `03-REPLAY-CONTRACT.md` without changing the public replay interfaces, route format, stable codes, legacy/save path, or user-owned decorator placement (CORR-03-09, CORR-03-10, D-07, D-08, D-25).</action>
|
||||
<action>At task start, write the scope snapshot required by the plan scope guard. Remove the replay-safety decorator helper import and all constructor-time wrapper calls from the command implementation; do not add a replacement decorator, move a decorator to a state class, or edit `HeroAttribute.set`, `HeroAttribute.mul`, or any other user-owned mutation method (CORR-03-08, S-04, S-05). Replace the four directional command bodies with one `ReplayDirectionCommand` receiving the existing `IReplayCommandState` and a `FaceDirection`, storing that direction, starting the mover, awaiting the returned controller's `onEnd`, and resolving `true` only after completion; a missing, active, failed, or rejected move resolves `false`. Change auto-pathfinding to await `IPathfindingController.controller.onEnd` before resolving, retaining numeric parameter validation and null-result failure. Keep item, equip, and unequip state calls synchronous behind the unchanged `Promise<boolean>` interface. Replace the stale command tests with real deferred-controller sequence assertions proving the next replay step cannot start before directional or pathfinding completion, and assert the four directional entries use one constructor while carrying distinct directions. Update `03-REPLAY-CONTRACT.md` so its supersession and completion sections state S-05, remove the stale synchronous completion wording, and preserve the public replay interfaces, route format, stable codes, legacy/save paths, and user-owned decorator placement (CORR-03-09, CORR-03-10, D-07, D-08, D-25).</action>
|
||||
<verify>
|
||||
<automated>pnpm exec vitest run packages-user/data-state/src/replay/commands.test.ts</automated>
|
||||
<fails_when>Vitest exits non-zero, a deferred movement/pathfinding command resolves before its controller completion signal, the next-step assertion observes early execution, the four directional entries use different command constructors, command behavior calls the replay-safety utility, or any user-owned decorator-placement assertion changes.</fails_when>
|
||||
<automated>$lines = Get-Content -LiteralPath 'packages-user/data-state/src/replay/commands.test.ts'; for ($i = 0; $i -lt $lines.Count; $i++) { if ($lines[$i] -match '^\s*it(?:\.[A-Za-z]+)*\s*\(') { if ($i -eq 0 -or $lines[$i - 1] -notmatch '^\s*//\s*[\u4e00-\u9fff]') { throw "Missing Chinese coverage comment before it at line $($i + 1)" } } }; pnpm exec vitest run packages-user/data-state/src/replay/commands.test.ts</automated>
|
||||
<fails_when>The Chinese-coverage scan or focused Vitest run exits non-zero, a deferred movement/pathfinding command resolves before its controller completion signal, the next-step assertion observes early execution, the four directional entries use different command constructors, command code owns replay-safety decoration, or any user-owned decorator-placement assertion changes.</fails_when>
|
||||
</verify>
|
||||
<acceptance_criteria>
|
||||
- `commands.ts` has one parameterized directional command implementation and no command-layer replay-safety utility import or constructor decoration (CORR-03-08, CORR-03-10).
|
||||
- Directional and auto-pathfinding command Promises remain pending until their returned controller `onEnd` settles; item/equipment behavior remains synchronous at the existing command boundary (CORR-03-09).
|
||||
- `commands.ts` has one parameterized directional command implementation and no command-layer replay-safety helper call or constructor decoration (CORR-03-08, CORR-03-10, S-05).
|
||||
- Directional and auto-pathfinding command Promises remain pending until their returned controller `onEnd` settles; item/equipment state calls remain synchronous at the existing command boundary (CORR-03-09, S-05).
|
||||
- The focused test file has a Chinese single-line coverage comment immediately before every `it` call added or modified, and no test edits touch `packages-user/data-base/src/hero/attribute.ts` (D-03, D-04, S-04).
|
||||
</acceptance_criteria>
|
||||
<done>The real replay command path awaits movement completion, uses one directional class, and contains no command-layer replay-safety decoration.</done>
|
||||
@ -108,14 +113,14 @@ Output: Corrected replay command source, regression tests, and a replay contract
|
||||
<gap_id>CORR-03-11</gap_id>
|
||||
<files>packages-user/data-state/src/replay/commands.ts, packages-user/data-state/src/replay/commands.test.ts</files>
|
||||
<read_first>packages-user/data-state/src/replay/commands.ts, packages-user/data-state/src/replay/commands.test.ts, packages-user/data-state/src/replay/types.ts, packages-user/data-common/src/replay/system.ts, packages-user/data-common/src/replay/sandbox.ts, .planning/phases/03-data-completion/03-REPLAY-CONTRACT.md, dev.md</read_first>
|
||||
<action>Rewrite the ordered registry construction as ordinary formatted object literals with direct `new ReplayDirectionCommand(state, direction)` and direct construction of the five non-directional command classes. Remove the manual formatter-suppression comments from this registry and let the repository formatter decide line breaks. Extend the source/behavior regression to assert stable enum order, fresh command instances, one directional constructor name, absence of command-layer decoration, and unchanged custom `IReplayCommandItem` registration. Keep the test's generic replay-safety helper coverage separate from production command construction, preserve Chinese comments before every changed `it`, and leave legacy/save files, `packages-user/data-base/src/hero/attribute.ts`, `ReplaySystem`, `ReplaySandbox`, and all route/enum interfaces untouched (CORR-03-08, CORR-03-10, CORR-03-11, D-04, S-04).</action>
|
||||
<action>Rewrite the ordered registry construction as ordinary formatted object literals with direct `new ReplayDirectionCommand(state, direction)` and direct construction of the five non-directional command classes. Remove manual formatter-suppression comments from this registry and let the repository formatter decide line breaks. Extend the source/behavior regression to assert stable enum order, fresh command instances, one directional constructor name, absence of command-layer replay-safety helper calls, awaited controller ordering, and unchanged custom `IReplayCommandItem` registration. Keep generic replay-safety helper tests separate from production command construction, preserve a Chinese comment immediately before every `it`, and leave legacy/save files, `packages-user/data-base/src/hero/attribute.ts`, `ReplaySystem`, `ReplaySandbox`, and all route/enum interfaces untouched (CORR-03-08, CORR-03-10, CORR-03-11, D-04, S-04, S-05). At the end, compare the working tree with the Task 1 scope snapshot and reject newly introduced forbidden paths, decorator-placement changes, or unrelated formatting while retaining all pre-existing changes.</action>
|
||||
<verify>
|
||||
<automated>$commands = Get-Content -Raw 'packages-user/data-state/src/replay/commands.ts'; if ($commands -match 'shouldReplay') { throw 'Command implementation still references replay-safety decoration' }; if ($commands -match 'prettier-ignore') { throw 'Replay registry still contains manual formatter suppression' }; if ($commands -match 'class\s+Replay(?:Up|Right|Down|Left)Command\b') { throw 'Duplicate directional command classes remain' }; if ($commands -notmatch 'class\s+ReplayDirectionCommand\b') { throw 'Parameterized directional command class is missing' }; $test = Get-Content -Raw 'packages-user/data-state/src/replay/commands.test.ts'; if ($test -notmatch 'ReplayDirectionCommand') { throw 'Directional constructor regression is missing' }; pnpm exec vitest run packages-user/data-state/src/replay/commands.test.ts; if ($?) { pnpm test:ci packages-user/data-common packages-user/data-base packages-user/data-system packages-user/data-state }; if ($?) { pnpm test:data-node }; if ($?) { pnpm exec tsx script/check-data-type.ts }; if ($?) { pnpm exec tsx script/check-data-circular.ts }; if ($?) { pnpm exec prettier --check packages-user/data-state/src/replay/commands.ts packages-user/data-state/src/replay/commands.test.ts }</automated>
|
||||
<fails_when>Any source assertion finds command-layer decoration, a manual formatter suppression, or a duplicate directional class; the Chinese-comment scan/test suite, Node replay gate, scoped type gate, scoped circular gate, or Prettier check exits non-zero.</fails_when>
|
||||
<automated>$commands = Get-Content -Raw 'packages-user/data-state/src/replay/commands.ts'; if ($commands -match 'shouldReplay') { throw 'Replay command source still invokes the replay-safety helper' }; if ($commands -match 'prettier-ignore') { throw 'Replay registry still contains manual formatter suppression' }; if ($commands -match 'class\s+Replay(?:Up|Right|Down|Left)Command\b') { throw 'Duplicate directional command classes remain' }; if ($commands -notmatch 'class\s+ReplayDirectionCommand\b') { throw 'Parameterized directional command class is missing' }; $test = Get-Content -Raw 'packages-user/data-state/src/replay/commands.test.ts'; if ($test -notmatch 'ReplayDirectionCommand') { throw 'Directional constructor regression is missing' }; $lines = Get-Content -LiteralPath 'packages-user/data-state/src/replay/commands.test.ts'; for ($i = 0; $i -lt $lines.Count; $i++) { if ($lines[$i] -match '^\s*it(?:\.[A-Za-z]+)*\s*\(') { if ($i -eq 0 -or $lines[$i - 1] -notmatch '^\s*//\s*[\u4e00-\u9fff]') { throw "Missing Chinese coverage comment before it at line $($i + 1)" } } }; pnpm exec vitest run packages-user/data-state/src/replay/commands.test.ts; if ($?) { pnpm test:ci packages-user/data-common packages-user/data-base packages-user/data-system packages-user/data-state }; if ($?) { pnpm test:data-node }; if ($?) { pnpm exec tsx script/check-data-type.ts }; if ($?) { pnpm exec vitest run script/check-data-circular.test.ts }; if ($?) { pnpm exec prettier --check packages-user/data-state/src/replay/commands.ts packages-user/data-state/src/replay/commands.test.ts }</automated>
|
||||
<fails_when>Any structural assertion finds a command-layer replay-safety helper call, manual formatter suppression, or duplicate directional class; the Chinese-comment scan, focused/full data tests, Node replay, scoped type gate, circular-classifier fixture tests, or Prettier check exits non-zero.</fails_when>
|
||||
</verify>
|
||||
<acceptance_criteria>
|
||||
- The registry has no manually inserted formatter-suppression comments and remains in the exact `REPLAY_COMMAND_ORDER` (CORR-03-11, D-08, D-25).
|
||||
- The full data suite and independent Node replay pass without modifying legacy/save code or user-owned decorator placement (D-04, D-15, S-01, S-04).
|
||||
- The full data suite, independent Node replay, scoped type gate, and circular-classifier fixture tests pass without requiring the documented seven-cycle compatibility baseline to disappear; legacy/save code and user-owned decorator placement remain unchanged (D-04, D-15, S-01, S-04, S-05).
|
||||
</acceptance_criteria>
|
||||
<done>The replay registry is normally formatted and structurally corrected, with all four replay gaps covered by focused and phase data gates.</done>
|
||||
</task>
|
||||
@ -142,12 +147,12 @@ Output: Corrected replay command source, regression tests, and a replay contract
|
||||
</threat_model>
|
||||
|
||||
<verification>
|
||||
- `pnpm exec vitest run packages-user/data-state/src/replay/commands.test.ts`
|
||||
- `pnpm test:ci packages-user/data-common packages-user/data-base packages-user/data-system packages-user/data-state`
|
||||
- `pnpm test:data-node`
|
||||
- `pnpm exec tsx script/check-data-type.ts`
|
||||
- `pnpm exec tsx script/check-data-circular.ts`
|
||||
- Scoped ESLint and Prettier checks on the replay implementation and test files
|
||||
- Run the Chinese `it`-comment scan in both tasks, then `pnpm exec vitest run packages-user/data-state/src/replay/commands.test.ts`.
|
||||
- Run `pnpm test:ci packages-user/data-common packages-user/data-base packages-user/data-system packages-user/data-state`, `pnpm test:data-node`, and `pnpm exec tsx script/check-data-type.ts`.
|
||||
- Run `pnpm exec vitest run script/check-data-circular.test.ts` for the structural/classifier tests. Do not use the live circular command as an unconditional zero-cycle gate: the documented seven accepted compatibility cycles remain and are verified through the phase verification/deferred-baseline record.
|
||||
- Mechanically read `.planning/phases/03-data-completion/03-VERIFICATION.md` and `deferred-items.md` and assert that the seven-cycle compatibility baseline is documented as deferred to Phase 5; this is a baseline assertion, not a claim that the live graph has no cycles.
|
||||
- Run scoped ESLint and Prettier checks on the replay implementation and test files.
|
||||
- Run the mechanical baseline-aware diff/scope assertion from `<scope_guard>`; it must reject newly changed legacy/save paths, `packages-user/data-base/src/hero/attribute.ts`, decorator-placement hunks, and unrelated formatting while preserving unrelated existing working-tree changes.
|
||||
</verification>
|
||||
|
||||
<success_criteria>
|
||||
|
||||
@ -9,10 +9,10 @@ files_modified:
|
||||
- packages-user/data-state/src/event/map.ts
|
||||
- packages-user/data-state/src/event/hero.ts
|
||||
- packages-user/data-state/src/event/event.ts
|
||||
- packages-user/data-state/src/event/runtime.ts
|
||||
- packages-user/data-state/src/event/registrations.ts
|
||||
- packages-user/data-state/src/event/event.test.ts
|
||||
- packages-user/data-state/src/core.ts
|
||||
- packages-user/data-state/src/index.ts
|
||||
- .planning/phases/03-data-completion/03-EVENT-CONTRACT.md
|
||||
files_deleted: []
|
||||
autonomous: true
|
||||
@ -26,10 +26,10 @@ estimate:
|
||||
confidence: low
|
||||
must_haves:
|
||||
truths:
|
||||
- "CORR-03-12: packages-user/data-state/src/event/index.ts contains export statements only; it has no imports, registration assembly, or registration logic."
|
||||
- "CORR-03-13: each approved event registration is an explicit class owning its stable name and callable func; registration assembly is a simple direct construction list in a non-index module."
|
||||
- "eventTouchFront implementation and its registration class belong to the hero event layer, while event.ts retains only event-control insertion behavior."
|
||||
- "The approved eight registration names and stable order remain unchanged, and CoreState passes the assembled entries to GameEventSystem through the existing seam."
|
||||
- "CORR-03-12: packages-user/data-state/src/event/index.ts and packages-user/data-state/src/index.ts contain export statements only; neither assembles registrations or executes registration logic."
|
||||
- "CORR-03-13: exactly eight approved event registrations are explicit classes owning their stable name and callable func: three map classes, three hero classes including eventTouchFront, and two control classes for eventInsertEvents/eventInsertEvent."
|
||||
- "eventTouchFront implementation and its registration class belong to the hero event layer, while event.ts retains only the two event-control insertion registrations."
|
||||
- "The approved eight registration names and stable order remain unchanged, registrations.ts is the sole deterministic direct-construction owner, and CoreState passes those entries to GameEventSystem through the existing seam."
|
||||
- "Event semantics, awaited movement/event actions, Statement[] direct insertion, null/missing-target safety, legacy/save boundaries, and user-owned decorator placement remain unchanged."
|
||||
artifacts:
|
||||
- path: "packages-user/data-state/src/event/index.ts"
|
||||
@ -41,13 +41,12 @@ must_haves:
|
||||
- path: "packages-user/data-state/src/event/hero.ts"
|
||||
provides: "Hero movement/front-touch functions and hero registration classes"
|
||||
- path: "packages-user/data-state/src/event/event.ts"
|
||||
provides: "Temporary event sequence/body functions and event registration classes"
|
||||
- path: "packages-user/data-state/src/event/runtime.ts"
|
||||
provides: "Shared environment target resolution without a barrel cycle"
|
||||
provides: "Event sequence/body functions and event registration classes"
|
||||
key_links:
|
||||
- "registrations.ts direct class construction -> CoreState -> GameEventSystem built-in table"
|
||||
- "hero TouchFront registration -> hero eventTouchFront -> existing ordered EventExecutor invocation"
|
||||
- "event/index.ts export statements -> public event symbols without executing assembly"
|
||||
- "data-state/src/index.ts export-only re-exports -> existing public event symbols remain reachable without becoming an assembly owner"
|
||||
---
|
||||
|
||||
<objective>
|
||||
@ -78,10 +77,15 @@ Output: Export-only event index, module-owned registration classes, separate reg
|
||||
@packages-user/data-state/src/event/event.ts
|
||||
@packages-user/data-state/src/event/types.ts
|
||||
@packages-user/data-state/src/core.ts
|
||||
@packages-user/data-state/src/index.ts
|
||||
@packages-user/data-system/src/event/system.ts
|
||||
@dev.md
|
||||
</context>
|
||||
|
||||
<scope_guard>
|
||||
Before the first edit, snapshot the current `git status --porcelain=v1 --untracked-files=all` path list and the bytes/diffs of the pre-existing working tree into `$env:TEMP\mota-phase03-18-scope-baseline`; also save a forbidden-path diff for `packages-user/data-state/src/legacy/**`, `packages-user/data-common/src/save/**`, and `packages-user/data-base/src/hero/attribute.ts`. Do not reset, stash, clean, or overwrite unrelated changes, including the preceding replay correction. The final task must compare the post-task path list and forbidden-path diff with those snapshots, fail on any newly changed path outside this plan's allowlist or any changed forbidden diff, and inspect the diff hunks for decorator-placement or unrelated formatting changes. Use a whitespace-aware diff plus `git diff --check`; pre-existing changes are preserved and excluded from the comparison.
|
||||
</scope_guard>
|
||||
|
||||
## Source Audit
|
||||
|
||||
| Source | ID | Item | Plan | Status |
|
||||
@ -91,6 +95,7 @@ Output: Export-only event index, module-owned registration classes, separate reg
|
||||
| RESEARCH | D-10/D-11/D-24/D-27 | Top-level assembly, minimum event scope, approved names, `(param, env)`, and safe behavior | 03-18 | COVERED |
|
||||
| CONTEXT | CORR-03-12 | Export-only event index and external registration assembly | 03-18 | COVERED |
|
||||
| CONTEXT | CORR-03-13 | Class-owned registrations with hero-level front touch and no scope expansion | 03-18 | COVERED |
|
||||
| CONTEXT | S-03 | Preserve direct `Statement[]` execution for `eventInsertEvent` while moving only registration ownership | 03-18 | COVERED |
|
||||
| CONTEXT | S-01/S-04 | Preserve legacy/save code and user-owned replay decorator placement | 03-18 | COVERED |
|
||||
|
||||
<tasks>
|
||||
@ -98,17 +103,17 @@ Output: Export-only event index, module-owned registration classes, separate reg
|
||||
<task type="tracer">
|
||||
<name>Task 1: CORR-03-13 class-owned event registrations and hero front-touch path</name>
|
||||
<gap_id>CORR-03-13</gap_id>
|
||||
<files>packages-user/data-state/src/event/map.ts, packages-user/data-state/src/event/hero.ts, packages-user/data-state/src/event/event.ts, packages-user/data-state/src/event/runtime.ts</files>
|
||||
<files>packages-user/data-state/src/event/map.ts, packages-user/data-state/src/event/hero.ts, packages-user/data-state/src/event/event.ts</files>
|
||||
<read_first>packages-user/data-state/src/event/map.ts, packages-user/data-state/src/event/hero.ts, packages-user/data-state/src/event/event.ts, packages-user/data-state/src/event/types.ts, packages-user/data-system/src/event/types.ts, packages-user/data-system/src/event/executor.ts, packages-user/data-common/src/event/types.ts, packages-user/data-base/src/map/types.ts, .planning/phases/03-data-completion/03-EVENT-CONTRACT.md, .planning/phases/03-data-completion/03-CONTEXT.md, dev.md</read_first>
|
||||
<action>Define explicit registration classes beside the existing handlers: three map classes in `map.ts`, three hero classes in `hero.ts` for move, move-step, and front touch, and two event-control classes in `event.ts` for the two insertion operations. Each class must implement the existing AnonTokyo built-in shape and own a typed stable `name` field plus the corresponding `func` field; do not route registration through a generic handler factory or opaque descriptor array. Move `eventTouchFront`, its event-source collection helpers, and its registration ownership into `hero.ts`; keep its current OnTouch ordering, environment construction, no-movement behavior, and awaited executor call. Move shared map/layer target resolution into a small `runtime.ts` declaration module if needed so map and hero imports remain acyclic. Keep `event.ts` responsible for `eventInsertEvents` and direct `Statement[]` `eventInsertEvent`, preserving the existing nested-depth guard and store/interpreter semantics. Keep simple compatibility builders temporarily if the existing barrel needs them during this task, but make them instantiate the explicit registration classes and preserve the exact eight-name order; the following task removes barrel assembly. Do not alter event parameter interfaces, event scope, legacy/save paths, or user-owned decorator placement (CORR-03-13, D-10, D-11, D-24, D-27, S-01, S-04).</action>
|
||||
<action>At task start, write the scope snapshot required by the plan scope guard. Define explicit registration classes beside the handlers: exactly three map classes in `map.ts` for set/move/delete, exactly three hero classes in `hero.ts` for move/move-step/front touch, and exactly two control classes in `event.ts` for `eventInsertEvents` and direct `Statement[]` `eventInsertEvent`. Each class must implement the existing AnonTokyo built-in shape and own a typed stable `name` field plus the corresponding `func` field; do not route registration through a generic handler factory or opaque descriptor array. Move `eventTouchFront`, its event-source collection helpers, and its registration ownership into `hero.ts`; keep its current OnTouch ordering, environment construction, no-movement behavior, and awaited executor call. Do not create or modify `event/runtime.ts`; keep any required target-resolution helper in an already-owned event module so file creation and reads remain deterministic. Keep `event.ts` responsible only for the two insertion operations, preserving the nested-depth guard, direct `Statement[]` interpreter path, and store/interpreter semantics. Do not alter event parameter interfaces, event scope, legacy/save paths, or user-owned decorator placement (CORR-03-13, D-10, D-11, D-24, D-27, S-01, S-04).</action>
|
||||
<verify>
|
||||
<automated>pnpm exec vitest run packages-user/data-state/src/event/event.test.ts packages-user/data-system/src/event/eventDispatch.test.ts</automated>
|
||||
<fails_when>Focused event or dispatch tests exit non-zero, front-touch registration remains owned by event.ts, a registration class does not expose its own stable name/function pair, event ordering/awaiting/direct-body semantics change, or a new import cycle prevents the event path from loading.</fails_when>
|
||||
</verify>
|
||||
<acceptance_criteria>
|
||||
- The eight approved handlers retain their current behavior and stable names; `eventTouchFront` and its registration class are defined in `hero.ts` (CORR-03-13, D-24).
|
||||
- Registration classes own the callable function and stable name directly, with no generic factory/descriptor mechanism controlling their identity (CORR-03-13).
|
||||
- New or modified `it` calls in the focused event tests have Chinese single-line coverage comments immediately before them (D-03, D-04).
|
||||
- Registration classes own the callable function and stable name directly, with exactly three map owners, three hero owners, and two insertion-control owners; no generic factory/descriptor mechanism controls their identity (CORR-03-13).
|
||||
- `eventInsertEvent` still receives and directly executes `Statement[]`; no event-id lookup or delegation to the id-sequence path is introduced (S-03, D-27).
|
||||
</acceptance_criteria>
|
||||
<done>The production event handlers and class-owned registrations provide the same event behavior, with front touch owned by the hero layer.</done>
|
||||
</task>
|
||||
@ -116,12 +121,12 @@ Output: Export-only event index, module-owned registration classes, separate reg
|
||||
<task type="auto">
|
||||
<name>Task 2: CORR-03-12 move assembly out of the event barrel</name>
|
||||
<gap_id>CORR-03-12, CORR-03-13</gap_id>
|
||||
<files>packages-user/data-state/src/event/index.ts, packages-user/data-state/src/event/registrations.ts, packages-user/data-state/src/core.ts, .planning/phases/03-data-completion/03-EVENT-CONTRACT.md</files>
|
||||
<read_first>packages-user/data-state/src/event/index.ts, packages-user/data-state/src/event/map.ts, packages-user/data-state/src/event/hero.ts, packages-user/data-state/src/event/event.ts, packages-user/data-state/src/event/runtime.ts, packages-user/data-state/src/core.ts, packages-user/data-system/src/event/system.ts, .planning/phases/03-data-completion/03-EVENT-CONTRACT.md, .planning/phases/03-data-completion/03-CONTEXT.md, dev.md</read_first>
|
||||
<action>Create `event/registrations.ts` as the sole assembly module. Its factory must return one direct, readable list of new registration class instances in the existing order: set block, move block, delete block, move hero, move hero step, touch front, insert events, insert event. Change CoreState to import this factory from the assembly module rather than relying on the event barrel. Reduce `event/index.ts` to export statements only, re-exporting declarations without importing or invoking them. Remove the temporary per-module builders once the direct assembly is wired. Update `03-EVENT-CONTRACT.md` to record that the index is export-only, `registrations.ts` owns order assembly, each class owns `name`/`func`, and front touch belongs to hero; preserve the eight names, existing event semantics, and no legacy catalog expansion (CORR-03-12, CORR-03-13, D-10, D-11, S-01).</action>
|
||||
<files>packages-user/data-state/src/event/index.ts, packages-user/data-state/src/event/registrations.ts, packages-user/data-state/src/core.ts, packages-user/data-state/src/index.ts, .planning/phases/03-data-completion/03-EVENT-CONTRACT.md</files>
|
||||
<read_first>packages-user/data-state/src/event/index.ts, packages-user/data-state/src/event/map.ts, packages-user/data-state/src/event/hero.ts, packages-user/data-state/src/event/event.ts, packages-user/data-state/src/core.ts, packages-user/data-state/src/index.ts, packages-user/data-system/src/event/system.ts, .planning/phases/03-data-completion/03-EVENT-CONTRACT.md, .planning/phases/03-data-completion/03-CONTEXT.md, dev.md</read_first>
|
||||
<action>Create `event/registrations.ts` as the sole assembly module. Its factory must return exactly eight direct, readable class instances in this order and ownership: map — `SetBlockEventRegistration`, `MoveBlockEventRegistration`, `DeleteBlockEventRegistration`; hero — `MoveHeroEventRegistration`, `MoveHeroStepEventRegistration`, `TouchFrontEventRegistration`; control — `InsertEventsEventRegistration`, `InsertEventEventRegistration`. Change CoreState to import this factory from the assembly module rather than relying on the event barrel. Reduce `event/index.ts` to export statements only, including a compatible re-export of the assembly factory if that symbol was previously reachable, without importing or invoking registration code there. Keep `data-state/src/index.ts` export-only and preserve every public event symbol currently reachable through it with the same path via compatible re-exports/wrappers; it must not become a registration owner. Remove all generic/per-module assembly builders once the direct list is wired. Update `03-EVENT-CONTRACT.md` to record the exact eight-entry class ownership, deterministic assembly owner, export-only barrels, hero front touch, direct `Statement[]` behavior, and unchanged public contracts (CORR-03-12, CORR-03-13, D-10, D-11, S-03, S-01).</action>
|
||||
<verify>
|
||||
<automated>$index = Get-Content -Raw 'packages-user/data-state/src/event/index.ts'; if ($index -match '(?m)^\s*import\s') { throw 'Event index still imports registration code' }; if ($index -match '(?m)^\s*(?:export\s+)?(?:async\s+)?function\s') { throw 'Event index still declares assembly logic' }; $registration = Get-Content -Raw 'packages-user/data-state/src/event/registrations.ts'; foreach ($token in @('new SetBlockEventRegistration', 'new MoveBlockEventRegistration', 'new DeleteBlockEventRegistration', 'new MoveHeroEventRegistration', 'new MoveHeroStepEventRegistration', 'new TouchFrontEventRegistration', 'new InsertEventsEventRegistration', 'new InsertEventEventRegistration')) { if ($registration -notmatch [regex]::Escape($token)) { throw "Missing direct registration construction: $token" } }; $core = Get-Content -Raw 'packages-user/data-state/src/core.ts'; if ($core -notmatch "event/registrations") { throw 'CoreState does not consume the external registration assembly module' }; pnpm exec vitest run packages-user/data-state/src/event/event.test.ts packages-user/data-system/src/event/eventDispatch.test.ts; if ($?) { pnpm exec tsx script/check-data-type.ts }; if ($?) { pnpm exec prettier --check packages-user/data-state/src/event/index.ts packages-user/data-state/src/event/registrations.ts packages-user/data-state/src/event/map.ts packages-user/data-state/src/event/hero.ts packages-user/data-state/src/event/event.ts packages-user/data-state/src/event/runtime.ts packages-user/data-state/src/core.ts .planning/phases/03-data-completion/03-EVENT-CONTRACT.md }</automated>
|
||||
<fails_when>The event index contains any import or function declaration, the assembly module omits any approved class/order entry, CoreState still consumes barrel-owned assembly, focused tests/type gate/Prettier exit non-zero, or the updated contract omits the new ownership boundaries.</fails_when>
|
||||
<automated>$index = Get-Content -Raw 'packages-user/data-state/src/event/index.ts'; if ($index -match '(?m)^\s*import\s') { throw 'Event index still imports registration code' }; if ($index -match '(?m)^\s*(?:export\s+)?(?:async\s+)?function\s') { throw 'Event index still declares assembly logic' }; $root = Get-Content -Raw 'packages-user/data-state/src/index.ts'; if ($root -match '(?m)^\s*import\s') { throw 'Data-state root index is not export-only' }; if ($root -notmatch "export \* from './event'") { throw 'Data-state root index no longer exposes event exports' }; $registration = Get-Content -Raw 'packages-user/data-state/src/event/registrations.ts'; $entries = [regex]::Matches($registration, 'new\s+\w+EventRegistration\s*\('); if ($entries.Count -ne 8) { throw "Expected exactly eight registration instances, found $($entries.Count)" }; foreach ($token in @('new SetBlockEventRegistration', 'new MoveBlockEventRegistration', 'new DeleteBlockEventRegistration', 'new MoveHeroEventRegistration', 'new MoveHeroStepEventRegistration', 'new TouchFrontEventRegistration', 'new InsertEventsEventRegistration', 'new InsertEventEventRegistration')) { if ($registration -notmatch [regex]::Escape($token)) { throw "Missing direct registration construction: $token" } }; foreach ($owner in @(@{file='map.ts'; tokens=@('class SetBlockEventRegistration','class MoveBlockEventRegistration','class DeleteBlockEventRegistration')}, @{file='hero.ts'; tokens=@('class MoveHeroEventRegistration','class MoveHeroStepEventRegistration','class TouchFrontEventRegistration')}, @{file='event.ts'; tokens=@('class InsertEventsEventRegistration','class InsertEventEventRegistration') })) { $source = Get-Content -Raw (Join-Path 'packages-user/data-state/src/event' $owner.file); foreach ($token in $owner.tokens) { if ($source -notmatch [regex]::Escape($token)) { throw "Registration ownership mismatch: $token" } } }; $core = Get-Content -Raw 'packages-user/data-state/src/core.ts'; if ($core -notmatch "event/registrations") { throw 'CoreState does not consume the external registration assembly module' }; if (Test-Path 'packages-user/data-state/src/event/runtime.ts') { throw 'runtime.ts is not part of this deterministic design' }; pnpm exec vitest run packages-user/data-state/src/event/event.test.ts packages-user/data-system/src/event/eventDispatch.test.ts; if ($?) { pnpm exec tsx script/check-data-type.ts }; if ($?) { pnpm exec prettier --check packages-user/data-state/src/event/index.ts packages-user/data-state/src/event/registrations.ts packages-user/data-state/src/event/map.ts packages-user/data-state/src/event/hero.ts packages-user/data-state/src/event/event.ts packages-user/data-state/src/core.ts packages-user/data-state/src/index.ts .planning/phases/03-data-completion/03-EVENT-CONTRACT.md }</automated>
|
||||
<fails_when>The event or data-state root index contains imports or assembly logic, registrations.ts does not contain exactly eight direct entries in the specified ownership/order, CoreState still consumes barrel-owned assembly, runtime.ts is created/used, focused tests/type gate/Prettier exit non-zero, or the updated contract omits the ownership/public-export boundaries.</fails_when>
|
||||
</verify>
|
||||
<acceptance_criteria>
|
||||
- `event/index.ts` contains only `export` statements and does not assemble registrations (CORR-03-12).
|
||||
@ -135,15 +140,15 @@ Output: Export-only event index, module-owned registration classes, separate reg
|
||||
<name>Task 3: CORR-03-12/13 registration ownership regression matrix</name>
|
||||
<gap_id>CORR-03-12, CORR-03-13</gap_id>
|
||||
<files>packages-user/data-state/src/event/event.test.ts</files>
|
||||
<read_first>packages-user/data-state/src/event/event.test.ts, packages-user/data-state/src/event/index.ts, packages-user/data-state/src/event/registrations.ts, packages-user/data-state/src/event/map.ts, packages-user/data-state/src/event/hero.ts, packages-user/data-state/src/event/event.ts, packages-user/data-state/src/core.ts, .planning/phases/03-data-completion/03-EVENT-CONTRACT.md, dev.md</read_first>
|
||||
<action>Extend the focused regression through the real `registrations.ts` assembly and CoreState interpreter. Assert the eight names and existing order, that every registration instance owns its own name/function properties, that the front-touch registration constructor originates from the hero module, and that the event barrel source contains exports only. Retain behavior assertions for map mutations, awaited hero/event actions, front OnTouch ordering/no movement, direct Statement[] insertion, id-sequence insertion, and safe missing targets. Add Chinese single-line comments immediately before each new or modified `it` call. Do not assert or implement any expanded legacy event catalog, save change, replay decorator move, or altered public event parameter contract (CORR-03-12, CORR-03-13, D-03, D-04, D-11, D-24, S-01, S-04).</action>
|
||||
<read_first>packages-user/data-state/src/event/event.test.ts, packages-user/data-state/src/event/index.ts, packages-user/data-state/src/event/registrations.ts, packages-user/data-state/src/event/map.ts, packages-user/data-state/src/event/hero.ts, packages-user/data-state/src/event/event.ts, packages-user/data-state/src/core.ts, packages-user/data-state/src/index.ts, .planning/phases/03-data-completion/03-EVENT-CONTRACT.md, dev.md</read_first>
|
||||
<action>Extend the focused regression through the real `registrations.ts` assembly and CoreState interpreter. Assert the exact eight names and existing order, the three-map/three-hero/two-control ownership split, that every registration instance owns its own name/function properties, that the front-touch registration constructor originates from the hero module, both event barrels contain exports only, and all public symbols previously reachable from `data-state/src/index.ts` remain reachable through compatible re-exports/wrappers. Retain behavior assertions for map mutations, awaited hero/event actions, front OnTouch ordering/no movement, direct `Statement[]` insertion, id-sequence insertion, and safe missing targets. Add a Chinese single-line comment immediately before every `it` call in the complete test file and run the scanner below. Do not assert or implement any expanded legacy event catalog, save change, replay decorator move, runtime.ts creation, or altered public event parameter contract (CORR-03-12, CORR-03-13, D-03, D-04, D-11, D-24, S-01, S-03, S-04).</action>
|
||||
<verify>
|
||||
<automated>$lines = Get-Content -LiteralPath 'packages-user/data-state/src/event/event.test.ts'; for ($i = 0; $i -lt $lines.Count; $i++) { if ($lines[$i] -match '^\s*it(?:\.[A-Za-z]+)*\s*\(') { if ($i -eq 0 -or $lines[$i - 1] -notmatch '^\s*//\s*[\u4e00-\u9fff]') { throw "Missing Chinese coverage comment before it at line $($i + 1)" } } }; pnpm exec vitest run packages-user/data-state/src/event/event.test.ts packages-user/data-system/src/event/eventDispatch.test.ts; if ($?) { pnpm test:ci packages-user/data-common packages-user/data-base packages-user/data-system packages-user/data-state }; if ($?) { pnpm test:data-node }</automated>
|
||||
<fails_when>Any event test lacks its Chinese coverage comment, registration ownership/order or existing event behavior fails, the four-package data suite exits non-zero, or the independent Node replay command exits non-zero.</fails_when>
|
||||
<automated>$lines = Get-Content -LiteralPath 'packages-user/data-state/src/event/event.test.ts'; for ($i = 0; $i -lt $lines.Count; $i++) { if ($lines[$i] -match '^\s*it(?:\.[A-Za-z]+)*\s*\(') { if ($i -eq 0 -or $lines[$i - 1] -notmatch '^\s*//\s*[\u4e00-\u9fff]') { throw "Missing Chinese coverage comment before it at line $($i + 1)" } } }; pnpm exec vitest run packages-user/data-state/src/event/event.test.ts packages-user/data-system/src/event/eventDispatch.test.ts; if ($?) { pnpm test:ci packages-user/data-common packages-user/data-base packages-user/data-system packages-user/data-state }; if ($?) { pnpm test:data-node }; if ($?) { $status = & git status --porcelain=v1 --untracked-files=all; $statusExit = $LASTEXITCODE; if ($statusExit -ne 0) { throw 'git status failed during scope assertion' }; $baseline = Get-Content -LiteralPath "$env:TEMP\mota-phase03-18-scope-baseline\paths.txt"; $new = Compare-Object -ReferenceObject $baseline -DifferenceObject $status -PassThru; $allowed = @('packages-user/data-state/src/event/index.ts','packages-user/data-state/src/event/map.ts','packages-user/data-state/src/event/hero.ts','packages-user/data-state/src/event/event.ts','packages-user/data-state/src/event/registrations.ts','packages-user/data-state/src/event/event.test.ts','packages-user/data-state/src/core.ts','packages-user/data-state/src/index.ts','.planning/phases/03-data-completion/03-EVENT-CONTRACT.md'); foreach ($delta in $new) { if ($delta.SideIndicator -eq '=>' -and $allowed -notcontains $delta.InputObject) { throw 'Scope assertion found a newly changed path outside Plan 03-18 allowlist' } }; if (Test-Path 'packages-user/data-state/src/event/runtime.ts') { throw 'runtime.ts must not be created' }; git diff --check }</automated>
|
||||
<fails_when>Any event test lacks its Chinese coverage comment, exact registration ownership/order/public-export or existing event behavior fails, runtime.ts is created, the four-package data suite or independent Node replay exits non-zero, or the baseline-aware scope/diff assertion finds forbidden or unrelated changes.</fails_when>
|
||||
</verify>
|
||||
<acceptance_criteria>
|
||||
- The real eight-entry class registry and CoreState interpreter path pass behavior and ownership assertions (CORR-03-13, D-10).
|
||||
- The existing data suite and Node replay remain green without modifications to legacy/save code or user-owned decorator placement (D-04, D-15, S-01, S-04).
|
||||
- The existing data suite and Node replay remain green without modifications to legacy/save code or user-owned decorator placement, and direct `Statement[]` insertion remains intact (D-04, D-15, S-01, S-03, S-04).
|
||||
</acceptance_criteria>
|
||||
<done>Event barrel, class ownership, hero front-touch placement, stable order, and existing behavior are regression-tested through the real assembly path.</done>
|
||||
</task>
|
||||
@ -164,7 +169,7 @@ Output: Export-only event index, module-owned registration classes, separate reg
|
||||
| Threat ID | Category | Component | Severity | Disposition | Mitigation Plan |
|
||||
|---|---|---|---|---|---|
|
||||
| T-03-43 | Tampering | event registration order/ownership | high | mitigate | Use eight explicit class instances in one readable order list and assert each name/function owner. |
|
||||
| T-03-44 | Denial of service | event barrel/import graph | medium | mitigate | Keep the index export-only and place shared resolution in an acyclic helper module. |
|
||||
| T-03-44 | Denial of service | event barrel/import graph | medium | mitigate | Keep both indexes export-only, avoid runtime.ts creation, and keep CoreState's direct registrations import acyclic. |
|
||||
| T-03-45 | Tampering | hero front-touch dispatch | high | mitigate | Move only ownership, preserve source ordering, OnTouch trigger, no-movement behavior, and awaited executor semantics. |
|
||||
| T-03-SC | Tampering | npm/pip/cargo installs | low | accept | No package installation is planned. |
|
||||
</threat_model>
|
||||
@ -175,10 +180,11 @@ Output: Export-only event index, module-owned registration classes, separate reg
|
||||
- `pnpm test:data-node`
|
||||
- `pnpm exec tsx script/check-data-type.ts`
|
||||
- Scoped ESLint and Prettier checks for the event implementation, assembly, CoreState import, contract, and tests
|
||||
- Baseline-aware mechanical diff/scope assertion from `<scope_guard>`; it rejects newly changed legacy/save paths, `attribute.ts`/decorator placement, runtime.ts, and unrelated formatting while preserving pre-existing working-tree changes
|
||||
</verification>
|
||||
|
||||
<success_criteria>
|
||||
CORR-03-12 and CORR-03-13 are closed when the event barrel contains exports only, explicit registration classes own their names/functions, a separate direct assembly module preserves the eight-entry order, eventTouchFront is hero-owned, and all existing event/data/replay behavior remains green.
|
||||
CORR-03-12 and CORR-03-13 are closed when both event indexes remain exports-only, exactly eight explicit registration classes preserve the three-map/three-hero/two-control ownership and stable order, eventTouchFront is hero-owned, current public exports remain reachable, direct `Statement[]` behavior remains intact, and all existing event/data/replay behavior remains green.
|
||||
</success_criteria>
|
||||
|
||||
<output>
|
||||
|
||||
@ -10,9 +10,9 @@ files_modified:
|
||||
- packages-user/data-state/src/event/map.ts
|
||||
- packages-user/data-state/src/event/hero.ts
|
||||
- packages-user/data-state/src/event/event.ts
|
||||
- packages-user/data-state/src/event/runtime.ts
|
||||
- packages-user/data-state/src/event/registrations.ts
|
||||
- packages-user/data-state/src/event/event.test.ts
|
||||
- script/check-touched-jsdoc.ts
|
||||
files_deleted: []
|
||||
autonomous: true
|
||||
requirements: [DATA-01]
|
||||
@ -25,10 +25,10 @@ estimate:
|
||||
confidence: low
|
||||
must_haves:
|
||||
truths:
|
||||
- "CORR-03-14: every function/method JSDoc block changed by these replay/event corrections uses multiline /** ... */ form."
|
||||
- "The JSDoc correction is limited to the replay/event files and functions/methods touched by CORR-03-08 through CORR-03-13; unrelated legacy/save/render files are not reformatted."
|
||||
- "CORR-03-14: every touched top-level function and class method in the replay/event correction files has a multiline JSDoc block, proven by an explicit touched-symbol inventory and declaration-aware scan."
|
||||
- "The JSDoc correction is limited to the replay/event files and touched symbols from CORR-03-08 through CORR-03-13; unrelated legacy/save/render files are not reformatted."
|
||||
- "Chinese single-line coverage comments remain immediately before every modified or newly added Vitest it call."
|
||||
- "Replay await semantics, one directional class, export-only event index, class-owned registration assembly, hero front touch, stable order, legacy/save boundaries, and user-owned decorator placement remain intact."
|
||||
- "Replay await semantics under S-05, one directional class, export-only event indexes, class-owned registration assembly, hero front touch, stable order, direct Statement[] insertion, legacy/save boundaries, and user-owned decorator placement remain intact."
|
||||
artifacts:
|
||||
- path: "packages-user/data-state/src/replay/commands.ts"
|
||||
provides: "Multiline function JSDoc for touched replay exports"
|
||||
@ -40,6 +40,8 @@ must_haves:
|
||||
provides: "Multiline function JSDoc for touched event-control functions"
|
||||
- path: "packages-user/data-state/src/event/registrations.ts"
|
||||
provides: "Multiline function JSDoc for the registration assembly function"
|
||||
- path: "script/check-touched-jsdoc.ts"
|
||||
provides: "Declaration-aware audit covering every touched top-level function and class method, not only top-level function declarations"
|
||||
key_links:
|
||||
- "JSDoc structural audit -> touched function declarations -> scoped formatter/test gates"
|
||||
- "Chinese test-comment audit -> replay/event regression tests -> reviewable correction evidence"
|
||||
@ -73,12 +75,15 @@ Output: Scoped JSDoc/style cleanup and structural regression checks over the cor
|
||||
@packages-user/data-state/src/event/map.ts
|
||||
@packages-user/data-state/src/event/hero.ts
|
||||
@packages-user/data-state/src/event/event.ts
|
||||
@packages-user/data-state/src/event/runtime.ts
|
||||
@packages-user/data-state/src/event/registrations.ts
|
||||
@packages-user/data-state/src/event/event.test.ts
|
||||
@dev.md
|
||||
</context>
|
||||
|
||||
<scope_guard>
|
||||
Before the first edit, snapshot the current `git status --porcelain=v1 --untracked-files=all` path list and the bytes/diffs of the pre-existing working tree into `$env:TEMP\mota-phase03-19-scope-baseline`; also save a forbidden-path diff for `packages-user/data-state/src/legacy/**`, `packages-user/data-common/src/save/**`, and `packages-user/data-base/src/hero/attribute.ts`. Do not reset, stash, clean, or overwrite unrelated changes from Plans 03-17/03-18. The final task must compare the post-task path list and forbidden-path diff with those snapshots, fail on any newly changed path outside this plan's allowlist or any changed forbidden diff, and inspect the diff hunks for decorator-placement or unrelated formatting changes. Use a whitespace-aware diff plus `git diff --check`; pre-existing changes are preserved and excluded from the comparison.
|
||||
</scope_guard>
|
||||
|
||||
## Source Audit
|
||||
|
||||
| Source | ID | Item | Plan | Status |
|
||||
@ -87,6 +92,7 @@ Output: Scoped JSDoc/style cleanup and structural regression checks over the cor
|
||||
| REQ | DATA-01 | Corrected replay/event behavior remains covered after documentation cleanup | 03-19 | COVERED |
|
||||
| RESEARCH | dev.md:71-85 | Function JSDoc style and Chinese test coverage comments | 03-19 | COVERED |
|
||||
| CONTEXT | CORR-03-14 | Multiline JSDoc for every touched function/method | 03-19 | COVERED |
|
||||
| CONTEXT | S-05 | Preserve awaited replay movement/pathfinding completion while keeping replay-safety ownership out of command code | 03-19 | COVERED |
|
||||
| CONTEXT | S-01/S-04 | No legacy/save changes and no user-owned decorator relocation | 03-19 | COVERED |
|
||||
|
||||
<tasks>
|
||||
@ -94,15 +100,15 @@ Output: Scoped JSDoc/style cleanup and structural regression checks over the cor
|
||||
<task type="tracer">
|
||||
<name>Task 1: CORR-03-14 replay documentation and ordering audit</name>
|
||||
<gap_id>CORR-03-14</gap_id>
|
||||
<files>packages-user/data-state/src/replay/commands.ts, packages-user/data-state/src/replay/commands.test.ts</files>
|
||||
<read_first>packages-user/data-state/src/replay/commands.ts, packages-user/data-state/src/replay/commands.test.ts, packages-user/data-state/src/replay/types.ts, packages-user/data-common/src/replay/types.ts, packages-user/data-base/src/hero/attribute.ts, .planning/phases/03-data-completion/03-REPLAY-CONTRACT.md, dev.md</read_first>
|
||||
<action>Convert every JSDoc block attached to a replay function or method changed by CORR-03-08 through CORR-03-11 into a multiline `/**` block with the description on its own line and the closing marker on its own line. Keep comments on the corrected parameterized directional command, awaited pathfinding path, stable registry exports, and registration behavior accurate; do not add decorator placement to the command classes or to user-owned state methods. Preserve the focused deferred-controller/class-collapse tests and ensure every changed `it` call retains an immediately preceding Chinese single-line coverage comment (CORR-03-14, S-04).</action>
|
||||
<files>packages-user/data-state/src/replay/commands.ts, packages-user/data-state/src/replay/commands.test.ts, script/check-touched-jsdoc.ts</files>
|
||||
<read_first>packages-user/data-state/src/replay/commands.ts, packages-user/data-state/src/replay/commands.test.ts, packages-user/data-state/src/replay/types.ts, packages-user/data-common/src/replay/types.ts, packages-user/data-base/src/hero/attribute.ts, .planning/phases/03-data-completion/03-REPLAY-CONTRACT.md, .planning/phases/03-data-completion/03-CONTEXT.md, dev.md</read_first>
|
||||
<action>At task start, write the scope snapshot required by the plan scope guard. Convert every JSDoc block attached to a replay symbol touched by CORR-03-08 through CORR-03-11 into a multiline block with the description on its own line and the closing marker on its own line. Maintain this explicit touched-symbol inventory: `ReplayDirectionCommand.moveHero`, `ReplayDirectionCommand.execute`, `ReplayAutoPathfindCommand.moveToPoint`, `ReplayAutoPathfindCommand.execute`, `ReplayUseItemCommand.useItem`, `ReplayUseItemCommand.execute`, `ReplayEquipCommand.equip`, `ReplayEquipCommand.execute`, `ReplayUnequipCommand.unequip`, `ReplayUnequipCommand.execute`, `createReplayCommandItems`, and `registerReplayCommandItems`; add any additional function or class method actually touched before running the audit. Constructors are checked as class members but remain undocumented per dev.md's constructor rule. Keep comments accurate for S-05 awaited movement/pathfinding, synchronous item/equipment calls, stable registry exports, and registration behavior; do not add decorator placement to command classes or user-owned state methods. Add `script/check-touched-jsdoc.ts` as a declaration-aware scanner using the TypeScript AST that enumerates top-level function declarations and every class method in the supplied files, reports the fully-qualified symbol inventory, and fails unless each inventoried declaration has multiline JSDoc. Preserve the deferred-controller/class-collapse tests and ensure every `it` call in the test file has an immediately preceding Chinese single-line coverage comment (CORR-03-14, S-04, S-05).</action>
|
||||
<verify>
|
||||
<automated>$files = @('packages-user/data-state/src/replay/commands.ts'); foreach ($file in $files) { $text = Get-Content -Raw $file; if ([regex]::IsMatch($text, '/\*\*[^\r\n]*\*/\s*(?:export\s+)?(?:async\s+)?function')) { throw "Single-line function JSDoc remains in $file" } }; $lines = Get-Content -LiteralPath 'packages-user/data-state/src/replay/commands.test.ts'; for ($i = 0; $i -lt $lines.Count; $i++) { if ($lines[$i] -match '^\s*it(?:\.[A-Za-z]+)*\s*\(') { if ($i -eq 0 -or $lines[$i - 1] -notmatch '^\s*//\s*[\u4e00-\u9fff]') { throw "Missing Chinese coverage comment before it at line $($i + 1)" } } }; pnpm exec vitest run packages-user/data-state/src/replay/commands.test.ts; if ($?) { pnpm exec prettier --check packages-user/data-state/src/replay/commands.ts packages-user/data-state/src/replay/commands.test.ts }</automated>
|
||||
<fails_when>Any touched replay function retains a single-line JSDoc block, a replay test lacks its Chinese coverage comment, focused tests fail, or the scoped Prettier check exits non-zero.</fails_when>
|
||||
<automated>pnpm exec tsx script/check-touched-jsdoc.ts packages-user/data-state/src/replay/commands.ts; if ($?) { $lines = Get-Content -LiteralPath 'packages-user/data-state/src/replay/commands.test.ts'; for ($i = 0; $i -lt $lines.Count; $i++) { if ($lines[$i] -match '^\s*it(?:\.[A-Za-z]+)*\s*\(') { if ($i -eq 0 -or $lines[$i - 1] -notmatch '^\s*//\s*[\u4e00-\u9fff]') { throw "Missing Chinese coverage comment before it at line $($i + 1)" } } } }; if ($?) { pnpm exec vitest run packages-user/data-state/src/replay/commands.test.ts }; if ($?) { pnpm exec prettier --check packages-user/data-state/src/replay/commands.ts packages-user/data-state/src/replay/commands.test.ts script/check-touched-jsdoc.ts }</automated>
|
||||
<fails_when>The declaration-aware scan finds a touched top-level function or class method without multiline JSDoc, the replay test lacks a Chinese coverage comment, focused tests fail, or the scoped Prettier check exits non-zero.</fails_when>
|
||||
</verify>
|
||||
<acceptance_criteria>
|
||||
- All touched replay function JSDoc blocks are multiline and describe the corrected await/ownership behavior (CORR-03-14).
|
||||
- Every inventoried touched replay function and class method has multiline JSDoc and the declaration-aware scan proves that no touched method was skipped (CORR-03-14).
|
||||
- Focused replay tests still prove controller ordering and one directional command ownership without changing user-owned decorator placement (CORR-03-08, CORR-03-09, CORR-03-10, S-04).
|
||||
</acceptance_criteria>
|
||||
<done>The replay correction has repository-compliant multiline function JSDoc and retains its behavioral regression path.</done>
|
||||
@ -111,16 +117,16 @@ Output: Scoped JSDoc/style cleanup and structural regression checks over the cor
|
||||
<task type="auto">
|
||||
<name>Task 2: CORR-03-14 event documentation and phase gates</name>
|
||||
<gap_id>CORR-03-14</gap_id>
|
||||
<files>packages-user/data-state/src/event/map.ts, packages-user/data-state/src/event/hero.ts, packages-user/data-state/src/event/event.ts, packages-user/data-state/src/event/runtime.ts, packages-user/data-state/src/event/registrations.ts, packages-user/data-state/src/event/event.test.ts</files>
|
||||
<read_first>packages-user/data-state/src/event/map.ts, packages-user/data-state/src/event/hero.ts, packages-user/data-state/src/event/event.ts, packages-user/data-state/src/event/runtime.ts, packages-user/data-state/src/event/registrations.ts, packages-user/data-state/src/event/index.ts, packages-user/data-state/src/event/event.test.ts, packages-user/data-state/src/core.ts, .planning/phases/03-data-completion/03-EVENT-CONTRACT.md, dev.md</read_first>
|
||||
<action>Convert every JSDoc block attached to an event function or registration-assembly function changed by CORR-03-12/13 into multiline form, including the moved hero-owned front-touch function and the shared runtime resolution functions. Add multiline JSDoc where the correction creates a public event function or assembly function that requires documentation; do not reformat member-only comments in unrelated contracts or files. Keep the export-only index, explicit class-owned registration fields, stable registration order, direct Statement[] behavior, front OnTouch semantics, and event test Chinese comments unchanged (CORR-03-14, CORR-03-12, CORR-03-13, D-11, D-24, D-27).</action>
|
||||
<files>packages-user/data-state/src/event/map.ts, packages-user/data-state/src/event/hero.ts, packages-user/data-state/src/event/event.ts, packages-user/data-state/src/event/registrations.ts, packages-user/data-state/src/event/event.test.ts</files>
|
||||
<read_first>packages-user/data-state/src/event/map.ts, packages-user/data-state/src/event/hero.ts, packages-user/data-state/src/event/event.ts, packages-user/data-state/src/event/registrations.ts, packages-user/data-state/src/event/index.ts, packages-user/data-state/src/event/event.test.ts, packages-user/data-state/src/core.ts, packages-user/data-state/src/index.ts, script/check-touched-jsdoc.ts, .planning/phases/03-data-completion/03-EVENT-CONTRACT.md, dev.md</read_first>
|
||||
<action>Convert every JSDoc block attached to an event function or registration class method touched by CORR-03-12/13 into multiline form, including the moved hero-owned front-touch function and every target-resolution, event-source collection, event-control, and registration-assembly declaration actually changed. Extend the scanner invocation to enumerate top-level functions, methods in all explicit registration classes, and any other declaration touched by the diff; do not rely on a top-level-function-only regular expression. Add multiline JSDoc where the correction creates a public event function or assembly function that requires documentation; do not reformat member-only comments in unrelated contracts or files. Keep both export-only indexes, explicit class-owned registration fields, exact eight-entry order, direct `Statement[]` behavior, front OnTouch semantics, public re-exports, and event test Chinese comments unchanged (CORR-03-14, CORR-03-12, CORR-03-13, D-11, D-24, D-27, S-03).</action>
|
||||
<verify>
|
||||
<automated>$files = @('packages-user/data-state/src/event/map.ts','packages-user/data-state/src/event/hero.ts','packages-user/data-state/src/event/event.ts','packages-user/data-state/src/event/runtime.ts','packages-user/data-state/src/event/registrations.ts'); foreach ($file in $files) { $text = Get-Content -Raw $file; if ([regex]::IsMatch($text, '/\*\*[^\r\n]*\*/\s*(?:export\s+)?(?:async\s+)?function')) { throw "Single-line function JSDoc remains in $file" } }; $lines = Get-Content -LiteralPath 'packages-user/data-state/src/event/event.test.ts'; for ($i = 0; $i -lt $lines.Count; $i++) { if ($lines[$i] -match '^\s*it(?:\.[A-Za-z]+)*\s*\(') { if ($i -eq 0 -or $lines[$i - 1] -notmatch '^\s*//\s*[\u4e00-\u9fff]') { throw "Missing Chinese coverage comment before it at line $($i + 1)" } } }; pnpm exec vitest run packages-user/data-state/src/event/event.test.ts packages-user/data-system/src/event/eventDispatch.test.ts; if ($?) { pnpm test:ci packages-user/data-common packages-user/data-base packages-user/data-system packages-user/data-state }; if ($?) { pnpm test:data-node }; if ($?) { pnpm exec tsx script/check-data-type.ts }; if ($?) { pnpm exec prettier --check packages-user/data-state/src/event/map.ts packages-user/data-state/src/event/hero.ts packages-user/data-state/src/event/event.ts packages-user/data-state/src/event/runtime.ts packages-user/data-state/src/event/registrations.ts packages-user/data-state/src/event/event.test.ts }</automated>
|
||||
<fails_when>Any touched event function retains a single-line JSDoc block, any event test lacks its Chinese coverage comment, event/data/Node/type/Prettier gates exit non-zero, or the gates reveal a change to stable event semantics or scope.</fails_when>
|
||||
<automated>pnpm exec tsx script/check-touched-jsdoc.ts packages-user/data-state/src/event/map.ts packages-user/data-state/src/event/hero.ts packages-user/data-state/src/event/event.ts packages-user/data-state/src/event/registrations.ts; if ($?) { $lines = Get-Content -LiteralPath 'packages-user/data-state/src/event/event.test.ts'; for ($i = 0; $i -lt $lines.Count; $i++) { if ($lines[$i] -match '^\s*it(?:\.[A-Za-z]+)*\s*\(') { if ($i -eq 0 -or $lines[$i - 1] -notmatch '^\s*//\s*[\u4e00-\u9fff]') { throw "Missing Chinese coverage comment before it at line $($i + 1)" } } } }; if ($?) { pnpm exec vitest run packages-user/data-state/src/event/event.test.ts packages-user/data-system/src/event/eventDispatch.test.ts }; if ($?) { pnpm test:ci packages-user/data-common packages-user/data-base packages-user/data-system packages-user/data-state }; if ($?) { pnpm test:data-node }; if ($?) { pnpm exec tsx script/check-data-type.ts }; if ($?) { pnpm exec prettier --check packages-user/data-state/src/event/map.ts packages-user/data-state/src/event/hero.ts packages-user/data-state/src/event/event.ts packages-user/data-state/src/event/registrations.ts packages-user/data-state/src/event/event.test.ts script/check-touched-jsdoc.ts }; if ($?) { $status = & git status --porcelain=v1 --untracked-files=all; $statusExit = $LASTEXITCODE; if ($statusExit -ne 0) { throw 'git status failed during scope assertion' }; $baseline = Get-Content -LiteralPath "$env:TEMP\mota-phase03-19-scope-baseline\paths.txt"; $new = Compare-Object -ReferenceObject $baseline -DifferenceObject $status -PassThru; $allowed = @('packages-user/data-state/src/replay/commands.ts','packages-user/data-state/src/replay/commands.test.ts','packages-user/data-state/src/event/map.ts','packages-user/data-state/src/event/hero.ts','packages-user/data-state/src/event/event.ts','packages-user/data-state/src/event/registrations.ts','packages-user/data-state/src/event/event.test.ts','script/check-touched-jsdoc.ts'); foreach ($delta in $new) { if ($delta.SideIndicator -eq '=>' -and $allowed -notcontains $delta.InputObject) { throw 'Scope assertion found a newly changed path outside Plan 03-19 allowlist' } }; if (Test-Path 'packages-user/data-state/src/event/runtime.ts') { throw 'runtime.ts must not be created or used' }; git diff --check }</automated>
|
||||
<fails_when>The declaration-aware scan finds any touched event function or class method without multiline JSDoc, any event test lacks its Chinese coverage comment, event/data/Node/type/Prettier gates exit non-zero, runtime.ts is created, or the baseline-aware scope/diff assertion finds forbidden or unrelated changes.</fails_when>
|
||||
</verify>
|
||||
<acceptance_criteria>
|
||||
- Event function and assembly JSDoc is multiline only in the correction-owned files; unrelated legacy/save/render files are not reformatted (CORR-03-14).
|
||||
- Event ownership, index export-only shape, hero front-touch placement, replay await behavior, stable order, and all data gates remain green (CORR-03-12, CORR-03-13, D-04, D-15, S-01, S-04).
|
||||
- Event function and registration class-method JSDoc is multiline for every declaration enumerated by the scanner; unrelated legacy/save/render files are not reformatted (CORR-03-14).
|
||||
- Event ownership, both index export-only shapes, hero front-touch placement, replay await behavior under S-05, direct `Statement[]` insertion, stable order, public exports, and all data gates remain green (CORR-03-12, CORR-03-13, D-04, D-15, S-01, S-03, S-04, S-05).
|
||||
</acceptance_criteria>
|
||||
<done>All touched replay/event function JSDoc and test-comment requirements pass without runtime or out-of-scope file changes.</done>
|
||||
</task>
|
||||
@ -151,11 +157,13 @@ Output: Scoped JSDoc/style cleanup and structural regression checks over the cor
|
||||
- `pnpm test:ci packages-user/data-common packages-user/data-base packages-user/data-system packages-user/data-state`
|
||||
- `pnpm test:data-node`
|
||||
- `pnpm exec tsx script/check-data-type.ts`
|
||||
- Scoped ESLint and Prettier checks for the correction-owned replay/event files
|
||||
- `pnpm exec tsx script/check-touched-jsdoc.ts` over replay commands and all event implementation/registration files; the declaration-aware scan must cover class methods as well as top-level functions.
|
||||
- Scoped ESLint and Prettier checks for the correction-owned replay/event files and the scanner
|
||||
- Baseline-aware mechanical diff/scope assertion from `<scope_guard>`; it must reject newly changed legacy/save paths, `attribute.ts`/decorator placement, runtime.ts, and unrelated formatting while preserving pre-existing working-tree changes.
|
||||
</verification>
|
||||
|
||||
<success_criteria>
|
||||
CORR-03-14 is closed when every function/method JSDoc touched by CORR-03-08 through CORR-03-13 is multiline, all changed tests retain Chinese coverage comments, and the corrected replay/event behavior and data gates remain green without legacy/save or user-owned decorator changes.
|
||||
CORR-03-14 is closed when every touched top-level function and class method identified by the explicit inventory/declaration-aware scan is multiline-documented, all changed tests pass the Chinese `it` comment audit, and corrected S-05 replay/event behavior and data gates remain green without legacy/save, runtime.ts, public-contract, or user-owned decorator changes.
|
||||
</success_criteria>
|
||||
|
||||
<output>
|
||||
|
||||
@ -62,6 +62,7 @@
|
||||
- **S-02:** replay 指令只处理同步状态变化,不等待移动控制器、事件链或其他 Promise;既有录像系统只做保证运行所需的最小兼容修改。该决定 supersedes D-06 及 replay contract 中关于 command completion 等待的部分。
|
||||
- **S-03:** `eventInsertEvent` 接收 `Statement[]` 事件语句列表并直接执行,不按事件 ID 查找或转发到 ID 序列路径。该决定 supersedes D-24 与旧 `03-EVENT-CONTRACT.md` 中单事件 ID 的语义。
|
||||
- **S-04:** `@shouldReplay()` 的最终落点由用户自行处理。本次 correction 不修改 `HeroAttribute.set`、`HeroAttribute.mul` 或其他用户指定状态修改方法的 decorator placement。
|
||||
- **S-05:** replay 的移动和寻路指令必须等待各自 controller 完成后,才允许进入下一录像步;本决定 supersedes S-02 中“replay command 不等待 Promise”的部分。同步约束仅适用于 `shouldReplay` 标记的状态修改调用栈,不适用于录像步骤的动作完成边界。
|
||||
|
||||
</decisions>
|
||||
|
||||
|
||||
@ -2,12 +2,12 @@
|
||||
|
||||
## User structural supersession
|
||||
|
||||
本节晚于初始 replay checkpoint,优先于下方关于异步 command completion 和 decorator
|
||||
placement 的旧记录:
|
||||
本节晚于初始 replay checkpoint,优先于下方关于 command completion 和 decorator
|
||||
placement 的旧记录。S-05 又 supersedes S-02 在 replay-step completion 边界上的结论:
|
||||
|
||||
- replay command 的状态操作必须同步完成;command 不等待移动控制器、事件链或其他 Promise,collection context 在装饰方法返回时同步恢复。
|
||||
- replay command 不调用 `shouldReplay`;移动和寻路 command 必须等待各自 controller 完成后再返回,确保下一录像步不会与上一步并发。`shouldReplay` 的最终落点仍由用户放在真正改变最终状态的低层方法上。
|
||||
- 既有 `ReplaySystem`、route 和 sandbox 只做使同步 command 正常运行所需的最小兼容调整,不重新设计录像系统。
|
||||
- `@shouldReplay()` 不在本次 correction 中移动或新增;其最终位置由用户自行放到真正改变最终状态的方法上。
|
||||
- `@shouldReplay()` 不在本次 correction 中移动或新增;其最终位置由用户自行处理,且不得通过 replay command 构造器间接注入。
|
||||
|
||||
## Approval
|
||||
|
||||
@ -63,12 +63,14 @@ approved enum order. The helper's registration items contain command behavior,
|
||||
while the top-level enum remains the only stable code owner. No lower layer
|
||||
registers a global code or imports the data-state root barrel to obtain one.
|
||||
|
||||
Each approved replay instruction is an independent class in the replay command
|
||||
module. The class owns its state reference, parameter validation, action call,
|
||||
and `execute` implementation. Directional commands therefore do not share an
|
||||
entrance object, mutable command context, or closure factory, and no instruction
|
||||
constructs or delegates to another instruction. The registry creates one fresh
|
||||
instance of each class in the stable enum order while retaining the existing
|
||||
Each non-directional replay instruction is an independent class in the replay
|
||||
command module. The class owns its state reference, parameter validation, action
|
||||
call, and `execute` implementation. The four directional entries use one
|
||||
parameterized `ReplayDirectionCommand` class with a distinct `FaceDirection`
|
||||
value per fresh instance; they share no mutable command context or closure
|
||||
factory, and no instruction constructs or delegates to another instruction.
|
||||
The registry creates four fresh directional instances plus one fresh instance
|
||||
of each non-directional class in stable enum order while retaining the existing
|
||||
`IReplayCommandItem` extension boundary.
|
||||
|
||||
The existing `IReplaySystem.registerCommand(code, command)` and
|
||||
@ -94,20 +96,21 @@ contract.
|
||||
## Completion boundaries
|
||||
|
||||
- Four-direction movement appends one direction to the hero mover, starts it,
|
||||
and returns `true` when the controller starts; it does not await
|
||||
`mover controller.onEnd`.
|
||||
and awaits the returned mover controller's `onEnd`; it returns `true` only
|
||||
after the controller completes and returns `false` for a missing, active, or
|
||||
failed action.
|
||||
- Auto-pathfind calls the existing `PathfindingSystem.moveTo({ x, y })`; a null
|
||||
result is `false`, and a non-null result returns `true` immediately without
|
||||
awaiting its controller.
|
||||
result is `false`, and a non-null result awaits its controller's `onEnd`
|
||||
before resolving `true`.
|
||||
- Item and equipment calls remain synchronous under the current interfaces; their
|
||||
boolean/undefined result is converted to the command's success boolean.
|
||||
- Replay safety collection is restored to its previous context immediately after
|
||||
every decorated method returns, including nested synchronous decorated calls.
|
||||
Synchronous queries, pure calculations, and internal helpers are outside the
|
||||
decoration boundary.
|
||||
- Replay command implementations do not add or invoke replay-safety decorators.
|
||||
The user-owned low-level state-mutation decorator boundary remains outside this
|
||||
correction; synchronous item/equipment calls retain their existing command
|
||||
boundary.
|
||||
- `IReplayCommand.execute()` continues to return the existing `Promise<boolean>`
|
||||
boundary, but command implementations adapt their immediate boolean result with
|
||||
`Promise.resolve` rather than adding asynchronous command sequencing.
|
||||
boundary, with movement/pathfinding completion awaited before that Promise
|
||||
resolves and synchronous item/equipment results adapted to the same boundary.
|
||||
|
||||
## Explicit exclusions
|
||||
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
---
|
||||
phase: 03-data-completion
|
||||
verified: 2026-09-11T07:32:03Z
|
||||
status: passed
|
||||
status: gaps_found
|
||||
score: 12/12 must-haves verified
|
||||
covered_files:
|
||||
- .planning/REQUIREMENTS.md
|
||||
@ -224,7 +224,52 @@ N/A — this is an infrastructure/data-layer phase with no user-facing UI or ext
|
||||
|
||||
## Gaps Summary
|
||||
|
||||
All six prior structural correction gaps are closed in the current source. The seven live compatibility-boundary cycles are explicitly deferred to Phase 5 under the user's scope instruction, not hidden as a passing circular gate. One non-blocking documentation-format warning remains for `03-EVENT-CONTRACT.md`; the plan-scoped source/test Prettier checks pass.
|
||||
The six prior structural correction gaps are closed, but the latest user review identified seven additional design corrections that must be planned before Phase 3 is structurally final.
|
||||
|
||||
## New User Review Gaps
|
||||
|
||||
- gap_id: CORR-03-08
|
||||
truth: "Replay command implementations do not call shouldReplay; replay safety belongs on lower-level state mutation methods and remains user-owned."
|
||||
status: failed
|
||||
reason: "commands.ts manually invokes shouldReplay in every command constructor."
|
||||
severity: blocker
|
||||
test: structural-review
|
||||
- gap_id: CORR-03-09
|
||||
truth: "Movement and pathfinding replay commands await their controller completion before the next replay step can run."
|
||||
status: failed
|
||||
reason: "Directional and pathfinding commands currently start actions and return immediately."
|
||||
severity: blocker
|
||||
test: structural-review
|
||||
- gap_id: CORR-03-10
|
||||
truth: "The four directional replay commands share one parameterized command class rather than four duplicate classes."
|
||||
status: failed
|
||||
reason: "ReplayUpCommand, ReplayRightCommand, ReplayDownCommand, and ReplayLeftCommand duplicate the same implementation."
|
||||
severity: blocker
|
||||
test: structural-review
|
||||
- gap_id: CORR-03-11
|
||||
truth: "The replay command registry contains no manually added prettier-ignore directives."
|
||||
status: failed
|
||||
reason: "commands.ts contains eight prettier-ignore directives around constructor expressions."
|
||||
severity: major
|
||||
test: structural-review
|
||||
- gap_id: CORR-03-12
|
||||
truth: "data-state/src/event/index.ts contains exports only; event registration assembly is owned elsewhere."
|
||||
status: failed
|
||||
reason: "index.ts still imports registration builders and assembles the built-in array."
|
||||
severity: blocker
|
||||
test: structural-review
|
||||
- gap_id: CORR-03-13
|
||||
truth: "Event registrations use the approved class-based design, and eventTouchFront belongs to the hero event layer."
|
||||
status: failed
|
||||
reason: "Registrations are object factories and eventTouchFront remains in event.ts/control registration."
|
||||
severity: blocker
|
||||
test: structural-review
|
||||
- gap_id: CORR-03-14
|
||||
truth: "Every function and method JSDoc touched by this correction uses multiline /** ... */ style."
|
||||
status: failed
|
||||
reason: "Several touched event and replay functions still use single-line JSDoc comments."
|
||||
severity: major
|
||||
test: structural-review
|
||||
|
||||
---
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user