Skip to content

chore(flow-functionality): add @stable and harden pythonApiGeneration - #140

Merged
daniellicnerski1 merged 2 commits into
mainfrom
validate/python-api-generation
May 12, 2026
Merged

chore(flow-functionality): add @stable and harden pythonApiGeneration#140
daniellicnerski1 merged 2 commits into
mainfrom
validate/python-api-generation

Conversation

@daniellicnerski1

Copy link
Copy Markdown
Collaborator

Summary

  • The original test asserted only clipboardContent.length > 0, which would pass even if the wrong tab's snippet or an empty buffer was copied. Replaced with 10 structural assertions that mirror the real output of getNewPythonApiCode for the Basic Prompting template.
  • Added the missing spec doc under docs/flow-functionality/pythonApiGeneration.md (mirrors the curl spec) and marked scenario 5.2 as covered in QA-CHECKLIST.md and QA-SCENARIOS-GUIDE.md.
  • Adjusted tags: added @stable, removed the misleading @api tag (this test exercises the UI snippet generator, not the REST endpoint), kept @release and @workspace.

What the new assertions check

  • Starts with import requests
  • Contains import uuid, api_key = 'YOUR_API_KEY_HERE'
  • URL is <base>/api/v1/run/<UUID> (regex on [0-9a-f-]{36})
  • Body carries "input_value": "Hello", "output_type": "chat", "input_type": "chat"
  • Code mutates payload["session_id"] = str(uuid.uuid4())
  • Builds headers = {"x-api-key": api_key}
  • Calls requests.request("POST", url, json=payload, headers=headers)

Test plan

  • ESLint clean
  • tsc --noEmit clean
  • Baseline 3x pass with --retries=0 (14.9s total)
  • Force-fail confirmed: deliberately broken assertion fails as expected, restored after
  • Real Python snippet captured from trace.zip and verified against the assertions
  • Spec doc filled with all required sections (Last validated: Langflow 1.10.x)

… test

The previous test asserted only `clipboardContent.length > 0`, which would
pass even if the wrong tab's snippet or an empty buffer were copied.

Replaced with structural assertions that match the real shape of
`getNewPythonApiCode` for the Basic Prompting template:
  - starts with `import requests`
  - contains `import uuid`, the API key placeholder, the `/api/v1/run/<UUID>` URL
  - contains the default `"Hello"` input value, output/input type `chat`
  - contains the session_id mutation, headers dict, and the requests.request call

Also added the missing spec doc under docs/flow-functionality/ and marked
the scenario as covered in QA-CHECKLIST.md and QA-SCENARIOS-GUIDE.md.

Removed the misleading `@api` tag — this test exercises the UI snippet
generator, not the REST endpoint.
@Victor-w-Madeira
Victor-w-Madeira requested a review from Copilot May 6, 2026 08:11

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.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@daniellicnerski1
daniellicnerski1 merged commit 2713cd4 into main May 12, 2026
2 checks passed
@Victor-w-Madeira
Victor-w-Madeira deleted the validate/python-api-generation branch May 15, 2026 18:28
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.

2 participants