π¦ Inventory β System Guarantees Matrix¶
This page defines the behavioural contract of the Inventory system.
No marketing. No implication. Just guarantees β and explicit non-guarantees.
π Quick Navigation¶
- Core Service
- Containers
- Mutations
- Results
- Events
- Authority
- Searching / Sorting
- Equipment
- Item Usage
- Snapshots / Persistence
- Determinism
- Public API
- NonβGuarantees
- Final Summary
1οΈβ£ Core Service¶
SceneInventoryService¶
| Aspect | Guarantee |
|---|---|
| Orchestration root | β Single service owns container truth |
| Container creation | β Service-controlled (lazy) |
| Container mutation | β Service-controlled |
| Delta computation | β Internal (not user-managed) |
| Supported mutation entry point | β IInventoryService |
| Runtime usage | Main thread |
| Inspector required | β No |
| UI required | β No |
2οΈβ£ Containers¶
| Aspect | Guarantee |
|---|---|
| Container ownership | β Owned by GameObject |
| Container identifier | β ContainerId |
| Container creation | β Lazy (on demand by service) |
| Container storage | Slot-based |
| Slot count mutable | β Yes (via ResizeContainer) |
| External container construction | β Not supported |
3οΈβ£ Mutations¶
| Aspect | Guarantee |
|---|---|
| Mutations routed through service | β Yes |
| Deterministic results | β Yes |
| Partial operations allowed | β Yes |
| Container auto-creation on mutation | β Yes |
| Atomicity within single operation | β Best-effort (rollback applied where supported) |
| Atomicity across containers | β Not guaranteed |
| Cross-system atomicity | β Not guaranteed |
Supported mutation classes:
- add
- remove
- split
- merge
- swap
- move
- transfer
- resize
4οΈβ£ Operation Results¶
| Aspect | Guarantee |
|---|---|
| Result returned for every mutation | β Yes |
| Deterministic failure codes | β Yes |
| Partial operations signaled | β InvOpCode.Partial |
| Silent failure | β Never |
All mutations return:
InvOpResult
5οΈβ£ Events¶
| Aspect | Guarantee |
|---|---|
| Container change events | β Yes |
| Slot-level delta information | β Yes |
| Event emission timing | β After mutation completes |
| Event emitted after resize | β Yes |
| Event emitted for no-op operations | β No |
Primary event surface:
SceneInventoryService.OnContainerChanged
6οΈβ£ Authority¶
| Aspect | Guarantee |
|---|---|
| Mutation gating supported | β Yes |
| Authority interface | β IInventoryAuthority |
| Unauthorized mutation result | β InvOpCode.NoAuthority |
| Authority evaluated before mutation | β Yes |
| Read operations gated | β No |
| Multiplayer replication | β Not provided |
Inventory enforces authority only during mutation calls.
7οΈβ£ Searching / Sorting¶
| Aspect | Guarantee |
|---|---|
| Search supported | β Yes |
| Sort supported | β Yes |
| Strategy interfaces | β Yes |
| Default implementations | β Yes |
| Deterministic sort order | β Stable sort |
| Operates on existing containers only | β Yes |
| Implicit container creation | β No |
| Cross-system deterministic ordering | β Not guaranteed |
Extension seams:
IInventorySearchIInventorySorter
8οΈβ£ Equipment¶
| Aspect | Guarantee |
|---|---|
| One item per equipment slot | β Yes |
| Equipment filters enforced | β Yes |
| Equip operations transactional | β Yes |
| Inventory integration | β Yes |
| Equipment managed by SceneInventoryService | β No |
Equipment operates through:
CharacterEquipment
9οΈβ£ Item Usage¶
| Aspect | Guarantee |
|---|---|
| Use effects supported | β Yes |
| Effects executed sequentially | β Yes |
| Item consumed after successful use | β Yes |
| Use system required | β No |
| External effect integration | β Yes |
| Deterministic resolver ordering | β Not guaranteed |
External effects integrate through:
UseEffectResolver.ExternalResolvers
π Snapshots / Persistence¶
| Aspect | Guarantee |
|---|---|
| Inventory snapshot supported | β Yes |
| Equipment snapshot supported | β Yes |
| JSON helpers provided | β Yes |
| Missing item handling policy | β Yes |
| Deferred event emission on apply | β Yes |
| Save slot management | β Not provided |
| Automatic persistence | β Not provided |
| Versioning / migration system | β Not provided |
Snapshots capture:
- container contents
- equipment contents
- item stacks
11οΈβ£ Determinism¶
| Aspect | Guarantee |
|---|---|
| Mutation determinism | β Yes |
| Event emission ordering | β Deterministic per mutation |
| Cross-system determinism | β Not guaranteed |
| Snapshot restore determinism | β Best-effort (dependent on item database consistency) |
12οΈβ£ Public API¶
| Aspect | Guarantee |
|---|---|
| Stable service surface | β Yes |
| Public extension interfaces | β Yes |
| Internal containers exposed | β No |
| Internal helpers public | β No |
| DTO types exposed | β No |
Public extension seams include:
IInventorySearchIInventorySorterIInventoryAuthorityIItemDatabaseIUseEffect
π¨ NonβGuarantees¶
Inventory does not guarantee:
- multiplayer replication
- prediction / rollback
- cross-system atomic transactions
- automatic persistence
- deterministic external resolver ordering
- deterministic behaviour across external systems
π― Final Summary¶
| Layer | Strong Guarantee | Best Effort | Not Guaranteed |
|---|---|---|---|
| Service-controlled mutations | β | ||
| Deterministic results | β | ||
| Partial operations | β | ||
| Snapshot restore | β | ||
| Cross-system atomicity | β | ||
| Multiplayer replication | β |
System Philosophy¶
Inventory is:
- Service-driven
- Slot-based
- Deterministic
- Authority-aware
- Explicit about guarantees