Yusuf Suleman 49c9b7871c
All checks were successful
Security Checks / dependency-audit (push) Successful in 13s
Security Checks / secret-scanning (push) Successful in 4s
Security Checks / dockerfile-lint (push) Successful in 4s
fix: Reader architecture overhaul — persistent WKWebView, stable layout, local-first state
Root-cause investigation identified 5 architectural issues. This commit
fixes all of them with structural changes, not patches.

## 1. Persistent ArticleRenderer (fixes first-article freeze)

BEFORE: Every article tap created a new WKWebView with a new
WKWebViewConfiguration and a new WKProcessPool. Each spawned a
WebContent process (~3s). The "warmer" used a different config,
warming a different process — useless.

AFTER: Single ArticleRenderer singleton owns one WKWebView with
one shared WKProcessPool + WKWebViewConfiguration. Created at app
launch via `_ = ArticleRenderer.shared` in ContentView.task.
ArticleWebView wraps the shared WKWebView in a container UIView.
SwiftUI owns the container lifecycle, not the WKWebView's.
Zero process launches after first warm-up.

## 2. Stable Reader layout (fixes tab jitter)

BEFORE: Sub-tabs and feed chips were conditionally rendered
(`if !vm.isLoading || !vm.entries.isEmpty`). When loading finished,
~80px of UI appeared suddenly, causing layout shift that rippled
to the tab bar.

AFTER: Sub-tabs and feed chip bar ALWAYS render. Feed chip bar has
fixed height (44px). No conditional wrappers in the layout hierarchy.
Content area shows LoadingView during fetch. Chrome never changes shape.

## 3. Local-first state updates (fixes mark-read lag)

BEFORE: markAsRead made 3 sequential API calls (mark, re-fetch entry,
re-fetch counters). toggleRead and toggleStar did the same. Each
action had 3 network round-trips before UI updated.

AFTER: Mutate local entries array immediately (status/starred are
now var). API sync happens in background via Task.detached. UI updates
instantly. Counter refresh happens async.

## 4. Atomic list replacement (fixes empty flash)

BEFORE: loadEntries(reset:true) set `entries = []` then
`entries = newList`. Two mutations = empty state flash + full
LazyVStack teardown/rebuild.

AFTER: Never clear entries. Fetch completes, then single atomic
`entries = newList`. SwiftUI diffs by Identifiable.id — only
changed rows update.

## 5. Reserved thumbnail space (fixes card layout jump)

BEFORE: AsyncImage default case was EmptyView() (0px). When image
loaded, 180px appeared. Cards jumped.

AFTER: Default case renders a placeholder Rectangle at 180px.
Card height is stable from first render.

## Additional: Pre-load moved off TabView

`.task { await readerVM.loadInitial() }` moved from TabView
(caused observable mutations during TabView body evaluation,
contributing to tab bar jitter) to the outer ZStack.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-03 21:17:41 -05:00

Gitea CI Workflows

security.yml

Runs on push/PR to master. Three jobs:

  1. dependency-auditnpm audit --audit-level=high for budget and frontend
  2. secret-scanning — checks for tracked .env/.db files and hardcoded secret patterns
  3. dockerfile-lint — verifies all Dockerfiles have USER (non-root) and HEALTHCHECK

Runner Setup

The runner is configured in the Gitea docker-compose at /media/yusiboyz/Media/Scripts/gitea/docker-compose.yml.

What was done:

  1. Added [actions] ENABLED = true to Gitea's app.ini
  2. Added runner service (gitea/act_runner) to Gitea's docker-compose
  3. Generated runner token via docker exec -u git gitea gitea actions generate-runner-token
  4. Token stored in /media/yusiboyz/Media/Scripts/gitea/.env as RUNNER_TOKEN
  5. Runner registered as platform-runner with labels: ubuntu-latest, ubuntu-24.04, ubuntu-22.04

To regenerate token (if needed):

cd /media/yusiboyz/Media/Scripts/gitea
docker exec -u git gitea gitea actions generate-runner-token
# Update .env with new RUNNER_TOKEN value
docker compose up -d runner

To check runner status:

docker logs gitea-runner
Description
Second Brain Platform - Dashboard, Fitness, Budget, Inventory, Trips, Reader, Media
Readme 31 MiB
Languages
Svelte 51.2%
Python 24.2%
Swift 13.5%
JavaScript 5.4%
TypeScript 3.3%
Other 2.4%