You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
docs(prompt-template): align step-by-step with current spec assertions
- Drop "records initial count / asserts increase" wording from tests 2, 3,
and 5 — the spec now asserts exact dynamic-handle counts via the
dynamicHandlesLocator and the specific per-variable handles, not
before/after comparisons (the count comparison was removed when
waitForTimeout was dropped from the helper).
- Fix External dependencies: api_utils.py lives under src/lfx/, the
extractor uses Python's string.Formatter (not a regex), and the
PromptComponent path now points at the real prompt.py location.
Copy file name to clipboardExpand all lines: docs/core-components/prompt-template-component-regression.md
+9-10Lines changed: 9 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -48,26 +48,24 @@ Tests 2–6 use the helper `setPromptTemplate(page, value)` which:
48
48
- Asserts exactly one node on the canvas (`react-flow__node` count === 1).
49
49
50
50
### 2. `variables in curly braces generate dynamic input handles`
51
-
- Records the initial count of `handle-prompt template` testids.
52
51
- Calls `setPromptTemplate` with `Hello {name}, your job is {profession}.`.
53
-
- Asserts the new handle count is strictly greater than the initial count.
54
52
- Asserts both `handle-prompt template-shownode-name-left` and `handle-prompt template-shownode-profession-left` are visible.
53
+
- Asserts the dynamic-handle locator (`-shownode-*-left` only) has count exactly 2 — sanity check that no extra handles leaked in.
55
54
56
55
### 3. `removing a variable removes its input handle`
57
-
- Sets the template to `Hello {name}!` and asserts the `name` handle is visible.
58
-
- Records the current handle count.
59
-
- Sets the template to `Hello world!` and asserts the `name` handle has zero matches.
60
-
- Asserts the new handle count is strictly less than the recorded count.
56
+
- Sets the template to `Hello {name}!` and asserts the `name` handle is visible and the dynamic-handle count is exactly 1.
57
+
- Sets the template to `Hello world!`.
58
+
- Asserts the `name` handle has zero matches and the dynamic-handle count is exactly 0.
61
59
62
60
### 4. `replacing a variable updates handles accordingly`
63
61
- Sets the template to `Hello {name}, you are {role}.` and asserts both `name` and `role` handles are visible.
64
62
- Sets the template to `Hello {name}, you are {title}.`.
65
63
- Asserts `name` is still visible, `role` has zero matches, and `title` is visible.
66
64
67
65
### 5. `clearing the template removes all dynamic handles`
68
-
- Sets the template to `{a} and {b} and {c}` and asserts the count of left-side dynamic handles is > 0.
66
+
- Sets the template to `{a} and {b} and {c}` and asserts the dynamic-handle count is exactly 3.
69
67
- Sets the template to `No variables here.`.
70
-
- Asserts the count of left-side dynamic handles equals 0.
68
+
- Asserts the dynamic-handle count is exactly 0.
71
69
72
70
### 6. `modal edits persist in UI and in saved flow`
73
71
- Sets the template to `Persisted prompt text {topic}.` via `setPromptTemplate`.
@@ -93,9 +91,10 @@ Tests 2–6 use the helper `setPromptTemplate(page, value)` which:
93
91
94
92
-`src/frontend/src/modals/promptModal/` — `genericModalBtnSave` button, `edit-prompt-sanitized` preview, and the textarea that holds the editable template; changes here break tests 2–6
95
93
-`src/frontend/src/CustomNodes/GenericNode/components/parameterRenderComponent/components/promptAreaComponent/` — `button_open_prompt_modal` trigger on the node inspector; breaks tests 2–6
96
-
-`src/backend/base/langflow/base/prompts/api_utils.py` — `extract_input_variables_from_prompt()` regex that derives the variable list from the template string; breaks tests 2–5
94
+
-`src/lfx/src/lfx/interface/utils.py` — `extract_input_variables_from_prompt()`: derives the variable list from the template string using Python's `string.Formatter().parse()` (not a regex); breaks tests 2–5
95
+
-`src/lfx/src/lfx/base/prompts/api_utils.py` — `validate_prompt()` and `_check_input_variables()`: validation layer around the extracted variables; breaks tests 2–5
96
+
-`src/lfx/src/lfx/components/models_and_agents/prompt.py` — `PromptComponent` definition (`display_name="Prompt Template"`, template field) and `update_build_config()` that synchronizes template ↔ input fields; breaks tests 2–6 and the backend assertion in test 6
97
97
-`src/frontend/src/CustomNodes/GenericNode/` — dynamic handle rendering for `handle-{component}-shownode-{var}-left`; breaks tests 1–5
-`GET /api/v1/flows/{id}` — flow read endpoint backing the autosave round-trip; the response shape `data.nodes[].data.node.template.template.value` is what test 6 asserts. A rename of the inner `template.template` nesting, or a change to `node.data.type` away from `"Prompt Template"`, breaks the backend assertion.
0 commit comments