Context
Follow-up to #214 (delivered in PR #220), which covered the f-string parser's invalid-pattern rejection contract. This issue tracks the mustache-mode equivalent — the cases originally listed under "mustache mode" in #214 that were deferred to a dedicated PR.
The mustache path is a different branch of the upstream validator (validate_mustache_template in src/lfx/src/lfx/utils/mustache_security.py plus mustache_template_vars from langchain_core.prompts.string), so the rejection contract must be re-asserted independently of #214. The use_double_brackets toggle helper landed in PR #218 (issue #213), so the test prerequisite is met.
Source references (Langflow upstream):
src/lfx/src/lfx/base/prompts/api_utils.py:127-177 — validate_prompt() branches on is_mustache; the mustache path calls validate_mustache_template() first, then mustache_template_vars().
src/lfx/src/lfx/utils/mustache_security.py — validate_mustache_template() rejects section/inverted/triple-brace syntax with explicit error messages.
Scope
All tests run with the use_double_brackets toggle flipped ON (mustache mode). Toggle helper available in prompt-template-double-brackets-regression.spec.ts (flipDoubleBrackets(page, true)).
| # |
Input |
Expected behavior |
| 1 |
{{ var }} (spaces inside braces) |
Error toast surfaces; no handle created |
| 2 |
{{var.attr}} (dot notation) |
Error toast surfaces; no handle created |
| 3 |
{{#section}}{{/section}} (mustache section) |
Error toast surfaces with the "Complex mustache syntax is not allowed" message; no handle created |
| 4 |
{{{var}}} (triple braces / unescaped HTML) |
Error toast surfaces; no handle created |
Probe each case against POST /api/v1/validate/prompt with \"mustache\": true before writing the spec — the f-string follow-up surfaced two cases ({} and {var-name}) that don't error in practice, and the same risk applies here. Adjust the spec if the live behavior differs from what this issue claims, and document the deviation in the spec doc.
Tags
All tests: @stable @regression @components. None should carry @release — defensive contract tests, not happy-path flows.
Deliverables
Out of scope
Notes
- The error surface is the same toast (
.error-build-message) used by f-string rejection — the i18n title comes from errors.prompt, the detail from error.response.data.detail. Selector strategy in prompt-template-invalid-patterns-regression.spec.ts is directly reusable.
- The toast auto-dismisses after 5 seconds (
src/frontend/src/alerts/error/index.tsx:22) — the first toast assertion should use a 5-second timeout.
- Tests should call
(page as any).allowFlowErrors() since the validate endpoint deliberately returns HTTP 500 for these cases.
Context
Follow-up to #214 (delivered in PR #220), which covered the f-string parser's invalid-pattern rejection contract. This issue tracks the mustache-mode equivalent — the cases originally listed under "mustache mode" in #214 that were deferred to a dedicated PR.
The mustache path is a different branch of the upstream validator (
validate_mustache_templateinsrc/lfx/src/lfx/utils/mustache_security.pyplusmustache_template_varsfromlangchain_core.prompts.string), so the rejection contract must be re-asserted independently of #214. Theuse_double_bracketstoggle helper landed in PR #218 (issue #213), so the test prerequisite is met.Source references (Langflow upstream):
src/lfx/src/lfx/base/prompts/api_utils.py:127-177—validate_prompt()branches onis_mustache; the mustache path callsvalidate_mustache_template()first, thenmustache_template_vars().src/lfx/src/lfx/utils/mustache_security.py—validate_mustache_template()rejects section/inverted/triple-brace syntax with explicit error messages.Scope
All tests run with the
use_double_bracketstoggle flipped ON (mustache mode). Toggle helper available inprompt-template-double-brackets-regression.spec.ts(flipDoubleBrackets(page, true)).{{ var }}(spaces inside braces){{var.attr}}(dot notation){{#section}}{{/section}}(mustache section){{{var}}}(triple braces / unescaped HTML)Probe each case against
POST /api/v1/validate/promptwith\"mustache\": truebefore writing the spec — the f-string follow-up surfaced two cases ({}and{var-name}) that don't error in practice, and the same risk applies here. Adjust the spec if the live behavior differs from what this issue claims, and document the deviation in the spec doc.Tags
All tests:
@stable @regression @components. None should carry@release— defensive contract tests, not happy-path flows.Deliverables
tests/tests-automations/regression/core-components/prompt-template-invalid-mustache-patterns-regression.spec.tsdocs/core-components/prompt-template-invalid-mustache-patterns-regression.mdQA-CHECKLIST.md— add bullets under §3.2 covering mustache-mode invalid-pattern rejectiondocs/core-components/prompt-template-invalid-patterns-regression.md— update the "What this test does not cover" section to point at the new specdocs/core-components/prompt-template-double-brackets-regression.md— extend "What this test does not cover" with a pointer to the new specOut of scope
use_double_bracketstoggle behavior itself (covered by test(core-components): cover use_double_brackets toggle in prompt template #213 / PR test(core-components): cover use_double_brackets toggle in prompt template #218)tool-mode.spec.ts)Notes
.error-build-message) used by f-string rejection — the i18n title comes fromerrors.prompt, the detail fromerror.response.data.detail. Selector strategy inprompt-template-invalid-patterns-regression.spec.tsis directly reusable.src/frontend/src/alerts/error/index.tsx:22) — the first toast assertion should use a 5-second timeout.(page as any).allowFlowErrors()since the validate endpoint deliberately returns HTTP 500 for these cases.