mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[GH-ISSUE #2266] [Issue]: 08-PRESET-RUNTIME-choice-variable-selection drops choice sanitizer and nested macro resolution #1107
Labels
No labels
android
bug
bugfix
ci
client
code freeze pause
container
dependencies
docs
documentation
duplicate
enhancement
feature
feature
feature
feature-creep
fixed-in-refactor
fixed-in-staging
good first issue
help wanted
in-pr
in-pr
needs-codeowner-decision
normal-scope
old-codebase
old-codebase
pull-request
qol
question
refactor
regression
revisit later
roadmap
scope-risk
scope-risk
server
server
shared
soup
upstream
windows
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Pasta-Devs/Marinara-Engine#1107
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @Promansis on GitHub (Jun 5, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/2266
Originally assigned to: @Xelvanis on GitHub.
Summary
08-PRESET-RUNTIME-choice-variable-selection: the refactor prompt assembly path accepts stale or invalid choice-variable values from preset defaults or per-chat choices, and it does not resolve macros inside selected option values before substituting{{variableName}}.Linked parity tracker: #2259.
Expected behavior
Legacy choice-variable behavior should be preserved:
{{user}}, are resolved before prompt sections consume the choice variable through{{variableName}}.Actual behavior
The refactor UI type-normalizes choices, but it does not validate existing/default selections against the choice block's option values. Runtime prompt assembly converts saved choice values directly into prompt variables, joins arrays, or random-picks array entries without checking that each value is still a valid option. It also passes selected choice values into the macro context without first resolving macros inside those values, so a choice value containing
{{user}}can remain unresolved when{{variableName}}is expanded.Steps to reproduce
refactor, create or import a prompt preset with a choice variable whose option value contains a macro, for examplePOV: "{{user}} watches from above".presetChoicesvalue for that variable, then change the choice block options so the saved value is stale or invalid.Impact area
Environment
refactorLogs, screenshots, or video
Static proof from parityscan Batch 10:
metadata.presetChoicesand opensChoiceSelectionModalfor assigned prompt-variable presets:src/features/catalog/presets/components/PresetsPanel.tsx:31,src/features/catalog/presets/components/PresetsPanel.tsx:73,src/features/catalog/presets/components/PresetsPanel.tsx:425.normalizeChoiceSelectionsonly type-filters values and does not validate them against options:src/features/catalog/presets/components/ChoiceSelectionModal.tsx:95,src/features/catalog/presets/lib/choice-selections.ts:7.preset.defaultChoicesand chatpresetChoicesinto prompt variables, with array join/random-pick support but no option-value sanitizer or first-option runtime fallback for invalid values:src/engine/generation/prompt-assembly.ts:249,src/engine/generation/prompt-assembly.ts:889.{{name}}replacement returns the stored variable value without recursively resolving macros inside it:src/engine/generation/prompt-assembly.ts:2862,src/engine/shared/macros/macro-engine.ts:902.main:packages/client/src/components/presets/ChoiceSelectionModal.tsx:38,main:packages/client/src/components/presets/ChoiceSelectionModal.tsx:103.variableValues:main:packages/server/src/services/prompt/assembler.ts:56,main:packages/server/src/services/prompt/assembler.ts:228,main:packages/server/src/services/prompt/assembler.ts:272.Regression notes
Legacy
mainpreserves the sanitizer, first-option fallback, multi-select/random/separator handling, and macro-inside-choice-value resolution. Currentrefactorpreserves the broad UI/runtime path but drops the sanitizer/fallback and nested macro resolution pieces.Acceptance criteria:
08-PRESET-RUNTIME-choice-variable-selectionvalidates preset default choices and per-chat choices against the selected preset's current choice block option values before injecting prompt variables.{{variableName}}.Additional context
Surface ID:
08-PRESET-RUNTIME-choice-variable-selection.Batch 10 result: confirmed parity gap, static trace only. Do not rebatch #2259; update that tracker row when this is fixed or explicitly de-scoped.
Template check
Please uncheck the box below before submitting so we know you read the template. It is intentionally pre-checked: