Repository Analysis

benbjohnson/litestream

Streaming replication for SQLite.

1.5 Likely human-written View on GitHub
1.5
Adjusted Score
1.5
Raw Score
100%
Time Factor
2026-05-29
Last Push
13,660
Stars
Go
Language
105,049
Lines of Code
262
Files
114
Pattern Hits
2026-05-31
Scan Date

Score History

Severity Breakdown

CRITICAL 1HIGH 0MEDIUM 6LOW 107

Pattern Findings

114 matches across 7 categories. Click a row to expand file-level details.

Over-Commented Block68 hits · 66 pts
SeverityFileLineSnippet
LOWcompactor.go21
LOWdb.go41 DefaultSyncBackoffMax = 5 * time.Minute // Maximum backoff between retries
LOWdb.go81 syncedSinceCheckpoint bool
LOWdb.go141 // A forced truncation checkpoint will block new transactions and wait for
LOWreplica_test.go101//
LOWreplica_client.go21 Type() string
LOWreplica.go521
LOWdb_internal_test.go1221// After bulk inserts trigger a checkpoint, litestream should NOT enter a self-perpetuating
LOW.goreleaser.yml181 # - main
LOWvfs.go1701// SetWriteEnabledWithTimeout enables or disables write support at runtime with an optional timeout.
LOWv3.go141}
LOWcmd/litestream-test/scripts/reproduce-critical-bug.sh1#!/bin/bash
LOWs3/replica_client.go381
LOWtests/integration/profile_test.go21 _ "modernc.org/sqlite"
LOWtests/integration/overnight_s3_soak_test.go21// Requirements:
LOWtests/integration/minio_soak_test.go21// Can be shortened with: go test -test.short (runs for 30 minutes)
LOWtests/integration/shutdown_retry_test.go21 "syscall"
LOWetc/litestream.yml1# AWS credentials
LOWetc/litestream.yml21# # Optional TLS configuration:
LOWinternal/resumable_reader.go21// During restore, the LTX compactor opens all LTX file streams upfront, then
LOW.github/workflows/release.yml221 # - name: Checkout
LOW.github/workflows/release.yml241 # security create-keychain -p actions temp.keychain
LOW.github/workflows/release.yml261
LOW.github/workflows/release.yml281 # WINDOWS_CERTIFICATE_PASSWORD: ${{ secrets.WINDOWS_CERTIFICATE_PASSWORD }}
LOWwebdav/replica_client.go181}
LOWwebdav/replica_client.go201//
LOWwebdav/replica_client.go221// 4. Upload using WriteStreamWithLength() with Content-Length header
LOW_examples/library/s3/main.go1// Example: Litestream Library Usage with S3 and Restore-on-Startup
LOWsrc/sqlite3.h81# define SQLITE_APICALL
LOWsrc/sqlite3.h441**
LOWsrc/sqlite3.h461#define SQLITE_CANTOPEN 14 /* Unable to open the database file */
LOWsrc/sqlite3.h501#define SQLITE_IOERR_SHORT_READ (SQLITE_IOERR | (2<<8))
LOWsrc/sqlite3.h521#define SQLITE_IOERR_SEEK (SQLITE_IOERR | (22<<8))
LOWsrc/sqlite3.h541#define SQLITE_CANTOPEN_FULLPATH (SQLITE_CANTOPEN | (3<<8))
LOWsrc/sqlite3.h561#define SQLITE_CONSTRAINT_TRIGGER (SQLITE_CONSTRAINT | (7<<8))
LOWsrc/sqlite3.h601#define SQLITE_OPEN_URI 0x00000040 /* Ok for sqlite3_open_v2() */
LOWsrc/sqlite3.h661** read of the first page to access the database header.
LOWsrc/sqlite3.h1221** database is not a temp db, then the [SQLITE_FCNTL_RESET_CACHE] file-control
LOWsrc/sqlite3.h1241#define SQLITE_FCNTL_TEMPFILENAME 16
LOWsrc/sqlite3.h1261#define SQLITE_FCNTL_CKPT_DONE 37
LOWsrc/sqlite3.h2181** ability is deactivated. Any other initial value for the integer leaves the
LOWsrc/sqlite3.h2201#define SQLITE_CONFIG_LOOKASIDE 13 /* int int */
LOWsrc/sqlite3.h2641** the first argument.
LOWsrc/sqlite3.h2661#define SQLITE_DBCONFIG_DQS_DML 1013 /* int int* */
LOWsrc/sqlite3.h3461#define SQLITE_DROP_INDEX 10 /* Index Name Table Name */
LOWsrc/sqlite3.h4321*/
LOWsrc/sqlite3.h7741** The collating sequence to be used for comparison can be found using
LOWsrc/sqlite3.h8421** prepared to accommodate additional static mutexes.
LOWsrc/sqlite3.h8521** These constants are the valid operation code parameters used
LOWsrc/sqlite3.h8541#define SQLITE_TESTCTRL_JSON_SELFCHECK 14
LOWsrc/sqlite3.h9001#define SQLITE_DBSTATUS_LOOKASIDE_USED 0
LOWsrc/sqlite3.h11061#ifdef SQLITE_OMIT_FLOATING_POINT
LOWsrc/sqlite3ext.h401#define sqlite3_bind_int sqlite3_api->bind_int
LOWsrc/sqlite3ext.h421#define sqlite3_column_database_name16 sqlite3_api->column_database_name16
LOWsrc/sqlite3ext.h441#define sqlite3_create_collation16 sqlite3_api->create_collation16
LOWsrc/sqlite3ext.h461#define sqlite3_get_auxdata sqlite3_api->get_auxdata
LOWsrc/sqlite3ext.h481#define sqlite3_reset sqlite3_api->reset
LOWsrc/sqlite3ext.h501#define sqlite3_total_changes sqlite3_api->total_changes
LOWsrc/sqlite3ext.h521#define sqlite3_vsnprintf sqlite3_api->xvsnprintf
LOWsrc/sqlite3ext.h541#define sqlite3_open_v2 sqlite3_api->open_v2
8 more matches not shown…
Verbosity Indicators31 hits · 56 pts
SeverityFileLineSnippet
LOWreplica_test.go122 // Step 1: Create initial data and replicate
LOWreplica_test.go154 // Step 2: Simulate hard recovery - remove database and .litestream directory, then restore
LOWreplica_test.go178 // Step 3: Start replication and insert new data
LOWreplica_test.go209 // Step 4: Simulate second hard recovery and restore again
LOWreplica_test.go231 // Step 5: Verify the new data (value=2) exists in restored database
LOWdb_internal_test.go1885 // Step 1: Initial sync — creates snapshot L0 with all current pages
LOWdb_internal_test.go1890 // Step 2: Write data to grow the database significantly
LOWdb_internal_test.go1898 // Step 3: Sync to capture the growth — creates incremental L0
LOWdb_internal_test.go1906 // Step 4: Run checkpoint CONCURRENTLY with more writes.
LOWdb_internal_test.go2016 // Step 6: Verify all pages are covered across L0 files.
LOWcmd/litestream-test/scripts/reproduce-critical-bug.sh63# Step 1: Create and populate initial database
LOWcmd/litestream-test/scripts/reproduce-critical-bug.sh70# Step 2: Start Litestream replication
LOWcmd/litestream-test/scripts/reproduce-critical-bug.sh84# Step 3: Start continuous writes
LOWcmd/litestream-test/scripts/reproduce-critical-bug.sh91# Step 4: Let it run normally for 20 seconds
LOWcmd/litestream-test/scripts/reproduce-critical-bug.sh100# Step 5: Kill Litestream (simulate crash)
LOWcmd/litestream-test/scripts/reproduce-critical-bug.sh106# Step 6: Let writes continue for 15 seconds without Litestream
LOWcmd/litestream-test/scripts/reproduce-critical-bug.sh111# Step 7: Execute non-PASSIVE checkpoint
LOWcmd/litestream-test/scripts/reproduce-critical-bug.sh120# Step 8: Resume Litestream
LOWcmd/litestream-test/scripts/reproduce-critical-bug.sh132# Step 9: Let Litestream catch up
LOWcmd/litestream-test/scripts/reproduce-critical-bug.sh151# Step 10: Attempt to restore (THIS IS WHERE THE BUG OCCURS)
LOWtests/integration/directory_watcher_test.go39 // Step 1: Create 2 databases in separate tenant directories
LOWtests/integration/directory_watcher_test.go53 // Step 2: Add data to both databases
LOWtests/integration/directory_watcher_test.go65 // Step 3: Create 3 more databases at intervals
LOWtests/integration/directory_watcher_test.go87 // Step 4: Delete one database and verify cleanup
LOWtests/integration/directory_watcher_test.go98 // Step 5: Verify no critical errors in log
LOWtests/integration/supabase-s3/test.sh29# Step 1: Build litestream
LOWtests/integration/supabase-s3/test.sh36# Step 2: Start Supabase stack
LOWtests/integration/supabase-s3/test.sh43# Step 3: Create bucket via Supabase REST API
LOWtests/integration/supabase-s3/test.sh61# Step 4: Create and populate test database
LOWtests/integration/supabase-s3/test.sh75# Step 5: Replicate to Supabase S3
LOWtests/integration/supabase-s3/test.sh101# Step 6: Restore and verify
Self-Referential Comments4 hits · 12 pts
SeverityFileLineSnippet
MEDIUMcmd/litestream-test/populate.go262 # Create a 1GB database with default settings
MEDIUMcmd/litestream-test/populate.go265 # Create a 2GB database with larger rows
MEDIUMcmd/litestream-test/scripts/test-754-s3-scenarios.sh254 # Create a short retention test with file replication for comparison
MEDIUM.github/workflows/commit.yml344 # Create the object store bucket
Redundant / Tautological Comments7 hits · 10 pts
SeverityFileLineSnippet
LOWcmd/litestream-test/scripts/test-754-s3-scenarios.sh15# Check if we have S3 environment setup
LOWcmd/litestream-test/scripts/test-754-s3-scenarios.sh293 # Check if old files are cleaned up
LOWcmd/litestream-test/scripts/test-s3-access-point.sh146# Check if Litestream is still running
LOW…/litestream-test/scripts/test-s3-retention-large-db.sh389 # Check if both databases cross the lock page boundary
LOW…stream-test/scripts/test-s3-retention-comprehensive.sh397 # Check if large database test crossed lock page boundary
LOWcmd/litestream-test/scripts/test-upgrade-large-db.sh100# Check if replication is working
LOW…itestream-test/scripts/test-simple-754-reproduction.sh39# Check if it's still running
Hallucination Indicators1 hit · 10 pts
SeverityFileLineSnippet
CRITICAL.github/workflows/pr-metrics.yml268 | Base (\`${context.payload.pull_request.base.sha.substring(0, 7)}\`) | ${fmt(baseSize)} | |
AI Slop Vocabulary2 hits · 6 pts
SeverityFileLineSnippet
MEDIUMcmd/litestream-test/scripts/test-upgrade-large-db.sh50# Use our test harness to create large database quickly
MEDIUMinternal/resumable_reader.go35// of OpenLTXFile). Callers like io.ReadFull see a seamless byte stream because
Example Usage Blocks1 hit · 2 pts
SeverityFileLineSnippet
LOWscripts/local-soak.sh5# Usage: