Skip to content

Cjl/litt integration#3435

Merged
cody-littley merged 6 commits into
mainfrom
cjl/litt-integration
May 19, 2026
Merged

Cjl/litt integration#3435
cody-littley merged 6 commits into
mainfrom
cjl/litt-integration

Conversation

@cody-littley

@cody-littley cody-littley commented May 14, 2026

Copy link
Copy Markdown
Contributor

Describe your changes and provide context

  • Make it so that LittDB is included in the regular build system.
  • Fixed all of the lint errors exposed by integrating the build.
  • Causes CI to run LittDB tests.
  • sabled some tests that were pulling in a docker dependency. The tests were slow, mildly flaky, and the features they covered are not important to our use case.

Testing performed to validate your change

unit test coverage, not yet used in prod

@cody-littley cody-littley self-assigned this May 14, 2026
@github-actions

github-actions Bot commented May 14, 2026

Copy link
Copy Markdown

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

BuildFormatLintBreakingUpdated (UTC)
✅ passed✅ passed✅ passed✅ passedMay 18, 2026, 6:24 PM

@codecov

codecov Bot commented May 14, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 67.54967% with 49 lines in your changes missing coverage. Please review.
✅ Project coverage is 58.94%. Comparing base (d56b207) to head (ac9765b).
⚠️ Report is 14 commits behind head on main.

Files with missing lines Patch % Lines
...i-db/db_engine/litt/benchmark/benchmark_metrics.go 0.00% 13 Missing ⚠️
...ei-db/db_engine/litt/benchmark/benchmark_engine.go 0.00% 12 Missing ⚠️
sei-db/db_engine/litt/disktable/table_metadata.go 75.00% 3 Missing and 1 partial ⚠️
sei-db/db_engine/litt/util/pprof.go 0.00% 4 Missing ⚠️
...-db/db_engine/litt/disktable/segment/value_file.go 72.72% 1 Missing and 2 partials ⚠️
sei-db/db_engine/litt/littbuilder/build_utils.go 57.14% 3 Missing ⚠️
sei-db/db_engine/litt/util/ssh.go 0.00% 3 Missing ⚠️
sei-db/db_engine/litt/cli/table_info.go 0.00% 2 Missing ⚠️
sei-db/db_engine/litt/benchmark/data_tracker.go 88.88% 1 Missing ⚠️
sei-db/db_engine/litt/dbcache/cached_table.go 0.00% 1 Missing ⚠️
... and 3 more
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #3435      +/-   ##
==========================================
- Coverage   59.30%   58.94%   -0.36%     
==========================================
  Files        2118     2176      +58     
  Lines      175556   181527    +5971     
==========================================
+ Hits       104108   107006    +2898     
- Misses      62383    64938    +2555     
- Partials     9065     9583     +518     
Flag Coverage Δ
sei-chain-pr 48.53% <67.54%> (?)
sei-db 70.41% <ø> (ø)

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/benchmark/cohort.go 69.86% <100.00%> (ø)
sei-db/db_engine/litt/benchmark/data_generator.go 100.00% <100.00%> (ø)
sei-db/db_engine/litt/cli/benchmark.go 0.00% <ø> (ø)
sei-db/db_engine/litt/cli/litt_cli.go 0.00% <ø> (ø)
sei-db/db_engine/litt/cli/ls.go 57.40% <ø> (ø)
sei-db/db_engine/litt/cli/main.go 0.00% <ø> (ø)
sei-db/db_engine/litt/cli/prune.go 43.51% <100.00%> (ø)
sei-db/db_engine/litt/cli/push.go 0.00% <ø> (ø)
sei-db/db_engine/litt/cli/rebase.go 59.73% <ø> (ø)
sei-db/db_engine/litt/cli/sync.go 0.00% <ø> (ø)
... and 48 more
🚀 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.

var err error

hostKeyCallback := ssh.InsecureIgnoreHostKey()
hostKeyCallback := ssh.InsecureIgnoreHostKey() //nolint:gosec // overridden when knownHosts provided

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[SUGGESTION] nolint:gosec for InsecureIgnoreHostKey() understates the risk

The comment says "overridden when knownHosts provided", but if a caller passes knownHosts == "" the insecure callback is what's actually used. This is pre-existing behavior, but if you're going to suppress the lint here, the nolint comment should reflect that fact (e.g. "intentional fallback; callers must supply knownHosts in production"), or — better — refuse to construct the session without knownHosts. Not introduced by this PR, but it's now being silenced rather than fixed.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Created a follow up task for this. The ssh feature is not something we will be using. It was useful at Eigen since people wanted to use SSH to perform periodic DB backups, but we don't have that need here. If not actively disabled, this code won't even execute, so there is no risk in the short term.

https://linear.app/seilabs/issue/STO-545/safer-ssh-configuration

TargetSegmentFileSize: math.MaxUint32,
MaxSegmentKeyCount: 50_000,
TargetSegmentKeyFileSize: 2 * units.MiB,
TargetSegmentKeyFileSize: 2 * unit.MB,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

