Skip to content

πŸ“¦ 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:

  • IInventorySearch
  • IInventorySorter

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:

  • IInventorySearch
  • IInventorySorter
  • IInventoryAuthority
  • IItemDatabase
  • IUseEffect

🚨 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