Formosa ESG 2026 — Project Development Record
Development Record

Formosa ESG 2026
Baishatun Mazu Pilgrimage GPS Tracking System — Project Development Record

From Proof of Concept to 10,000-User System: 26-Day Journey Including Live Operations

Version 1.2 Coverage Period: 2026/03/23 — 2026/04/17 Last Updated: 2026/04/17 Formosa ESG Project Team
26
Dev + Live-Ops Days
6
Development Phases
5
Pre-Launch Audit Rounds
179+
Issues Resolved
4
Locales Supported

1. Project Overview

"Formosa ESG 2026 Baishatun Mazu Pilgrimage GPS Tracking System" is a pilgrimage tracking service combining GPS positioning, carbon footprint estimation, and community interaction. Pilgrims log in via LINE, use their phones for real-time check-ins, accumulate mileage, view level progress, and can share personalized achievement cards. The system also provides an admin dashboard with live maps, push notifications, user management, and other backend functions.

The technical architecture uses Astro (frontend SSG) + Cloudflare Pages + Workers + D1 (SQLite) + KV (caching and buffering), combined with LINE LIFF SDK for login and sharing integration. The system is designed to handle 10,000 concurrent users.

Event Date
2026/04/12 Departure
Event Duration
~8-9 days (at Mazu's will)
Capacity Target
10,000 concurrent users
Supported Locales
zh-Hant / en / ja / zh-Hans
Frontend Framework
Astro + Cloudflare Pages
Backend Architecture
Workers + D1 + KV

2. Development Phase Overview

PhaseDateCore ObjectivesStatus
Phase 0 03/23 PoC: EXIF GPS reading, D1 write feasibility Done
Phase 0.5 03/24 MVP:16-question survey + GPS check-in + carbon footprint + achievement card + LINE webhook Done
Phase 1 03/25 UX overhaul: One-question-per-page cards + 9-tier levels + LIFF + share cards + Dashboard Done
Phase 1.5 03/25–26 Security hardening + Dashboard + LIFF Published + Workers Paid upgrade Done
Phase 2 03/25–26 4 load test rounds + D1 bottleneck analysis + KV Buffer architecture design Done
Phase 3 03/27–04/05 Pre-launch: KV Buffer implementation + GPS Pipeline Fix + permission system + push notifications + docs Deployed
Phase 4 04/01–07 Feature refinement: achievement card rules + survey optimization + Issue fixes + cost optimization Deployed
Phase 5 04/08–11 5 rounds of Pre-Launch Audit + segmented push + Issue #155 auto-synced dashboard Completed
Live Ops 04/12– Post-launch operations: hotfixes #168/#171/#172 + governance v4.8→v4.12 + post-event branch isolation In Progress

3. Daily Work Log

DatePhaseWork ItemStatus
03/23
Day 1
Phase 0 EXIF GPS coordinate reading PoC (browser-side EXIF.js) Done
Phase 0 Cloudflare D1 database creation + Workers API endpoints Done
Phase 0 Project page framework (Astro SSG + Cloudflare Pages) Done
03/24
Day 2
Phase 0.5 16-question ESG survey (one-question-per-page card workflow) Done
Phase 0.5 GPS check-in feature + carbon footprint calculation engine Done
Phase 0.5 Achievement card system (check-in point visualization) Done
Phase 0.5 LINE Bot webhook integration (Messaging API) Done
Phase 0.5 Cloudflare Workers CORS fix + deployment verification Done
03/25
Day 3
Phase 1 UX overhaul: one-question-per-page + linear progress bar + swipe animations Done
Phase 1 9-tier pilgrim level system (cultivation → ascension), dual conditions: km + check-in count Done
Phase 1 9 AI-generated mascot images (replace emoji level icons) Done
Phase 1 LINE LIFF SDK integration (Login channel + init) Done
Phase 1 Share card (vertical layout + map + QR code + mascot + stats) Done
Phase 2 Load test R1: HTTP layer C-10K ~ C-100K all PASS Done
03/26
Day 4
Phase 1.5 Dashboard: heatmap + clustering markers + front/tail + 3 mode switching Done
Phase 1.5 Security hardening: AuthGate + Admin Token API verification Done
Phase 2 Load test R2: 800 VU sweet spot confirmed (99.99% success) Done
Phase 2 Load test R3: D1 write bottleneck verification (SQLite single-writer lock) Done
Phase 2 Load test R4: real-world scenario simulation (CF-800 PASS / RW-500 Data API bottleneck) Done
03/27–28
Day 5–6
Phase 3 Carbon footprint daily reporting frontend + dynamic OG Image generation Done
Phase 3 Mascot image 4x resolution upgrade + Dashboard AuthGate fix Done
Phase 3 7 UX fixes (photo thumbnails / FB sharing / GPS persistence, etc.) Done
Phase 3 Feature inventory: 23-item Done list compiled Done
03/29
Day 7
Phase 3 Privacy consent mechanism (P0) + pause/Done status Done
Phase 3 Carbon footprint simplified to 2-tier structure (zero-emission vs motorized transit) Done
Phase 3 QR Code replaced with NET-ZERO logo + FB OG Image fix Done
Phase 3 User guides converted to web pages (pilgrim version + admin version) Done
Phase 3 LINE Bot guidance link integration Done
Phase 3 Event photo archival feature + FB share fbclid fix Done
03/30
Day 8
Phase 3 Event photo archival button UX improvement (clear save button) Done
Phase 3 Personalized FB OG Image implementation Done
Phase 3 Test mode banner + photo saving bug fix Done
03/31
Day 9
Phase 3 Comprehensive GPS data pipeline fixes GP-1 ~ GP-9 (commit 8f08e5d) Deployed
Phase 3 KV Buffer architecture implementation: Checkin → KV → Cron batch INSERT D1 Deployed
Phase 3 Accommodation carbon coefficient update: 12.5 → 8.85 kgCO₂e/night Done
04/01–02
Day 10–11
Phase 4 Survey optimization Q16 → Q10 (reduced 6 questions + renumbered) Deployed
Phase 3 Three-tier permission system launched: Owner / Manager / Volunteer Deployed
Phase 3 Dashboard access logging (fire-and-forget KV logging) Done
Phase 4 Achievement card threshold: check-in ≥3 times + completed survey + phone number Done
04/03–04
Day 12–13
Phase 3 mazu.today Custom Domain launched (Worker routing + DNS) Deployed
Ops RFC #100: HealthAlert + Service Worker + Offline Fallback verification Deployed
Ops Issue #99:8 resilience improvements (Promise.allSettled, localStorage fallback, etc.) Deployed
Ops Issue #102: Dual auth system alignment (KV invite code + Worker secret unified) Deployed
Phase 3 LIFF Channel → Published (available to all users) Deployed
04/05
Day 14
Ops Issue #103: Carbon motorized transit coefficient correction 0.47515 → 0.12013 kg CO₂e/person·km Deployed
Ops Issue #105:Push supports image + image+text formats(commit 35945cd) Deployed
Ops Issue #106:Volunteer visibility fix (hide only push + user list) Deployed
Ops Worker full deployment confirmed (Version 342af8b0) Deployed
Phase 4 Cloudflare cost analysis: $44.63/month, KV ops account for 84% Done
04/06–07
Day 15–16
Phase 4 KV cost optimization Plan A: Remove TICKER_KV.delete() (commit a4b6fd2) Deployed
Phase 4 Pre-Launch Checklist generated (7 categories, 34 items) Done
Phase 4 Complete tech docs inventory + public deployment plan (/docs/ + /verification/) Done
Phase 4 mazu.today Redirect Rules reconnaissance completed (Cloudflare Dashboard solution confirmed) Done
04/08–09
Day 17–18
Phase 4 Issue #141: Segmented push notifications + LIFF OA guidance + Secrets audit Deployed
Phase 4 Issue #120: Push image upload (R2 storage) + Wiki Phase 3–4A Deployed
Ops Dashboard migrated to GitHub Issue #155 + sync-dashboard Action auto-sync Done
04/10
Day 19
Ops Pre-Launch Audit R3: Data quality + defensive resilience (computeFilteredKm + VALID_SOURCES fix, Worker deploy 174bace0) Deployed
Ops Issue #162: Today's Good Footprint API verification passed Done
Ops CI/CD audit + Governance Framework Phase 1–2.5 completed (Dashboard + API + KV seed) Deployed
04/11
Day 20
Ops Pre-Launch Audit R4: User journey + edge personas + operational resilience (P0=0, P1=4 all fixed, Worker deploy 876dddbd) Deployed
Ops Issue #163: GPS drift + straight-line trajectory fix (speed outlier filter + accuracy filtering) Deployed
Ops Issue #161: Share footprint link fix (race condition — lineUserId captured as null before LIFF async) Deployed
Ops Pre-Launch Audit R5: Full codebase health check + fixes (P0×2 + P1×6 all fixed, commit 9fa6c9d) Done
Ops All 5 rounds of Pre-Launch Audit completed ✅ — core check-in path solid, offline mechanism intact, no dead routes Done
04/12
Day 21 — Departure
Ops 🎉 Baishatun Gongtian Temple departure, system officially live (Worker version 8148bac5) Deployed
Ops Departure-day wipe: D1 test data cleared (users 143→0, gps 1140→0, surveys 20→0) + KV gps: buffer 9,255 keys bulk-deleted Done
Ops Feedback governance Phase A: formosa-feedback skill Step 6.5 exit gate + session-handoff v4.4 reconciliation + 7 legacy triaging entries PATCH-fixed Deployed
Ops Phase B batch-update.yml live: file-based trigger flow (Chat research → Cowork proposal → Code impl → Cowork verify), commit 57024b2 Deployed
04/13
Day 22
Ops Issue #168 GPS phantom mileage fix (commit 9160a69) — /track/sync geofence + WHERE source != 'remote' filter; spawned guardrail #13 (new endpoint protection inheritance), session-handoff upgraded to v4.8 Deployed
04/14
Day 23
Ops Issue #170 pushHours phantom deployment incident: cross-repo truth verification failure; spawned guardrail #14 + Code tri-state declaration spec, session-handoff upgraded to v4.9 Done
Ops Issue #171 personal footprint carbon field fix (commit 93fb621) — wrong carbon_kg binding; deployed, awaiting LIFF real-device verification Deployed
Ops Governance framework Code-First audit landed: session-handoff v4.9 consolidates Code/Cowork tri-state declaration + deferred-trigger behavior verification Done
04/15
Day 24
Ops Issue #172 web/LINE dual-rank desync fix (commit a389dd6) — root cause: cross-browser localStorage isolation + Stats API fallback trap (Math.max(len, 1) returns 1 for empty array); spawned #174 AuthGate bypass + #175 auto-close.yml injection Deployed
Ops Three direct feedback reports triaged: #177 GPS not logged south of Changhua / #178 LIFF persistence affecting LINE groups+calls / #179 camera entry missing + album missing — all post-event labeled; established live-ops principles: silent fix over user-facing warnings, deploy only if backend-only and zero user-visible side-effects Scheduled
04/16
Day 25
Ops Cowork sweep + Code Formosa post-event batch fix: Batch 1 (#175 auto-close.yml injection) merged to main (0aeb496); Batch 2+3 (#177/#178/#173/#174/#179) isolated on fix/formosa-post-event branch for post-event merge+deploy Isolated
Ops Impact Fence (live-ops code barrier) established: 🟢 Safe Zone (CI/CD) → main directly / 🔴 Live Zone (frontend + Worker) → fix/formosa-post-event isolation Done
04/17
Day 26
Ops CI race condition systemic fix (commit 70173b2): seo-index.yml + ai-ready-opt.yml gained concurrency group + 3-retry pull --rebase loop, rooting out workflow_run chain-triggered self-race Deployed
Ops Cowork governance v4.12 landed: dashboard carrier renamed (Apple Notes → Issue #155 single source of truth); added Phase version history v4.7→v4.12 + guardrails #12–#14 lineage Done

4. Load Test Results Summary

Conducted 4 rounds of load testing using Grafana k6 (2026/03/25–26) to verify system performance under high concurrency. Test environment: MacBook Air local + Cloudflare Workers production.

RoundDateTest FocusVU RangeKey Results
R1 03/25 HTTP Layer Limits 10K–100K S-BURST / S-WAVE / S-EXTREME all PASS; 5,000 VU 91% success rate
R2 03/25 Capacity Sweet Spot 200–1,200 800 VU = 99.99% success rate (sweet spot); 1,200+ starts declining; recovery test 54%
R3 03/26 D1 Write Bottleneck 500 DI-500 confirms D1 SQLite single-writer lock; real-time success rate 42%; latency +51%
R4 03/26 Real-World Scenario Simulation 500–800 CF-800 (direct D1 write) 100% PASS; RW-500 (mixed load) 60% FAIL = Data API bottleneck

Root Cause & Solutions

R3-R4 tests confirmed the root cause is D1 SQLite's single-writer lock, causing serialization bottlenecks at high concurrency. Solution adopts KV Buffer architecture:

Solution 1 — KV Buffer
Write check-ins to KV (not D1), key = gps:{ts}:{userId}:{randomId}
Solution 2 — Cron Flush
Batch flush KV → D1 every 5 minutes, INSERT OR IGNORE prevents duplicates
Solution 3 — Data API Cache
Stats first check KV cache (TTL 60s), miss then query D1

All three solutions deployed and verified as of 2026/03/29.

5. GPS Data Pipeline Fixes

On 2026/03/31, performed comprehensive GPS data pipeline fixes (commit 8f08e5d), covering 9 improvements:

ItemFix ItemDescription
GP-1Auto-track persistencelocalStorage Status persists across sessions
GP-2Batch Batch uploadAccumulated offline check-ins uploaded in batch
GP-3Sync endpointFrontend ↔ Worker data sync API
GP-4GPS accuracy filteringauto-skip if accuracy > threshold
GP-5Speed detection≤15 km/h zero-emission / >15 km/h motorized transit
GP-6Distance calculation fixHaversine formula + mileage accumulation
GP-7Timestamp standardizationUTC → ISO 8601 unified format
GP-8Duplicate check-in protectionTime interval + location distance dual check
GP-9Error RecoveryNetwork interruption auto-retry + error reporting

6. Carbon Footprint Model

Carbon footprint uses GPS speed auto-detection to classify pilgrimage movement into zero-emission (walking/cycling) and motorized transit. Motorized transit carbon coefficient is academically corrected using ecoinvent "market for transport, regular bus" dataset.

Zero-emission (≤15 km/h)
0 kg CO₂e / person·km
Motorized transit (>15 km/h)
0.12013 kg CO₂e / person·km
Accommodation carbon
8.85 kg CO₂e / night
Data source
ecoinvent — regular bus (person·km)

Carbon data includes "estimate" notation and disclaimers, provided for user reference but not as official carbon accounting. Carbon coefficient was corrected and deployed in Issue #103 (old value 0.47515 kg CO₂e/km was vehicle-km basis, semantically incorrect).

7. Infrastructure & Operations

mazu.today Independent Domain

2026/04/03–04 mazu.today Custom Domain launched, reverse-proxied via Cloudflare Workers to paulkuo.tw/projects/formosa-esg-2026/. Covers DNS setup, Worker routing, i18n path mapping, webhook URL migration, etc. All LINE push links now use mazu.today.

Permission System

Three-tier role permissions: Owner (full admin rights), Manager (push + user management), Volunteer (view-only Dashboard maps & stats, no push or user list). Via KV invite code mechanism distributes invite codes, unified with Worker secret unified verification.

Cloudflare Cost Analysis

Monthly cost (03/05–04/04)
$44.63 USD
Largest item
KV ops account for 84%
Estimated for 10K users
~$46/month (controllable)
Estimated after optimization
~$27/month (Plan A removes delete ops)

Other Infrastructure

Workers Paid plan upgraded ($5/month), removed 100K/day request limit. LIFF Channel published to Published Status. LINE OA upgraded to Medium tier (3,000 messages/month). Dashboard push supports text, template, and image formats.

8. Key Issue Tracking

IssueTitleRiskStatus
#998 system resilience improvements (error handling, Promise.allSettled, localStorage fallback) L1Deployed
#100RFC — HealthAlert + Service Worker + Offline Fallback L2Deployed
#101_redirects dual domain redirect loop (emergency revert) L3Reverted
#102Dual auth system alignment (KV invite code + Worker secret) L2Deployed
#103Carbon motorized transit coefficient correction (ecoinvent person·km basis) L2Deployed
#105Push supports image + image+text formats L1Deployed
#106Volunteer visibility scope fix L1Deployed
#107/verification/ checklist page L1Deployed
#108/docs/ documentation center + Footer expansion L1Deployed
#120Push image upload (R2 storage) L1Deployed
#141Segmented push + LIFF OA guidance L2Deployed
#161Share footprint link race condition fix L2Deployed
#162Today's Good Footprint API verification L1Done
#163GPS drift + straight-line trajectory fix L2Deployed
#168GPS phantom mileage (stationary users accumulating fake km) — geofence + source filter L2Deployed
#170pushHours phantom deployment incident — cross-repo truth verification (spawned guardrail #14) L2Done
#171Personal footprint carbon_kg field mis-binding fix L1Deployed
#172Web/LINE dual-rank desync (localStorage isolation + fallback trap) L2Deployed
#173Dashboard Mazu location marker missing L1post-event branch
#174AuthGate bypass suspected L2post-event branch
#175auto-close.yml Expression injection — gh api replaces shell heredoc L1Deployed
#177GPS not logged south of Changhua (Vivo OriginOS power-saving hypothesis) L1post-event branch
#178LIFF persistence affects LINE groups+calls L1post-event branch
#179Photo upload: camera entry missing + album missing L1post-event branch

9. Delivered Documents

Document NameVersionPurposeStatus
Pilgrim User Guidev0.4General user operation guide Live
Admin User Guidev0.5Dashboard operation + push notifications + user management Live
FAQv1.0User self-help troubleshooting Live
Privacy Policyv1.0Data Collection and Privacy Live
Pre-Launch Checklistv1.0Partner / Sponsor reference Done
Project Development Record (this document)v1.0Complete development journey record Done
Volunteer User GuideVolunteer operation guide Deployed

10. Development Milestones

03/23 — Project Launch
PoC complete, EXIF GPS reading + D1 write feasibility confirmed
03/24 — MVP Live
Survey + GPS check-in + carbon footprint + achievement card + LINE Bot,Zero to functional in 24 hours
03/25 — Major UX Overhaul
One-question-per-page card workflow, 9-tier level system, LIFF integration, share cards, Dashboard map. Load test R1 completed same day
03/26 — Load Tests Complete
R2-R4 complete, confirmed D1 bottleneck and KV Buffer solution direction
03/29 — KV Buffer Verified
All three solutions deployed and verified: KV Buffer, Cron Flush, Data API Cache
03/31 — GPS Pipeline Fix
GP-1 ~ GP-9, 9 fixes deployed, data quality significantly improved
04/03 — mazu.today Live
Independent domain live, brand recognition improved, all LINE links migrated
04/05 — Full Deployment
RFC #100 + Issues #99 / #102 / #103 / #105 / #106 deployed together. Open issues resolved
04/07 — Pre-Launch Review
Checklist complete, tech docs inventory, cost optimization Plan A deployed.5 days until departure
04/08–09 — Feature Completion + Governance
Segmented push live, push image R2 storage, Dashboard migrated to GitHub Issue #155 auto-sync
04/10 — R3 Audit + Fix
Data quality + defensive resilience audit, computeFilteredKm + VALID_SOURCES fix deployed, Governance Framework live
04/11 — All 5 Audit Rounds Complete ✅
R4 + R5 audit + fixes done, Issues #161/#163 closed.Core path solid, 1 day to departure
04/12 — Departure Day 🎉
Departure from Baishatun Gongtian Temple. System officially live (Worker 8148bac5). D1 test data wiped (users 143→0, gps 1140→0, surveys 20→0), KV buffer 9,255 keys bulk-deleted, Phase A feedback governance (exit gate + batch-update.yml) deployed.
04/13 — Issue #168 Phantom Mileage Fix
Stationary users accumulating fake km → root cause: v1 GPS pipeline missing speed filter. Fixed (commit 9160a69). Guardrail #13 added, skill upgraded to v4.8.
04/14 — Issue #170 Phantom Deploy + #171 Carbon Field
pushHours phantom deploy incident (cross-repo truth drift). Guardrail #14 added, skill upgraded to v4.9. Issue #171 personal footprint page carbon_kg field mismatch fixed (commit 93fb621).
04/15 — Issue #172 Dual-Rank Root Cause
Wu Xin-tien case: personal page vs. leaderboard showing different levels. Root cause: localStorage isolation between LIFF/Safari + Math.max(len, 1) fallback trap. Fixed (commit a389dd6). Feedback pipeline full-coverage triage completed.
04/16 — Post-Event Branch Strategy
Impact Fence established: Batch 1 (backend-only #175) merged to main (0aeb496); Batches 2 & 3 (frontend + Worker changes #173/#174/#177/#178/#179) isolated on fix/formosa-post-event branch for post-event merge. Live-ops bar: backend-only + zero user-visible side-effect.
04/17 — CI Race Fix + Governance v4.12
batch-update.yml concurrency group + pull --rebase retry fix (commit 70173b2). Cowork governance upgraded to v4.12: live-ops deploy gate + silent-fix principle + cross-session truth reconciliation.Phase 5 live-operations running stable — Day 6 of pilgrimage.

Formosa ESG 2026 — Baishatun Mazu Pilgrimage GPS Tracking System

mazu.today  |  This Document Version 1.2  |  Last Updated 2026/04/17

隱私權聲明問題回報
EN