banatie-service/tests/api/07-known-issues.rest

260 lines
6.7 KiB
ReStructuredText

@base = http://localhost:3000
@apiKey = bnt_727d2f4f72bd03ed96da5278bb971a00cb0a2454d4d70f9748b5c39f3f69d88d
###############################################################################
# KNOWN ISSUES TESTS
# These tests document known bugs and implementation gaps
#
# ⚠️ EXPECTED TO FAIL until issues are fixed
#
# Test Coverage:
# 1. Project alias on flow image
# 2. Flow delete cascades non-aliased images
# 3. Flow delete preserves aliased images
# 4. Flow delete cascades generations
###############################################################################
###############################################################################
# ISSUE 1: Project Alias on Flow Image
# An image in a flow should be able to have a project-scoped alias
###############################################################################
### Step 1.1: Create image with both flow and project alias
# @name issue1Gen
POST {{base}}/api/v1/generations
Content-Type: application/json
X-API-Key: {{apiKey}}
{
"prompt": "Image in flow with project alias",
"aspectRatio": "1:1",
"flowAlias": "@flow-test",
"alias": "@project-test"
}
###
@issue1FlowId = {{issue1Gen.response.body.$.data.flowId}}
@issue1GenId = {{issue1Gen.response.body.$.data.id}}
### Step 1.2: Poll generation
# @name checkIssue1Gen
GET {{base}}/api/v1/generations/{{issue1GenId}}
X-API-Key: {{apiKey}}
###
@issue1ImageId = {{checkIssue1Gen.response.body.$.data.outputImageId}}
### Step 1.3: Resolve project alias (via deprecated /resolve endpoint)
# @name resolveProjectOnFlow
GET {{base}}/api/v1/images/resolve/@project-test
X-API-Key: {{apiKey}}
###
# BUG: Project alias on flow image should be resolvable
# Expected: Returns image with id = {{issue1ImageId}}
### Step 1.4: Resolve project alias (via direct path - Section 6.2)
# @name resolveProjectOnFlowDirect
GET {{base}}/api/v1/images/@project-test
X-API-Key: {{apiKey}}
###
# This should work after Section 6.2 implementation
###############################################################################
# ISSUE 2: Flow Delete Cascades Non-Aliased Images
# When deleting a flow, images without project alias should be deleted
###############################################################################
### Step 2.1: Create flow with non-aliased image
# @name issue2Gen1
POST {{base}}/api/v1/generations
Content-Type: application/json
X-API-Key: {{apiKey}}
{
"prompt": "No alias image",
"aspectRatio": "1:1",
"flowAlias": "@issue-flow"
}
###
@issue2FlowId = {{issue2Gen1.response.body.$.data.flowId}}
@issue2Gen1Id = {{issue2Gen1.response.body.$.data.id}}
### Step 2.2: Poll generation
# @name checkIssue2Gen1
GET {{base}}/api/v1/generations/{{issue2Gen1Id}}
X-API-Key: {{apiKey}}
###
@issue2Image1Id = {{checkIssue2Gen1.response.body.$.data.outputImageId}}
### Step 2.3: Add aliased image to same flow
# @name issue2Gen2
POST {{base}}/api/v1/generations
Content-Type: application/json
X-API-Key: {{apiKey}}
{
"prompt": "With alias image",
"aspectRatio": "1:1",
"flowId": "{{issue2FlowId}}",
"alias": "@protected-image"
}
###
@issue2Gen2Id = {{issue2Gen2.response.body.$.data.id}}
### Step 2.4: Poll generation
# @name checkIssue2Gen2
GET {{base}}/api/v1/generations/{{issue2Gen2Id}}
X-API-Key: {{apiKey}}
###
@issue2Image2Id = {{checkIssue2Gen2.response.body.$.data.outputImageId}}
### Step 2.5: Delete flow
# @name deleteIssue2Flow
DELETE {{base}}/api/v1/flows/{{issue2FlowId}}
X-API-Key: {{apiKey}}
###
### Step 2.6: Check non-aliased image (should be 404)
# @name checkIssue2Image1Deleted
GET {{base}}/api/v1/images/{{issue2Image1Id}}
X-API-Key: {{apiKey}}
###
# Expected: 404 - Non-aliased image should be deleted with flow
### Step 2.7: Check aliased image (should still exist)
# @name checkIssue2Image2Exists
GET {{base}}/api/v1/images/{{issue2Image2Id}}
X-API-Key: {{apiKey}}
###
# Expected: 200 - Aliased image should be preserved
###############################################################################
# ISSUE 3: Flow Delete Preserves Aliased Images
# Aliased images should have flowId set to null after flow deletion
###############################################################################
### Step 3.1: Create flow with aliased image
# @name issue3Gen
POST {{base}}/api/v1/generations
Content-Type: application/json
X-API-Key: {{apiKey}}
{
"prompt": "Protected image",
"aspectRatio": "1:1",
"flowAlias": "@test-flow-2",
"alias": "@keep-this"
}
###
@issue3FlowId = {{issue3Gen.response.body.$.data.flowId}}
@issue3GenId = {{issue3Gen.response.body.$.data.id}}
### Step 3.2: Poll generation
# @name checkIssue3Gen
GET {{base}}/api/v1/generations/{{issue3GenId}}
X-API-Key: {{apiKey}}
###
@issue3ImageId = {{checkIssue3Gen.response.body.$.data.outputImageId}}
### Step 3.3: Delete flow
# @name deleteIssue3Flow
DELETE {{base}}/api/v1/flows/{{issue3FlowId}}
X-API-Key: {{apiKey}}
###
### Step 3.4: Check aliased image (should exist with flowId=null)
# @name checkIssue3ImagePreserved
GET {{base}}/api/v1/images/{{issue3ImageId}}
X-API-Key: {{apiKey}}
###
# Expected: 200 with flowId = null
# BUG: flowId might not be set to null
###############################################################################
# ISSUE 4: Flow Delete Cascades Generations
# Generations should be deleted when flow is deleted
###############################################################################
### Step 4.1: Create flow with generation
# @name issue4Gen
POST {{base}}/api/v1/generations
Content-Type: application/json
X-API-Key: {{apiKey}}
{
"prompt": "Test generation",
"aspectRatio": "1:1",
"flowAlias": "@gen-flow"
}
###
@issue4FlowId = {{issue4Gen.response.body.$.data.flowId}}
@issue4GenId = {{issue4Gen.response.body.$.data.id}}
### Step 4.2: Poll generation
# @name checkIssue4Gen
GET {{base}}/api/v1/generations/{{issue4GenId}}
X-API-Key: {{apiKey}}
###
### Step 4.3: Delete flow
# @name deleteIssue4Flow
DELETE {{base}}/api/v1/flows/{{issue4FlowId}}
X-API-Key: {{apiKey}}
###
### Step 4.4: Check generation (should be 404)
# @name checkIssue4GenDeleted
GET {{base}}/api/v1/generations/{{issue4GenId}}
X-API-Key: {{apiKey}}
###
# Expected: 404 - Generation should be deleted with flow
###############################################################################
# NOTES
###############################################################################
#
# Flow Deletion Cascade (per api-refactoring-final.md):
# - Flow record → DELETE
# - All generations → DELETE
# - Images without alias → DELETE (with MinIO cleanup)
# - Images with project alias → KEEP (unlink: flowId = NULL)
#
# Known Issues:
# 1. Project alias on flow images may not resolve properly
# 2. Flow deletion may not properly cascade deletions
# 3. Aliased images may not have flowId set to null
#
# These tests document expected behavior that may not be implemented yet.
#