Commit Graph
16 Commits
Author SHA1 Message Date
clawbot 29922dba51 Move the command line from cmd/bsdaily into internal/cli (closes #8)
check / check (push) Waiting to run
cmd/bsdaily/main.go now only passes Version to cli.Main and exits with
the status it returns, as REPO_POLICIES.md requires of cmd/. The cobra
command, the flag rules and the date parsing moved unchanged into
internal/cli, so flags, help text, error messages, exit status and the
first log line stay as they were. The fallback to dev for an empty
version moved with them into cli.Main.

parseTargetDates is exported as ParseTargetDates so that a table test
outside the package can reach it; the test never touches the filesystem
or runs the extraction. README describes the new layout and TODO.md
records the step.

Model: opus-5-5
2026-10-06 19:42:41 +00:00
clawbot c16f177575 Adopt the shared .golangci.yml and fix the code to it (closes #6)
check / check (push) Successful in 5m14s
Vendor .golangci.yml byte-identical from sneak/prompts at cc440118 and
move the Dockerfile lint phase to golangci-lint v2.14.0 by the digest
REPO_POLICIES.md names. Fix the code to that config with flags, help
text, output files, SQL and the order of steps unchanged; long
functions are split into named steps.

Judgement call: the extraction transaction is now rolled back on every
early return; the old deferred rollback missed most failures and could
dereference a nil transaction.
Thirteen //nolint directives (gosec, unconvert, mnd, unqueryvet), each
with its reason.

Model: opus-5-5
2026-10-06 14:24:48 +02:00
sneak a256b83734 Fix errcheck lint failures with proper error handling
check / check (push) Successful in 1m42s
Handle every error return flagged by golangci-lint's errcheck rather
than discarding it:

- run.go: add a cleanup() helper that logs a warning (and ignores
  ErrNotExist) when removing a temp file fails, so leaked scratch files
  are surfaced; use it for all best-effort removals.
- copy.go / extract.go: log a warning on deferred Close() failures for
  the source file, destination DB, and result-set rows.
- extract.go: on the rollback path, ignore the benign sql.ErrTxDone
  (already committed) and log any other rollback failure.
- verify.go: add killCat() which ignores os.ErrProcessDone (zstdcat
  already exited via SIGPIPE) and logs any unexpected kill failure.

make check is clean (0 lint issues, tests pass).
2026-06-28 10:25:47 +02:00
sneak 8845f0ade6 Add minimal compilation smoke test; tidy go.mod
check / check (push) Failing after 59s
Add a smoke test that references the package's exported surface so go
test fails if it stops compiling. Run go mod tidy to promote cobra to
a direct dependency.
2026-06-28 10:09:56 +02:00
sneak 7316054b07 Add README, LICENSE, Makefile, Dockerfile, and CI
Add a detailed README, WTFPL LICENSE, and build/CI tooling modeled on
the vaultik repo (Makefile, multi-stage digest-pinned Dockerfile,
.gitea/workflows/check.yml). Bump Go to 1.26.4 and pin golangci-lint
to v2.12.2. gofmt existing sources so the new fmt-check gate passes.
2026-06-28 10:08:44 +02:00
sneak 9c4f8a7cc9 latest 2026-06-28 09:42:31 +02:00
sneak 05b5c2b528 fix SQLite database locking issues
- Use tx.QueryRow instead of db.QueryRow within transaction for media table check
- Switch to WAL mode instead of OFF for better concurrency handling
- Add busy_timeout pragma to wait up to 5 seconds if database is locked
- Clear transaction variable after commit to prevent defer rollback issues
2026-02-12 13:40:58 -08:00
sneak 8e3a868b7a remove parallel processing to fix SQLite locking issues
- Remove parallel.go entirely
- Process days strictly sequentially to avoid SQLITE_BUSY errors
- Complete each day fully (extract, dump, compress, verify, write) before starting next
- Clean up temp files immediately after each day to save disk space
- SQLite cannot handle multiple concurrent ATTACH operations on same database
2026-02-12 13:26:55 -08:00
sneak 56c3fe7804 fix Linux build: use golang.org/x/sys/unix for Fadvise
Replace syscall.Fadvise with unix.Fadvise from golang.org/x/sys/unix
which is the correct portable way to access fadvise on Linux
2026-02-12 13:15:39 -08:00
sneak 156217043e change temp directory to NVMe storage
Move temporary working directory from /srv/tmp to /srv/storage/tmp
to leverage NVMe storage for better I/O performance during extraction
2026-02-12 13:10:04 -08:00
sneak f23db96922 optimize file copy performance for large database files
- Increase copy buffer from 4MB to 256MB for NVMe-speed transfers
- Add Linux-specific fadvise hints for sequential reads and prefetching
- Pre-allocate destination file to avoid fragmentation
- Add throughput monitoring to track copy performance
- Platform-specific build tags for Linux optimizations
2026-02-12 13:08:08 -08:00
sneak cf79e008b5 speed optimizations 2026-02-12 13:01:52 -08:00
sneak 2d46dc70a9 date range 2026-02-11 03:01:48 -08:00
sneak 3c890f0b83 speed up database pruning for throwaway copies
Disable crash-safety pragmas (synchronous=OFF, journal_mode=MEMORY),
use a 200MB page cache, disable foreign keys to avoid per-row CASCADE
overhead, bulk-delete junction tables explicitly, and wrap all deletes
in a single transaction.
2026-02-09 01:48:42 -08:00
sneak c31484f0cf support targeting specific date 2026-02-09 01:18:16 -08:00
sneak e6e85b6e11 initial 2026-02-09 00:42:06 -08:00