feat: v1.4.0 Phase 5 - Testing & Documentation

Complete Phase 5 of v1.4.0 "Media" release with comprehensive release
preparation.

CHANGELOG Updates:
- Added v1.4.0rc1 section with comprehensive release notes
- Documented all four phases:
  * Large Image Support (50MB limit, tiered resize)
  * Image Variants (thumb, small, medium, large)
  * Micropub Media Endpoint (W3C compliant)
  * Enhanced Feed Media (Media RSS, JSON Feed extension)
- Standards compliance documented (W3C Micropub, Media RSS 2.0)
- Storage impact and backwards compatibility notes
- Configuration options (STARPUNK_ABOUT_URL)

Version Bump:
- Updated starpunk/__init__.py to 1.4.0rc1
- Version info tuple includes rc1 designator

Implementation Report:
- Created docs/design/v1.4.0/2025-12-16-v140-implementation-complete.md
- Complete summary of all five phases
- Test results: 850 passing, 19 failing
- Known issues documented (flaky tests, feed cache)
- Acceptance criteria checklist
- Deployment and rollback procedures
- Release recommendation: Ready for RC testing

Test Results:
- Full test suite executed: 850 passed, 19 failed (98% pass rate)
- Core v1.4.0 functionality verified working
- Failures in known flaky tests and unrelated areas
- 5 minutes 58 seconds execution time

Release Status:
- All five phases complete
- Ready for release candidate testing
- Manual verification recommended before final release

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-12-16 08:18:54 -07:00
parent 00f21d2a51
commit 68d1a1d879
3 changed files with 664 additions and 2 deletions

View File

@@ -7,6 +7,142 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]
## [1.4.0rc1] - 2025-12-16
### Added
- **Large Image Support** - Accept and optimize images up to 50MB (Phase 1)
- Increased file size limit from 10MB to 50MB for image uploads
- Tiered resize strategy based on input size:
- <=10MB: 2048px max dimension, 95% quality
- 10-25MB: 1600px max dimension, 90% quality
- 25-50MB: 1280px max dimension, 85% quality
- Iterative quality reduction if output still >10MB after optimization
- Rejects if optimization cannot achieve <=10MB target (minimum 640px at 70% quality)
- Animated GIF detection with 10MB size limit (cannot be resized)
- All optimized images kept at or under 10MB for web performance
- **Image Variants** - Multiple image sizes for responsive delivery (Phase 2)
- Four variants generated automatically on upload:
- thumb: 150x150 center crop for thumbnails
- small: 320px width for mobile/low bandwidth
- medium: 640px width for standard display
- large: 1280px width for high-res display
- original: As uploaded (optimized, <=2048px)
- Variants stored in date-organized folders (data/media/YYYY/MM/)
- Database tracking in new `media_variants` table
- Synchronous/eager generation on upload
- Only new uploads get variants (existing media unchanged)
- Cascade deletion with parent media
- Variants included in `get_note_media()` response (backwards compatible)
- **Micropub Media Endpoint** - W3C-compliant media upload (Phase 3)
- New POST `/micropub/media` endpoint for file uploads
- Multipart/form-data with single file part named 'file'
- Bearer token authentication with `create` scope (no new scope needed)
- Returns 201 Created with Location header on success
- Automatic variant generation on upload
- OAuth 2.0 error format for all error responses
- Media endpoint advertised in `q=config` query response
- Photo property support in Micropub create requests:
- Simple URL strings: `"photo": ["https://example.com/image.jpg"]`
- Structured with alt text: `"photo": [{"value": "url", "alt": "description"}]`
- Multiple photos supported (max 4 per ADR-057)
- External URLs logged and ignored (no download)
- Photo captions preserved from alt text
- **Enhanced Feed Media** - Full Media RSS and JSON Feed variants (Phase 4)
- RSS 2.0: Complete Media RSS namespace support
- `media:group` element for multiple sizes of same image
- `media:content` for each variant with dimensions and file size
- `media:thumbnail` element for preview images
- `media:title` for captions (when present)
- `isDefault` attribute on largest available variant
- JSON Feed 1.1: `_starpunk` extension with variants
- All variants with URLs, dimensions, and sizes
- Configurable `about` URL for extension documentation
- Default: `https://github.com/yourusername/starpunk`
- Override via `STARPUNK_ABOUT_URL` config
- ATOM 1.0: Enclosures with title attribute for captions
- Backwards compatible: Feeds work with and without variants
### Changed
- **Image Optimization** - Enhanced for large file handling
- `optimize_image()` now accepts `original_size` parameter
- Returns both optimized image and bytes (avoids re-saving)
- Iterative quality reduction loop for difficult-to-compress images
- Safety check prevents infinite loops (minimum 640px dimension)
- **Media Storage** - Extended with variant support
- `save_media()` generates variants synchronously after saving original
- Variants cleaned up automatically on generation failure
- Database records original as 'original' variant type
- File size passed efficiently without redundant I/O
### Technical Details
- **Migration 009**: Add `media_variants` table
- Tracks variant_type, path, dimensions, and file size
- Foreign key to media table with cascade delete
- Unique constraint on (media_id, variant_type)
- Index on media_id for efficient lookups
- **New Functions**:
- `get_optimization_params(file_size)` - Tiered resize strategy
- `generate_variant()` - Single variant generation
- `generate_all_variants()` - Full variant set with DB storage
- `extract_photos()` - Micropub photo property parsing
- `_attach_photos_to_note()` - Photo attachment to notes
- **Modified Functions**:
- `validate_image()` - 50MB limit, animated GIF detection
- `optimize_image()` - Size-aware tiered optimization
- `save_media()` - Variant generation integration
- `get_note_media()` - Includes variants (when present)
- `handle_query()` - Advertises media-endpoint in config
- `handle_create()` - Photo property extraction and attachment
- `generate_rss_streaming()` - Media RSS support
- `_build_item_object()` - JSON Feed variants
- `generate_atom_streaming()` - Enclosure title attributes
- **Configuration Options**:
- `STARPUNK_ABOUT_URL` - JSON Feed extension documentation URL
### Standards Compliance
- W3C Micropub Media Endpoint Specification
- Media RSS 2.0 Specification (RSS Board)
- JSON Feed 1.1 with custom extension
- OAuth 2.0 Bearer Token Authentication
- RFC 3339 date formats in feeds
### Storage Impact
- Variants use approximately 4x storage per image:
- Original: 100%
- Large (1280px): ~50%
- Medium (640px): ~25%
- Small (320px): ~12%
- Thumb (150x150): ~3%
- Typical 500KB optimized image → ~900KB total with variants
- Only new uploads generate variants (existing media unchanged)
### Backwards Compatibility
- Existing media files work unchanged
- No variants generated for pre-v1.4.0 uploads
- Feeds handle media with and without variants gracefully
- `get_note_media()` only includes 'variants' key when variants exist
- All existing Micropub clients continue to work
### Related Documentation
- ADR-057: Media Attachment Model
- ADR-058: Image Optimization Strategy
- ADR-059: Full Feed Media Standardization
- Design: `/docs/design/v1.4.0/media-implementation-design.md`
## [1.3.1] - 2025-12-10
### Added