5.0 KiB
ADDED Requirements
Requirement: ObserverPosition types
The system SHALL export a discriminated union ObserverPosition with three variants: surface (planet + coord), atmospheric (planet + coord + altitude), and space (Vec3 + frame).
Scenario: Surface observer construction
- WHEN an
ObserverPositionof typesurfaceis constructed with a validPlanetConfigandSphericalCoord - THEN the object validates successfully
- AND the
PlanetConfigis accessible inline without lookup
Requirement: CoordinateFrame types and conversion
The system SHALL export CoordinateFrame as a union of heliocentric, galactic, and custom, plus pure conversion functions convertFrame, toHeliocentric, and toGalactic.
Scenario: Identity conversion
- WHEN
convertFrame(vec, heliocentric, heliocentric)is called - THEN the result equals the input vector
Requirement: CelestialBody shape
The system SHALL export a CelestialBody interface with name, type, altitude, azimuth, apparent magnitude, angular diameter, distance in AU, and heliocentric position.
Scenario: Body validation
- WHEN a
CelestialBodyobject is constructed with all required fields - THEN Zod validation succeeds
Requirement: CatalogStar and ObservedStar shapes
The system SHALL export CatalogStar (catalog-space, no observer fields) and ObservedStar (extends CatalogStar with altitude, azimuth, and extincted magnitude).
Scenario: Observed star construction
- WHEN an
ObservedStaris created from aCatalogStarwith addedaltitude,azimuth, andextinctedMagnitude - THEN the object satisfies both the
CatalogStarandObservedStarcontracts
Requirement: SolarProvider interface
The system SHALL export a SolarProvider interface with getBodies, getBody, getSunrise, and getSunset, all accepting ObserverPosition, Date, and optional AbortSignal.
Scenario: SolarProvider cancellation
- WHEN
getBodiesis called with anAbortSignalthat is aborted before resolution - THEN the promise rejects with an abort error
Requirement: StarProvider interface
The system SHALL export a StarProvider interface with getVisibleStars (returns ObservedStar[]), queryCone (returns CatalogStar[]), and getStar.
Scenario: StarProvider query
- WHEN
getVisibleStarsis called with a surface observer andStarQueryOptions - THEN the returned array contains only
ObservedStarentries withaltitudeandazimuthpopulated
Requirement: TidalProvider interface
The system SHALL export a TidalProvider interface with predictHeight and getExtremes, accepting PlanetConfig, SphericalCoord, Date, and optional AbortSignal.
Scenario: Tidal prediction cancellation
- WHEN
predictHeightis called with an aborted signal - THEN the promise rejects with an abort error
Requirement: WeatherState and WeatherProvider interface
The system SHALL export WeatherState and WeatherProvider with a locked interface for future @suaveplan/weather integration.
Scenario: WeatherProvider registration
- WHEN a
WeatherProvideris registered withUniverseClient - THEN
UniverseScene.weatheris populated aftergetScene
Requirement: UniverseClient plugin registry
The system SHALL provide UniverseClient with typed register methods for solar, stars, tides, and weather domains, returning this for chaining.
Scenario: Register all providers
- WHEN providers are registered for all four domains
- AND
getSceneis called with valid observer and time - THEN the returned
UniverseScenecontainsbodies,stars,tides, andweather
Requirement: UniverseScene shape
The system SHALL export UniverseScene with bodies, stars, optional tides, and optional weather.
Scenario: Scene without optional providers
- WHEN only
solarandstarsproviders are registered - AND
getSceneis called - THEN the scene has
bodiesandstars, withtidesandweatherundefined
Requirement: StarPacket BitSchema
The system SHALL export a StarPacket BitSchema quantising RA, Dec, magnitude, altitude, azimuth, and spectral class into ~11 bytes per star.
Scenario: Pack and unpack stars
- WHEN an array of
ObservedStarobjects is packed viapackStars - AND the buffer is unpacked via
unpackStarswith the correct count - THEN the unpacked array has the same length
- AND each field is within the quantisation error tolerance of the original
Requirement: CelestialBodyPacket BitSchema
The system SHALL export a CelestialBodyPacket BitSchema quantising altitude, azimuth, angular diameter, apparent magnitude, and body type.
Scenario: Pack and unpack bodies
- WHEN an array of
CelestialBodyobjects is packed viapackBodies - AND the buffer is unpacked via
unpackBodieswith the correct count - THEN the unpacked array has the same length and matching fields within tolerance