Cjl/litt integration#3435
Conversation
|
The latest Buf updates on your PR. Results from workflow Buf / buf (pull_request).
|
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #3435 +/- ##
==========================================
- Coverage 59.30% 58.94% -0.36%
==========================================
Files 2118 2176 +58
Lines 175556 181526 +5970
==========================================
+ Hits 104108 107008 +2900
- Misses 62383 64935 +2552
- Partials 9065 9583 +518
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
| var err error | ||
|
|
||
| hostKeyCallback := ssh.InsecureIgnoreHostKey() | ||
| hostKeyCallback := ssh.InsecureIgnoreHostKey() //nolint:gosec // overridden when knownHosts provided |
There was a problem hiding this comment.
[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.
| TargetSegmentFileSize: math.MaxUint32, | ||
| MaxSegmentKeyCount: 50_000, | ||
| TargetSegmentKeyFileSize: 2 * units.MiB, | ||
| TargetSegmentKeyFileSize: 2 * unit.MB, |
There was a problem hiding this comment.
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.
| 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 |
There was a problem hiding this comment.
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.
| // 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 |
There was a problem hiding this comment.
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
Describe your changes and provide context
Testing performed to validate your change
unit test coverage, not yet used in prod