hermes-agent/tests/plugins/platforms/photon
Jash Lee 3cd93f6aa8 fix(photon): auto-reinstall stale sidecar deps before start
A `hermes update` that bumps the spectrum-ts pin rewrites the Photon
sidecar's package-lock.json but never reinstalls node_modules. The sidecar
then spawns against the old install and the v8 postinstall patch throws
"@spectrum-ts/imessage dist not found", so the gateway retries the photon
platform every 300s forever without ever repairing the deps. Observed in
the wild: a June pin bump to spectrum-ts 8.0.0 left node_modules at 3.1.0,
and inbound/outbound iMessage stayed dead for days with the reconnect loop
faithfully restarting into the identical broken state.

_start_sidecar only checked that node_modules exists, not that it matches
the lockfile, so restart never became repair. Detect the skew with the same
signal npm ci uses: the top-level package-lock.json being newer than npm's
node_modules/.package-lock.json install marker. When stale, reinstall
(npm ci, falling back to npm install) before spawning. The reinstall runs
via asyncio.to_thread so a cold install can't block the event loop and stall
every other platform's traffic; worst case it heals on the next reconnect
tick instead. First-run "deps not installed" behavior is unchanged, and a
missing/unreadable marker fails safe to "not stale" so start is never
blocked.

Reuses the existing npm ci -> npm install fallback from
`hermes photon install-sidecar`. Adds unit tests for the staleness signal
(stale / fresh / missing-marker).
2026-07-05 17:38:32 -07:00
..
test_auth.py fix(photon): unify project identifiers and update documentation for Spectrum provisioning 2026-06-16 05:25:56 -07:00
test_inbound.py fix(photon): preserve text in mixed iMessage attachments (salvage #46513) (#46818) 2026-06-17 16:14:24 -05:00
test_markdown.py feat(photon): upgrade to spectrum-ts 3.0.0 (pinned) with markdown + reactions 2026-06-12 01:07:38 -07:00
test_mention_gating.py feat(photon): gRPC-native iMessage channel (no webhook) 2026-06-08 21:03:58 -07:00
test_outbound_media.py feat(photon): wire outbound media via spectrum-ts attachment() (#42397) 2026-06-08 15:29:16 -07:00
test_overflow_recovery.py fix(photon): recover degraded upstream stream 2026-06-23 21:33:10 -07:00
test_reactions.py fix(photon): correlate tapbacks to bot message context 2026-06-27 00:51:34 -07:00
test_setup_access.py fix(photon): unify project identifiers and update documentation for Spectrum provisioning 2026-06-16 05:25:56 -07:00
test_sidecar_deps_stale.py fix(photon): auto-reinstall stale sidecar deps before start 2026-07-05 17:38:32 -07:00
test_sidecar_lifecycle.py fix(photon): stop gateway restarts from orphaning the sidecar on its port 2026-06-12 01:07:38 -07:00
test_spectrum_patch.py fix(photon): upgrade spectrum-ts sidecar to v8.0.0 2026-06-27 00:51:34 -07:00