unit.MB is defined as 1024 * 1024 in sei-db/common/unit/data_units.go, which matches docker/go-units.MiB, so all sizes/throughputs are preserved. However, naming a 2^20 constant MB is the opposite of the SI convention and will eventually trip someone up. Not blocking — just worth a doc comment on the constant if you can't rename.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I'm willing to rename to unit.MiB. Ten second refactor in the IDE, but will yield hundreds of diffs scattered across the codebase. Would you be ok if this happens in a separate PR?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

keyRequest := &types.ScopedKey{
Key: data.Key,
Address: types.NewAddress(s.index, firstByteIndex, uint8(shard), uint32(len(data.Value))),
Address: types.NewAddress(s.index, firstByteIndex, uint8(shard), uint32(len(data.Value))), //nolint:gosec // shard <= 255, value len fits uint32

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

uint8(shard) is justified only because shard < ShardingFactor ≤ MaxShardingFactor = 256. The comment says "shard <= 255" which is right, but if a corrupted metadata file ever deserializes a shardingFactor > 256, this will silently truncate rather than fail loudly. Consider asserting shardingFactor <= MaxShardingFactor in loadMetadataFile/deserialize.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The shard for each key is serialized/deserialized to/from a single byte, so it's impossible for data corruption to cause the value to exceed the max.

shardID:   bytes[8], // shardID is type uint8

You are correct that the metadata file could be corrupted in a way that leads to this violation getting broken. In order to avoid that, I've modified serialization/deserialization for the metadata to also store data in a single byte, making this sort of bounds overflow impossible.

// Write the TTL
ttlNanoseconds := t.GetTTL().Nanoseconds()
binary.BigEndian.PutUint64(data[4:12], uint64(ttlNanoseconds))
binary.BigEndian.PutUint64(data[4:12], uint64(ttlNanoseconds)) //nolint:gosec // serialized as time.Duration

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

uint64(ttlNanoseconds) and time.Duration(uint64) round-trip is fine, but TTL is signed; a negative TTL would deserialize to a huge positive duration. Probably impossible in practice, but worth validating TTL > 0 on load

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Added a check for negative values:

intTTL := int64(binary.BigEndian.Uint64(data[4:12])) //nolint:gosec // serialized as time.Duration
if intTTL < 0 {
	return nil, fmt.Errorf("TTL is negative: %d", intTTL)
}
ttl := time.Duration(intTTL)

@cursor

cursor Bot commented May 18, 2026

Copy link
Copy Markdown

PR Summary

Medium Risk
Enables previously tag-guarded LittDB code and tests in the main module and changes on-disk metadata layouts (sharding factor serialization), which could impact compatibility and data recovery if not handled carefully.

Overview
LittDB is now part of the normal build and CI test surface. The littdb_wip build tags and nested sei-db/db_engine/litt module boundary are removed, Makefile targets no longer pass custom tags, and urfave/cli/v2 is promoted to a direct dependency.

Sharding factor is standardized on uint8 and persisted as 1 byte on disk. This updates APIs (SetShardingFactor), segment/table metadata serialization layouts (with corresponding test fixes), and adds bounds/validation in places like the benchmark config.

Dependency/lint hardening and test adjustments. Replaces docker/go-units with internal common/unit, tightens file/dir permissions for LittDB artifacts, adds ReadHeaderTimeout to the metrics HTTP server, and fully comments out Docker-based push CLI tests to avoid pulling in the Docker SDK.

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

Comment thread sei-db/db_engine/litt/disktable/segment/segment.go

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 2 potential issues.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 476462e. Configure here.

Comment thread sei-db/db_engine/litt/disktable/control_loop.go Outdated
// - 4 bytes for keyCount
// - 1 byte for sealed
V3MetadataSize = 21
V3MetadataSize = 18

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Segment metadata format changed without version bump

Low Severity

The segment metadata binary layout changed (shardingFactor shrunk from 4 bytes to 1 byte, shifting all subsequent fields, total size from 21 to 18) while LatestSegmentVersion remains at ShardedAddressSegmentVersion = 3. Any existing V3 metadata files from development will fail with a confusing size-mismatch error instead of a clear version error. The version constant in segment_version.go was not incremented to reflect this incompatible on-disk format change.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 476462e. Configure here.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Not a problem. The current version 3 is already a bump compared the prior deployed version (i.e. in the EigenDA repo). Since this isn't deployed to production yet, it's safe to make as many serialization breaks as we need without a version bump. That will change after we have our first production deployment, though.

@cody-littley cody-littley added this pull request to the merge queue May 19, 2026
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks May 19, 2026
@cody-littley cody-littley added this pull request to the merge queue May 19, 2026
Merged via the queue into main with commit f87766f May 19, 2026
57 of 59 checks passed
@cody-littley cody-littley deleted the cjl/litt-integration branch May 19, 2026 17:07
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.

3 participants