74 lines
2.1 KiB
Markdown
74 lines
2.1 KiB
Markdown
# OpenSpec Change: enterprise-gaming-api-plugin-game-persistence
|
|
|
|
- **Change ID**: enterprise-gaming-api-plugin-game-persistence
|
|
- **Package**: `@suaveplan/api-plugin-game-persistence`
|
|
- **Category**: gaming/server
|
|
- **Target path**: `gaming/server/api-plugin-game-persistence`
|
|
- **Status**: PROPOSED
|
|
- **Date**: 2026-04-24
|
|
- **Reference spec**: `/mnt/s/web/suaveplan/enterprise/api-plugin-game-persistence.md`
|
|
|
|
---
|
|
|
|
## Summary
|
|
|
|
Deliver `@suaveplan/api-plugin-game-persistence` on the genesis branch from scratch at enterprise quality. The package wraps `@suaveplan/game-persistence`'s `SaveManager` in a Hono HTTP plugin. Routes expose save slot CRUD (list, create, load, delete, autosave). A `definePlugin()` factory registers the `SaveManager` as an injectable service. Genesis adds Zod request/response schemas, structured errors, OTel route instrumentation, and 100% coverage with Hono test client integration tests.
|
|
|
|
---
|
|
|
|
## Current-state audit (genesis)
|
|
|
|
Package does not exist on genesis yet — fresh build.
|
|
|
|
---
|
|
|
|
## Available workspace deps on genesis
|
|
|
|
| Package | Role |
|
|
|---|---|
|
|
| `@suaveplan/error` (`workspace:^`) | HTTP error mapping |
|
|
| `@suaveplan/game-persistence` (`workspace:^`) | `SaveManager` core logic |
|
|
| `zod` (`catalog:forms`) | Request/response schemas |
|
|
| `@opentelemetry/api` (`catalog:observability`) | Route span instrumentation |
|
|
|
|
---
|
|
|
|
## HTTP Routes
|
|
|
|
| Method | Path | Description |
|
|
|---|---|---|
|
|
| `GET` | `/saves/:playerId` | List save slots |
|
|
| `POST` | `/saves/:playerId/:slotId` | Save data to slot |
|
|
| `GET` | `/saves/:playerId/:slotId` | Load slot |
|
|
| `DELETE` | `/saves/:playerId/:slotId` | Delete slot |
|
|
| `POST` | `/saves/:playerId/autosave` | Autosave |
|
|
|
|
---
|
|
|
|
## File layout
|
|
|
|
```text
|
|
gaming/server/api-plugin-game-persistence/
|
|
package.json
|
|
tsconfig.json
|
|
vitest.config.ts
|
|
src/
|
|
index.ts
|
|
error-codes.ts
|
|
types/common.ts
|
|
types/common.md
|
|
routes/
|
|
saves.ts
|
|
saves.md
|
|
plugin.ts
|
|
plugin.md
|
|
tests/
|
|
integration.test.ts
|
|
```
|
|
|
|
---
|
|
|
|
## Impact
|
|
|
|
**Downstream**: `@suaveplan/api-plugin-game-server` calls autosave on session termination. Prerequisites: `@suaveplan/error`, `@suaveplan/game-persistence`.
|