Skip to content

Modernize: dart-define config, configurable model ids, tests, CI, cleanup - #1

Open
bluzername wants to merge 7 commits into
mainfrom
modernize
Open

bluzername wants to merge 7 commits into
mainfrom
modernize

Conversation

@bluzername

Copy link
Copy Markdown
Owner

What changed

Secrets and config

  • lib/core/config/env.dart reads SUPABASE_URL / SUPABASE_ANON_KEY via String.fromEnvironment. Debug builds assert with a clear message listing the missing defines; release builds log and run offline as before. Env.ensureConfigured() throws a StateError for callers that want a hard failure.
  • UserSettings.podcastFeedUrl derives from Env.supabaseUrl instead of a hardcoded project URL.
  • supabase/migrations/20260205_setup_daily_digest_cron.sql uses <SUPABASE_URL> / <SUPABASE_ANON_KEY> placeholders with a comment on substituting them or using Supabase Vault. No history rewrite; the old anon key remains in git history (public by design).
  • Added .env.example (app defines only) and supabase/functions/.env.example (Edge Function secrets and model ids). Kept them separate on purpose: everything in the app .env is compiled into the binary, so server-side keys must not go there. .gitignore un-ignores *.env.example.
  • ios/ci_scripts/ci_post_clone.sh now requires SUPABASE_URL / SUPABASE_ANON_KEY from the Xcode Cloud workflow environment and runs flutter build ios --config-only --release --no-codesign --dart-define=... after flutter pub get so Generated.xcconfig carries DART_DEFINES into the archive (fails fast if it does not). ios/scripts/validate_and_upload.sh does the same from .env via --dart-define-from-file. Neither script ran flutter build ios before; the archive step is unchanged.

Model ids

  • New supabase/functions/_shared/config.ts exposes CLAUDE_MODEL and GROK_MODEL from Deno.env with defaults; extract-article and generate-digest use them.
  • Claude default is anthropic/claude-haiku-4.5, confirmed against https://openrouter.ai/api/v1/models (the previous anthropic/claude-3.5-haiku is no longer in OpenRouter's list, so the deployed functions were likely failing on analysis).
  • Grok default stays grok-4-1-fast. https://docs.x.ai/docs/models no longer lists that id (current general models there: grok-4.6, grok-4.5, grok-4.3, grok-4.20; the only *-fast ids are grok-code-fast-*). I could not confirm which one supports x_search without an API key, so the default is unchanged and should be overridden with supabase secrets set GROK_MODEL=... after a quick test.

Dead files

  • Deleted jan29.md, UI_FIX_PLAN.md, ios/Flutter/Flutter 2.podspec, ios/Flutter/Generated 2.xcconfig, ios/Flutter/flutter_export_environment 2.sh (grep confirmed project.pbxproj does not reference the " 2" names), and supabase/functions/test-grok/.
  • Deleted supabase/migrations/001_initial_schema.sql. Diff against 20250129_initial_schema.sql showed 001 is NOT a subset: it alone defined processing_queue (which process-queue reads and writes), the on_article_created -> queue_article_processing trigger that feeds the queue, the on_auth_user_created -> handle_new_user trigger that creates user_settings, articles.error_message, update_article_status(), and a process-article-queue pg_cron entry with placeholder URLs. The still-used objects are preserved idempotently in a new 20250130_processing_queue.sql so a fresh supabase db push yields a schema the functions can run against. The pg_cron entries from 001 were not carried over (the digest cron has its own migration; the per-minute queue cron was placeholder-only).
  • .gitignore already covered ios/Flutter/Generated.xcconfig, flutter_export_environment.sh and .env.

Deps

  • Raised floors to the already-resolved versions (flutter_riverpod ^2.6.1, riverpod_annotation ^2.6.1, riverpod_generator ^2.6.5, go_router ^13.2.5, supabase_flutter ^2.15.4) and bumped flutter_markdown ^0.7.7, just_audio ^0.10.6, audio_session ^0.2.4, intl ^0.20.2, flutter_lints ^5.0.0.
  • pubspec.lock was gitignored; it is now tracked for reproducible CI and release builds.

Tests and CI

  • test/ with 27 unit tests: model JSON parsing/defaults/round-trips (Article, ArticleAnalysis, DailyDigest, PodcastEpisode, UserSettings), RestrictedDomains provider detection, and Env behaviour without defines.
  • .github/workflows/ci.yml: Flutter 3.27.3 (matches ci_post_clone.sh), pub get, analyze, test. .github/dependabot.yml for pub and github-actions (no package.json in the repo, so no npm entry).

Docs and naming

  • README rewritten from the code: pipeline, layout, dart-define setup, Edge Function secrets table, model env vars, Xcode Cloud and local release flow, podcast feature. Claude badge fixed.
  • "Saving to Readwise..." toast in the Android share activity now says ReadZero. Remaining "readwise" mentions are the Android package path com.readwise.share and supabase/config.toml project_id, both non-user-facing and left alone.

What was verified

Command Result
flutter analyze (before, origin/main) 80 issues: 0 errors, 7 warnings, 73 infos
flutter analyze (after) 56 issues: 0 errors, 7 warnings, 49 infos (drop is flutter_lints 5 retiring prefer_const_constructors; no new rules fire; nothing in test/)
flutter test 27 tests, all passed
flutter pub get / flutter pub upgrade resolves; 6 dependencies changed
deno check supabase/functions/_shared/config.ts passes
deno check on the three functions 13 errors before and after (all pre-existing catch (error) unknown-typing)
deno lint supabase/functions/_shared/config.ts passes
sh -n / bash -n on both iOS scripts ok
grep for the old project URL / anon JWT in tracked files no hits
em dash (U+2014) scan of every changed file clean

