Skip to content

test(core-components): cover invalid mustache patterns in prompt template - #223

Merged
Victor-w-Madeira merged 4 commits into
mainfrom
test/prompt-template-invalid-mustache
May 12, 2026
Merged

test(core-components): cover invalid mustache patterns in prompt template#223
Victor-w-Madeira merged 4 commits into
mainfrom
test/prompt-template-invalid-mustache

Conversation

@Victor-w-Madeira

Copy link
Copy Markdown
Collaborator

Summary

  • Adds 4 @stable @regression @components tests exercising the mustache parser rejection contract (with use_double_brackets toggle ON):
    • {{ var }} (spaces inside braces) and {{var.attr}} (dot notation) — SIMPLE_VARIABLE_PATTERN miss branch
    • {{#section}}{{/section}} and {{{var}}} (triple braces) — DANGEROUS_PATTERNS regex-hit branch
  • Each case was probed against POST /api/v1/validate/prompt with mustache=true on Langflow 1.10.x before the spec was written — all 4 return HTTP 500 with the two distinct upstream messages the spec asserts on.
  • Adds the matching spec doc and cross-references it from the two sibling docs; adds 4 bullets to QA-CHECKLIST.md §3.2 (Phase 0 — Validated block auto-regenerated, 128 → 132 @stable tests).

Test plan

  • npx playwright test tests/tests-automations/regression/core-components/prompt-template-invalid-mustache-patterns-regression.spec.ts — 4 passed (17.5s)
  • npm run typecheck — clean
  • npm run lint — no new errors
  • npm run coverage:summary — idempotent regeneration
  • Live API probe confirmed all 4 cases reject as expected

Notes

Closes #221

🤖 Generated with Claude Code

…late

Add 4 @stable @regression @components tests exercising the mustache parser
rejection contract (use_double_brackets toggle ON):

- {{ var }} (spaces inside braces) — SIMPLE_VARIABLE_PATTERN miss
- {{var.attr}} (dot notation) — SIMPLE_VARIABLE_PATTERN miss
- {{#section}}{{/section}} — DANGEROUS_PATTERNS hit
- {{{var}}} (triple braces) — DANGEROUS_PATTERNS hit

Each case was probed against POST /api/v1/validate/prompt with mustache=true
on Langflow 1.10.x before the spec was written, confirming HTTP 500 with the
two distinct upstream messages the spec asserts on.

The error toast (.error-build-message) and isEdit=true behavior surface
through the mustache modal's onError callback in mustachePromptModal/index.tsx
— same rendering path as the f-string sibling spec.
…spec

Replace the 'follow-up planned' stubs in the f-string invalid-patterns and
double-brackets spec docs with pointers to the now-existing
prompt-template-invalid-mustache-patterns-regression.spec.ts.
Add 4 [x] bullets under §3.2 Prompt Template covering the mustache parser
rejection contract. The Phase 0 — Validated block was regenerated by
npm run coverage:summary (128 → 132 @stable test() calls).

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds automated regression coverage for Prompt Template mustache-mode validation failures, ensuring forbidden mustache syntaxes continue to be rejected and surfaced via the UI error toast. This complements the existing f-string invalid-pattern coverage and documents the expected rejection contract.

Changes:

  • Adds a new Playwright spec with 4 @stable @regression @components tests covering invalid mustache patterns ({{ var }}, {{var.attr}}, {{#section}}{{/section}}, {{{var}}}).
  • Updates QA checklist counts and Phase 0 validated bullets to include the new stable tests.
  • Adds/updates docs to describe the mustache invalid-pattern regression spec and cross-link it from related Prompt Template docs.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.

Show a summary per file
File Description
tests/tests-automations/regression/core-components/prompt-template-invalid-mustache-patterns-regression.spec.ts New serial Playwright spec asserting mustache validator rejection contract + “no dynamic handle created” behavior.
QA-CHECKLIST.md Adds 4 validated bullets for the new spec and updates coverage totals/Phase 0 stable test counts.
docs/core-components/prompt-template-invalid-patterns-regression.md Updates “does not cover” section to point to the new mustache invalid-pattern spec.
docs/core-components/prompt-template-invalid-mustache-patterns-regression.md New documentation describing scope, contract, dependencies, and validation criteria for the mustache invalid-pattern tests.
docs/core-components/prompt-template-double-brackets-regression.md Updates “does not cover” section to reference the new mustache invalid-pattern spec.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

…s race

Snapshot toast.textContent() once after toBeVisible resolves, then run the
title and detail assertions against the captured string. The previous
toContainText calls inherited Playwright's 5s expect default, which could
race the .error-build-message 5s auto-dismiss timer if visibility resolved
near the dismissal boundary. Snapshot pattern eliminates the race.

Also pin the modal-stays-visible assertion in step 5 to an explicit 5s
timeout, mirroring the toast lifetime — makes the bound visible at the
call site instead of inheriting it implicitly.
@Victor-w-Madeira
Victor-w-Madeira merged commit 1214a08 into main May 12, 2026
2 checks passed
@Victor-w-Madeira
Victor-w-Madeira deleted the test/prompt-template-invalid-mustache branch May 12, 2026 21:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

test(core-components): cover invalid mustache patterns in prompt template

2 participants