52d774f0f9
On Darwin, synchronous=FULL (the WAL default) only issues a plain fsync(), which Apple documents does NOT guarantee writes reach stable storage or stay ordered. SQLite's WAL corruption-safety guarantee assumes the OS honors the fsync barrier; macOS does not unless the app uses F_FULLFSYNC. During a launchd *system* shutdown the page cache is dropped (effectively power-loss for in-flight pages), so a WAL checkpoint whose fsync 'reported' durable may never hit the platter — corrupting state.db with a malformed image. That is the trigger in #30636 ('SIGTERM during launchd shutdown under high load'). Apply PRAGMA checkpoint_fullfsync=1 (macOS-guarded) in apply_wal_with_fallback. It forces the F_FULLFSYNC barrier only at checkpoint boundaries (where WAL frames land in the main DB), so cost amortizes to ~+0.1ms/commit vs ~+4ms for the broader fullfsync=1. No-op off Darwin (F_FULLFSYNC is macOS-only). Root-cause analysis by @catapreta on #30636. Supersedes #30654, whose synchronous=FULL is a no-op (already FULL in WAL mode) and whose TRUNCATE-on-close is already on main. Co-authored-by: catapreta <catapreta@users.noreply.github.com>