Skip to content

test(characters): cover LinkService state machine (Claim/Adopt/Fork)#102

Merged
RebelliousSmile merged 1 commit into
mainfrom
claude/phase-6-cn-export-producer-ypynt9
Jul 7, 2026
Merged

test(characters): cover LinkService state machine (Claim/Adopt/Fork)#102
RebelliousSmile merged 1 commit into
mainfrom
claude/phase-6-cn-export-producer-ypynt9

Conversation

@RebelliousSmile

Copy link
Copy Markdown
Owner

Closes the audit gap #1 (session 2026-05-17): characters/services.py held
all of the link-request business logic with no dedicated, comprehensive test.

Adds tests/characters/test_link_service.py exercising:

  • validate_claim / validate_adopt / validate_fork (all branches)
  • create_request PENDING vs QUEUED, unknown link type, atomic rollback
  • accept_request for claim/adopt/fork, queued cancellation, guards
  • reject_request + QUEUED→PENDING promotion & creator notification (US-15)
  • cancel_request for PENDING (promotes) and QUEUED (no promote)
  • get_queue_position ordering
  • revoke_link draft vs published paths + notification recipient logic
  • check-then-create concurrency invariant, incl. a threaded row-lock race
  • build_character_queryset filters (status/system/tag/FTS, remote excluded)

Coverage on suddenly/characters/services.py: 100%.

Removes the older tests/test_services.py, which tested only LinkService and
is fully subsumed by the new dedicated file (no coverage lost).

Refs #92

Co-Authored-By: Claude Opus 4.8 noreply@anthropic.com
Claude-Session: https://claude.ai/code/session_01SkDjRxJt7B8nnEGRT1pbZy

Closes the audit gap #1 (session 2026-05-17): characters/services.py held
all of the link-request business logic with no dedicated, comprehensive test.

Adds tests/characters/test_link_service.py exercising:
- validate_claim / validate_adopt / validate_fork (all branches)
- create_request PENDING vs QUEUED, unknown link type, atomic rollback
- accept_request for claim/adopt/fork, queued cancellation, guards
- reject_request + QUEUED→PENDING promotion & creator notification (US-15)
- cancel_request for PENDING (promotes) and QUEUED (no promote)
- get_queue_position ordering
- revoke_link draft vs published paths + notification recipient logic
- check-then-create concurrency invariant, incl. a threaded row-lock race
- build_character_queryset filters (status/system/tag/FTS, remote excluded)

Coverage on suddenly/characters/services.py: 100%.

Removes the older tests/test_services.py, which tested only LinkService and
is fully subsumed by the new dedicated file (no coverage lost).

Refs #92

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SkDjRxJt7B8nnEGRT1pbZy
@RebelliousSmile RebelliousSmile merged commit 41ce2de into main Jul 7, 2026
1 check failed
@RebelliousSmile RebelliousSmile deleted the claude/phase-6-cn-export-producer-ypynt9 branch July 7, 2026 12:59
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