Not verified: an actual Xcode Cloud run or flutter build ios (needs signing); runtime behaviour of just_audio 0.10 / audio_session 0.2 on device.

What was skipped and why

  • riverpod 3 and go_router 18 migrations: major API changes, out of scope for this PR (L item).
  • flutter_local_notifications 16 -> 19+, flutter_secure_storage 9 -> 10+, share_plus, google_fonts, cached_network_image majors: major bumps, not attempted.
  • Deno CI job: deno lint reports 33 problems (22 no-explicit-any, 8 no-unused-vars, 2 no-empty, 1 prefer-const) and deno check 13 type errors on the existing functions, so a job would be red on day one.
  • Cron key via Vault: not switched, since I cannot run it against the database; placeholder plus comment instead.
  • flutter analyze --no-fatal-warnings is passed in CI because of 7 pre-existing warnings (unused imports/fields/locals in article_detail_screen.dart, discover_card.dart, web_login_screen.dart).

Follow-ups

  • Set SUPABASE_URL and SUPABASE_ANON_KEY on the Xcode Cloud workflow before the next cloud build, then confirm DART_DEFINES shows up in the post-clone log.
  • Pick and set GROK_MODEL after testing x_search against a current xAI model id.
  • Fix the 7 analyzer warnings and drop --no-fatal-warnings from CI.
  • Type the Edge Function catch blocks (error: unknown) so deno check passes, then add a Deno job.
  • Migrate flutter_riverpod 2 -> 3 and go_router 13 -> 18; then the other major bumps.
  • The app calls generate-podcast and podcast-feed functions and a podcast_episodes table plus user_settings.podcast_token that are not in this repo (no migration or function source). Commit them or document where they live.
  • supabase_flutter deprecates anonKey in favour of publishableKey.

…tes and debug function

- Delete jan29.md and UI_FIX_PLAN.md (dated AI-session notes)
- Delete supabase/migrations/001_initial_schema.sql; the dated
  20250129_initial_schema.sql is canonical. Objects that only 001 defined
  and that the code still uses (processing_queue, article queue trigger,
  handle_new_user trigger, articles.error_message, update_article_status)
  are preserved idempotently in 20250130_processing_queue.sql
- Delete ios/Flutter '* 2.*' duplicates (not referenced by project.pbxproj)
- Delete supabase/functions/test-grok debug function
- Fix user-facing 'Saving to Readwise' toast in the Android share activity
…constants

- Env reads SUPABASE_URL and SUPABASE_ANON_KEY via String.fromEnvironment;
  debug builds assert with a clear message when they are missing, release
  builds log and run offline as before
- Podcast feed URL is derived from Env.supabaseUrl
- Daily digest cron migration uses <SUPABASE_URL>/<SUPABASE_ANON_KEY>
  placeholders (with a Vault note) instead of a committed key
- Add .env.example (app defines) and supabase/functions/.env.example
  (Edge Function secrets and model ids); un-ignore *.env.example
- Xcode Cloud ci_post_clone.sh and validate_and_upload.sh write the defines
  into Generated.xcconfig with flutter build ios --config-only
- Stop ignoring pubspec.lock (committed in a later change)
- Add supabase/functions/_shared/config.ts reading CLAUDE_MODEL and
  GROK_MODEL from the environment with defaults
- Default Claude model is anthropic/claude-haiku-4.5 (confirmed against
  the OpenRouter model list; anthropic/claude-3.5-haiku is no longer listed)
- Default Grok model stays grok-4-1-fast; override with the GROK_MODEL secret
- extract-article and generate-digest use the shared values
- Raise floors to the currently resolved versions for flutter_riverpod,
  riverpod_annotation, riverpod_generator, go_router and supabase_flutter
- Bump flutter_markdown ^0.7.7, just_audio ^0.10.6, audio_session ^0.2.4,
  intl ^0.20.2 and flutter_lints ^5.0.0
- Track pubspec.lock for reproducible CI and release builds
- flutter analyze: 80 issues before (0 errors, 7 warnings), 56 after
  (0 errors, 7 warnings); no new lint rules fire
- Article, ArticleAnalysis, DailyDigest, PodcastEpisode and UserSettings
  JSON parsing, defaults and round-trips
- RestrictedDomains provider detection and login URLs
- Env behaviour for a build without dart-defines
- 27 tests, flutter test passes
- Flutter 3.27.3 (matches Xcode Cloud): pub get, analyze, test
- Dependabot for pub and github-actions, weekly
- No Deno job: deno lint (33 problems) and deno check (13 pre-existing
  type errors) currently fail on the Edge Functions
- Document dart-define setup, Edge Function secrets, model env vars,
  Xcode Cloud and local release flow
- Describe the actual pipeline (share extension, processing queue,
  extract-article, generate-digest, podcast playback)
- Fix the Claude badge (Haiku 4.5 via OpenRouter) and add App Store,
  website and CI links
@vercel

vercel Bot commented Sep 17, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
v0-read-zero Building Building Preview, v0 Sep 17, 2026 4:32am UTC

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.

1 participant