fix(fake-scenarios): preserve endsWithPrompt through flattenScenario - #362
Open
dormouse-bot wants to merge 1 commit into
Open
fix(fake-scenarios): preserve endsWithPrompt through flattenScenario#362dormouse-bot wants to merge 1 commit into
dormouse-bot wants to merge 1 commit into
Conversation
flattenScenario copied name/chunks/exitCode but silently dropped the endsWithPrompt flag, so a flattened prompt-ending scenario reported scenarioEndsWithPrompt() === false. This is latent today (flattenScenario is only consumed by Storybook stories, which don't read the flag; the playground uses non-flattened scenarios), but it is a genuine fidelity gap given exitCode is deliberately preserved. Also add the missing endsWithPrompt: true to SCENARIO_FAST_OUTPUT, which ends with a prompt like its siblings but did not declare it.
Deploying mouseterm with
|
| Latest commit: |
b89c619
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://161ba952.mouseterm.pages.dev |
| Branch Preview URL: | https://fix-fake-scenarios-endswithp.mouseterm.pages.dev |
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.
Problem
flattenScenario(lib/src/lib/platform/fake-scenarios.ts) collapses aFakeScenariointo a single instant chunk for Chromatic/regression stories. It explicitly copiesname,chunks, andexitCode— but silently omits theendsWithPromptflag. A flattened prompt-ending scenario therefore reportsFakePtyAdapter.scenarioEndsWithPrompt() === false.This is latent today:
flattenScenariois only consumed by Storybook stories, which never readendsWithPrompt, and the website playground registers non-flattened scenarios (with the flag intact). But it is a genuine fidelity gap —exitCodeis deliberately preserved through the flatten, so dropping the sibling semantic fieldendsWithPromptis an oversight that would surface as a duplicate-prompt bug the moment a flattened scenario is registered in the playground shell registry.Separately,
SCENARIO_FAST_OUTPUTends with a shell prompt (instant(PROMPT, 200)) just likeSCENARIO_SHELL_PROMPT,SCENARIO_LS_OUTPUT,SCENARIO_ANSI_COLORS, andSCENARIO_LONG_RUNNING, but was the only one of them not declaringendsWithPrompt: true.Solution
flattenScenarionow carriesendsWithPromptthrough, alongsideexitCode.endsWithPrompt: truetoSCENARIO_FAST_OUTPUT.Testing
Added two cases to
fake-scenarios.test.tsalongside the existingexitCodetests: one assertingflattenScenariopreservesendsWithPrompt: true, one asserting it staysundefinedwhen the source scenario has no prompt. The first would have failed before this change (the flattened scenario returnedendsWithPrompt === undefined). Fullfake-scenarios.test.tssuite passes (15 tests).Surfaced by the nightly code-quality survey.