Skip to content

clean up littDB config#3549

Open
cody-littley wants to merge 1 commit into
mainfrom
cjl/litt-config-cleanup
Open

clean up littDB config#3549
cody-littley wants to merge 1 commit into
mainfrom
cjl/litt-config-cleanup

Conversation

@cody-littley
Copy link
Copy Markdown
Contributor

Describe your changes and provide context

Cleans up LittDB config so that non-serializable fields are not in the config struct

Testing performed to validate your change

unit tests

@cursor
Copy link
Copy Markdown

cursor Bot commented Jun 4, 2026

PR Summary

Medium Risk
Wide constructor and config API changes across LittDB; behavior should match prior defaults, but any external code setting removed Config fields must migrate to RuntimeConfig.

Overview
Introduces RuntimeConfig for non-serializable LittDB dependencies (context, logger, clock, optional fatal-error callback) with DefaultRuntimeConfig() and Validate(), so Config only holds settings that can be loaded from a file.

Config drops CTX, Logger, Clock, and FatalErrorCallback; SanityCheck() is renamed to Validate() and no longer checks those runtime fields. littbuilder.NewDB accepts an optional *RuntimeConfig (defaults when omitted); NewDBUnsafe, NewDiskTable, NewMemTable, and the table builder callback now take RuntimeConfig instead of separate ctx/logger/clock. Benchmark and tests construct DefaultRuntimeConfig() (or override logger/clock) and pass it through.

Reviewed by Cursor Bugbot for commit 2d3c4ac. Bugbot is set up for automated code reviews on this repo. Configure here.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Jun 4, 2026

The latest Buf updates on your PR. Results from workflow Buf / buf (pull_request).

BuildFormatLintBreakingUpdated (UTC)
✅ passed✅ passed✅ passed✅ passedJun 4, 2026, 2:23 PM

@codecov
Copy link
Copy Markdown

codecov Bot commented Jun 4, 2026

Codecov Report

❌ Patch coverage is 58.90411% with 30 lines in your changes missing coverage. Please review.
✅ Project coverage is 58.26%. Comparing base (1a1b8cd) to head (2d3c4ac).

Files with missing lines Patch % Lines
sei-db/db_engine/litt/littbuilder/db_impl.go 54.54% 10 Missing and 5 partials ⚠️
sei-db/db_engine/litt/runtime_config.go 53.84% 3 Missing and 3 partials ⚠️
...ei-db/db_engine/litt/benchmark/benchmark_engine.go 0.00% 5 Missing ⚠️
sei-db/db_engine/litt/littbuilder/build_utils.go 33.33% 4 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #3549      +/-   ##
==========================================
- Coverage   59.12%   58.26%   -0.87%     
==========================================
  Files        2218     2145      -73     
  Lines      183132   174565    -8567     
==========================================
- Hits       108285   101716    -6569     
+ Misses      65082    63783    -1299     
+ Partials     9765     9066     -699     
Flag Coverage Δ
sei-chain-pr 57.50% <58.90%> (?)
sei-db 70.41% <ø> (ø)
sei-db-state-db ?

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
sei-db/db_engine/litt/disktable/disk_table.go 64.08% <100.00%> (ø)
sei-db/db_engine/litt/littdb_config.go 59.25% <100.00%> (+3.70%) ⬆️
sei-db/db_engine/litt/memtable/mem_table.go 66.66% <100.00%> (ø)
sei-db/db_engine/litt/littbuilder/build_utils.go 49.61% <33.33%> (-0.39%) ⬇️
...ei-db/db_engine/litt/benchmark/benchmark_engine.go 0.00% <0.00%> (ø)
sei-db/db_engine/litt/runtime_config.go 53.84% <53.84%> (ø)
sei-db/db_engine/litt/littbuilder/db_impl.go 51.26% <54.54%> (-3.64%) ⬇️

... and 74 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Copy Markdown

@claude claude Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM — straightforward refactor splitting non-serializable runtime fields (CTX/Logger/Clock/FatalErrorCallback) into a new RuntimeConfig type, with all call sites mechanically updated.

Extended reasoning...

Overview

This PR cleanly separates non-serializable runtime dependencies (CTX, Logger, Clock, FatalErrorCallback) from the serializable litt.Config by introducing a new RuntimeConfig type with DefaultRuntimeConfig() and Validate(). The SanityCheck() rename to Validate() is consistent with the new type. Constructor signatures (NewDB, NewDBUnsafe, NewDiskTable, NewMemTable, TableBuilderFunc) are updated to pass through the new struct, and all 14 modified files (including tests, benchmarks, and the builder) are updated consistently.

Security risks

None. This is an internal API refactor with no changes to auth, crypto, permissions, or data-on-disk layout. The PR is labeled non-app-hash-breaking.

Level of scrutiny

Low. This is a mechanical type-split refactor preserving existing defaults — the variadic NewDB(config, runtimeConfig...) signature keeps the no-runtime-config call path working, and DefaultRuntimeConfig() produces values identical to the prior defaults (context.Background(), slog.Default(), time.Now). I verified that no callers exist outside sei-db/db_engine/litt (grep confirms LittDB is self-contained), and no leftover references to the removed config.CTX/Logger/Clock/FatalErrorCallback fields or to SanityCheck remain.

Other factors

The bug hunting system found no issues. Unit tests are updated alongside the code, including the renamed TestValidateShardingFactorBounds. The Cursor bot flagged it as medium-risk due to wide API surface change, but since LittDB has no external callers in this repo, the blast radius is contained.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants