fix: enforce the FableLoom hosted-session HTTPS gate under the test runner (#5670) - #5807
Merged
Conversation
…unner (#5670) checkHostedSessionReadiness forced its HTTPS posture to "enabled" whenever NODE_ENV === 'test', so the one preflight check that actually blocks a hosted play session was unreachable from the suite: an HTTP-only install refusing to start a session with a 412 HOSTED_SESSION_PREFLIGHT_FAILED had never been pinned by a test and could regress silently. The same line also computed an httpsEnabled binding that nothing read. Drop both NODE_ENV escape hatches and the dead binding, and mock getNetworkExposureStatus in the tests instead — matching how the rest of the server treats that dependency. New coverage pins the HTTPS-on green path, the HTTPS-off readiness error, and the 412 refusal from createHostedSession; the socket-namespace suite gets the same TLS-provisioned snapshot because it drives the real createHostedSession. Claude-Session: https://claude.ai/code/session_01GMxEz43s3YCLaVZV9KmVwE
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
checkHostedSessionReadinessforced its HTTPS posture to "enabled" wheneverNODE_ENV === 'test'— a test-only hack in production code that made the one preflight check actually blocking a hosted FableLoom play session unreachable from the suite. The behavior that matters ("HTTPS off ⇒startHostedSessionthrows 412HOSTED_SESSION_PREFLIGHT_FAILED") had never been pinned by a test and could regress silently. The same line also computed anhttpsEnabledbinding that nothing in the file read.httpsEnabledbinding.isHttpsnow reads the real network posture only:netStatus.scheme === 'https'.getNetworkExposureStatusinstead, matching how the rest of the server treats that dependency.server/sockets/fableLoomHosted.test.jsgets the same TLS-provisioned snapshot, since it drives the realcreateHostedSession.Every other readiness check (start scene, STT, TTS, playback) and the join-URL host resolution are untouched.
Test plan
New coverage in
server/services/fableLoom/hostedSession.test.js:ready: true,https.enabled: true,https.urlstartshttps://,checks.https.ok.scheme: 'http') ⇒ready: false,checks.https.ok: false, anderrorscontains theHTTPS is required…message.createHostedSessionrejects withstatus: 412/code: 'HOSTED_SESSION_PREFLIGHT_FAILED'— the regression this uniquely catches, which was impossible to fail before because the gate was disarmed under the runner.Verified the two new tests fail against the pre-fix source and pass after.
cd server && npm testis green (37,264 passed; the one flakyroutes/imageGen.multipart.test.jsbeforeAllhook timeout under full-suite load passes on its own re-run and is unrelated to this change).Acceptance criteria from the issue:
grep -n "NODE_ENV" server/services/fableLoom/hostedSession.jsreturns nothing, andhttpsEnabledno longer appears in the file.Closes #5670
https://claude.ai/code/session_01GMxEz43s3YCLaVZV9KmVwE