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
script/fmt now also runs prettier over every Markdown file, and
script/fmt-check checks them without writing. prettier is pinned in
package.json and yarn.lock. script/bootstrap keeps its Go and apt
handling and gains the canonical node and yarn install (nvm from a
hash-checked archive, yarn through corepack), at the pinned versions
when they are absent; a node or yarn already installed is used as is.
Both fmt scripts find yarn the canonical way. The new files come from
sneak/prompts at cc440118c876. README.md and TODO.md are rewrapped by
make fmt, with no wording changes.
Deviation: package.json drops the canonical "license": "MIT" line; this
repo is WTFPL.
Model: opus-5-5
Co-authored-by: clawbot <sneak+clawbot@sneak.cloud>
Vendors .gitignore, .dockerignore, .editorconfig, REPO_POLICIES.md,
script/cibuild, script/docker, script/lint, script/test and the CI
workflow byte-identical from sneak/prompts commit cc440118c876; the
two ignore files then add this repo's own build output, root-anchored
so cmd/bsdaily/ stays in. The Dockerfile gains a lint phase on the
golangci-lint image already pinned and a test phase on the Debian Go
image with sqlite3 and zstd; the build stage copies a file from each,
so a plain docker build cannot skip them. Nothing installs
golangci-lint on the host. On apt, script/bootstrap refreshes the
package lists once before its first install.
.golangci.yml and the lint cleanup: #6
Model: opus-5-5
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).
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.
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.
- 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
- 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
- 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
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.