Sharpee Platform Architecture

Is very nearly complete.
I have a baseline story (Cloak of Darkness) somewhat working as expect. Enough to believe the architecture is solid. So how do we prove it outside of a big game? Unit testing.
I have completed unit test suites for the packages Core, Event Processor, and am working through World Model. So far, one minor refactor to manage circular dependencies. I moved a bunch of shared types to a new package if-domain.
The structure is holding strong. This is where my past iterations always failed and massive architecture gaps appeared. This is why unit testing is so critical.
These are the currently passing test suites:
dave@DCSurface:/mnt/c/repotemp/sharpee/packages/core$ pnpm test
> @sharpee/core@0.1.0 test /mnt/c/repotemp/sharpee/packages/core
> cross-env NODE_NO_WARNINGS=1 jest
PASS tests/setup.test.ts (28.131 s)
PASS tests/debug/types.test.ts (28.407 s)
PASS tests/events/simple-event-source.test.ts (35.03 s)
PASS tests/integration/event-rule-integration.test.ts (36.448 s)
PASS tests/types/result.test.ts (45.175 s)
PASS tests/events/semantic-event-source.test.ts (43.965 s)
PASS tests/events/event-system.test.ts (49.058 s)
PASS tests/language/registry.test.ts (48.823 s)
PASS tests/language/language-requirements.test.ts (60.276 s)
PASS tests/rules/simple-rule-system.test.ts (74.458 s)
Test Suites: 10 passed, 10 total
Tests: 122 passed, 122 total
Snapshots: 0 total
Time: 100.522 s
Ran all test suites.
> @sharpee/event-processor@0.1.0 test /mnt/c/repotemp/sharpee/packages/event-processor
> cross-env NODE_NO_WARNINGS=1 jest
PASS tests/unit/processor-reactions.test.ts (30.709 s)
PASS tests/unit/processor.test.ts (30.717 s)
PASS tests/unit/handlers/registration.test.ts (101.462 s)
Test Suites: 3 passed, 3 total
Tests: 17 passed, 17 total
Snapshots: 0 total
Time: 133.609 s
Ran all test suites.
> @sharpee/world-model@0.1.0 test /mnt/c/repotemp/sharpee/packages/world-model
> cross-env NODE_NO_WARNINGS=1 jest
PASS tests/unit/entities/entity-store.test.ts (25.391 s)
EntityStore
basic operations
✓ should add and retrieve entities (530 ms)
✓ should return undefined for non-existent entities (10 ms)
✓ should remove entities and clear traits (1 ms)
✓ should clear all entities
querying
✓ should get all entities (1 ms)
✓ should get entities by type (1 ms)
✓ should find entities with specific trait (1 ms)
✓ should find entities with all specified traits
✓ should find entities with any specified traits (1 ms)
iteration
✓ should be iterable (1 ms)
serialization
✓ should serialize to JSON (1 ms)
✓ should deserialize from JSON
size property
✓ should reflect number of entities (1 ms)
edge cases
✓ should handle removing non-existent entity
✓ should handle duplicate adds gracefully
✓ should work with empty store
PASS tests/unit/behaviors/behavior.test.ts (26.541 s)
Behavior
trait requirements
✓ should validate entity has required traits (565 ms)
✓ should get list of missing traits (1 ms)
✓ should work with behaviors having no requirements (1 ms)
require helper
✓ should return trait when present
✓ should throw error when required trait is missing (209 ms)
optional helper
✓ should return trait when present (1 ms)
✓ should return undefined when trait is missing
behavior patterns
✓ should support behaviors that check state
✓ should support behaviors with no requirements (1 ms)
inheritance
✓ should support behavior inheritance
error messages
✓ should provide clear error messages for missing traits (1 ms)
static nature
✓ should not require instantiation
PASS tests/unit/entities/if-entity.test.ts (91.592 s)
IFEntity
constructor
✓ should create entity with id and type (947 ms)
✓ should accept creation params (1 ms)
traits
✓ should add trait
✓ should remove trait (1 ms)
✓ should replace existing trait of same type
✓ should check multiple traits with hasAll (1 ms)
✓ should check multiple traits with hasAny
✓ should get all traits
✓ should get all trait types (1 ms)
✓ should clear all traits
✓ should support trait aliases (getTrait, hasTrait)
convenience properties
✓ should identify rooms
✓ should identify containers
✓ should identify takeable items
✓ should get name from identity trait (1 ms)
✓ should get weight from attributes
cloning
✓ should create deep copy with new ID (1 ms)
serialization
✓ should serialize to JSON
✓ should deserialize from JSON (1 ms)
openable/lockable properties
✓ should detect openable trait (10 ms)
✓ should detect lockable trait (1 ms)
light source properties
✓ should detect light provision
switchable properties
✓ should detect switchable state
actor properties
✓ should detect actors and players (1 ms)
error handling
✓ should throw error for invalid traits (305 ms)
Test Suites: 3 passed, 3 total
Tests: 53 passed, 53 total
Snapshots: 0 total
Time: 119.596 s
Ran all test suites.
> @sharpee/world-model@0.1.0 test /mnt/c/repotemp/sharpee/packages/world-model
> cross-env NODE_NO_WARNINGS=1 jest -- tests/unit/traits/
PASS tests/unit/traits/container.test.ts (24.436 s)
ContainerTrait
initialization
✓ should create trait with default values (499 ms)
✓ should create trait with provided data (1 ms)
capacity constraints
✓ should handle weight limit
✓ should handle volume limit (1 ms)
✓ should handle item count limit (1 ms)
✓ should handle multiple constraints
✓ should handle unlimited capacity
transparency
✓ should default to opaque
✓ should handle transparent containers (1 ms)
enterable containers
✓ should default to not enterable
✓ should handle enterable containers (1 ms)
type restrictions
✓ should handle allowed types (1 ms)
✓ should handle excluded types (1 ms)
✓ should handle both allowed and excluded types
✓ should handle no type restrictions
entity integration
✓ should attach to entity correctly
✓ should replace existing container trait (1 ms)
special container types
✓ should handle transparent container setup
✓ should handle secure container setup (1 ms)
✓ should handle nested container setup
edge cases
✓ should handle empty capacity object
✓ should handle empty arrays for type restrictions (1 ms)
✓ should handle zero capacity values
PASS tests/unit/traits/room.test.ts (25.102 s)
RoomTrait
initialization
✓ should create trait with default values (536 ms)
✓ should create trait with provided data (1 ms)
exits management
✓ should handle simple exits (6 ms)
✓ should handle exits with doors (1 ms)
✓ should handle blocked exits (1 ms)
✓ should handle custom exits (1 ms)
lighting
✓ should handle dark rooms (1 ms)
✓ should handle lit rooms
✓ should handle outdoor lighting (1 ms)
✓ should handle underground rooms
visit tracking
✓ should start unvisited (1 ms)
✓ should track visited state
✓ should handle initial description (1 ms)
ambience
✓ should handle ambient sounds (1 ms)
✓ should handle ambient smells
✓ should handle both sound and smell (1 ms)
regions and tags
✓ should handle region assignment (3 ms)
✓ should handle multiple tags (3 ms)
✓ should handle rooms without regions or tags (10 ms)
entity integration
✓ should attach to entity correctly (1 ms)
✓ should work with container trait
complex room setups
✓ should handle maze-like connections (1 ms)
✓ should handle multi-level connections (1 ms)
✓ should handle outdoor/indoor transitions
PASS tests/unit/traits/exit.test.ts (23.902 s)
ExitTrait
initialization
✓ should create trait with required values (588 ms)
✓ should throw error if required fields are missing (201 ms)
✓ should create trait with all optional values (1 ms)
standard directional exits
✓ should handle north direction (1 ms)
✓ should handle south direction (1 ms)
✓ should handle east direction
✓ should handle west direction
✓ should handle up direction
✓ should handle down direction
✓ should handle in direction
✓ should handle out direction
✓ should handle diagonal directions
custom exits
✓ should handle magic words (1 ms)
✓ should handle action-based exits
✓ should handle object-interaction exits
bidirectional exits
✓ should handle simple bidirectional exit
✓ should handle bidirectional portal
visibility and listing
✓ should handle hidden exits
✓ should handle visible but unlisted exits
✓ should handle discovered exits
conditional exits
✓ should handle simple condition (1 ms)
✓ should handle complex condition
✓ should handle time-based condition
messages
✓ should handle custom use messages
✓ should handle custom blocked messages
✓ should allow no custom messages (1 ms)
entity integration
✓ should attach to entity correctly
✓ should replace existing exit trait
special exit types
✓ should handle one-way exit
✓ should handle teleporter (1 ms)
✓ should handle vehicle-based exit
PASS tests/unit/traits/identity.test.ts (23.914 s)
IdentityTrait
initialization
✓ should create trait with default values (621 ms)
✓ should create trait with provided data (1 ms)
article handling
✓ should handle "a" article
✓ should handle "an" article
✓ should handle "the" article (1 ms)
✓ should handle "some" article for plural/mass nouns
✓ should handle empty article for proper names
aliases
✓ should start with empty aliases
✓ should store multiple aliases
descriptions
✓ should handle full description
✓ should handle brief description separately (1 ms)
✓ should allow empty descriptions
concealment
✓ should default to not concealed
✓ should handle concealed objects
physical properties
✓ should handle weight (1 ms)
✓ should handle volume
✓ should handle size categories
✓ should allow undefined physical properties
entity integration
✓ should attach to entity correctly (1 ms)
✓ should replace existing identity trait
special cases
✓ should handle proper names correctly
✓ should handle mass nouns
✓ should handle unique items
PASS tests/unit/traits/entry.test.ts (68.884 s)
EntryTrait
initialization
✓ should create trait with default values (1006 ms)
✓ should create trait with provided data (1 ms)
prepositions
✓ should handle "in" preposition for containers
✓ should handle "on" preposition for surfaces (1 ms)
✓ should handle "under" preposition (1 ms)
✓ should handle "behind" preposition
occupancy management
✓ should track single occupant
✓ should track multiple occupants
✓ should handle unlimited occupancy
✓ should track occupancy state
visibility and perception
✓ should handle visible occupants (1 ms)
✓ should handle hidden occupants
✓ should handle one-way visibility
✓ should handle soundproofing
posture requirements
✓ should handle standing entries
✓ should handle sitting entries
✓ should handle lying entries (1 ms)
✓ should handle no posture requirement
custom messages
✓ should handle enter message
✓ should handle exit message
✓ should handle full message
✓ should handle blocked message
mobile entries
✓ should handle stationary entries (1 ms)
✓ should handle mobile entries
✓ should handle rideable animals
access control
✓ should handle open access
✓ should handle blocked access
✓ should handle conditional access (1 ms)
entity integration
✓ should attach to entity correctly (1 ms)
✓ should replace existing entry trait
complex entry scenarios
✓ should handle nested entries
✓ should handle multi-purpose entries (1 ms)
✓ should handle vehicle with compartments
✓ should handle theatrical entries
Test Suites: 5 passed, 5 total
Tests: 135 passed, 135 total
Snapshots: 0 total
Time: 90.018 s, estimated 93 s
Ran all test suites matching
The next set of tests are /world-model/world and there are issues, so the next posting will continue the progress reports.
Test Suites: 3 failed, 3 total
Tests: 5 failed, 27 passed, 32 total
Snapshots: 0 total
Time: 119.66 s
Ran all test suites matching