Skip to content

test(api): mark api-invalid-key as @stable - #167

Merged
daniellicnerski1 merged 4 commits into
mainfrom
validate/api-invalid-key-stable
May 12, 2026
Merged

test(api): mark api-invalid-key as @stable#167
daniellicnerski1 merged 4 commits into
mainfrom
validate/api-invalid-key-stable

Conversation

@daniellicnerski1

Copy link
Copy Markdown
Collaborator

Summary

  • Add @stable and @api tags to all 6 tests in api-invalid-key.spec.ts (kept @release, @workspace, @regression).
  • Refactor cleanup pattern in Tests 4 and 6: assert createRes.status() === 201 before extracting flowId, removing if (flowId) conditionals in finally blocks. Silences 2 playwright/no-conditional-in-test warnings without weakening test behavior.
  • Add spec doc docs/api/flows/api-invalid-key.md (mandatory per CLAUDE.md PR review checklist).
  • Update QA-CHECKLIST.md line 99 (POST with invalid API key): flip [-] → [x] and append spec filename.

Validation pipeline (all 7 steps performed)

  • npm run typecheck — clean
  • npm run lint filtered to file — 0 errors / 0 warnings (after refactor)
  • playwright-test-linter skill checklist — clean (no if/else in test logic, no .catch(()=>false), no standalone .isVisible(), no swallowing try/catch; expect-count ratio is 10/6 by design — each test asserts a single status-code contract)
  • npx playwright test ... --workers=1 --retries=0 — 6/6 pass, 1.3s, no retries
  • Force-fail check — changed expect([401, 403]).toContain(...) to expect([999]).toContain(...) in Test 2; that test failed exactly at line 36:21 (others continued passing); reverted; final run clean
  • --trace=on run — trace captured
  • Backend errors audit — zero 🚨 Backend Error: in output

Why both @stable and @api are added

  • @stable puts the spec in the weekly stable workflow, the goal of this validation pass.
  • @api was missing from the original tags; per CLAUDE.md tag semantics (@api — Tests exercising REST API endpoints), every spec under regression/api/ should carry it. The previously merged api-health-check.spec.ts already follows this convention. Adding here for parity.

Test plan

  • Local run passes 6/6 against langflow-nightly at http://localhost:7860.
  • CI pr-validation.yml (typecheck + lint) passes.
  • Weekly weekly-stable.yml picks up the test on next Monday's run.

Daniel Licnerski Borges added 2 commits May 6, 2026 14:51
- Add @stable and @api tags to all 6 tests (kept @release/@workspace/@regression).
- Refactor cleanup pattern: assert createRes.status() before extracting flowId,
  removing 'if (flowId)' conditionals in finally blocks (silenced 2
  playwright/no-conditional-in-test warnings).
- Add spec doc docs/api/flows/api-invalid-key.md (mandatory per CLAUDE.md).
- Mark QA-CHECKLIST line 99 with spec filename.

Validation pipeline (7/7):
- typecheck clean, npm run lint clean (0 errors/warnings on file)
- 6/6 PASS in 1.3s, --retries=0
- force-fail: changed expect to [999] -> Test 2 failed at :36:21 as expected; reverted
- --trace=on captured
- zero backend errors in output
- expect(flowId).toBeTruthy() after destructuring in tests 4 and 6 —
  surfaces a clear failure if the API ever returns 201 without an id,
  instead of issuing DELETE /api/v1/flows/undefined.
- Consolidate two-line comments into a single WHY line per CLAUDE.md
  ("don't explain WHAT").

Pipeline re-run: typecheck/lint/linter-skill clean; 6/6 pass in 1.2s
with --retries=0; force-fail on the new guard fails at line 68:22 with
clear message; --trace=on captured; zero 🚨 Backend Error.

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

This pull request updates the API invalid-auth coverage to be eligible for the weekly stable workflow, while aligning the spec with the repository’s tagging and documentation requirements for @stable tests.

Changes:

  • Tagged all tests in api-invalid-key.spec.ts with @stable and @api (retaining existing tags).
  • Refactored cleanup in the flow-creating tests to assert successful creation before using flowId, removing conditional cleanup branches.
  • Added a required spec document under docs/ and updated QA-CHECKLIST.md to mark the scenario as validated.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
tests/tests-automations/regression/api/flows/api-invalid-key.spec.ts Adds @stable/@api tags and simplifies cleanup logic in tests that create a temporary flow.
QA-CHECKLIST.md Marks “POST with invalid API key” as validated and links to the spec filename.
docs/api/flows/api-invalid-key.md Adds the required test spec documentation for the invalid-key API coverage.

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

Comment thread docs/api/flows/api-invalid-key.md Outdated
---

## Validation criterion *(required)*
- All four "rejected status" assertions return one of the documented codes (`401`, `403`, or `422` for malformed-create).

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Fixed in 10c7798. Reworded to "Every "rejected status" assertion across the 6 tests returns one of the documented codes (401, 403, or 422 for malformed-create)" — covers all 6 rejection assertions and is robust to future additions.

Daniel Licnerski Borges added 2 commits May 12, 2026 11:08
…ests

Original wording said "All four rejected status assertions" but the spec
has 6 rejection assertions (one per test). Replace with phrasing that
covers every rejection check across the 6 tests, addressing Copilot
review feedback on PR #167.
@daniellicnerski1
daniellicnerski1 merged commit 64e549a into main May 12, 2026
2 checks passed
@Victor-w-Madeira
Victor-w-Madeira deleted the validate/api-invalid-key-stable 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