Skip to content

Add tests for content-addressed storage key generation #143

@btc

Description

@btc

The image and audio upload codepaths now use content-addressed (SHA-256) keys, but the key construction logic is untested.

What to test:

  • Image key: questions/{uuid}/{sha256hex16}.png (in internal/jobs/generate_image.go)
  • Audio key: {sessionID}/{messageID}/{sha256hex16}.{ext} (in internal/backend/turn.go)

Suggested approach:
Extract key-building into small pure functions and unit test them directly — deterministic input bytes should produce deterministic keys, identical content should produce identical keys, different content should produce different keys.

No integration test or mock wiring needed — just test the pure key construction.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions