feat: the moon shapes who answers; wire magnetometer; drop dead CSS
MOON INFLUENCE ON SUMMONING
Astronomy previously only decided whether a channel's familiar spirit
returned. It now shapes *who comes through*:
- Rarity skews with real moon illumination. At full moon the rare and
mythic weights roughly triple while common recedes, so a mythic
summoning becomes a reason to go out on the right night rather than a
flat lottery. Deliberately a skew and never a gate — every tier stays
reachable on every night, because someone who can only play midweek
should not be locked out of the good spirits.
- Hidden traits take a small moonlit nudge: power and volatility rise,
alignment drifts slightly darker. Capped at 0.12 and clamped to [0,1],
so a full moon intensifies what a spirit already is instead of
rewriting it. Deceptiveness is untouched — whether a spirit lies is its
own nature, not the sky's doing.
- The mint prompt is told the phase, and explicitly told the entity must
never mention or seem aware of it. It shapes who they are, not their
dialogue; a ghost remarking on the moonlight would break the illusion
instantly.
Tests assert the outcomes shift in practice (mythic rate over 4000 draws,
rare-tier counts across 300 fallback profiles), not merely that the code
runs. test_mint_prompt_never_receives_traits now allows `sky` while still
forbidding `traits`: moon phase is public, observable state anyone can look
up, hidden ground truth is not.
GEOMAGNETIC (app/geomagnetic.py)
Real NOAA SWPC planetary K-index, verified against the live endpoint —
which caught a real bug: I had written the parser against an
array-of-arrays shape, and the actual feed serves a list of objects
(`estimated_kp` float, `kp_index` int, `kp` a display string with a letter
suffix). Fixed, and the tests now use the real captured shape. Cached,
never blocking, and a failed refresh keeps serving the last real value —
an hour-old genuine measurement beats nothing, and geomagnetic conditions
do not change fast enough for that to mislead.
MAGNETOMETER WIRED
MagnetometerListener existed but was never connected. The EMF panel now
runs it alongside the motion listener where the hardware exists, so the
"EMF meter" measures actual magnetic field in µT rather than only
inferring disturbance from movement. Additive: the motion path is
untouched and remains the only option on iOS. Its field jitter also feeds
the entropy pool.
DEAD CODE
Removed .evp-scope and .radio-waterfall, orphaned when both panels moved to
the shared SpectrumScope. Audited every other flagged export first and left
them alone — they are used internally, and "not imported elsewhere" is not
the same as dead.
Adds docs/CHANNELS.md recording what each channel measures and, honestly,
what has actually been verified against hardware versus only written
carefully.
311 backend + 355 frontend tests pass; i18n parity gate passes.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -38,6 +38,7 @@ from app.deps import SESSION_COOKIE_NAME
|
||||
from app.entities import fallback_signature, signature_from_anomalies
|
||||
from app.celestial import veil_thinness
|
||||
from app.entropy import contribution_bits, veil_float
|
||||
from app.geomagnetic import geomagnetic_cache
|
||||
from app.inventory import (
|
||||
RITUAL_SUCCESS_ESSENCE,
|
||||
SUMMON_ESSENCE_TRICKLE,
|
||||
@@ -148,6 +149,9 @@ class SeanceState:
|
||||
# coordinate would be retaining precise location data we have no use
|
||||
# for. Never persisted; lives and dies with the connection.
|
||||
longitude: float | None = None
|
||||
# Latest NOAA planetary K-index reading, refreshed on summon. Cached on
|
||||
# the state so the manifest path can report it without another lookup.
|
||||
geomagnetic: dict | None = None
|
||||
|
||||
|
||||
# Active-session registry (spec: ESP32 sensor node, Workstream K): maps a
|
||||
@@ -362,7 +366,13 @@ async def _summon(state: SeanceState, channel: str) -> tuple[Entity, bool]:
|
||||
# premise. Real astronomy, computed from the seeker's own
|
||||
# longitude: see app/celestial.py.
|
||||
sky = veil_thinness(state.longitude)
|
||||
return_chance = RETURN_CHANCE * (1.0 - sky["thinness"] * VEIL_THINNESS_PULL)
|
||||
thinness = sky["thinness"]
|
||||
if state.geomagnetic is not None:
|
||||
# A real storm counts for a third of the reading — enough
|
||||
# that a Kp-7 night is noticeably stranger, not so much
|
||||
# that quiet space weather flattens the moon's effect.
|
||||
thinness = thinness * 0.67 + state.geomagnetic["disturbance"] * 0.33
|
||||
return_chance = RETURN_CHANCE * (1.0 - thinness * VEIL_THINNESS_PULL)
|
||||
answers = (
|
||||
known is not None
|
||||
and veil_float(state.entropy, "answers") < return_chance
|
||||
@@ -382,6 +392,9 @@ async def _summon(state: SeanceState, channel: str) -> tuple[Entity, bool]:
|
||||
profile = await spirit_service.mint_profile(
|
||||
mint_signature, channel, state.anomalies, state.language,
|
||||
entropy=state.entropy,
|
||||
# The moon shapes who answers — see
|
||||
# entities.rarity_weights_for_moon / moon_trait_bias.
|
||||
sky=sky,
|
||||
)
|
||||
discoverer = await db.get(User, state.user_id)
|
||||
favor = discoverer.favor if discoverer is not None else 0.0
|
||||
@@ -484,10 +497,18 @@ async def _handle_summon(state: SeanceState) -> None:
|
||||
)
|
||||
return
|
||||
|
||||
# Real measured geomagnetic activity (NOAA SWPC). Served from cache and
|
||||
# never blocking: a cold cache or an outage yields None and the séance
|
||||
# proceeds on astronomy alone.
|
||||
geo = await geomagnetic_cache.reading()
|
||||
if geo is not None:
|
||||
state.geomagnetic = geo
|
||||
|
||||
await state.send_queue.put(
|
||||
{
|
||||
"type": "status",
|
||||
"state": "summoning",
|
||||
"geomagnetic": state.geomagnetic,
|
||||
# How much physical noise from the room actually fed this
|
||||
# draw. Display only — a client can lie about it freely, and
|
||||
# it is never used to weight or gate anything.
|
||||
@@ -551,6 +572,10 @@ def _room_readings(state: SeanceState, anomaly: dict) -> dict:
|
||||
if isinstance(mag, (int, float)):
|
||||
readings["deviation above the floor"] = f"{mag:.1f}"
|
||||
readings["disturbances so far"] = str(len(state.anomalies))
|
||||
if state.geomagnetic is not None:
|
||||
readings["earth's magnetic field"] = (
|
||||
f"Kp {state.geomagnetic['kp']:.2f} — {state.geomagnetic['label']}"
|
||||
)
|
||||
sky = veil_thinness(state.longitude)
|
||||
readings["moon"] = f"{sky['moon_name']} ({sky['moon_illumination']:.0%} lit)"
|
||||
if sky["witching_proximity"] is not None:
|
||||
|
||||
Reference in New Issue
Block a user