Repository navigation
Conversation
b7r6
force-pushed
the
b7r6/mongo-update-truncated-on-stream-error
branch
3 times, most recently
from
October 8, 2026 15:12
0320a75 to
a1b9aaf
Compare
b7r6
force-pushed
the
b7r6/mongo-update-truncated-on-stream-error
branch
2 times, most recently
from
October 15, 2026 11:19
94a1704 to
ec6867d
Compare
…ried blob (TraceMachina#2840) `sizes_for_keys` snapshotted `lru.len()` once for the whole batch and reused that stale length in `should_evict` for every key in the loop. When the map sits one entry over `max_count` — e.g. an action-input lease (or a TTL-pending entry) pins it at `max_count + 1` — the first unleased queried key is popped, bringing the real length back to `max_count`. But iterations 2..N still saw the stale `lru_len == max_count + 1`, so `is_over_count` stayed true and every remaining queried, unleased entry was popped too: remove-callbacks queued, `FileEntryImpl` unref deleting the backing files. The batch then reports `None` for all N digests, the client treats them as absent and re-uploads, and a plain existence check (`has()` → FilesystemStore → `sizes_for_keys`) has destroyed every resident blob it was only asked about. Fix: keep a mutable working count and decrement it as entries are reaped, so the over-count predicate is re-evaluated against the current length each iteration. Eviction now stops the moment the map is back at/under the limit — a size/existence query evicts at most the genuine overage and never cascades. Adds a white-box regression test that pins the map one over `max_count` with a leased entry (bypassing the insert-time eviction pass the way a held lease does) and asserts a batch `sizes_for_keys` over the resident keys leaves all but the single-entry overage present. It fails on the stale-len code (all N reported missing) and passes with the fix. Provenance: adversarial review fleet, highest-severity finding.
* Update Rust crate rustls to v0.23.46 [SECURITY] * Fix MODULE.bazel.lock
…date update read the upload stream with while let Ok(chunk) = reader.recv().await, which treats a stream Err identically to the empty-chunk EOF. An upload that fails partway (client disconnect, or an upstream store erroring mid-copy) was upserted as whatever bytes arrived and returned Ok(partial_len) -- a truncated blob stored under the full digest key, served as success on every later read. Propagate the recv error instead, and (belt-and-suspenders) reject a completed read whose size disagrees with UploadSizeInfo::ExactSize. Regression update_rejects_truncated_stream_instead_of_committing_it drops the writer mid-stream without send_eof and asserts update returns Err and the digest is absent; fails without the fix (commits the truncation as Ok). Co-authored-by: Claude Opus 4.8 <[email protected]>
…ne), not Err
ExperimentalMongoStore::update_data used find_one_and_update(...).upsert(true). On a version-CAS conflict (a concurrent writer already bumped the version) the {_id, version} filter matches nothing, so upsert tries to INSERT a doc with the existing _id and MongoDB returns a DuplicateKeyError (E11000), surfaced as Err(Internal). The version-CAS contract (and the Redis backend, which returns Ok(None)) require a conflict to be retryable; instead concurrent updates on a Mongo-backed record spuriously failed. Fix: .upsert(current_version == 0) so only a genuine first-create upserts; a non-matching filter on an existing record now returns Ok(None) (retryable). Adds a deterministic fails-without regression and corrects an existing (ignored) scheduler test that had pinned the buggy Err behavior.
Co-Authored-By: Claude Opus 4.8 <[email protected]>
b7r6
force-pushed
the
b7r6/mongo-update-truncated-on-stream-error
branch
from
October 15, 2026 13:51
ec6867d to
c36fa2e
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What and why
Lane A stability fix from the findings catalog (see
nativelink-findings-2026-10-05.csvon the
meta/findings-catalog-2026-10-05branch), rebased onto OSS main@bf4b3aa855. This fork PR exists to validate the change on CI that is
representative of upstream PR lanes (public read-only cache, same endpoints)
before any upstream submission.
How was this verified?
The branch carries its own regression tests (fails-without where the fix
class allows it — see the branch's test commits). This PR's purpose is the
full representative CI run; green here rehearses the exact checks an
upstream PR would face.
Risk
Fork-internal validation PR; nothing lands anywhere by merging this. The
underlying fix's risk assessment happens at upstream-submission time.
AI assistance
Agent-assisted pipeline (Claude) for rebase and PR mechanics under my
direction; the fix itself carries verification in its tests.