This document derives from design.md and defines how the delete-conversation feature should be proven.
- Feature / phase:
Delete Conversation / Part 1 - Depends on
design.mdversion:initial example version - Depends on
architecture.mdsections:Target Shape / To-Be,Key Flows,Constraints and Boundaries - Out-of-scope behaviors: restore flow, bulk delete, admin override
- Selected methodology:
Follow Existing Project Pattern - Why this methodology fits the feature: existing-system change should preserve the project's current testing style rather than impose a new one
- Existing project testing pattern to follow: unit tests for service rules, integration tests for endpoint + repository behavior, BDD-style acceptance scenario for ownership language
- Approved exceptions to the default methodology: none
- Test layers in scope:
unit,integration,acceptance - Primary test subjects:
ConversationServiceImpl, delete endpoint, repository transaction boundary - Required test doubles / fixtures: repository fake for unit test, seeded owned/non-owned conversations for integration/acceptance
- Real dependencies allowed in test runs: ephemeral database in integration layer only
- Mock / stub / fake policy: unit tests may fake repository; integration and acceptance tests must use real persistence
- Data setup / teardown rules: create one owned conversation, one non-owned conversation, then clean both between runs
classDiagram
class ServiceUnitTest
class DeleteEndpointIntegrationTest
class DeleteConversationBDD
class ConversationServiceImpl
class FakeConversationRepository
class RealDatabase
ServiceUnitTest --> ConversationServiceImpl
ServiceUnitTest --> FakeConversationRepository
DeleteEndpointIntegrationTest --> ConversationServiceImpl
DeleteEndpointIntegrationTest --> RealDatabase
DeleteConversationBDD --> RealDatabase
- Source production flow:
DELETE /api/conversations/:id - Primary layer proving it:
integration - Setup: authenticated user with owned conversation and child messages
- Expected assertions: response
204; conversation row removed; child messages removed - Ownership / authorization checks:
user_idin delete predicate - Negative paths: none in this case
- Source production flow: ownership boundary in delete repository predicate
- Primary layer proving it:
acceptance - Setup: authenticated user attempts to delete another user's conversation
- Expected assertions: conversation remains; failure response returned
- Ownership / authorization checks: requester cannot cross ownership boundary
- Negative paths: forbidden/not-found path depending on approved API contract
- Source production flow: service maps zero rows deleted into domain failure
- Primary layer proving it:
unit - Setup: fake repository returns
not found - Expected assertions: service returns domain error without HTTP coupling
- Ownership / authorization checks: service requires ownership-aware repository call
- Negative paths: missing conversation
ConversationServiceImpl owns orchestration of delete behavior->conversation.service.unit.test.tsConversationServiceImpl maps repository miss into domain failure->conversation.service.unit.test.ts
DELETE /api/conversations/:idhappy path ->conversation-delete.integration.test.tsrepository deletes child messages then parent->conversation-delete.integration.test.ts
user may delete only owned conversation tree->conversation-delete.featureactive -> deleted is allowed->conversation-delete.featurenon-owner cannot delete another user's conversation->conversation-delete.feature
DEL-001:- Purpose: owner deletes own conversation
- Layer:
integration - Expected evidence:
204response and missing rows in DB
DEL-002:- Purpose: delete missing conversation
- Layer:
unit - Expected failure mode: domain
not found
DEL-003:- Purpose: non-owner delete attempt rejected
- Layer:
acceptance - Expected enforcement: no rows deleted and failure response returned
DEL-004:- Purpose: deleted conversation does not reappear in same test run
- Layer:
integration - Expected enforcement: follow-up fetch cannot find deleted conversation
- Tests that must exist before implementation proceeds:
DEL-002unit case andDEL-003ownership scenario - Red -> Green -> Refactor expectations: not required because this example follows existing project pattern instead of strict greenfield TDD
- Scenario-first expectations: acceptance scenario should be written before final endpoint wiring is declared complete
- Minimum suites that must pass before review: service unit suite, delete integration suite, ownership acceptance scenario
- Cases allowed to be deferred and why: none
- Expected test files or suite locations:
tests/unit/conversation.service.unit.test.tstests/integration/conversation-delete.integration.test.tstests/acceptance/conversation-delete.feature
- Required command surface:
pnpm test -- conversation.service.unit.test.tspnpm test:integration -- conversation-delete.integration.test.tspnpm test:acceptance -- conversation-delete.feature
- Expected durable evidence path:
docs/DevoSkill/examples/delete-conversation/verification.md - Reviewer spot-check starting points: ownership scenario, service not-found mapping, DB child-message cleanup
- None