Skip to content

Add PWA offline support, podcast generation pipeline, and comprehensive tests#5

Open
JordanTranchina wants to merge 67 commits into
kbroose:mainfrom
JordanTranchina:claude/fix-android-cloud-upload-1jIEB
Open

Add PWA offline support, podcast generation pipeline, and comprehensive tests#5
JordanTranchina wants to merge 67 commits into
kbroose:mainfrom
JordanTranchina:claude/fix-android-cloud-upload-1jIEB

Conversation

@JordanTranchina
Copy link
Copy Markdown

Summary

This PR introduces three major feature areas to Stash:

  1. PWA Offline Support – Full offline-first architecture with IndexedDB caching, Service Worker enhancements, and sync-on-reconnect for articles and user actions
  2. Listen Later Podcast Pipeline – Automated conversion of saved articles into conversational AI podcasts using Gemini for scriptwriting and Edge TTS for audio generation, orchestrated via GitHub Actions
  3. Comprehensive Test Suite – Unit and E2E tests for web app, extension, and podcast modules with full mock coverage

Key Changes

PWA & Offline Experience

  • web/db.js (new) – IndexedDB wrapper for caching articles and pending saves with offline-first read/write operations
  • web/sw.js (modified) – Enhanced Service Worker with improved cache versioning, offline fallback strategy, and background sync support
  • web/app.js (modified) – Added setupRealtime() for Supabase real-time subscriptions, syncPendingShares() for offline queue processing, and PWA install prompt handling
  • web/manifest.json (modified) – Added maskable icon support and improved PWA metadata
  • web/save.html (modified) – Redesigned with stealth overlay UI for saving state, spinner animations, and improved mobile UX
  • web/styles.css (modified) – Code formatting and PWA-specific styling improvements
  • documentation/Stash PWA Specification.md (new) – Complete PWA product and technical specification

Podcast Generation Pipeline

  • podcast/script.py (new) – Core orchestrator: fetches articles, generates conversational scripts via Gemini 2.0 Flash, synthesizes audio with Edge TTS, assembles episodes, and uploads to Supabase
  • podcast/extract.py (new) – Supabase article fetching with text cleaning and filtering logic
  • podcast/assembly.py (new) – FFmpeg-based audio concatenation with ID3 metadata tagging
  • supabase/functions/podcast-rss/index.ts (new) – Deno edge function generating iTunes-compatible RSS feeds from podcast episodes
  • supabase/migrations/20260126_create_podcast_episodes.sql (new) – Database schema for podcast episodes with RLS policies
  • .github/workflows/podcast.yml (new) – Daily cron job (8 AM UTC) to generate podcasts with manual dispatch support
  • documentation/PODCAST_TECH_SPEC.md (new) – Technical architecture and cost analysis for the podcast pipeline
  • documentation/Product Spec.md (new) – Product vision and feature specification for Listen Later

Testing Infrastructure

  • tests/unit/web.test.js (new) – Jest tests for web app utility functions with mocked Supabase client
  • tests/unit/extension.test.js (new) – Tests for extension background script logic (voice selection, site name extraction, payload building)
  • tests/unit/podcast-rss.test.js (new) – Tests for RSS generation helpers (duration formatting, RFC-822 dates, XML escaping)
  • tests/e2e/web.e2e.test.js (new) – Puppeteer-based E2E tests loading the web app in headless Chrome with mocked Supabase
  • podcast/tests/test_script.py (new) – Pytest coverage for script generation, Gemini API interaction, markdown fence cleanup, and Supabase operations
  • podcast/tests/test_extract.py (new) – Tests for article fetching and text cleaning logic
  • podcast/tests/test_assembly.py (new) – Tests for audio assembly and ffmpeg command construction
  • podcast/tests/conftest.py (new) – Pytest configuration with Supabase client mocking
  • .github/workflows/pr-test.yml (new) – CI workflow running Python pytest and JavaScript Jest on pull

https://claude.ai/code/session_01WgxxrUffuvF1ZD2iXw89GK

…ough chrome extension.

feat: Configure Supabase credentials, improve single-user session handling, and enhance save operation feedback in the extension.
feat: Configure extension and update docs
feat(tts): Implement basic TTS with background service
…ability, and share target integration with IndexedDB and service worker.
…e submission logic into a reusable function.
Fix PWA Share Target & Improve UX
- Added `podcast/script.py`: Core logic for Gemini interaction and persona management.
- Added `podcast/requirements.txt`: Python dependencies for the podcast pipeline.
- Implemented Supabase integration for persisting generated scripts and metadata.
- Configured GitHub Secrets support for automated cloud runs.
…ngine

feat: AI Scriptwriting (Vibe Engine) Implementation
feat: Implement Audio Generation (Issue #8)
JordanTranchina and others added 28 commits February 22, 2026 23:49
feat: secure secrets and automate podcast generation
…te Supabase anonymous keys in JavaScript configurations.
…xtension

Update Supabase keys to modern publishable keys
…ith-persistent-episodes

Fix Podcast Generation and Artifact Upload
feat: Upload podcast audio to Supabase Storage (#26)
feat: Introduce comprehensive unit and E2E testing for web and podcast modules, along with CI integration.
- Add supabase/functions/podcast-rss/index.ts: Deno edge function that
  serves a valid RSS 2.0 / iTunes podcast feed from podcast_episodes table
  (HH:MM:SS duration, XML escaping, deployed to Supabase with --no-verify-jwt)
- Add tests/unit/podcast-rss.test.js: Jest unit tests for formatDuration,
  formatRFC822, escapeXml, and buildRssXml (92 tests passing)
- Add .claude/launch.json: dev launcher config for web server on port 8080
- Fix package.json: exclude .claude/worktrees from Jest test discovery

Closes #10
…neration

Use ffprobe (ships with ffmpeg) to read MP3 duration and os.path.getsize
for file size immediately after assembly, then persist both alongside the
audio_url in the podcast_episodes table.

- Add get_audio_metadata(file_path) -> (duration_seconds, size_bytes)
- Update update_episode_audio_url() to accept and write optional duration/size
- Update test_script.py: fix existing update test + add 4 new tests for
  get_audio_metadata (success path, ffprobe failure fallback) and the
  new duration/size update path
…pointers

feat: Add pytest.ini to set testpaths.
- Replace deprecated  with
   +
- Use  +
  with  instead of
   +
- Upgrade model alias from gemini-flash-latest to gemini-2.0-flash
- Update mocks in test_script.py to patch genai.Client
- Swap requirements.txt entry to google-genai

All 33 tests pass.
chore: migrate from google-generativeai to google-genai SDK
Two bugs prevented saves from reaching Supabase when sharing from Android:

1. Missing Authorization header in save.html caused RLS policy to reject
   the INSERT, silently falling back to the offline queue every time.

2. The offline pending queue (IndexedDB) was never synced back to the cloud.
   Added getPendingShares/deletePendingShare to db.js, implemented
   syncPendingShares() in app.js, and call it on init and on reconnect.

https://claude.ai/code/session_01WgxxrUffuvF1ZD2iXw89GK
@JordanTranchina JordanTranchina marked this pull request as ready for review March 28, 2026 16:51
@matbgn
Copy link
Copy Markdown

matbgn commented Mar 28, 2026

👀 Like those ideas, interested to see if @kbroose and his agent will accept this PR

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.

3 participants